25 #ifndef INCLUDED_PropertyBagHelper_h_GUID_BAA9AA5B_2879_4CA0_04F3_9B90F3BAC871
26 #define INCLUDED_PropertyBagHelper_h_GUID_BAA9AA5B_2879_4CA0_04F3_9B90F3BAC871
29 #include "comutils/ComPtr.h"
30 #include "comutils/ComVariant.h"
44 mon.BindToStorage(
nullptr,
nullptr, IID_IPropertyBag,
45 AttachPtr(m_propBag));
49 explicit operator bool()
const {
return bool(m_propBag); }
58 std::wstring
read(
const wchar_t propName[])
const {
59 using namespace comutils::variant;
61 auto ret = std::wstring{};
63 m_propBag->Read(propName, AttachVariant(val),
nullptr);
64 if (contains<std::wstring>(val)) {
65 ret = get<std::wstring>(val);
71 comutils::Ptr<IPropertyBag> m_propBag;
73 #endif // INCLUDED_PropertyBagHelper_h_GUID_BAA9AA5B_2879_4CA0_04F3_9B90F3BAC871
IPropertyBag & getPropertyBag()
Accessor for underlying object reference.
IPropertyBag const & getPropertyBag() const
Const accessor for underlying object reference.
std::wstring read(const wchar_t propName[]) const
Reads a (wide-string) property, returning an empty string if failed.