#include <input_keys.h>
Object to store a YAML input file key together with metadata associated to it.
default_type | Type of the key value. |
Definition at line 54 of file input_keys.h.
Classes | |
struct | WrongNumberOfVersions |
Thrown when too few or too many versions are passed to the constructor. More... | |
Public Types | |
using | type = default_type |
Let the clients of this class have access to the key type. More... | |
Public Member Functions | |
Key (const std::initializer_list< std::string_view > &labels, const std::initializer_list< std::string_view > &versions) | |
Construct a new Key object without default value. More... | |
Key (const std::initializer_list< std::string_view > &labels, const std::optional< default_type > &value, const std::initializer_list< std::string_view > &versions) | |
Construct a new Key object with default value. More... | |
default_type | default_value () const |
Get the default value of the key. More... | |
Version | introduced_in () const noexcept |
Get the SMASH version in which the key has been introduced. More... | |
Version | deprecated_in () const |
Get the SMASH version in which the key has been deprecated. More... | |
Version | removed_in () const |
Get the SMASH version in which the key has been removed. More... | |
bool | is_deprecated () const noexcept |
Get whether the key is deprecated or not. More... | |
bool | is_allowed () const noexcept |
Get whether the key is still allowed or not. More... | |
bool | has_same_labels (const KeyLabels &labels) const noexcept |
Check if given labels are the same as those of this object. More... | |
operator std::string () const noexcept | |
Converts a Key to a std::string using all labels. More... | |
const KeyLabels & | labels () const |
Method to access the Key labels. More... | |
Private Attributes | |
Version | introduced_in_ {} |
SMASH version in which the key has been introduced. More... | |
std::optional< Version > | deprecated_in_ {} |
SMASH version in which the key has been deprecated, if any. More... | |
std::optional< Version > | removed_in_ {} |
SMASH version in which the key has been removed, if any. More... | |
std::optional< default_type > | default_ {} |
Key default value, if any. More... | |
KeyLabels | labels_ {} |
The label(s) identifying the key in the YAML input file. More... | |
using smash::Key< default_type >::type = default_type |
Let the clients of this class have access to the key type.
Definition at line 123 of file input_keys.h.
|
inlineexplicit |
Construct a new Key
object without default value.
[in] | labels | The label(s) identifying the key in the YAML input file. |
[in] | versions | A list of one, two or three version numbers identifying the versions in which the key has been introduced, deprecated and removed, respectively. |
Definition at line 72 of file input_keys.h.
|
inline |
Construct a new Key
object with default value.
Note that the default value could be simply taken as parameter of type default_type
. However, this would complicate delegating construction in the other constructor and the caller can still pass a variable of type default_type
and the std::optional
will be constructed without problems.
[in] | labels | The label(s) identifying the key in the YAML input file. |
[in] | value | The key default value. |
[in] | versions | A list of one, two or three version numbers identifying the versions in which the key has been introduced, deprecated and removed, respectively. |
WrongNumberOfVersions | If versions has the wrong size. |
Definition at line 93 of file input_keys.h.
|
inline |
Get the default value of the key.
default_type
variable.std::bad_optional_access | If the key has no default value. |
Definition at line 132 of file input_keys.h.
|
inlinenoexcept |
Get the SMASH version in which the key has been introduced.
Version
variable. Definition at line 139 of file input_keys.h.
|
inline |
Get the SMASH version in which the key has been deprecated.
Version
variable.std::bad_optional_access | If the key is not deprecated. |
Definition at line 148 of file input_keys.h.
|
inline |
Get the SMASH version in which the key has been removed.
Version
variable.std::bad_optional_access | If the key is still allowed. |
Definition at line 157 of file input_keys.h.
|
inlinenoexcept |
Get whether the key is deprecated or not.
true
if the key is deprecated, false
otherwise. Definition at line 164 of file input_keys.h.
|
inlinenoexcept |
Get whether the key is still allowed or not.
true
if the key is allowed, false
otherwise. Definition at line 171 of file input_keys.h.
|
inlinenoexcept |
Check if given labels are the same as those of this object.
[in] | labels | Given labels to be checked against. |
true
if all labels match in the given order, false
otherwise. Definition at line 181 of file input_keys.h.
|
inlineexplicitnoexcept |
Converts a Key to a std::string
using all labels.
std::string
with labels concatenated with
:␣ (colon-space) and quotes all around. Definition at line 192 of file input_keys.h.
|
inline |
Method to access the Key
labels.
Definition at line 201 of file input_keys.h.
|
private |
SMASH version in which the key has been introduced.
Definition at line 205 of file input_keys.h.
|
private |
SMASH version in which the key has been deprecated, if any.
Definition at line 207 of file input_keys.h.
|
private |
SMASH version in which the key has been removed, if any.
Definition at line 209 of file input_keys.h.
|
private |
Key default value, if any.
Definition at line 211 of file input_keys.h.
|
private |
The label(s) identifying the key in the YAML input file.
Definition at line 213 of file input_keys.h.