A qualified value representing a phase of matter. More...
#include <value-types.hh>
Public Types | |
enum | Value { SOLID, LIQUID, GAS } |
The possible phase values. More... | |
Public Member Functions | |
Phase (const Value &source, Qualifier qualifier=Q_NEUTRAL) throw () | |
Constructs a new defined phase. | |
Phase (Qualifier qualifier=Q_UNK) throw () | |
Constructs a new undefined or default phase. | |
virtual int | compare (const value_base &other) const throw () |
virtual color | get_color () const throw () |
Returns a color representing the value. | |
Public Attributes | |
Value | 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 representing a phase of matter.
Constructs a new defined phase.
source | The initial definition. | |
qualifier | The qualification of the initial value. |
Elemental::Phase::Phase | ( | Qualifier | qualifier = Q_UNK |
) | throw () |
Constructs a new undefined or default phase.
qualifier | The qualification of the initial value. |
virtual ustring Elemental::Phase::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.
virtual color Elemental::Phase::get_color | ( | ) | const throw () [virtual] |
Returns a color representing the value.
Derived classes must implement this function, returning a color that corresponds to the defined value. A special color should be returned if has_value() is false
.
Implements Elemental::color_value_base.