BALL::ResourceFile Class Reference
[Support for hierarchical text data.]

#include <BALL/FORMAT/resourceFile.h>

Inheritance diagram for BALL::ResourceFile:
Inheritance graph
[legend]

List of all members.

Public Types

typedef Entry::Iterator Iterator
typedef Entry::ConstIterator ConstIterator
Type Definition

typedef ResourceEntry Entry

Public Member Functions

Iterator begin ()
Iterator end ()
ConstIterator begin () const
ConstIterator end () const
Constructors and Destructors

 ResourceFile ()
 ResourceFile (const String &name) throw (Exception::FileNotFound)
virtual ~ResourceFile ()
void destroy ()
virtual void clear ()
Accessors

Size getSize () const
EntrygetRoot ()
const EntrygetRoot () const
EntrygetEntry (const String &key_path)
const EntrygetEntry (const String &key_path) const
StringgetValue (const String &key_path)
const StringgetValue (const String &key_path) const
Entryinsert (const String &key_path, const String &name)
bool removeKey (const String &key_path)
Attributes

bool operator== (const ResourceFile &entry) const
bool operator!= (const ResourceFile &entry) const
bool hasKey (const String &key_path) const
bool isEmpty () const
Debugging and Diagnostics

bool isValid () const
void dump (std::ostream &s=std::cout, Size depth=0) const

Static Public Attributes

Constants

static char ENTRY_BEGIN
static char ENTRY_END
static char SEPARATOR

Private Member Functions

const ResourceFileoperator= (const ResourceFile &file)
bool validateSyntax_ ()
void skipWhitespaces_ ()

Static Private Member Functions

static void save_ (File &file, const Entry *entry, Size &depth)

Private Attributes

Entry root_

Friends

Storers

std::istream & operator>> (std::istream &s, ResourceFile &resource_file)

File-related methods.



bool open (const String &name)
void close ()
void saveAs (const String &name)
void save (const Entry &entry)
void save ()
static void saveAs (const Entry &entry, const String &name)

Processor and Visitor related methods



void host (Visitor< ResourceFile > &visitor)
bool apply (UnaryProcessor< Entry > &processor)
static bool applyChildren (Entry &entry, UnaryProcessor< Entry > &processor)

Detailed Description

Resource file class

Definition at line 581 of file resourceFile.h.


Member Typedef Documentation

Definition at line 786 of file resourceFile.h.

Definition at line 609 of file resourceFile.h.

Definition at line 773 of file resourceFile.h.


Constructor & Destructor Documentation

BALL::ResourceFile::ResourceFile (  ) 

Default constructor

BALL::ResourceFile::ResourceFile ( const String name  )  throw (Exception::FileNotFound)

Detailed constructor.

virtual BALL::ResourceFile::~ResourceFile (  )  [virtual]

Destructor


Member Function Documentation

bool BALL::ResourceFile::apply ( UnaryProcessor< Entry > &  processor  ) 
static bool BALL::ResourceFile::applyChildren ( Entry entry,
UnaryProcessor< Entry > &  processor 
) [static]
ConstIterator BALL::ResourceFile::begin (  )  const [inline]

Definition at line 788 of file resourceFile.h.

Iterator BALL::ResourceFile::begin (  )  [inline]

Definition at line 775 of file resourceFile.h.

virtual void BALL::ResourceFile::clear (  )  [virtual]

Clear method

Reimplemented from BALL::File.

void BALL::ResourceFile::close (  ) 

Close the file.

Reimplemented from BALL::File.

void BALL::ResourceFile::destroy (  ) 

Destroy method

void BALL::ResourceFile::dump ( std::ostream &  s = std::cout,
Size  depth = 0 
) const
ConstIterator BALL::ResourceFile::end (  )  const [inline]

Definition at line 793 of file resourceFile.h.

Iterator BALL::ResourceFile::end (  )  [inline]

Definition at line 780 of file resourceFile.h.

const Entry* BALL::ResourceFile::getEntry ( const String key_path  )  const
Entry* BALL::ResourceFile::getEntry ( const String key_path  ) 
const Entry& BALL::ResourceFile::getRoot (  )  const
Entry& BALL::ResourceFile::getRoot (  ) 
Size BALL::ResourceFile::getSize (  )  const
const String* BALL::ResourceFile::getValue ( const String key_path  )  const
String* BALL::ResourceFile::getValue ( const String key_path  ) 
bool BALL::ResourceFile::hasKey ( const String key_path  )  const
void BALL::ResourceFile::host ( Visitor< ResourceFile > &  visitor  ) 
Entry* BALL::ResourceFile::insert ( const String key_path,
const String name 
)
bool BALL::ResourceFile::isEmpty (  )  const
bool BALL::ResourceFile::isValid (  )  const

Test if the file is valid. If the filename was not set, false is returned. This function uses std::fstream::good().

Returns:
bool true if the file is valid

Reimplemented from BALL::File.

bool BALL::ResourceFile::open ( const String name  ) 
bool BALL::ResourceFile::operator!= ( const ResourceFile entry  )  const

Inequality operator

const ResourceFile& BALL::ResourceFile::operator= ( const ResourceFile file  )  [private]
bool BALL::ResourceFile::operator== ( const ResourceFile entry  )  const

Equality operator

bool BALL::ResourceFile::removeKey ( const String key_path  ) 
void BALL::ResourceFile::save (  ) 
void BALL::ResourceFile::save ( const Entry entry  ) 
static void BALL::ResourceFile::save_ ( File file,
const Entry entry,
Size depth 
) [static, private]
void BALL::ResourceFile::saveAs ( const String name  ) 
static void BALL::ResourceFile::saveAs ( const Entry entry,
const String name 
) [static]
void BALL::ResourceFile::skipWhitespaces_ (  )  [private]
bool BALL::ResourceFile::validateSyntax_ (  )  [private]

Friends And Related Function Documentation

std::istream& operator>> ( std::istream &  s,
ResourceFile resource_file 
) [friend]

Member Data Documentation

Definition at line 592 of file resourceFile.h.

Definition at line 596 of file resourceFile.h.

Definition at line 809 of file resourceFile.h.

Definition at line 600 of file resourceFile.h.

Generated by  doxygen 1.6.3