26 template<
typename T,
typename R>
29 for (
int i = 0; i < ARRAYSIZE(flagmap); i++)
31 if (flagmap[i].name == name)
33 return flagmap[i].value;
37 std::stringstream error;
39 throw std::exception(error.str().c_str());
43 template<
typename T,
typename R>
46 for (
int i = 0; i < ARRAYSIZE(flagmap); i++)
48 if (flagmap[i].value == value)
50 return flagmap[i].name;
54 std::stringstream error;
56 throw std::exception(error.str().c_str());
60 template<
typename T,
typename R>
61 R
GetFlagsValue(
const std::vector<std::wstring>& flags,
const T& flagmap)
65 for each (
const std::wstring& flag_entry
in flags)
67 if (flag_entry.length() == 0)
70 R item_result = GetFlagValue<T, R>(flag_entry, flagmap);
71 result |= item_result;
78 template <
typename T,
typename R>
81 std::vector<std::wstring> flags_vector;
83 return GetFlagsValue<T, R>(flags_vector, flagmap);
87 template <
typename T,
typename R>
90 std::wstring property_value = msiInstall.
GetProperty(name);
91 return GetStringFlagsValue<T, R>(property_value, flagmap);
98 return GetFlagValue<T, ULONG>(name, flagmap);
102 ULONG
GetFlagsValue(
const std::vector<std::wstring>& flags,
const T& flagmap)
104 return GetFlagsValue<T, ULONG>(flags, flagmap);
108 template <
typename T>
111 return GetStringFlagsValue<T, ULONG>(flags, flagmap);
115 template <
typename T>
118 return GetPropertyValue<T, ULONG>(msiInstall, name, flagmap);
struct AppSecInc::Msi::Flags::FlagMapEntryWORD FlagMapEntry
R GetStringFlagsValue(const std::wstring &flags, const T &flagmap)
convert a string of flags to the combined flag value
Definition: MsiFlags.h:79
void tokenizeOnChar(const std::string &ss, std::vector< std::string > &tokens, const std::string &delims)
Definition: StringUtils.cpp:54
Definition: MsiFlags.h:13
DWORD value
Definition: MsiFlags.h:22
R GetFlagsValue(const std::vector< std::wstring > &flags, const T &flagmap)
convert a vector of flags to the combined flag value
Definition: MsiFlags.h:61
R GetPropertyValue(MsiInstall &msiInstall, const std::wstring &name, const T &flagmap)
retreive an MSI property and convert to a flag value
Definition: MsiFlags.h:88
A wrapper for an MSIHANDLE with MSI support functions.
Definition: MsiInstall.h:7
std::wstring GetFlagName(const R &value, const T &flagmap)
convert a single flag value to its flag name
Definition: MsiFlags.h:44
R GetFlagValue(const std::wstring &name, const T &flagmap)
convert a single flag to its flag value
Definition: MsiFlags.h:27
LPCWSTR name
Definition: MsiFlags.h:9
std::string toString(VARIANT from)
Definition: StringUtils.cpp:359
WORD value
Definition: MsiFlags.h:10
LPCWSTR name
Definition: MsiFlags.h:15
Definition: MsiFlags.h:19
std::string wc2mb(const std::wstring &from)
Definition: StringUtils.cpp:184
std::wstring GetProperty(const std::wstring &name)
get a property
Definition: MsiInstall.cpp:26
LPCWSTR name
Definition: MsiFlags.h:21
UINT value
Definition: MsiFlags.h:16