ClearSilver::ConstHDF Class Reference

Encapsulation of HDF dataset. More...

#include <ConstHDF.h>

Inheritance diagram for ClearSilver::ConstHDF:

ClearSilver::ConstHDFNode List of all members.

Public Types

typedef std::string Name
STL type definitions
typedef size_t size_type
typedef forward_iterator_tag iterator_category
typedef ConstHDF value_type
typedef ptrdiff_t difference_type
typedef ConstHDFpointer
typedef ConstHDF reference
typedef ConstHDF const_reference
typedef ConstHDF const_iterator

Public Member Functions

virtual ClearSilverNode node () const
 Access to the current node.
ClearSilverNode root () const
 Access to the root node.
void swap (ConstHDF &) throw ()
 Swap contents with another object.
bool is_iterator () const
 Is this an iterator?
bool is_dataset () const
 Is this a dataset?
bool is_reference () const
 Is this a node within a dataset?
Constructors and assignment operators
 ConstHDF ()
 Default constructor.
 ConstHDF (const char *path)
 Construct a dataset from a file.
 ConstHDF (const std::string &path)
 Construct a dataset from a file.
 ConstHDF (const RootNode &)
 Construct a dataset from a preexisting root node.
 ConstHDF (const HDF &)
 Construct from a non-const HDF dataset..
 ConstHDF (const ConstHDF &)
 Copy constructor.
 ~ConstHDF () throw ()
 Destructor.
ConstHDFoperator= (const ConstHDF &)
 Assignment operator for an entire dataset.
Inspectors
size_type depth () const
 Nesting depth of the current node within the HDF dataset.
std::string path () const
 Path to the current node.
Associative array interface
const_reference operator[] (const char *key) const
const_reference operator[] (const std::string &) const
STL iterator constructors
const_iterator begin () const
const_iterator end () const
const_iterator find (const char *key) const
const_iterator find (const std::string &key) const
Iterator methods
These methods provide the standard STL forward iteration interface.

const_iteratoroperator++ ()
const_iterator operator++ (int)
value_type operator * ()
 Dereference an iterator.
pointer operator-> ()
 Return a pointer to the current node.
STL inspectors
bool empty () const
Conversions
 operator bool () const
 Is this a valid node?
 operator std::string () const
 Convert to the value of the node.
Node accessors
std::string name () const
 Name of the node.
std::string value () const
 Value of the node.
HDF dataset operations
These functions directly encapsulate the corresponding functions from the ClearSilver C API. Note that the values stored internally to represent boolean values correspond to the constants returned by True() and False().

std::string get_value () const
std::string get_value (const char *key) const
std::string get_value (const std::string &key) const
std::string get_value (const char *key, const char *default_value) const
std::string get_value (const std::string &key, const std::string &default_value) const
void write_file (const char *filename) const
void write_file (const std::string &filename) const
void dump () const
void dump (const char *prefix) const
void dump (const std::string &prefix) const

Static Public Member Functions

static bool & debug ()
 Access the debug flag.
Boolean constants
These string values represent the boolean constants "true" and "false" within the dataset. This simplifies, for example, the comparison of node values expected to represent boolean values with a consistent set of contants.

static std::string Boolean (bool b)
static std::string True ()
static std::string False ()

Protected Member Functions

virtual Nodes::Nodes nodes () const
virtual Nodes::Nodes & nodes ()
virtual void push (const Name &, const ClearSilverNode &)
virtual void pop ()
virtual ClearSilverNode top () const
virtual void push (const Name &, const ClearSilverNode &)=0
void swap (ConstHDFNode &) throw ()
 Swap contents with another object.
Nodes find_node (const std::string &) const
 Construct the path to a node.
bool & is_iterator ()
 Access the iterator flag.

Friends

bool operator== (const reference &, const reference &)
 Equality comparison operator.

Classes

struct  forward_iterator_tag
struct  input_iterator_tag

Detailed Description

Encapsulation of HDF dataset.

This class is one of the two primary interfaces to a ClearSilver (http://www.clearsilver.net/) HDF dataset. Specifically, it encapsulates a constant dataset; the other primary interface, the HDF class, encapsulates a non-constant dataset. Members provide access to data within the HDF dataset via accessor functions, via an associative array interface, and via an STL iterator interface. The same class is used for all of these interfaces in order to achieve a recursive interface, regardless of the current level of nesting within the dataset.

Definition at line 72 of file ConstHDF.h.


Member Function Documentation

bool & ClearSilver::ConstHDF::debug  )  [static]
 

Access the debug flag.

If the debug flag is true, syslog(3) messages with priority LOG_DEBUG will be logged.

Reimplemented from ClearSilver::ConstHDFNode.

Definition at line 230 of file ConstHDF.cc.

bool & ClearSilver::ConstHDFNode::is_iterator  )  [protected, inherited]
 

Access the iterator flag.

The STL iterator constructors (e.g., begin() and end()) must set this flag appropriately in order for the assignment operator to differentiate between assigning the whole dataset in the case of an iterator or assigning the node value otherwise.

Definition at line 342 of file ConstHDFNode.cc.

Referenced by ClearSilver::HDF::begin(), begin(), ClearSilver::HDF::end(), end(), ClearSilver::HDF::operator *(), operator *(), and ClearSilver::HDF::operator=().

ClearSilver::ConstHDF::value_type ClearSilver::ConstHDF::operator *  ) 
 

Dereference an iterator.

This method interprets the current node as an iterator and dereferences it. Note that once dereferences, a node is no longer regarded as an iterator.

Definition at line 151 of file ConstHDF.cc.

References ClearSilver::ConstHDFNode::is_iterator().

ClearSilver::ConstHDF::pointer ClearSilver::ConstHDF::operator->  ) 
 

Return a pointer to the current node.

This method interprets the current node as an iterator and returns a pointer to it.

Definition at line 159 of file ConstHDF.cc.


The documentation for this class was generated from the following files:
Generated on Tue May 16 14:50:54 2006 for ClearSilver C++ Library by  doxygen 1.4.5