Back to index

nux  3.0.0
Public Types | Static Public Member Functions
nux::type::serializable_impl< T > Struct Template Reference

The serializable_impl template has different signatures than the standard Serializable traits class to avoid the generalised template being used as a traits type when we really don't want it being used in that way, but we do want a generalized implementation for the types we do care about. More...

#include <PropertyTraits.h>

List of all members.

Public Types

typedef std::pair< T, bool > ResultType

Static Public Member Functions

static std::string to_string_impl (T const &value)
static ResultType from_string_impl (std::string const &serialized_form)

Detailed Description

template<typename T>
struct nux::type::serializable_impl< T >

The serializable_impl template has different signatures than the standard Serializable traits class to avoid the generalised template being used as a traits type when we really don't want it being used in that way, but we do want a generalized implementation for the types we do care about.

Definition at line 75 of file PropertyTraits.h.


Member Typedef Documentation

template<typename T >
typedef std::pair<T, bool> nux::type::serializable_impl< T >::ResultType

Definition at line 77 of file PropertyTraits.h.


Member Function Documentation

template<typename T >
static ResultType nux::type::serializable_impl< T >::from_string_impl ( std::string const &  serialized_form) [inline, static]

Definition at line 84 of file PropertyTraits.h.

  {
    try {
      return ResultType(boost::lexical_cast<T>(serialized_form), true);
    }
#if defined(NUX_OS_WINDOWS)
    catch (boost::bad_lexical_cast const& ) {
#else
    catch (boost::bad_lexical_cast const& e) {
#endif
      return std::make_pair<T, bool>(T(), false);
    }
  }

Here is the caller graph for this function:

template<typename T >
static std::string nux::type::serializable_impl< T >::to_string_impl ( T const &  value) [inline, static]

Definition at line 79 of file PropertyTraits.h.

  {
    return boost::lexical_cast<std::string>(value);
  }

Here is the caller graph for this function:


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