[ Lit Window Library at SourceForge[ Lit Window Productions Homepage ]  [ wxWidgets Tips&Tricks ]  [  wxVisualSetup ]

Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

typed_const_accessor Class Template Reference
[Data adapters]

typed_const_accessor is a const_accessor with additional get/set functions that work with the actual type of the object. More...

Inheritance diagram for typed_const_accessor:

Inheritance graph
[legend]
Collaboration diagram for typed_const_accessor:

Collaboration graph
[legend]
List of all members.

Public Member Functions

void assert_valid () const
 assert the validness of the accessor, throw an exception if it is invalid.
const Value get () const
 return the value of the object pointed to by this accessor.
void get (Value &v) const
 Return the value of the object pointed to by this accessor.
const_accessor get_const_accessor () const
 return an untyped const_accessor from this typed_const_accessor
const Value * get_ptr () const
 get a typed pointer to the original object.
const Value & get_ref () const
 get a typed reference to the original object.
bool is_valid () const
 test validity of the accessor.
 typed_const_accessor ()
 typed_const_accessor (const const_accessor &p)

Protected Attributes

converter_value_base< Value > * type_ptr

Detailed Description

template<class Value>
class litwindow::typed_const_accessor< Value >

Used with dynamic_cast_accessor.


Constructor & Destructor Documentation

typed_const_accessor const const_accessor p  ) 
 

typed_const_accessor  ) 
 


Member Function Documentation

void assert_valid  )  const
 

Reimplemented from const_accessor.

const Value get  )  const
 

Same as get(Value &v) except that it returns the value.

void get Value &  v  )  const
 

This function accesses the object directly rather than using string representations.

            typed_const_accessor<float> p=dynamic_cast_accessor<float>(someAccessor);
            if (p.is_valid()) {
                float aFloat;
                p.get(aFloat);
            } else {
                printf("error: someAccessor is not of type float.");
            }
will copy the float pointed to by someAccessor to aFloat
Returns:
the actual value & type of the object.

const_accessor get_const_accessor  )  const
 

const Value* get_ptr  )  const
 

get_ptr returns a pointer to the object pointed to by this accessor.

Note:
Not all accessors support this, in which case get_ptr will return 0. Use of typed_const_accessor::get is generally preferred.

Reimplemented in typed_accessor.

const Value& get_ref  )  const
 

get_ref returns a reference to the object pointed to by this accessor.

Note:
Not all accessors support this, in which case get_ref will throw a runtime_exception. Use of typed_const_accessor::get is generally preferred.

Reimplemented in typed_accessor.

bool is_valid  )  const
 

Returns:
true if the accessor is valid and points to an object.

Reimplemented from const_accessor.


Member Data Documentation

converter_value_base<Value>* type_ptr [protected]
 


Copyright 2004, Hajo Kirchhoff, Lit Window Productions