Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

plist::Primitive< T > Class Template Reference

#include <plistPrimitives.h>

Inheritance diagram for plist::Primitive< T >:

Detailed Description

template<typename T>
class plist::Primitive< T >

Implements type-specific functionality through template specialization, mainly involving value conversion and stringification formatting

Provides smart-pointer style functionality for transparent access to the value storage, as well as automatic casting to and from the value type so you can almost always treat the Primitive as if it was the value itself.

Definition at line 60 of file plistPrimitives.h.

List of all members.

Classes

struct  conversion_policy

Public Member Functions

 Primitive ()
 constructor
 Primitive (const T &v)
 copy constructor, automatic conversion from value type
Primitiveoperator= (const T &v)
 assignment from value type (template specializations add in-place modiciation (e.g. +=, *=))
virtual Primitiveoperator= (const PrimitiveBase &pb)
 assignment (don't assign listeners); doesn't trigger fireValueChanged, subclass should do that from its own operator=() following assignment
Primitiveoperator= (const Primitive &p)
 assignment from primitive of the same type (just assign value)
Primitiveoperator+= (const T &v)
 add in-place
Primitiveoperator-= (const T &v)
 subtract in-place
Primitiveoperator*= (const T &v)
 multiply in-place
Primitiveoperator/= (const T &v)
 divide in-place
const T & operator* () const
 smart pointer, dereference to access primitive storage
const T * operator-> () const
 smart pointer, dereference to access primitive storage
 operator T () const
 cast operator to automatically convert to value type
void loadXML (xmlNode *node)
 interprets node as holding the specialization type
void saveXML (xmlNode *node) const
 saves val into node
void set (const std::string &str)
 assign a new value
std::string get () const
 return current value as a string
virtual bool operator== (const PrimitiveBase &other)
virtual long toLong () const
 return current value as an (long) integer (throws std::runtime_error exception if incompatable, e.g. dictionary or array to value type)
virtual double toDouble () const
 return current value as a double (throws std::runtime_error exception if incompatable, e.g. dictionary or array to value type)
virtual Primitive< T > * clone () const __attribute__((warn_unused_result))
 clone definition for Primitive<T>
const T & getPreviousValue () const
 returns the previously assigned value

Protected Attributes

val
 storage of primitive value
prevVal
 following each assignment, this is the "old" value -- very handy for PrimitiveListeners

Constructor & Destructor Documentation

template<typename T>
plist::Primitive< T >::Primitive (  ) 

constructor

Definition at line 65 of file plistPrimitives.h.

template<typename T>
plist::Primitive< T >::Primitive ( const T &  v  ) 

copy constructor, automatic conversion from value type

Definition at line 67 of file plistPrimitives.h.


Member Function Documentation

template<typename T >
Primitive< T > * plist::Primitive< T >::clone (  )  const [virtual]

clone definition for Primitive<T>

implements the clone function for Primitive<T>

implements the clone function for Primitive<std::string>

implements the clone function for Primitive<unsigned char>

implements the clone function for Primitive<char>

implements the clone function for Primitive<bool>

Implements plist::ObjectBase.

Reimplemented in plist::OutputSelector, and plist::Angle.

Definition at line 68 of file plistPrimitives.cc.

template<typename T>
std::string plist::Primitive< T >::get (  )  const [virtual]
template<typename T>
const T& plist::Primitive< T >::getPreviousValue (  )  const

returns the previously assigned value

Definition at line 114 of file plistPrimitives.h.

template<typename T >
void plist::Primitive< T >::loadXML ( xmlNode node  )  [virtual]

interprets node as holding the specialization type

Reimplemented from plist::ObjectBase.

Reimplemented in plist::OutputSelector, and plist::Angle.

Definition at line 13 of file plistPrimitives.cc.

Referenced by plist::Point::loadXML().

template<typename T>
plist::Primitive< T >::operator T (  )  const

cast operator to automatically convert to value type

Definition at line 85 of file plistPrimitives.h.

template<typename T>
const T& plist::Primitive< T >::operator* (  )  const

smart pointer, dereference to access primitive storage

Definition at line 80 of file plistPrimitives.h.

template<typename T>
Primitive& plist::Primitive< T >::operator*= ( const T &  v  ) 

multiply in-place

Definition at line 76 of file plistPrimitives.h.

template<typename T>
Primitive& plist::Primitive< T >::operator+= ( const T &  v  ) 

add in-place

Definition at line 74 of file plistPrimitives.h.

template<typename T>
Primitive& plist::Primitive< T >::operator-= ( const T &  v  ) 

subtract in-place

Definition at line 75 of file plistPrimitives.h.

template<typename T>
const T* plist::Primitive< T >::operator-> (  )  const

smart pointer, dereference to access primitive storage

Definition at line 82 of file plistPrimitives.h.

template<typename T>
Primitive& plist::Primitive< T >::operator/= ( const T &  v  ) 

divide in-place

Definition at line 77 of file plistPrimitives.h.

template<typename T>
Primitive& plist::Primitive< T >::operator= ( const Primitive< T > &  p  ) 

assignment from primitive of the same type (just assign value)

Definition at line 72 of file plistPrimitives.h.

Referenced by plist::Primitive< bool >::operator=().

template<typename T>
virtual Primitive& plist::Primitive< T >::operator= ( const PrimitiveBase pb  )  [virtual]

assignment (don't assign listeners); doesn't trigger fireValueChanged, subclass should do that from its own operator=() following assignment

Reimplemented from plist::PrimitiveBase.

Definition at line 70 of file plistPrimitives.h.

Referenced by plist::Primitive< bool >::operator=().

template<typename T>
Primitive& plist::Primitive< T >::operator= ( const T &  v  ) 

assignment from value type (template specializations add in-place modiciation (e.g. +=, *=))

Reimplemented in plist::OutputSelector.

Definition at line 69 of file plistPrimitives.h.

template<typename T>
virtual bool plist::Primitive< T >::operator== ( const PrimitiveBase other  )  [virtual]

Implements plist::PrimitiveBase.

Definition at line 101 of file plistPrimitives.h.

template<typename T >
void plist::Primitive< T >::saveXML ( xmlNode node  )  const [virtual]

saves val into node

Implements plist::ObjectBase.

Reimplemented in plist::OutputSelector, and plist::Angle.

Definition at line 47 of file plistPrimitives.cc.

Referenced by plist::Point::saveXML().

template<typename T >
void plist::Primitive< T >::set ( const std::string &  str  )  [virtual]
template<typename T>
double plist::Primitive< T >::toDouble (  )  const [virtual]

return current value as a double (throws std::runtime_error exception if incompatable, e.g. dictionary or array to value type)

Implements plist::ObjectBase.

Definition at line 109 of file plistPrimitives.h.

template<typename T>
long plist::Primitive< T >::toLong (  )  const [virtual]

return current value as an (long) integer (throws std::runtime_error exception if incompatable, e.g. dictionary or array to value type)

Implements plist::ObjectBase.

Definition at line 108 of file plistPrimitives.h.


Member Data Documentation

template<typename T>
T plist::Primitive< T >::prevVal [protected]

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

Tekkotsu v5.1CVS
Generated Mon May 9 04:59:25 2016 by Doxygen 1.6.3