libelemental 2.0.2
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
Elemental::Event Class Reference

A qualified value representing the time and location of an event. More...

#include <value-types.hh>

Inheritance diagram for Elemental::Event:
Inheritance graph
[legend]

Public Member Functions

 Event (int when, const ustring &where, Qualifier qualifier=Q_NEUTRAL) throw ()
 Constructs a new defined event.
 
 Event (Qualifier qualifier=Q_UNK) throw ()
 Constructs a new undefined or empty event.
 
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 event.
 
- Public Member Functions inherited from Elemental::value_base
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

int when
 The year in which the event occurred, if defined.
 
ustring where
 The place in which the event occurred, if defined.
 
- Public Attributes inherited from Elemental::value_base
Qualifier qualifier
 The qualification of the value's meaning.
 

Protected Member Functions

virtual ustring do_get_string (const ustring &format) const throw ()
 Returns a localized text representation of a defined value.
 
virtual int compare_base (const value_base &other) const throw ()
 Compares the qualifications of two events.
 
- Protected Member Functions inherited from Elemental::value_base
 value_base (Qualifier qualifier) throw ()
 

Additional Inherited Members

- Protected Attributes inherited from Elemental::value_base
bool always
 Whether an undefined value should make an entry.
 
- Static Protected Attributes inherited from Elemental::value_base
static const int YIELD_COMPARE
 Indicates that comparison should be based on values, not definedness.
 

Detailed Description

A qualified value representing the time and location of an event.

Events are compared by year of occurrence.

Constructor & Destructor Documentation

◆ Event() [1/2]

Elemental::Event::Event ( int  when,
const ustring &  where,
Qualifier  qualifier = Q_NEUTRAL 
)
throw (
)

Constructs a new defined event.

Parameters
whenThe year in which the event occurred.
whereThe place in which the event occurred.
qualifierThe qualification of the event.

◆ Event() [2/2]

Elemental::Event::Event ( Qualifier  qualifier = Q_UNK)
throw (
)

Constructs a new undefined or empty event.

Parameters
qualifierThe qualification of the event.

Member Function Documentation

◆ compare()

virtual int Elemental::Event::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
otherThe 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.

◆ compare_base()

virtual int Elemental::Event::compare_base ( const value_base other) const
throw (
)
protectedvirtual

Compares the qualifications of two events.

Reimplemented from Elemental::value_base.

◆ do_get_string()

virtual ustring Elemental::Event::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
formatA 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.

◆ get_string()

virtual ustring Elemental::Event::get_string ( const ustring &  format = ustring()) const
throw (
)
virtual

Returns a localized text representation of the event.

Parameters
formatAn optional compose-style format string with which to output the value. The year is "%1" and the place is "%2". By default, the format is the localized version of "%1 (%2)".
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: