Kea 2.7.4
|
Implements the concept of a constant value with a text label. More...
#include <labeled_value.h>
Public Member Functions | |
LabeledValue (const int value, const std::string &label) | |
Constructor. | |
virtual | ~LabeledValue () |
Destructor. | |
std::string | getLabel () const |
Gets the text label of this instance. | |
int | getValue () const |
Gets the integer value of this instance. | |
bool | operator!= (const LabeledValue &other) const |
Inequality operator. | |
bool | operator< (const LabeledValue &other) const |
Less-than operator. | |
bool | operator== (const LabeledValue &other) const |
Equality operator. | |
Implements the concept of a constant value with a text label.
This class implements an association between a constant integer value and a text label. It provides a single constructor, accessors for both the value and label, and boolean operators which treat the value as the "key" for comparisons. This allows them to be assembled into dictionaries of unique values. Note, that the labels are not required to be unique but in practice it makes little sense to for them to be otherwise.
Definition at line 39 of file labeled_value.h.
isc::util::LabeledValue::LabeledValue | ( | const int | value, |
const std::string & | label ) |
Constructor.
value | the numeric constant value to be labeled. |
label | the text label to associate to this value. |
LabeledValueError | if label is empty. |
Definition at line 16 of file labeled_value.cc.
References isc_throw.
|
virtual |
Destructor.
Destructor is virtual to permit derivations.
Definition at line 23 of file labeled_value.cc.
std::string isc::util::LabeledValue::getLabel | ( | ) | const |
Gets the text label of this instance.
Definition at line 32 of file labeled_value.cc.
int isc::util::LabeledValue::getValue | ( | ) | const |
Gets the integer value of this instance.
Definition at line 27 of file labeled_value.cc.
bool isc::util::LabeledValue::operator!= | ( | const LabeledValue & | other | ) | const |
Inequality operator.
Definition at line 42 of file labeled_value.cc.
bool isc::util::LabeledValue::operator< | ( | const LabeledValue & | other | ) | const |
Less-than operator.
Definition at line 46 of file labeled_value.cc.
bool isc::util::LabeledValue::operator== | ( | const LabeledValue & | other | ) | const |
Equality operator.
Definition at line 37 of file labeled_value.cc.