Skip to content

BitPropVariant

Oz edited this page May 19, 2024 · 8 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 ) noexcept( std::is_integral< 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.


auto getBool() const -> bool

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


auto getFileTime() const -> FILETIME

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


auto getInt16() const -> int16_t

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


auto getInt32() const -> int32_t

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).


auto getInt64() const -> int64_t

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).


auto getInt8() const -> int8_t

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


auto getNativeString() const -> native_string

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


auto getString() const -> tstring

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


auto getTimePoint() const -> time_type

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


auto getUInt16() const -> uint16_t

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).


auto getUInt32() const -> uint32_t

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).


auto getUInt64() const -> uint64_t

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).


auto getUInt8() const -> uint8_t

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


auto isBool() const noexcept -> bool

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


auto isEmpty() const noexcept -> bool

Returns a boolean value indicating whether the variant is empty.


auto isFileTime() const noexcept -> bool

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


auto isInt16() const noexcept -> bool

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


auto isInt32() const noexcept -> bool

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


auto isInt64() const noexcept -> bool

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


auto isInt8() const noexcept -> bool

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


auto isString() const noexcept -> bool

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


auto isUInt16() const noexcept -> bool

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


auto isUInt32() const noexcept -> bool

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


auto isUInt64() const noexcept -> bool

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


auto isUInt8() const noexcept -> bool

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


auto operator=( BitPropVariant&& other ) noexcept -> BitPropVariant&

Move assignment operator.

Parameters:

  • other: the variant to be moved.

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


auto operator=( const BitPropVariant& other ) -> BitPropVariant&

Copy assignment operator.

Parameters:

  • other: the variant to be copied.

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


auto operator=( const T& value ) -> BitPropVariant&

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


auto toString() const -> tstring

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


auto type() const -> BitPropVariantType

Returns the BitPropVariantType of this variant.


Clone this wiki locally