|
Gromacs
2026.0-dev-20251114-850eace
|
#include <gromacs/utility/include/gromacs/utility/stringtoenumvalueconverter.h>
A class to convert a string to an enum value of type EnumType.
It can be configured:
Usage example:
enum class Foo : int { Fizz, Buzz, Count, Default = Fizz }; StringToEnumValueConverter<Foo, enumValueToString> converter; Foo type = converter.valueFrom(theString);
| EnumType | A class enum for which enumValueToString is defined and maps all values (except EnumType::Count) to a string. |
| enumValueToStringFunction | Function to convert EnumValue to string, which is typically enumValueToString, per convention |
| stringCompareType | Indicates how the string should be compared with respect to case, hyphens, underscores, etc. |
| stripStrings | Indicates whether strings should have leading and trailing whitespace removed before comparison |
Public Member Functions | |
| std::optional< EnumType > | valueFrom (const std::string &s) const |
Return an optional enum value identified from the s (which is never EnumType::Count) | |
1.8.5