Scope Class Reference

Hold variables and other scopes using various values as key. More...

#include <scope.h>

Inherited by AbstractTypeScope, AttributeScope, CompositeScope, ConstScope, ContextScope, FunctionScope, LocalScope, and ObjectScope.

List of all members.

Public Types

typedef ScopePtr Ptr

Public Member Functions

virtual ~Scope ()
Variable get (const Variant &key, bool modifiable=false)
 Get a variable by its key.
Variable get (const VariablePath &path, bool modifiable=false)
 Get a variable using a path describing the scopes indirection.
Variable declare (const Variant &key, const Variant &initialValue=Variant())
 Declare a new variable to be handled and return it.
bool assignSubscope (const Variant &key, const Ptr &subscope)
 Assign subscope whith the given key.
bool assignSubscope (const Variant &key, Scope *subscope)
bool assignSubscope (const VariablePath &path, const Ptr &subscope)
void remove (const Variant &key)
 Delete variable and/or subscope.
void remove (const VariablePath &path)
Ptr getScope (const Variant &key)
 Get a reference to a subscope by its key.
Ptr getScope (const VariablePath &path)
virtual Variable getValue (bool modifiable)
 Get designated value for the scope.

Protected Member Functions

virtual Variable doGet (const Variant &key, bool modifiable)
 Implementation for get.
virtual Variable doDeclare (const Variant &key, const Variant &initialValue)
 Implementation for declare.
virtual Ptr doGetScope (const Variant &key)
 Implementation for getScope.
virtual bool doAssignSubscope (const Variant &key, const Ptr &subscope)
 Implementation for assignSubscope.
virtual void doRemove (const Variant &key)
 Implementation for remove.

Detailed Description

Hold variables and other scopes using various values as key.

Variables are typically access using a path that accesses first navigates through scopes by their keys and then accesses the variable.

This implementation cannot have any variable or scopes, the class needs to be subclass for pratical implementations.


Member Typedef Documentation

typedef ScopePtr Scope::Ptr

Constructor & Destructor Documentation

virtual Scope::~Scope ( ) [inline, virtual]

Member Function Documentation

bool Scope::assignSubscope ( const Variant key,
const Ptr subscope 
)

Assign subscope whith the given key.

Return true if the assignment was successful

bool Scope::assignSubscope ( const Variant key,
Scope subscope 
)
bool Scope::assignSubscope ( const VariablePath path,
const Ptr subscope 
)
Variable Scope::declare ( const Variant key,
const Variant initialValue = Variant() 
)

Declare a new variable to be handled and return it.

Returns an invalid variable if it cannot be declared

virtual bool Scope::doAssignSubscope ( const Variant key,
const Ptr subscope 
) [protected, virtual]

Implementation for assignSubscope.

Reimplemented in LocalScope.

virtual Variable Scope::doDeclare ( const Variant key,
const Variant initialValue 
) [protected, virtual]

Implementation for declare.

Reimplemented in CompositeScope, LocalScope, and ConstScope.

virtual Variable Scope::doGet ( const Variant key,
bool  modifiable 
) [protected, virtual]
virtual Ptr Scope::doGetScope ( const Variant key) [protected, virtual]

Implementation for getScope.

Reimplemented in CompositeScope, LocalScope, ObjectScope, and ConstScope.

virtual void Scope::doRemove ( const Variant key) [protected, virtual]

Implementation for remove.

Reimplemented in LocalScope.

Variable Scope::get ( const Variant key,
bool  modifiable = false 
)

Get a variable by its key.

Returns an invalid variable if the key isn't handled

Variable Scope::get ( const VariablePath path,
bool  modifiable = false 
)

Get a variable using a path describing the scopes indirection.

get({a, b, c}) is equivalent to getScope(a).getScope(b).get(c)

Ptr Scope::getScope ( const Variant key)

Get a reference to a subscope by its key.

Returns a null reference if the subscope isn't handled

Ptr Scope::getScope ( const VariablePath path)
virtual Variable Scope::getValue ( bool  modifiable) [virtual]

Get designated value for the scope.

Reimplemented in ObjectScope, AbstractTypeScope, and ConstScope.

void Scope::remove ( const Variant key)

Delete variable and/or subscope.

void Scope::remove ( const VariablePath path)

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