Go from string to enum key
| 109 | |
| 110 | /// Go from string to enum key |
| 111 | configuration_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 | |
| 126 | std::unique_ptr<Configuration> pconfig; |
| 127 | /// A helper function to ensure that configuration is not accessed before it is initialized (was formerly static) |
no outgoing calls
no test coverage detected