Gromacs
5.1
|
#include <gromacs/options/basicoptions.h>
Specifies an option that provides string values.
Examples:
Public methods in this class do not throw.
Public Types | |
typedef StringOptionInfo | InfoType |
OptionInfo subclass corresponding to this option type. | |
Public Types inherited from gmx::OptionTemplate< std::string, StringOption > | |
typedef std::string | ValueType |
Type that stores a single option value. | |
typedef StringOption | MyClass |
Alias for the derived class type. | |
Public Member Functions | |
StringOption (const char *name) | |
Initializes an option with the given name. | |
template<size_t count> | |
MyClass & | enumValue (const char *const (&values)[count]) |
Sets the option to only accept one of a fixed set of strings. More... | |
MyClass & | enumValueFromNullTerminatedArray (const char *const *values) |
Sets the option to only accept one of a fixed set of strings. More... | |
MyClass & | defaultEnumIndex (int index) |
Sets the default value using an index into the enumeration table. More... | |
MyClass & | storeEnumIndex (int *store) |
Stores the index of the selected value into the provided memory location. More... | |
Public Member Functions inherited from gmx::OptionTemplate< std::string, StringOption > | |
MyClass & | description (const char *descr) |
Sets a description for the option. More... | |
MyClass & | hidden (bool bHidden=true) |
Hides the option from normal help output. | |
MyClass & | required (bool bRequired=true) |
Requires the option to be specified explicitly. More... | |
MyClass & | allowMultiple (bool bMulti=true) |
Allows the option to be specified multiple times. | |
MyClass & | valueCount (int count) |
Requires exactly count values for the option. | |
MyClass & | multiValue (bool bMulti=true) |
Allows any number of values for the option. | |
MyClass & | defaultValue (const std::string &defaultValue) |
Sets a default value for the option. More... | |
MyClass & | defaultValueIfSet (const std::string &defaultValue) |
Sets a default value for the option when it is set. More... | |
MyClass & | store (std::string *store) |
Stores value(s) in memory pointed by store . More... | |
MyClass & | storeCount (int *countptr) |
Stores number of values in the value pointed by countptr . More... | |
MyClass & | storeVector (std::vector< std::string > *store) |
Stores option values in the provided vector. More... | |
Friends | |
class | StringOptionStorage |
Needed to initialize StringOptionStorage from this class without otherwise unnecessary accessors. | |
Additional Inherited Members | |
Protected Types inherited from gmx::OptionTemplate< std::string, StringOption > | |
typedef OptionTemplate < std::string, StringOption > | MyBase |
Alias for the template class for use in base classes. | |
Protected Member Functions inherited from gmx::OptionTemplate< std::string, StringOption > | |
const std::string * | defaultValue () const |
Returns a pointer to user-specified default value, or NULL if there is none. | |
const std::string * | defaultValueIfSet () const |
Returns a pointer to user-specified default value, or NULL if there is none. | |
OptionTemplate (const char *name) | |
Initializes the name and default values for an option. | |
MyClass & | me () |
Returns *this casted into MyClass to reduce typing. | |
Protected Member Functions inherited from gmx::AbstractOption | |
AbstractOption (const char *name) | |
Initializes the name and default values for an option. | |
void | setDescription (const char *descr) |
Sets the description for the option. | |
void | setFlag (OptionFlag flag) |
Sets a flag for the option. | |
void | clearFlag (OptionFlag flag) |
Clears a flag for the option. | |
void | setFlag (OptionFlag flag, bool bSet) |
Sets or clears a flag for the option. | |
bool | isVector () const |
Returns true if the option is vector-valued. | |
void | setVector () |
Sets the option to be vector-valued. More... | |
void | setValueCount (int count) |
Sets the required number of values for the option. | |
Protected Attributes inherited from gmx::AbstractOption | |
int | minValueCount_ |
Minimum number of values required for the option. | |
int | maxValueCount_ |
Maximum number of values allowed for the option. | |
|
inline |
Sets the default value using an index into the enumeration table.
Cannot be specified without enumValue().
|
inline |
Sets the option to only accept one of a fixed set of strings.
[in] | values | Array of strings to accept. |
Also accepts prefixes of the strings; if a prefix matches more than one of the possible strings, the shortest one is used (in a tie, the first one is).
It is not possible to provide multiple values for an option with this property set, i.e., valueCount() and similar attributes cannot be set.
The strings are copied once the option is created.
|
inline |
Sets the option to only accept one of a fixed set of strings.
[in] | values | Array of strings to accept, with a NULL pointer following the last string. |
Works otherwise as the array version, but accepts a pointer to an array of undetermined length. The end of the array is indicated by a NULL pointer in the array.
|
inline |
Stores the index of the selected value into the provided memory location.
The index (zero-based) of the selected value in the array values
provided to enumValues() is written into *store
after the option gets its value. If the option has not been provided, and there is no default value, -1 is stored. If store(), storeVector() or defaultEnumIndex() is not present, the value in *store
is kept as a default value, otherwise it is always overwritten.
Cannot be specified without enumValue().