winrt::handle_type 構造体テンプレート (C++/WinRT)

winrt::handle および winrt::file_handle 構造体 テンプレート。

手記

独自のハンドル特性 (\cppwinrt\winrt\base.hhandle_traitsfile_handle_traits など) を定義し、winrt::handle_typetypename Tとして使用できます。 これらの例のいずれかを base.h から独自のソース コード ファイルにコピーし、独自のハンドルの種類と実装を指定します。 詳細については、C++を使用した Windows MSDN マガジンの記事を参照してください。

構文

template <typename T>
struct handle_type

テンプレート パラメーター

typename T 表されるハンドルの種類 (ハンドル、ファイル ハンドル、またはその他の型) を指定する特性型です。

必要条件

サポートされる最小 SDK: Windows SDK バージョン 10.0.17134.0 (Windows 10 バージョン 1803) を

Namespace: winrt

ヘッダー: %WindowsSdkDir%Include<WindowsTargetPlatformVersion>\cppwinrt\winrt\base.h (既定で含まれます)

メンバー型のエイリアス

エイリアス名 種類
handle_type::type 型名 T::typeのシノニム 。ここで、Ttypename T テンプレート パラメーターです。

コンス トラクター

コンストラクタ 形容
handle_type::handle_type コンストラクターの 必要に応じて、入力データのコピーまたは移動を使用して、handle_type 構造体の新しいインスタンスを初期化します。

メンバー関数

機能 形容
handle_type::attach 関数の ハンドル値にアタッチし、その所有権を取得します。
handle_type::close 関数の 基になるハンドルを閉じます。
handle_type::d etach 関数の 基になるハンドルからデタッチします。
handle_type::get 関数の 関数に渡す必要がある場合は、基になるハンドルを返します。
handle_type::p ut 関数の 基になるハンドルのアドレスを返します。この関数は、ハンドルへのポインターを介して out パラメーターとして参照を返すメソッドを呼び出すのに役立ちます。

メンバー演算子

演算子 形容
handle_type::operator bool handle_type オブジェクトが現在有効なハンドルを表しているかどうかを確認します。
handle_type::operator= (代入演算子) handle_type オブジェクトに値を割り当てます。

無料の関数

機能 形容
スワップ関数 を する 2 つの handle_type パラメーターの内容を入れ替えて、互いにハンドルを含めます。

handle_type::handle_type コンストラクター

必要に応じて、入力データのコピーまたは移動を使用して、handle_type 構造体の新しいインスタンスを初期化します。

構文

handle_type() noexcept;
explicit handle_type(handle_type::type value) noexcept;
handle_type(handle_type&& other) noexcept;

パラメーター

value handle_type オブジェクトを初期化する値です。

handle_type オブジェクトを初期化する別の handle_typeother します。

handle_type::attach 関数

ハンドル値にアタッチし、その所有権を取得します。

構文

void attach(handle_type::type value) noexcept;

パラメーター

value アタッチするハンドル値です。

handle_type::close 関数

基になるハンドルを閉じます。

構文

void close() noexcept;

handle_type::d etach 関数

基になるハンドルからデタッチします。

構文

handle_type::type detach() noexcept;

戻り値

handle_type オブジェクトによって以前に表された基になるハンドル。

handle_type::get 関数

関数に渡す必要がある場合は、基になるハンドルを返します。

構文

handle_type::type get() const noexcept;

戻り値

handle_type オブジェクトによって表される基になるハンドル。

handle_type::p ut 関数

基になるハンドルのアドレスを返します。この関数は、ハンドルへのポインターを介して out パラメーターとして参照を返すメソッドを呼び出すのに役立ちます。

構文

handle_type::type* put() noexcept;

戻り値

handle_type オブジェクトによって表される基になるハンドルのアドレス。

handle_type::operator bool

handle_type オブジェクトが現在有効なハンドルを表しているかどうかを確認します。

構文

explicit operator bool() const noexcept;

戻り値

handle_type オブジェクトが現在有効なハンドルを表しているかどうかを true します。それ以外の場合は false

handle_type::operator= (代入演算子)

handle_type オブジェクトに値を割り当てます。

構文

winrt::handle_type& operator=(winrt::handle_type&& other) noexcept;

パラメーター

other handle_type オブジェクトに割り当てる handle_type 値です。

戻り値

handle_type オブジェクトへの参照。

swap 関数

2 つの handle_type パラメーターの内容を入れ替えて、互いにハンドルを含めます。

構文

void swap(winrt::handle_type& left, winrt::handle_type& right) noexcept;

パラメーター

left right 他のパラメーターと相互にスワップするハンドルを持つ handle_type 値です。

関連項目

  • winrt 名前空間 を する
  • winrt::handle 構造体 を する
  • winrt::file_handle 構造体 を する