Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

skTreeNodeObject Class Reference

This class gives an skExecutable wrapper to an skTreeNode object The class implements methods from the Executable interface. More...

#include <skTreeNodeObject.h>

Inheritance diagram for skTreeNodeObject:

skExecutable skScriptedExecutable List of all members.

Public Methods

 skTreeNodeObject ()
 Default Constructor.

 skTreeNodeObject (const skString& location,skTreeNode * node,bool created)
 Constructor providing a treenode. More...

 ~skTreeNodeObject ()
 Destructor - will delete the associated node if the created flag is set.

int executableType () const
 returns the value TREENODE_TYPE to identify this as a TreeNodeObject.

int intValue () const
 Returns the data field of the node as an integer.

float floatValue () const
 Returns the data field of the node as a float.

bool boolValue () const
 Returns the data field of the node as a boolean.

char charValue () const
 Returns the first character of the data field of the node.

skString strValue () const
 Returns the data field of the node as a string.

bool setValue (const skString& name,const skString& attribute,const skRValue& value)
 Sets a value within the node. More...

bool setValueAt (const skRValue& array_index,const skString& attribute,const skRValue& value)
 Sets a value within the nth node of the tree node. More...

bool getValue (const skString& name,const skString& attribute,skRValue& v)
 Retrieves a value from within the node. More...

bool getValueAt (const skRValue& array_index,const skString& attribute,skRValue& value)
 Retrieves the nth value from within the node. More...

bool method (const skString& name,skRValueArray& args,skRValue& ret)
 This function attempts to call a method defined within the TreeNode. More...

skTreeNodegetNode ()
 This function returns the treenode wrapped by this object.

void setNode (skTreeNode * node)
 This function changes the node associated with this object.

skString getLocation () const
 This function returns the location associated with this object (typically a file name).


Protected Attributes

skString m_Location
 the location the node came from.


Detailed Description

This class gives an skExecutable wrapper to an skTreeNode object The class implements methods from the Executable interface.

The methods getValue, setValue and method all search for matching child labels within the TreeNode document. Only the first matching label is used.

The class supports the following fields:


Constructor & Destructor Documentation

skTreeNodeObject::skTreeNodeObject ( const skString & location,
skTreeNode * node,
bool created )
 

Constructor providing a treenode.

Parameters:
location   - the location of this treenode (e.g. file or database), this is used in error messages
node   - the node itself
created   - set this to true to allow the TreeNodeObject to delete the node when it is deleted


Member Function Documentation

bool skTreeNodeObject::getValue ( const skString & name,
const skString & attribute,
skRValue & v ) [virtual]
 

Retrieves a value from within the node.

The field name is matched to a child of the treenode with the same label. If a match is found, a new TreeNodeObject encapsulating the child is returned.

Reimplemented from skExecutable.

bool skTreeNodeObject::getValueAt ( const skRValue & array_index,
const skString & attribute,
skRValue & value ) [virtual]
 

Retrieves the nth value from within the node.

If the array index falls within the range of the number of children of this node, a new TreeNodeObject encapsulating the child is returned.

Reimplemented from skExecutable.

bool skTreeNodeObject::method ( const skString & s,
skRValueArray & args,
skRValue & ret ) [virtual]
 

This function attempts to call a method defined within the TreeNode.

It searches for a child whose label matches the method name, and tries to execute its data as a Simkin script

Parameters:
name   - the name of the method
args   - the arguments to pass to the method
ret   - the RValue to receive the results of the method call
Returns:
true if the method was found, otherwise false

Reimplemented from skExecutable.

bool skTreeNodeObject::setValue ( const skString & name,
const skString & attribute,
const skRValue & value ) [virtual]
 

Sets a value within the node.

The field name is matched to a child of the treenode with the same label. If a match is found, the child's data is changed.

Parameters:
name   - the name of the field
attribute   - the attribute name is ignored
value   - the value to be assigned to the child. If this is a TREENODE_TYPE object, the full treenode is copied

Reimplemented from skExecutable.

bool skTreeNodeObject::setValueAt ( const skRValue & array_index,
const skString & attribute,
const skRValue & value ) [virtual]
 

Sets a value within the nth node of the tree node.

Parameters:
array_index   - the identifier of the item - this might be a string, integer or any other legal value
attribute   - the attribute name to set (may be blank)
value   - the value to be set
Returns:
true if the field was changed, false if the field could not be set or found

Reimplemented from skExecutable.


The documentation for this class was generated from the following files:
Generated at Wed May 9 11:32:22 2001 for Simkin by doxygen1.2.1 written by Dimitri van Heesch, © 1997-2000