libelemental 2.0.2
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
Elemental::ValueList< T > Class Template Reference

A qualified list of values of a generic type. More...

#include <value.hh>

Inheritance diagram for Elemental::ValueList< T >:
Inheritance graph
[legend]

Public Member Functions

template<class S >
 ValueList (const S source[], int count, Qualifier qualifier=Q_NEUTRAL)
 Constructs a new defined value list.
 
template<class S >
 ValueList (const ValueList< S > &source)
 Constructs a new value list based on another value list.
 
 ValueList (Qualifier qualifier=Q_UNK) throw ()
 Constructs a new undefined or empty value list.
 
virtual int compare (const value_base &other) const throw ()
 Compares two qualified values.
 
- Public Member Functions inherited from Elemental::value_base
bool has_value () const throw ()
 Returns whether the value is defined.
 
virtual ustring get_string (const ustring &format=ustring()) const throw ()
 Returns a localized text representation of the value.
 
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

std::vector< T > values
 The values, 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.
 
- Protected Member Functions inherited from Elemental::value_base
 value_base (Qualifier qualifier) throw ()
 
virtual int compare_base (const value_base &other) const throw ()
 Compares the qualifications of two values.
 

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

template<class T>
class Elemental::ValueList< T >

A qualified list of values 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.

Constructor & Destructor Documentation

◆ ValueList() [1/3]

template<class T >
template<class S >
Elemental::ValueList< T >::ValueList ( const S  source[],
int  count,
Qualifier  qualifier = Q_NEUTRAL 
)

Constructs a new defined value list.

Parameters
sourceAn array of the initial values.
countThe length of the source array.
qualifierThe qualification of the initial values.

◆ ValueList() [2/3]

template<class T >
template<class S >
Elemental::ValueList< T >::ValueList ( const ValueList< S > &  source)

Constructs a new value list based on another value list.

Parameters
sourceThe value list to be copied.

◆ ValueList() [3/3]

template<class T >
Elemental::ValueList< T >::ValueList ( Qualifier  qualifier = Q_UNK)
throw (
)

Constructs a new undefined or empty value list.

Parameters
qualifierThe qualification of the initial values.

Member Function Documentation

◆ compare()

template<class T >
virtual int Elemental::ValueList< 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.

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.

◆ do_get_string()

template<class T >
virtual ustring Elemental::ValueList< T >::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.


The documentation for this class was generated from the following file: