Function getString

Synopsis

#include <include/bitpropvariant.hpp>

wstring getString() const

Description

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

Source

Lines 238-244 in src/bitpropvariant.cpp. Line 424 in include/bitpropvariant.hpp.

wstring BitPropVariant::getString() const {
    if ( vt != VT_BSTR ) {
        throw BitException( "BitPropVariant is not a string" );
    }
    //Note: a nullptr BSTR is semantically equivalent to an empty string!
    return bstrVal == nullptr ? L"" : wstring( bstrVal, SysStringLen( bstrVal ) );
}





Add Discussion as Guest

Log in