dynamic::internal::var_methods< Derived, Deref > Class Template Reference
[Syntax classes]

Defines methods for var, and a number of helper classes which behave like var. More...

#include <var_methods.hpp>

Inheritance diagram for dynamic::internal::var_methods< Derived, Deref >:

dynamic::internal::extender dynamic::internal::var_member_base< T > dynamic::var dynamic::internal::var_member_base< const char * > dynamic::internal::var_member< T > dynamic::exception dynamic::internal::var_member< const char * > dynamic::expired_iterator dynamic::invalid_string dynamic::not_found dynamic::not_supported dynamic::too_many_arguments dynamic::wrong_number_of_args

List of all members.

Public Member Functions

template<typename T >
var operator+ (const T &t) const
 Add.
template<typename T >
var operator- (const T &t) const
 Subtract.
template<typename T >
var operator* (const T &t) const
 Multiply.
template<typename T >
var operator/ (const T &t) const
 Divide.
template<typename T >
var operator% (const T &t) const
 Modulo.
template<typename T >
var operator>> (const T &t) const
 Right-shift.
template<typename T >
var operator<< (const T &t) const
 Left-shift.
var operator- () const
 Negation.
var operator+ () const
 Unary add, usually clones.
var operator~ () const
 Bitwise inverse.
var_deref operator-> () const
 Access iterator value.
var operator* () const
 Dereference iterator.
var begin () const
 Returns iterator to container contents.
var end () const
 Returns iterator to end of container contents.
int size () const
 Returns the number of items in the container.
bool empty () const
 Returns whether the container is empty.
var rbegin () const
 Returns a reverse iterator to the container.
var rend () const
 Returns the end reverse iterator to the container.
string as_string () const
 Returns a string representation of the object.
wstring as_wstring () const
 Returns a wide string representation of the object.
int as_int () const
 Returns an integer representation of the object.
double as_double () const
 Returns a double representation of the object.
bool as_bool () const
 Convert the object to a bool.
 operator bool () const
 Same as as_bool().
bool operator! () const
 Logical not operator.
 operator int () const
 Convert the var to an int, or returns 0.
var clone () const
 Creates a clone.
void resize (const var &size)
 Resizes the contents for certain datatypes.
void clear ()
 Erases all items in the object.
void push_back (const var &)
 Adds an item to the back of the container.
var pop_back ()
 Removes an item from the back of the container, and returns it.
void push_front (const var &)
 Pushes an item to the front of the container.
var pop_front ()
 Removes an item from the front of the container, and returns it.
void insert (const var &item)
 Inserts an item into the container.
void insert (const var &position, const var &item)
 Inserts a pair of items into the container (for maps).
var front () const
 Returns the first item in the container.
var back () const
 Returns the last item in the container.
var key () const
 Returns the key of the iterator.
var value () const
 Returns the value of the iterator.
bool contains (const var &item) const
 Tests whether the container contains the given item.
void erase (const var &item)
 Erases the given item from the container.
void mixin (const var &object)
 Merges the members of one object into another.
template<typename T >
bool operator== (const T &v) const
 Compare for equality using compare().
template<typename T >
bool operator!= (const T &v) const
 Compare for not equals.
template<typename T >
bool operator< (const T &v) const
 Compare for less-than.
template<typename T >
bool operator> (const T &v) const
 Compare for greater-than.
template<typename T >
bool operator<= (const T &v) const
 Compare for less-than-or-equals.
template<typename T >
bool operator>= (const T &v) const
 Compare for greater-than-or-equals.
template<typename T >
T & as ()
 Extract the stored type from create().
template<typename T >
T & as_unsafe ()
 Extract the stored type (without type check).
Derived & operator++ ()
 Preincrement operator.
var operator++ (int)
 Postincrement operator.
Derived & operator-- ()
 Predecrement operator.
var operator-- (int)
 Postdecrement operator.
var operator() () const
 Function call.
var operator() (const var &) const
 Function call.
var operator() (const var &, const var &) const
 Function call.
var operator() (const var &, const var &, const var &) const
 Function call.
var operator() (const var &, const var &, const var &, const var &) const
 Function call.
var operator() (const var &, const var &, const var &, const var &, const var &) const
 Function call.
var operator() (const var &, const var &, const var &, const var &, const var &, const var &) const
 Function call.
var operator() (const var &, const var &, const var &, const var &, const var &, const var &, const var &) const
 Function call.
var operator() (const var &, const var &, const var &, const var &, const var &, const var &, const var &, const var &) const
 Function call.
var operator() (const var &, const var &, const var &, const var &, const var &, const var &, const var &, const var &, const var &) const
 Function call.
var operator() (const var &, const var &, const var &, const var &, const var &, const var &, const var &, const var &, const var &, const var &) const
 Function call.
std::string class_name () const
 Returns the class name of the object.
var keys () const
 Returns a container of the keys (default is null).
var values () const
 Returns a container of values (default is null).
int max_args () const
 Returns the maximum number of arguments that the functor can be called with.
var proxy () const
 Returns a threadsafe proxy to this object.
var enumerator () const
 Returns an enumerator to the contents of the object (default null).
var reverse_enumerator () const
 Returns an enumerator to traverse the contents in reverse order (default null).
template<typename T >
dynamic::internal::extender extend (const char *m, T t)
 Extend the object with a sequence of name-value pairs.


Detailed Description

template<typename Derived, typename Deref>
class dynamic::internal::var_methods< Derived, Deref >

Defines methods for var, and a number of helper classes which behave like var.

Parameters:
Derived is the derived class that we static_cast to
Deref is the type used to access the underlying var

Definition at line 78 of file var_methods.hpp.


Member Function Documentation

template<typename Derived , typename Deref >
void dynamic::internal::var_methods< Derived, Deref >::clear (  )  [inline]

Erases all items in the object.

Always succeeds, and has no effect on non-containers.

Definition at line 237 of file inline_impl.hpp.

template<typename Derived , typename Deref >
var dynamic::internal::var_methods< Derived, Deref >::clone (  )  const [inline]

Creates a clone.

Always succeeds, unless we get a memory exception (std::bad_alloc)

Definition at line 189 of file inline_impl.hpp.

template<typename Derived , typename Deref >
bool dynamic::internal::var_methods< Derived, Deref >::contains ( const var item  )  const [inline]

Tests whether the container contains the given item.

This always succeeds but by default returns false.

Definition at line 303 of file inline_impl.hpp.

Referenced by dynamic::types::set_impl::assign_mul(), dynamic::exception_description(), dynamic::types::set_impl::op_mul(), and dynamic::substring().

template<typename Derived , typename Deref >
void dynamic::internal::var_methods< Derived, Deref >::erase ( const var item  )  [inline]

Erases the given item from the container.

This always succeeds but has not effect if not implemented or the container does not contain the item.

Definition at line 309 of file inline_impl.hpp.

template<typename Derived , typename Deref >
dynamic::internal::var_methods< Derived, Deref >::operator int (  )  const [inline]

Convert the var to an int, or returns 0.

Always succeeds

Definition at line 173 of file var_methods.hpp.

template<typename Derived , typename Deref >
void dynamic::internal::var_methods< Derived, Deref >::resize ( const var size  )  [inline]

Resizes the contents for certain datatypes.

Throws "unsupported" if the underlying object does not support the operation

Definition at line 225 of file inline_impl.hpp.

References dynamic::internal::var_methods< Derived, Deref >::as_int().

Referenced by dynamic::pad().


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

Generated on Thu Dec 18 22:14:19 2008 for C++Script by  doxygen 1.5.7.1