1 // Windows/PropVariantUtils.h
2 
3 #ifndef __PROP_VARIANT_UTILS_H
4 #define __PROP_VARIANT_UTILS_H
5 
6 #include "../Common/MyString.h"
7 
8 #include "PropVariant.h"
9 
10 struct CUInt32PCharPair
11 {
12   UInt32 Value;
13   const char *Name;
14 };
15 
16 AString TypePairToString(const CUInt32PCharPair *pairs, unsigned num, UInt32 value);
17 void PairToProp(const CUInt32PCharPair *pairs, unsigned num, UInt32 value, NWindows::NCOM::CPropVariant &prop);
18 
19 AString FlagsToString(const char * const *names, unsigned num, UInt32 flags);
20 AString FlagsToString(const CUInt32PCharPair *pairs, unsigned num, UInt32 flags);
21 void FlagsToProp(const char * const *names, unsigned num, UInt32 flags, NWindows::NCOM::CPropVariant &prop);
22 void FlagsToProp(const CUInt32PCharPair *pairs, unsigned num, UInt32 flags, NWindows::NCOM::CPropVariant &prop);
23 
24 AString TypeToString(const char * const table[], unsigned num, UInt32 value);
25 void TypeToProp(const char * const table[], unsigned num, UInt32 value, NWindows::NCOM::CPropVariant &prop);
26 
27 #define PAIR_TO_PROP(pairs, value, prop) PairToProp(pairs, ARRAY_SIZE(pairs), value, prop)
28 #define FLAGS_TO_PROP(pairs, value, prop) FlagsToProp(pairs, ARRAY_SIZE(pairs), value, prop)
29 #define TYPE_TO_PROP(table, value, prop) TypeToProp(table, ARRAY_SIZE(table), value, prop)
30 
31 void Flags64ToProp(const CUInt32PCharPair *pairs, unsigned num, UInt64 flags, NWindows::NCOM::CPropVariant &prop);
32 #define FLAGS64_TO_PROP(pairs, value, prop) Flags64ToProp(pairs, ARRAY_SIZE(pairs), value, prop)
33 
34 #endif
35