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 skiExecutable List of all members.

Public Member Functions

IMPORT_C skTreeNodeObject ()
 Default Constructor.

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

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

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

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

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

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

virtual IMPORT_C Char charValue () const
 Returns the first character of the data field of the node.

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

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

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

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

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

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

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

IMPORT_C void setNode (const skString &location, skTreeNode *node, bool created)
 This function changes the node associated with this object.

IMPORT_C void setNode (const TDesC &location, skTreeNode *node, bool created)
 This function changes the node associated with this object.

virtual IMPORT_C bool equals (const skiExecutable *o) const
 This function tests if this object is equal to the other object.

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

virtual IMPORT_C skExecutableIteratorcreateIterator (const skString &qualifier)
 This function returns an skExecutableIterator object which is used in the for each statement.

virtual IMPORT_C skExecutableIteratorcreateIterator ()
 This function returns an skExecutableIterator object which is used in the for each statement.

virtual IMPORT_C skString getSource (const skString &location)
 Returns the source code for the given method.

virtual IMPORT_C void getInstanceVariables (skRValueTable &table)
 This method returns the instance variables for this object.

IMPORT_C void setAddIfNotPresent (bool enable)
 sets the flag controlling whether new nodes are created as they are accessed

IMPORT_C bool getAddIfNotPresent ()
 this returns the value of the flag controlling whether new nodes are created as they are accessed


Protected Member Functions

virtual IMPORT_C skTreeNodeObject * createTreeNodeObject (const skString &location, skTreeNode *node, bool created)
 This method creates a new TreeNode object to wrap a node.


Protected Attributes

skString m_Location
 the location the node came from


Friends

class skTreeNodeObjectEnumerator

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

IMPORT_C 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

virtual IMPORT_C skExecutableIterator* skTreeNodeObject::createIterator  )  [virtual]
 

This function returns an skExecutableIterator object which is used in the for each statement.

It will iterate over *all* children of this node

Exceptions:
a Symbian - a leaving function

Reimplemented from skExecutable.

virtual IMPORT_C skExecutableIterator* skTreeNodeObject::createIterator const skString qualifier  )  [virtual]
 

This function returns an skExecutableIterator object which is used in the for each statement.

It will iterate over nodes with the given node label.

Parameters:
qualifier node label - only nodes with this label will appear in the iteration
Exceptions:
a Symbian - a leaving function

Reimplemented from skExecutable.

virtual IMPORT_C skTreeNodeObject* skTreeNodeObject::createTreeNodeObject const skString location,
skTreeNode node,
bool  created
[protected, virtual]
 

This method creates a new TreeNode object to wrap a node.

Override this for special behaviour in derived classes. In this method, the newly created object inherits this object's m_AddIfNotPresent flag

Parameters:
location the location of this element
node the TreeNode to associate with the object
created indicates if the node should be deleted in the new objects' destructor. Set to true if this should happen.
Exceptions:
a Symbian - a leaving function

virtual IMPORT_C bool skTreeNodeObject::equals const skiExecutable o  )  const [virtual]
 

This function tests if this object is equal to the other object.

It does this by checking the string values are equal

Reimplemented from skExecutable.

IMPORT_C bool skTreeNodeObject::getAddIfNotPresent  ) 
 

this returns the value of the flag controlling whether new nodes are created as they are accessed

Returns:
true if the feature is enabled, otherwise false (the default)

virtual IMPORT_C void skTreeNodeObject::getInstanceVariables skRValueTable table  )  [virtual]
 

This method returns the instance variables for this object.

Parameters:
table a table to filled with references to the instance variables
Exceptions:
a Symbian - a leaving function

Reimplemented from skExecutable.

virtual IMPORT_C skString skTreeNodeObject::getSource const skString location  )  [virtual]
 

Returns the source code for the given method.

Exceptions:
a Symbian - a leaving function

Reimplemented from skExecutable.

virtual IMPORT_C 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. If the m_AddIfNotPresent flag is true, a new item will be added if one is not already present

Exceptions:
a Symbian - a leaving function

Reimplemented from skExecutable.

virtual IMPORT_C 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. If the m_AddIfNotPresent flag is true, a new item will be added if one is not already present.

Exceptions:
a Symbian - a leaving function

Reimplemented from skExecutable.

virtual IMPORT_C bool skTreeNodeObject::method const skString name,
skRValueArray args,
skRValue ret,
skExecutableContext ctxt
[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
ctxt context object to receive errors
Returns:
true if the method was found, otherwise false
Exceptions:
a Symbian - a leaving function
skParseException - if a syntax error is encountered while the script is running
skRuntimeException - if an error occurs while the script is running

Reimplemented from skExecutable.

IMPORT_C void skTreeNodeObject::setAddIfNotPresent bool  enable  ) 
 

sets the flag controlling whether new nodes are created as they are accessed

Parameters:
enable enables this feature (which by default is disabled)

IMPORT_C void skTreeNodeObject::setNode const TDesC &  location,
skTreeNode node,
bool  created
 

This function changes the node associated with this object.

Remarks:
only available in Symbian version
Exceptions:
a Symbian - a leaving function

virtual IMPORT_C 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. If the m_AddIfNotPresent flag is true, a new item will be added if one is not already present

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
Exceptions:
a Symbian - a leaving function

Reimplemented from skExecutable.

virtual IMPORT_C 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.

If the m_AddIfNotPresent flag is true, a new item will be added if one is not already present.

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
Exceptions:
a Symbian - a leaving function

Reimplemented from skExecutable.


The documentation for this class was generated from the following file:
Generated on Fri Dec 17 20:28:28 2004 for Simkin C++ for Symbian by doxygen1.3