Kea
1.9.9-git
|
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. More... | |
virtual | ~LabeledValue () |
Destructor. More... | |
std::string | getLabel () const |
Gets the text label of this instance. More... | |
int | getValue () const |
Gets the integer value of this instance. More... | |
bool | operator!= (const LabeledValue &other) const |
Inequality operator. More... | |
bool | operator< (const LabeledValue &other) const |
Less-than operator. More... | |
bool | operator== (const LabeledValue &other) const |
Equality operator. More... | |
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.
Referenced by isc::util::operator<<().
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 47 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.