Skip to content

BitPropVariant

Oz edited this page Sep 25, 2024 · 9 revisions

The BitPropVariant struct is a light extension to the WinAPI PROPVARIANT struct providing useful getters.

#include <bit7z/bitpropvariant.hpp>

inherits from PROPVARIANT.

List of all members

Public Members

Return type Name
BitPropVariant()
BitPropVariant( BitPropVariant&& other ) noexcept
BitPropVariant( bool value ) noexcept
BitPropVariant( const BitPropVariant& other )
BitPropVariant( const std::wstring& value )
BitPropVariant( const wchar_t* value )
BitPropVariant( FILETIME value ) noexcept
BitPropVariant( int16_t value ) noexcept
BitPropVariant( int32_t value ) noexcept
BitPropVariant( int64_t value ) noexcept
BitPropVariant( int8_t value ) noexcept
BitPropVariant( uint16_t value ) noexcept
BitPropVariant( uint32_t value ) noexcept
BitPropVariant( uint64_t value ) noexcept
BitPropVariant( uint8_t value ) noexcept
~BitPropVariant()
void clear() noexcept
bool getBool() const
FILETIME getFileTime() const
int16_t getInt16() const
int32_t getInt32() const
int64_t getInt64() const
int8_t getInt8() const
native_string getNativeString() const
tstring getString() const
time_type getTimePoint() const
uint16_t getUInt16() const
uint32_t getUInt32() const
uint64_t getUInt64() const
uint8_t getUInt8() const
bool isBool() const noexcept
bool isEmpty() const noexcept
bool isFileTime() const noexcept
bool isInt16() const noexcept
bool isInt32() const noexcept
bool isInt64() const noexcept
bool isInt8() const noexcept
bool isString() const noexcept
bool isUInt16() const noexcept
bool isUInt32() const noexcept
bool isUInt64() const noexcept
bool isUInt8() const noexcept
BitPropVariant & operator=( BitPropVariant&& other ) noexcept
BitPropVariant & operator=( const BitPropVariant& other )
BitPropVariant & operator=( const T& value )
tstring toString() const
BitPropVariantType type() const

Member Function Documentation

BitPropVariant()

Constructs an empty BitPropVariant object.


BitPropVariant( BitPropVariant&& other ) noexcept

Move constructs this BitPropVariant from another one.

Parameters:

  • other: the variant to be moved.

BitPropVariant( bool value ) noexcept

Constructs a boolean BitPropVariant.

Parameters:


BitPropVariant( const BitPropVariant& other )

Copy constructs this BitPropVariant from another one.

Parameters:

  • other: the variant to be copied.

BitPropVariant( const std::wstring& value )

Constructs a string BitPropVariant from a wstring.

Parameters:


BitPropVariant( const wchar_t* value )

Constructs a string BitPropVariant from a null-terminated C wide string.

Parameters:

  • value: the null-terminated C wide string value of the BitPropVariant

BitPropVariant( FILETIME value ) noexcept

Constructs a FILETIME BitPropVariant.

Parameters:


BitPropVariant( int16_t value ) noexcept

Constructs a 16-bit integer BitPropVariant.

Parameters:


BitPropVariant( int32_t value ) noexcept

Constructs a 32-bit integer BitPropVariant.

Parameters:


BitPropVariant( int64_t value ) noexcept

Constructs a 64-bit integer BitPropVariant.

Parameters:


BitPropVariant( int8_t value ) noexcept

Constructs an 8-bit integer BitPropVariant.

Parameters:


BitPropVariant( uint16_t value ) noexcept

Constructs a 16-bit unsigned integer BitPropVariant.

Parameters:


BitPropVariant( uint32_t value ) noexcept

Constructs a 32-bit unsigned integer BitPropVariant.

Parameters:


BitPropVariant( uint64_t value ) noexcept

Constructs a 64-bit unsigned integer BitPropVariant.

Parameters:


BitPropVariant( uint8_t value ) noexcept

Constructs an 8-bit unsigned integer BitPropVariant.

Parameters:


~BitPropVariant()

BitPropVariant destructor.

Note

This is not virtual to maintain the same memory layout of the base struct!


void clear() noexcept

Clears the current value of the variant object.


bool getBool() const

Returns the boolean value of this variant (it throws an exception if the variant is not a boolean value).


FILETIME getFileTime() const

Returns the FILETIME value of this variant (it throws an exception if the variant is not a filetime).


int16_t getInt16() const

Returns the 16-bit integer value of this variant (it throws an exception if the variant is not an 8 or 16-bit integer).


int32_t getInt32() const

Returns the 32-bit integer value of this variant (it throws an exception if the variant is not an 8, 16 or 32-bit integer).


int64_t getInt64() const

Returns the 64-bit integer value of this variant (it throws an exception if the variant is not an 8, 16, 32 or 64-bit integer).


int8_t getInt8() const

Returns the 8-bit integer value of this variant (it throws an exception if the variant is not an 8-bit integer).


native_string getNativeString() const

Returns the native string value of this variant (it throws an exception if the variant is not a string).


tstring getString() const

Returns the string value of this variant (it throws an exception if the variant is not a string).


time_type getTimePoint() const

Returns the FILETIME value of this variant converted to std::time_point (it throws an exception if the variant is not a filetime).


uint16_t getUInt16() const

Returns the 16-bit unsigned integer value of this variant (it throws an exception if the variant is not an 8 or 16-bit unsigned integer).


uint32_t getUInt32() const

Returns the 32-bit unsigned integer value of this variant (it throws an exception if the variant is not an 8, 16 or 32-bit unsigned integer).


uint64_t getUInt64() const

Returns the 64-bit unsigned integer value of this variant (it throws an exception if the variant is not an 8, 16, 32 or 64-bit unsigned integer).


uint8_t getUInt8() const

Returns the 8-bit unsigned integer value of this variant (it throws an exception if the variant is not an 8-bit unsigned integer).


bool isBool() const noexcept

Returns a boolean value indicating whether the variant is a boolean value.


bool isEmpty() const noexcept

Returns a boolean value indicating whether the variant is empty.


bool isFileTime() const noexcept

Returns a boolean value indicating whether the variant is a FILETIME structure.


bool isInt16() const noexcept

Returns a boolean value indicating whether the variant is an 8 or 16-bit integer.


bool isInt32() const noexcept

Returns a boolean value indicating whether the variant is an 8, 16 or 32-bit integer.


bool isInt64() const noexcept

Returns a boolean value indicating whether the variant is an 8, 16, 32 or 64-bit integer.


bool isInt8() const noexcept

Returns a boolean value indicating whether the variant is an 8-bit integer.


bool isString() const noexcept

Returns a boolean value indicating whether the variant is a string.


bool isUInt16() const noexcept

Returns a boolean value indicating whether the variant is an 8 or 16-bit unsigned integer.


bool isUInt32() const noexcept

Returns a boolean value indicating whether the variant is an 8, 16 or 32-bit unsigned integer.


bool isUInt64() const noexcept

Returns a boolean value indicating whether the variant is an 8, 16, 32 or 64-bit unsigned integer.


bool isUInt8() const noexcept

Returns a boolean value indicating whether the variant is an 8-bit unsigned integer.


BitPropVariant & operator=( BitPropVariant&& other ) noexcept

Move assignment operator.

Parameters:

  • other: the variant to be moved.

Returns a reference to *this object (with the moved values from other).


BitPropVariant & operator=( const BitPropVariant& other )

Copy assignment operator.

Parameters:

  • other: the variant to be copied.

Returns a reference to *this object (with the copied values from other).


BitPropVariant & operator=( const T& value )

Assignment operator.

Note

this will work only for T types for which a BitPropVariant constructor is defined!

Parameters:

  • value: the value to be assigned to the object

Returns a reference to *this object having the value as new variant value


tstring toString() const

Returns the value of this variant converted from any supported type to std::wstring.


BitPropVariantType type() const

Returns the BitPropVariantType of this variant.


Clone this wiki locally