Struct BitPropVariant

Synopsis

#include <include/bitpropvariant.hpp>

struct BitPropVariant : public PROPVARIANT

Description

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

Inheritance

Ancestors: PROPVARIANT

Methods

BitPropVariant overloadConstructs an empty BitPropVariant object.
BitPropVariant overloadCopy constructs this BitPropVariant from another one.
BitPropVariant overloadMove constructs this BitPropVariant from another one.
BitPropVariant overloadConstructs a boolean BitPropVariant.
BitPropVariant overloadConstructs a string BitPropVariant from a null-terminated C wide string.
BitPropVariant overloadConstructs a string BitPropVariant from a wstring.
BitPropVariant overloadConstructs a 8-bit unsigned integer BitPropVariant.
BitPropVariant overloadConstructs a 16-bit unsigned integer BitPropVariant.
BitPropVariant overloadConstructs a 32-bit unsigned integer BitPropVariant.
BitPropVariant overloadConstructs a 64-bit unsigned integer BitPropVariant.
BitPropVariant overloadConstructs a 8-bit integer BitPropVariant.
BitPropVariant overloadConstructs a 16-bit integer BitPropVariant.
BitPropVariant overloadConstructs a 32-bit integer BitPropVariant.
BitPropVariant overloadConstructs a 64-bit integer BitPropVariant.
BitPropVariant overloadConstructs a FILETIME BitPropVariant.
~BitPropVariantBitPropVariant destructor.
clearClears the current value of the variant object.
getBoolReturns: the boolean value of this variant (it throws an expcetion if the variant is not a boolean).
getFiletimeReturns: the FILETIME value of this variant (it throws an exception if the variant is not a filetime).
getInt16Returns: the 16-bit integer value of this variant (it throws an exception if the variant is not an 8 or 16-bit integer).
getInt32Returns: the 32-bit integer value of this variant (it throws an exception if the variant is not an 8, 16 or 32-bit integer).
getInt64Returns: 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).
getInt8Returns: the 8-bit integer value of this variant (it throws an exception if the variant is not an 8-bit integer).
getStringReturns: the string value of this variant (it throws an exception if the variant is not a string).
getUInt16Returns: 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).
getUInt32Returns: 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).
getUInt64Returns: 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).
getUInt8Returns: the 8-bit unsigned integer value of this variant (it throws an exception if the variant is not an 8-bit unsigned integer).
isBoolReturns: true if this variant is a boolean, false otherwise.
isEmptyReturns: true if this variant is empty, false otherwise.
isFiletimeReturns: true if this variant is a FILETIME structure, false otherwise.
isInt16Returns: true if this variant is an 8 or 16-bit integer, false otherwise.
isInt32Returns: true if this variant is an 8, 16 or 32-bit integer, false otherwise.
isInt64Returns: true if this variant is an 8, 16, 32 or 64-bit integer, false otherwise.
isInt8Returns: true if this variant is an 8-bit integer, false otherwise.
isStringReturns: true if this variant is a string, false otherwise.
isUInt16Returns: true if this variant is an 8 or 16-bit unsigned integer, false otherwise.
isUInt32Returns: true if this variant is an 8, 16 or 32-bit unsigned integer, false otherwise.
isUInt64Returns: true if this variant is an 8, 16, 32 or 64-bit unsigned integer, false otherwise.
isUInt8Returns: true if this variant is an 8-bit unsigned integer, false otherwise.
operator= overloadCopy assignment operator.
operator= overloadMove assignment operator.
operator= overloadAssignment operator.
toStringReturns: the the value of this variant converted from any supported type to std::wstring.
typeReturns: the BitPropVariantType of this variant.

Source

Lines 270-560 in include/bitpropvariant.hpp.

struct BitPropVariant : public PROPVARIANT {
        /**
         * @brief Constructs an empty BitPropVariant object.
         */
        BitPropVariant();
        /**
         * @brief Copy constructs this BitPropVariant from another one.
         *
         * @param other the variant to be copied.
         */
        BitPropVariant( const BitPropVariant& other );
        /**
         * @brief Move constructs this BitPropVariant from another one.
         *
         * @param other the variant to be moved.
         */
        BitPropVariant( BitPropVariant&& other ) NOEXCEPT;
        /**
         * @brief Constructs a boolean BitPropVariant
         *
         * @param value the bool value of the BitPropVariant
         */
        explicit BitPropVariant( bool value );
        /**
         * @brief Constructs a string BitPropVariant from a null-terminated C wide string
         *
         * @param value the null-terminated C wide string value of the BitPropVariant
         */
        explicit BitPropVariant( const wchar_t* value );
        /**
         * @brief Constructs a string BitPropVariant from a wstring
         *
         * @param value the wstring value of the BitPropVariant
         */
        explicit BitPropVariant( const wstring& value );
        /**
         * @brief Constructs a 8-bit unsigned integer BitPropVariant
         *
         * @param value the uint8_t value of the BitPropVariant
         */
        explicit BitPropVariant( uint8_t value );
        /**
         * @brief Constructs a 16-bit unsigned integer BitPropVariant
         *
         * @param value the uint16_t value of the BitPropVariant
         */
        explicit BitPropVariant( uint16_t value );
        /**
         * @brief Constructs a 32-bit unsigned integer BitPropVariant
         *
         * @param value the uint32_t value of the BitPropVariant
         */
        explicit BitPropVariant( uint32_t value );
        /**
         * @brief Constructs a 64-bit unsigned integer BitPropVariant
         *
         * @param value the uint64_t value of the BitPropVariant
         */
        explicit BitPropVariant( uint64_t value );
        /**
         * @brief Constructs a 8-bit integer BitPropVariant
         *
         * @param value the int8_t value of the BitPropVariant
         */
        explicit BitPropVariant( int8_t value );
        /**
         * @brief Constructs a 16-bit integer BitPropVariant
         *
         * @param value the int16_t value of the BitPropVariant
         */
        explicit BitPropVariant( int16_t value );
        /**
         * @brief Constructs a 32-bit integer BitPropVariant
         *
         * @param value the int32_t value of the BitPropVariant
         */
        explicit BitPropVariant( int32_t value );
        /**
         * @brief Constructs a 64-bit integer BitPropVariant
         *
         * @param value the int64_t value of the BitPropVariant
         */
        explicit BitPropVariant( int64_t value );
        /**
         * @brief Constructs a FILETIME BitPropVariant
         *
         * @param value the FILETIME value of the BitPropVariant
         */
        explicit BitPropVariant( const FILETIME& value );
        /**
         * @brief BitPropVariant destructor.
         *
         * @note This is not virtual, in order to maintain the same memory layout of the base struct!
         */
        ~BitPropVariant();
        /**
         * @brief Copy assignment operator.
         *
         * @param other the variant to be copied.
         *
         * @return a reference to *this object (with the copied values from other).
         */
        BitPropVariant& operator=( const BitPropVariant& other ) NOEXCEPT;
        /**
         * @brief Move assignment operator.
         *
         * @param other the variant to be moved.
         *
         * @return a reference to *this object (with the moved values from other).
         */
        BitPropVariant& operator=( BitPropVariant&& other ) NOEXCEPT;
        /**
         * @brief Assignment operator
         *
         * @note this will work only for T types for which a BitPropVariant constructor is defined!
         *
         * @param value the value to be assigned to the object
         *
         * @return a reference to *this object having the value as new variant value
         */
        template<typename T>
        BitPropVariant& operator=( const T& value ) {
            *this = BitPropVariant( value );
            return *this;
        }
        /**
         * @return the boolean value of this variant
         * (it throws an expcetion if the variant is not a boolean).
         */
        bool getBool() const;
        /**
         * @return the string value of this variant
         * (it throws an exception if the variant is not a string).
         */
        wstring getString() const;
        /**
         * @return the 8-bit unsigned integer value of this variant
         * (it throws an exception if the variant is not an 8-bit unsigned integer).
         */
        uint8_t getUInt8() const;
        /**
         * @return 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).
         */
        uint16_t getUInt16() const;
        /**
         * @return 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).
         */
        uint32_t getUInt32() const;
        /**
         * @return 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).
         */
        uint64_t getUInt64() const;
        /**
         * @return the 8-bit integer value of this variant
         * (it throws an exception if the variant is not an 8-bit integer).
         */
        int8_t getInt8() const;
        /**
         * @return the 16-bit integer value of this variant
         * (it throws an exception if the variant is not an 8 or 16-bit integer).
         */
        int16_t getInt16() const;
        /**
         * @return the 32-bit integer value of this variant
         * (it throws an exception if the variant is not an 8, 16 or 32-bit integer).
         */
        int32_t getInt32() const;
        /**
         * @return 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).
         */
        int64_t getInt64() const;
        /**
         * @return the FILETIME value of this variant
         * (it throws an exception if the variant is not a filetime).
         */
        FILETIME getFiletime() const;
        /**
         * @return the the value of this variant converted from any supported type to std::wstring.
         */
        wstring toString() const;
        /**
         * @return true if this variant is empty, false otherwise.
         */
        bool isEmpty() const;
        /**
         * @return true if this variant is a boolean, false otherwise.
         */
        bool isBool() const;
        /**
         * @return true if this variant is a string, false otherwise.
         */
        bool isString() const;
        /**
         * @return true if this variant is an 8-bit unsigned integer, false otherwise.
         */
        bool isUInt8() const;
        /**
         * @return true if this variant is an 8 or 16-bit unsigned integer, false otherwise.
         */
        bool isUInt16() const;
        /**
         * @return true if this variant is an 8, 16 or 32-bit unsigned integer, false otherwise.
         */
        bool isUInt32() const;
        /**
         * @return true if this variant is an 8, 16, 32 or 64-bit unsigned integer, false otherwise.
         */
        bool isUInt64() const;
        /**
         * @return true if this variant is an 8-bit integer, false otherwise.
         */
        bool isInt8() const;
        /**
         * @return true if this variant is an 8 or 16-bit integer, false otherwise.
         */
        bool isInt16() const;
        /**
         * @return true if this variant is an 8, 16 or 32-bit integer, false otherwise.
         */
        bool isInt32() const;
        /**
         * @return true if this variant is an 8, 16, 32 or 64-bit integer, false otherwise.
         */
        bool isInt64() const;
        /**
         * @return true if this variant is a FILETIME structure, false otherwise.
         */
        bool isFiletime() const;
        /**
         * @return the BitPropVariantType of this variant.
         */
        BitPropVariantType type() const;
        /**
         * @brief Clears the current value of the variant object
         */
        void clear();
    private:
        void internalClear();
        friend bool operator ==( const BitPropVariant& a, const BitPropVariant& b );
        friend bool operator !=( const BitPropVariant& a, const BitPropVariant& b );
};





Add Discussion as Guest

Log in