BALL  1.4.79
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | Protected Member Functions | Friends | List of all members
BALL::ResourceEntry Class Reference

#include <BALL/FORMAT/resourceFile.h>

Inheritance diagram for BALL::ResourceEntry:
BALL::AutoDeletable

Classes

class  IteratorTraits_
 

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 ()
 
 ResourceEntry (const ResourceEntry &entry, bool deep=true)
 
 ResourceEntry (const String &key, const String &value, ResourceEntry *parent=0)
 
virtual ~ResourceEntry ()
 
void clear ()
 
void destroy ()
 
Assignment
void set (const ResourceEntry &entry, bool deep=true)
 
const ResourceEntryoperator= (const ResourceEntry &entry)
 
void get (ResourceEntry &entry, bool deep=true) const
 
Miscellaneous
bool operator== (const ResourceEntry &entry) const
 
bool operator!= (const ResourceEntry &entry) const
 
ResourceEntrygetRoot ()
 
const ResourceEntrygetRoot () const
 
ResourceEntrygetParent ()
 
const ResourceEntrygetParent () const
 
ResourceEntrygetChild (Position index)
 
const ResourceEntrygetChild (Position index) const
 
ResourceEntrygetEntry (const String &key_path)
 
const ResourceEntrygetEntry (const String &key_path) const
 
const StringgetKey () const
 
void setValue (const String &value)
 
StringgetValue ()
 
const StringgetValue () const
 
String getPath () const
 
Size countChildren () const
 
Size countDescendants () const
 
Size getSize () const
 
Size getDepth () const
 
ResourceEntryinsertChild (const String &key, const String &value, bool replace_value=true)
 
ResourceEntryinsertSibling (const String &key, const String &value, bool replace_value=true)
 
ResourceEntryinsertChild (ResourceEntry &entry, bool replace_value=true)
 
ResourceEntryinsert (const String &key_path, const String &name)
 
bool mergeChildrenOf (ResourceEntry &entry, bool replace_value=true)
 
bool removeChild (const String &key, ResourceEntry **removed=0)
 
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)
 
- Public Member Functions inherited from BALL::AutoDeletable
virtual ~AutoDeletable ()
 
void * operator new (size_t size)
 
void operator delete (void *ptr)
 
void * operator new (size_t size, void *ptr)
 
void operator delete (void *ptr, void *)
 
bool isAutoDeletable () const
 
void setAutoDeletable (bool enable)
 

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)
 
- Protected Member Functions inherited from BALL::AutoDeletable
 AutoDeletable ()
 
 AutoDeletable (const AutoDeletable &auto_deletable, bool deep=false)
 

Friends

class IteratorTraits_
 

Additional Inherited Members

- Static Public Member Functions inherited from BALL::AutoDeletable
static void clearLastPtr ()
 

Detailed Description

Resource entry class

Definition at line 41 of file resourceFile.h.

Member Typedef Documentation

Definition at line 542 of file resourceFile.h.

Definition at line 541 of file resourceFile.h.

Definition at line 319 of file resourceFile.h.

Constructor & Destructor Documentation

BALL::ResourceEntry::ResourceEntry ( )

Default constructor

BALL::ResourceEntry::ResourceEntry ( const ResourceEntry entry,
bool  deep = true 
)

Copy constructor. Creates a new resource entry from another.

Parameters
entrythe ResourceEntry object to be copied
deepcreate a deep (true) or shallow (false) copy
BALL::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
keythe key of the new entry
valuethe value of the new entry
parentthe content of the new entry's parent pointer
virtual BALL::ResourceEntry::~ResourceEntry ( )
virtual

Member Function Documentation

bool BALL::ResourceEntry::apply ( UnaryProcessor< ResourceEntry > &  processor)
bool BALL::ResourceEntry::applyChildren ( UnaryProcessor< ResourceEntry > &  processor)
bool BALL::ResourceEntry::applyNostart_ ( UnaryProcessor< ResourceEntry > &  processor)
protected
Iterator BALL::ResourceEntry::begin ( )
inline

Definition at line 544 of file resourceFile.h.

ConstIterator BALL::ResourceEntry::begin ( ) const
inline

Definition at line 548 of file resourceFile.h.

void BALL::ResourceEntry::clear ( )
Size BALL::ResourceEntry::countChildren ( ) const

Return the number of child entries.

Size BALL::ResourceEntry::countDescendants ( ) const

Return the number of children which are not leaves.

virtual void BALL::ResourceEntry::deleteEntry ( ResourceEntry entry) const
protectedvirtual
virtual void BALL::ResourceEntry::deleteEntryArray ( ResourceEntry **  entry_array) const
protectedvirtual
void BALL::ResourceEntry::destroy ( )
void BALL::ResourceEntry::dump ( std::ostream &  s = std::cout,
Size  depth = 0 
) const
Iterator BALL::ResourceEntry::end ( )
inline

Definition at line 545 of file resourceFile.h.

ConstIterator BALL::ResourceEntry::end ( ) const
inline

Definition at line 549 of file resourceFile.h.

ResourceEntry* BALL::ResourceEntry::findChild ( const String key)
const ResourceEntry* BALL::ResourceEntry::findChild ( const String key) const
ResourceEntry* BALL::ResourceEntry::findDescendant ( const String key)
const ResourceEntry* BALL::ResourceEntry::findDescendant ( const String key) const
ResourceEntry* BALL::ResourceEntry::findEntry ( const String key)
const ResourceEntry* BALL::ResourceEntry::findEntry ( const String key) const
void BALL::ResourceEntry::get ( ResourceEntry entry,
bool  deep = true 
) const

Assign the contents of a resource enytry to another one.

Parameters
entrythe ResourceEntry object to be copied
deepcreate a deep (true) or shallow (false) copy
ResourceEntry* BALL::ResourceEntry::getChild ( Position  index)

Return a pointer to a child node.

Returns
0 if the child index does not exist
const ResourceEntry* BALL::ResourceEntry::getChild ( Position  index) const

Return a const pointer to a child node.

Returns
0 if the child index does not exist
Size BALL::ResourceEntry::getDepth ( ) const

Compute the depth of this entry within the tree.

ResourceEntry* BALL::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 ResourceEntry* BALL::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
const String& BALL::ResourceEntry::getKey ( ) const

Return the key of this ResourceEntry.

ResourceEntry* BALL::ResourceEntry::getParent ( )
const ResourceEntry* BALL::ResourceEntry::getParent ( ) const
String BALL::ResourceEntry::getPath ( ) const

Return the path of an entry.

ResourceEntry& BALL::ResourceEntry::getRoot ( )
const ResourceEntry& BALL::ResourceEntry::getRoot ( ) const
Size BALL::ResourceEntry::getSize ( ) const

????? What is the size of an entry? Why not use size()?

String& BALL::ResourceEntry::getValue ( )

Get a mutable reference to the value of this ResourceEntry.

const String& BALL::ResourceEntry::getValue ( ) const

Get a constant reference to the value of this ResourceEntry.

bool BALL::ResourceEntry::hasChild ( const String key) const
void BALL::ResourceEntry::host ( Visitor< ResourceEntry > &  visitor)
ResourceEntry* BALL::ResourceEntry::insert ( const String key_path,
const String name 
)

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

ResourceEntry* BALL::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* BALL::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* BALL::ResourceEntry::insertSibling ( const String key,
const String value,
bool  replace_value = true 
)

Insert a child into the tree below the parent entry.

bool BALL::ResourceEntry::isAncestorOf ( const ResourceEntry entry) const
bool BALL::ResourceEntry::isChildOf ( const ResourceEntry entry) const
bool BALL::ResourceEntry::isDescendantOf ( const ResourceEntry entry) const
bool BALL::ResourceEntry::isEmpty ( ) const
bool BALL::ResourceEntry::isParentOf ( const ResourceEntry entry) const
bool BALL::ResourceEntry::isRelatedWith ( const ResourceEntry entry) const
bool BALL::ResourceEntry::isRoot ( ) const
bool BALL::ResourceEntry::isValid ( ) const
bool BALL::ResourceEntry::mergeChildrenOf ( ResourceEntry entry,
bool  replace_value = true 
)

Merge the children of a resource entry.

virtual ResourceEntry* BALL::ResourceEntry::newEntry ( const String key,
const String value,
ResourceEntry parent = 0 
) const
protectedvirtual
virtual ResourceEntry** BALL::ResourceEntry::newEntryArray ( Size  size) const
protectedvirtual
bool BALL::ResourceEntry::operator!= ( const ResourceEntry entry) const

Inequality operator

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

Assignment operator.

Parameters
entrythe ResourceEntry object to be copied
bool BALL::ResourceEntry::operator== ( const ResourceEntry entry) const

Equality operator

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

Remove a child of a resource entry.

bool BALL::ResourceEntry::removeKey ( const String key_path)
void BALL::ResourceEntry::set ( const ResourceEntry entry,
bool  deep = true 
)

Assign a resource entry from another.

Parameters
entrythe ResourceEntry object to be copied
deepcreate a deep (true) or shallow (false) copy
void BALL::ResourceEntry::setValue ( const String value)

Set the value of this ResourceEntry.

Friends And Related Function Documentation

friend class IteratorTraits_
friend

Definition at line 539 of file resourceFile.h.