MCPcopy Create free account
hub / github.com/CoolProp/CoolProp / config_string_to_key

Function config_string_to_key

src/Configuration.cpp:111–124  ·  view source on GitHub ↗

Go from string to enum key

Source from the content-addressed store, hash-verified

109
110/// Go from string to enum key
111configuration_keys config_string_to_key(const std::string& s) {
112/* See http://stackoverflow.com/a/148610
113 * See http://stackoverflow.com/questions/147267/easy-way-to-use-variables-of-enum-types-as-string-in-c#202511
114 */
115#define X(Enum, String, Default, Desc) \
116 if (s == (String)) { \
117 return Enum; \
118 }
119 CONFIGURATION_KEYS_ENUM
120#undef X
121
122 // Nothing else has fired
123 throw ValueError();
124};
125
126std::unique_ptr<Configuration> pconfig;
127/// A helper function to ensure that configuration is not accessed before it is initialized (was formerly static)

Callers 4

set_config_stringFunction · 0.85
set_config_doubleFunction · 0.85
set_config_boolFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected