gpxlib
agpxlibrary
Public Member Functions | Protected Member Functions | List of all members
gpx::Node Class Reference

The base class. More...

#include <Node.h>

Inheritance diagram for gpx::Node:
gpx::Bounds gpx::Copyright gpx::DateTime gpx::Decimal gpx::DGPSStation gpx::EMail gpx::Fix gpx::GPX gpx::Link gpx::Metadata gpx::Person gpx::PT gpx::PTSeg gpx::RTE gpx::String gpx::TRK gpx::TRKSeg gpx::Unsigned gpx::WPT

Public Member Functions

 Node (Node *parent, const char *name, bool mandatory)
 
virtual ~Node ()
 
const std::string & name () const
 
virtual const std::string & value () const
 
bool mandatory () const
 
bool used () const
 
void used (bool value)
 
virtual void value (std::string value)
 
Nodeparent () const
 
std::list< Node * > & attributes ()
 
std::list< Node * > & elements ()
 
virtual NodebuildAttribute (const char *name, std::ostream *report=0)
 
virtual NodebuildElement (const char *name, std::ostream *report=0)
 
virtual Nodebuilt ()
 
virtual bool validate (std::ostream *report=0) const
 
virtual bool write (std::ostream &output, int level) const
 
void indent (std::ostream &output, int level) const
 

Protected Member Functions

void insert (const char *name, Node *node)
 
void filter (const char *name, std::list< Node * > &nodes)
 
bool isExtension ()
 

Detailed Description

The base class.

Constructor & Destructor Documentation

gpx::Node::Node ( Node parent,
const char *  name,
bool  mandatory 
)

Constructor

Parameters
parentthe parent node
namethe name of the attribute or element
mandatoryis the attribute or element mandatory ?
gpx::Node::~Node ( )
virtual

Deconstructor

Member Function Documentation

std::list<Node*>& gpx::Node::attributes ( )
inline

Get the attributes list

Returns
the parent node (or 0)
Node * gpx::Node::buildAttribute ( const char *  name,
std::ostream *  report = 0 
)
virtual

Build an attribute node

Parameters
namethe name of the attribute
reportthe optional report stream
Returns
the node (or 0 if not found)

Reimplemented in gpx::GPX.

Node * gpx::Node::buildElement ( const char *  name,
std::ostream *  report = 0 
)
virtual

Build an element node

Parameters
namethe name of the element
reportthe optional report stream
Returns
the node (or 0 if not found)

Reimplemented in gpx::WPT, gpx::Metadata, gpx::TRK, gpx::RTE, gpx::GPX, gpx::TRKSeg, and gpx::PTSeg.

virtual Node* gpx::Node::built ( )
inlinevirtual

Done building the node

Returns
the parent node (or 0 if not found)

Reimplemented in gpx::GPX.

std::list<Node*>& gpx::Node::elements ( )
inline

Get the elements list

Returns
the parent node (or 0)
void gpx::Node::filter ( const char *  name,
std::list< Node * > &  nodes 
)
protected

Filter the attributes and elements for a node name

Parameters
namethe name of the node
nodesthe destination list for the nodes
void gpx::Node::indent ( std::ostream &  output,
int  level 
) const

Indent the current output

Parameters
outputthe output stream
levelthe indent level
void gpx::Node::insert ( const char *  name,
Node node 
)
protected

Insert a repeating node

Parameters
namethe name of the node
nodethe node to be inserted
bool gpx::Node::isExtension ( )
protected

Check if this node or one of its parents is an extension node

Returns
is it ?
bool gpx::Node::mandatory ( ) const
inline

Is mandatory

Returns
is the attribute or element mandatory
const std::string& gpx::Node::name ( ) const
inline

Return the name

Returns
the name of the attribute or element
Node* gpx::Node::parent ( ) const
inline

Get the parent node of this node

Returns
the parent node (or 0)
bool gpx::Node::used ( ) const
inline

Is the node used ?

Returns
is it ?
void gpx::Node::used ( bool  value)
inline

Set the attribute or element used

Parameters
valueis it used ?
bool gpx::Node::validate ( std::ostream *  report = 0) const
virtual

Validate the object

Parameters
reportthe optional report stream
Returns
is validation succesfull

Reimplemented in gpx::Fix, gpx::Link, gpx::DateTime, gpx::Decimal, gpx::Degrees, gpx::DGPSStation, gpx::Longitude, gpx::String, gpx::Unsigned, gpx::URI, and gpx::Latitude.

virtual const std::string& gpx::Node::value ( ) const
inlinevirtual

Return the value

Returns
the value of the attribute or element
virtual void gpx::Node::value ( std::string  value)
inlinevirtual

Set the value

Parameters
valuethe value of the attribute or element

Reimplemented in gpx::GPX.

bool gpx::Node::write ( std::ostream &  output,
int  level 
) const
virtual

Write the gpx object to a stream

Parameters
outputthe output stream
levelthe indent level (or <0 for disabled)
Returns
is the writting succesfull

The documentation for this class was generated from the following files: