|
libelemental 1.2.0
|
A qualified value of a generic type. More...
#include <value.hh>

Public Member Functions | |
| template<class S > | |
| Value (const S &source, Qualifier qualifier=Q_NEUTRAL) | |
| Constructs a new defined value. | |
| template<class S > | |
| Value (const Value< S > &source) | |
| Constructs a new value based on another value. | |
| Value (Qualifier qualifier=Q_UNK) throw () | |
| Constructs a new undefined or default value. | |
| virtual int | compare (const value_base &other) const throw () |
| Compares two qualified values. | |
Public Attributes | |
| T | value |
| The value, if defined. | |
Protected Member Functions | |
| virtual ustring | do_get_string (const ustring &format) const throw () |
| Returns a localized text representation of a defined value. | |
A qualified value of a generic type.
This template requires a class with default and copy constructors and less-than, greater-than, and stream insertion operators. Compiler-generated functions are acceptable.
| Elemental::Value< T >::Value | ( | const S & | source, |
| Qualifier | qualifier = Q_NEUTRAL |
||
| ) |
Constructs a new defined value.
| source | The initial definition. |
| qualifier | The qualification of the initial value. |
Constructs a new value based on another value.
| source | The value to be copied. |
| Elemental::Value< T >::Value | ( | Qualifier | qualifier = Q_UNK | ) | throw () |
Constructs a new undefined or default value.
| qualifier | The qualification of the initial value. |
| virtual int Elemental::Value< T >::compare | ( | const value_base & | other | ) | const throw () [virtual] |
Compares two qualified values.
Derived classes may override this function, first calling compare_base, and use a dynamic_cast to check other.
| other | The qualified value for comparison. |
-1 if this value is undefined or is less than other; 0 if the values are equal; or 1 if other is undefined or this value is greater than other. Reimplemented from Elemental::value_base.
| virtual ustring Elemental::Value< T >::do_get_string | ( | const ustring & | format | ) | const throw () [protected, virtual] |
Returns a localized text representation of a defined value.
Derived classes must implement this function to produce a text representation based on the format. It will be called by get_string(), which will then decorate its output as appropriate for the current qualifier. If has_value() is false, the behavior is undefined.
| format | A compose-style format string. Derived classes may define the number of argument references expected in the string; the default is one. If format is empty, a minimal default should be used. |
Implements Elemental::value_base.
1.7.4