diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2015-09-22 03:00:00 +0300 |
---|---|---|
committer | Kornel LesiĆski <kornel@geekhood.net> | 2016-05-28 02:16:55 +0300 |
commit | f6444c32568553e0261ca0105083658f12be6284 (patch) | |
tree | 8f4eb80f6accd2a9d0759e2564fd6a2b00836e02 /CPP/Windows | |
parent | cba375916fb18db8b9101aedf4fa079e019311b3 (diff) |
15.0715.07
Diffstat (limited to 'CPP/Windows')
-rw-r--r-- | CPP/Windows/PropVariantUtils.cpp | 39 | ||||
-rw-r--r-- | CPP/Windows/PropVariantUtils.h | 3 |
2 files changed, 42 insertions, 0 deletions
diff --git a/CPP/Windows/PropVariantUtils.cpp b/CPP/Windows/PropVariantUtils.cpp index 5ffe7121..7149616b 100644 --- a/CPP/Windows/PropVariantUtils.cpp +++ b/CPP/Windows/PropVariantUtils.cpp @@ -108,3 +108,42 @@ void FlagsToProp(const CUInt32PCharPair *pairs, unsigned num, UInt32 flags, NCOM { prop = FlagsToString(pairs, num, flags); } + + +AString Flags64ToString(const CUInt32PCharPair *pairs, unsigned num, UInt64 flags) +{ + AString s; + for (unsigned i = 0; i < num; i++) + { + const CUInt32PCharPair &p = pairs[i]; + UInt64 flag = (UInt64)1 << (unsigned)p.Value; + if ((flags & flag) != 0) + { + if (p.Name[0] != 0) + { + if (!s.IsEmpty()) + s += ' '; + s += p.Name; + } + } + flags &= ~flag; + } + if (flags != 0) + { + if (!s.IsEmpty()) + s += ' '; + { + char sz[32]; + sz[0] = '0'; + sz[1] = 'x'; + ConvertUInt64ToHex(flags, sz + 2); + s += sz; + } + } + return s; +} + +void Flags64ToProp(const CUInt32PCharPair *pairs, unsigned num, UInt64 flags, NCOM::CPropVariant &prop) +{ + prop = Flags64ToString(pairs, num, flags); +} diff --git a/CPP/Windows/PropVariantUtils.h b/CPP/Windows/PropVariantUtils.h index 0da9c3b7..64dfd5a1 100644 --- a/CPP/Windows/PropVariantUtils.h +++ b/CPP/Windows/PropVariantUtils.h @@ -27,4 +27,7 @@ void TypeToProp(const char * const table[], unsigned num, UInt32 value, NWindows #define FLAGS_TO_PROP(pairs, value, prop) FlagsToProp(pairs, ARRAY_SIZE(pairs), value, prop) #define TYPE_TO_PROP(table, value, prop) TypeToProp(table, ARRAY_SIZE(table), value, prop) +void Flags64ToProp(const CUInt32PCharPair *pairs, unsigned num, UInt64 flags, NWindows::NCOM::CPropVariant &prop); +#define FLAGS64_TO_PROP(pairs, value, prop) Flags64ToProp(pairs, ARRAY_SIZE(pairs), value, prop) + #endif |