UHD
003.001.002
|
#include <wax.hpp>
Public Member Functions | |
obj (void) | |
obj (const obj &o) | |
template<class T > | |
obj (const T &o) | |
virtual | ~obj (void) |
obj | operator[] (const obj &key) |
obj & | operator= (const obj &val) |
obj | get_link (void) const |
const std::type_info & | type (void) const |
template<class T > | |
T | as (void) const |
WAX object base class:
A wax obj has two major purposes: 1) to act as a polymorphic container, just like boost any 2) to provide a nested set/get properties interface
Internally, the polymorphic container is handled by a boost any. For properties, a subclass should override the set and get methods. For property nesting, wax obj subclasses return special links to other wax obj subclasses, and the api handles the magic.
wax::obj::obj | ( | void | ) |
Default constructor: The contents will be empty.
wax::obj::obj | ( | const obj & | o | ) |
Copy constructor: The contents will be cloned.
o | another wax::obj |
|
inline |
Templated any type constructor: The contents can be anything. Uses the boost::any to handle the magic.
o | an object of any type |
|
virtual |
Destructor.
|
inline |
Cast this obj into the desired type. Usage: myobj.as<type>()
wax::bad_cast | when the cast fails |
obj wax::obj::get_link | ( | void | ) | const |
Get a link in the chain: When a wax obj returns another wax obj as part of a get call, the return value should be set to the result of this method. Doing so will ensure chain-ability of the returned object.
The assignment operator: This operator allows for assignment of new contents. In the special case where this obj contains a proxy, the value will be set to the proxy's property reference.
val | the new value to assign to the wax obj |
The chaining operator: This operator allows access objs with properties. A call to the [] operator will return a new proxy obj. The proxy object is an obj with special proxy contents. Assignment and casting can be used on this special object to access the property referenced by the obj key.
key | a key to identify a property within this obj |
const std::type_info& wax::obj::type | ( | void | ) | const |
Get the type of the contents of this obj.