Wt  3.3.8
Static Public Member Functions | List of all members
Wt::boost_any_traits< Type > Struct Template Reference

A traits class for a type stored in a boost::any. More...

Static Public Member Functions

static WString asString (const Type &value, const WString &format)
 Converts a value to a string. More...
 
static double asNumber (const Type &v)
 Converts a value to a number. More...
 
static int compare (const Type &v1, const Type &v2)
 Compares two values. More...
 

Detailed Description

template<typename Type>
struct Wt::boost_any_traits< Type >

A traits class for a type stored in a boost::any.

The traits are used by Wt's view classes (such as Wt::WTableView Wt::WTreeView, Wt::Chart::WCartesianChart) to deal with values in a Wt::WAbstractItemModel:

This traits class provides a default implementation for supporting values value of a custom type Type in Wt's MVC system, which relies on:

You can specialize these traits if you need to customize one or more of these operations.

Member Function Documentation

template<typename Type >
double Wt::boost_any_traits< Type >::asNumber ( const Type &  v)
static

Converts a value to a number.

The default implementation returns:

boost::lexical_cast<double>(asString(v), "")
template<typename Type >
WString Wt::boost_any_traits< Type >::asString ( const Type &  value,
const WString format 
)
static

Converts a value to a string.

The default implementation uses a boost::lexical_cast, and thus an overloaded std::ostream<< operator for the value.

template<typename Type >
int Wt::boost_any_traits< Type >::compare ( const Type &  v1,
const Type &  v2 
)
static

Compares two values.

The default implementation uses operator== and operator<.


Generated on Wed Aug 16 2017 for the C++ Web Toolkit (Wt) by doxygen 1.8.11