Main Page | Modules | Namespace List | Class Hierarchy | Class List | Namespace Members | Class Members

ResourceEntry Class Reference
[Support for hierarchical text data.]

Resource entry class. More...

#include <resourceFile.h>

Inheritance diagram for ResourceEntry:

AutoDeletable List of all members.

Public Types

typedef ResourceEntryIteratorPosition
typedef ForwardIterator< ResourceEntry,
ResourceEntry, ResourceEntry *,
IteratorTraits_ > 
Iterator
typedef ConstForwardIterator<
ResourceEntry, ResourceEntry,
ResourceEntry *, IteratorTraits_ > 
ConstIterator

Public Member Functions

Iterator begin ()
Iterator end ()
ConstIterator begin () const
ConstIterator end () const
Constructors and Destructors
 ResourceEntry ()
 Default constructor.
 ResourceEntry (const ResourceEntry &entry, bool deep=true)
 Copy constructor.
 ResourceEntry (const String &key, const String &value, ResourceEntry *parent=0)
 Create a new resource entry.
void clear ()
void destroy ()
Assignment
void set (const ResourceEntry &entry, bool deep=true)
 Assign a resource entry from another.
const ResourceEntryoperator= (const ResourceEntry &entry)
 Assignment operator.
void get (ResourceEntry &entry, bool deep=true) const
 Assign the contents of a resource enytry to another one.
Miscellaneous
bool operator== (const ResourceEntry &entry) const
 Equality operator.
bool operator!= (const ResourceEntry &entry) const
 Inequality operator.
ResourceEntrygetRoot ()
const ResourceEntrygetRoot () const
ResourceEntrygetParent ()
const ResourceEntrygetParent () const
ResourceEntrygetChild (Position index)
 Return a pointer to a child node.
const ResourceEntrygetChild (Position index) const
 Return a const pointer to a child node.
ResourceEntrygetEntry (const String &key_path)
 Return a pointer to an entry.
const ResourceEntrygetEntry (const String &key_path) const
 Return a const pointer to an entry Searches for an entry via its path.
const StringgetKey () const
 Return the key of this ResourceEntry.
void setValue (const String &value)
 Set the value of this ResourceEntry.
StringgetValue ()
 Get a mutable reference to the value of this ResourceEntry.
const StringgetValue () const
 Get a constant reference to the value of this ResourceEntry.
String getPath () const
 Return the path of an entry.
Size countChildren () const
 Return the number of child entries.
Size countDescendants () const
 Return the number of children which are not leaves.
Size getSize () const
 ????? What is the size of an entry? Why not use size()?
Size getDepth () const
 Compute the depth of this entry within the tree.
ResourceEntryinsertChild (const String &key, const String &value, bool replace_value=true)
 Insert a child into the tree below this entry, if the key has not been used yet.
ResourceEntryinsertSibling (const String &key, const String &value, bool replace_value=true)
 Insert a child into the tree below the parent entry.
ResourceEntryinsertChild (ResourceEntry &entry, bool replace_value=true)
 Insert a child into the tree below this entry, if the key has not been used yet.
ResourceEntryinsert (const String &key_path, const String &name)
 Insert a resource entry at the appropriate place in the tree.
bool mergeChildrenOf (ResourceEntry &entry, bool replace_value=true)
 Merge the children of a resource entry.
bool removeChild (const String &key, ResourceEntry **removed=0)
 Remove a child of a resource entry.
bool removeKey (const String &key_path)
ResourceEntryfindChild (const String &key)
const ResourceEntryfindChild (const String &key) const
ResourceEntryfindDescendant (const String &key)
const ResourceEntryfindDescendant (const String &key) const
ResourceEntryfindEntry (const String &key)
const ResourceEntryfindEntry (const String &key) const
Attributes
bool hasChild (const String &key) const
bool isEmpty () const
bool isParentOf (const ResourceEntry &entry) const
bool isChildOf (const ResourceEntry &entry) const
bool isAncestorOf (const ResourceEntry &entry) const
bool isDescendantOf (const ResourceEntry &entry) const
bool isRelatedWith (const ResourceEntry &entry) const
bool isRoot () const
Debugging and Diagnostics
bool isValid () const
void dump (std::ostream &s=std::cout, Size depth=0) const
Processor and Visitor related methods
void host (Visitor< ResourceEntry > &visitor)
bool apply (UnaryProcessor< ResourceEntry > &processor)
bool applyChildren (UnaryProcessor< ResourceEntry > &processor)

Protected Member Functions

virtual ResourceEntrynewEntry (const String &key, const String &value, ResourceEntry *parent=0) const
virtual ResourceEntry ** newEntryArray (Size size) const
virtual void deleteEntry (ResourceEntry *entry) const
virtual void deleteEntryArray (ResourceEntry **entry_array) const
bool applyNostart_ (UnaryProcessor< ResourceEntry > &processor)

Friends

class IteratorTraits_

Detailed Description

Resource entry class.


Constructor & Destructor Documentation

ResourceEntry::ResourceEntry const ResourceEntry entry,
bool  deep = true
 

Copy constructor.

Creates a new resource entry from another.

Parameters:
entry the ResourceEntry object to be copied
deep create a deep (true) or shallow (false) copy

ResourceEntry::ResourceEntry const String key,
const String value,
ResourceEntry parent = 0
 

Create a new resource entry.

An entry with key and value is created. If parent is given, the new entries parent pointer is set to this value. Take care: the parents child array is not updated - so use this option only if you really know what you are doing. To keep this data consistent, use insertChild .

Parameters:
key the key of the new entry
value the value of the new entry
parent the content of the new entry's parent pointer


Member Function Documentation

Size ResourceEntry::countChildren  )  const
 

Return the number of child entries.

Size ResourceEntry::countDescendants  )  const
 

Return the number of children which are not leaves.

void ResourceEntry::get ResourceEntry entry,
bool  deep = true
const
 

Assign the contents of a resource enytry to another one.

Parameters:
entry the ResourceEntry object to be copied
deep create a deep (true) or shallow (false) copy

const ResourceEntry* ResourceEntry::getChild Position  index  )  const
 

Return a const pointer to a child node.

Returns:
0 if the child index does not exist

ResourceEntry* ResourceEntry::getChild Position  index  ) 
 

Return a pointer to a child node.

Returns:
0 if the child index does not exist

Size ResourceEntry::getDepth  )  const
 

Compute the depth of this entry within the tree.

const ResourceEntry* ResourceEntry::getEntry const String key_path  )  const
 

Return a const pointer to an entry Searches for an entry via its path.

Returns:
0 if the specified path does not exist

ResourceEntry* ResourceEntry::getEntry const String key_path  ) 
 

Return a pointer to an entry.

Searches for an entry via its path.

Returns:
0 if the specified path does not exist

const String& ResourceEntry::getKey  )  const
 

Return the key of this ResourceEntry.

String ResourceEntry::getPath  )  const
 

Return the path of an entry.

const String& ResourceEntry::getValue  )  const
 

Get a constant reference to the value of this ResourceEntry.

String& ResourceEntry::getValue  ) 
 

Get a mutable reference to the value of this ResourceEntry.

ResourceEntry* ResourceEntry::insert const String key_path,
const String name
 

Insert a resource entry at the appropriate place in the tree.

ResourceEntry* ResourceEntry::insertChild ResourceEntry entry,
bool  replace_value = true
 

Insert a child into the tree below this entry, if the key has not been used yet.

ResourceEntry* ResourceEntry::insertChild const String key,
const String value,
bool  replace_value = true
 

Insert a child into the tree below this entry, if the key has not been used yet.

ResourceEntry* ResourceEntry::insertSibling const String key,
const String value,
bool  replace_value = true
 

Insert a child into the tree below the parent entry.

bool ResourceEntry::mergeChildrenOf ResourceEntry entry,
bool  replace_value = true
 

Merge the children of a resource entry.

const ResourceEntry& ResourceEntry::operator= const ResourceEntry entry  ) 
 

Assignment operator.

Parameters:
entry the ResourceEntry object to be copied

bool ResourceEntry::removeChild const String key,
ResourceEntry **  removed = 0
 

Remove a child of a resource entry.

void ResourceEntry::set const ResourceEntry entry,
bool  deep = true
 

Assign a resource entry from another.

Parameters:
entry the ResourceEntry object to be copied
deep create a deep (true) or shallow (false) copy

void ResourceEntry::setValue const String value  ) 
 

Set the value of this ResourceEntry.