A qualified UTF-8 string value that requires translation.
More...
#include <value-types.hh>
Public Member Functions |
| Message (const char *source, Qualifier qualifier=Q_NEUTRAL) throw () |
| Constructs a new defined message.
|
| Message (Qualifier qualifier=Q_UNK) throw () |
| Constructs a new undefined or empty message.
|
virtual int | compare (const value_base &other) const throw () |
| Compares two qualified values.
|
virtual ustring | get_string (const ustring &format=ustring()) const throw () |
| Returns a localized text representation of the value.
|
bool | has_value () const throw () |
| Returns whether the value is defined.
|
ustring | get_tip () const throw () |
| Returns a localized message to be displayed as a tooltip.
|
void | make_entry (EntriesView &view, const ustring &name, const ustring &format=ustring()) const throw () |
| Possibly adds the result of get_string() to an EntriesView.
|
Public Attributes |
ustring | value |
| The untranslated message, if defined.
|
Qualifier | qualifier |
| The qualification of the value's meaning.
|
Additional Inherited Members |
bool | always |
| Whether an undefined value should make an entry.
|
static const int | YIELD_COMPARE |
| Indicates that comparison should be based on values, not definedness.
|
Detailed Description
A qualified UTF-8 string value that requires translation.
Messages are compared by collation order.
Constructor & Destructor Documentation
Elemental::Message::Message |
( |
const char * |
source, |
|
|
Qualifier |
qualifier = Q_NEUTRAL |
|
) |
| throw () |
Constructs a new defined message.
- Parameters
-
source | The untranslated message. |
qualifier | The qualification of the message. |
Constructs a new undefined or empty message.
- Parameters
-
qualifier | The qualification of the message. |
Member Function Documentation
virtual int Elemental::Message::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.
- Parameters
-
other | The qualified value for comparison. |
- Returns
-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::Message::do_get_string |
( |
const ustring & |
format | ) |
const throw () |
|
protectedvirtual |
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.
- Parameters
-
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. |
- Returns
- A UTF-8 string containing the localized representation.
Implements Elemental::value_base.
virtual ustring Elemental::Message::get_string |
( |
const ustring & |
format = ustring() | ) |
const throw () |
|
virtual |
Returns a localized text representation of the value.
- Parameters
-
format | An optional compose-style format string with which to output the value. If not otherwise specified, the value is argument reference %%1 . |
- Returns
- A UTF-8 string containing the localized representation.
Reimplemented from Elemental::value_base.
The documentation for this class was generated from the following file: