Follow this link to skip to the main content

claraty::Parse_Tree_Data Class Reference

#include <parse_tree.h>

Collaboration diagram for claraty::Parse_Tree_Data:

Collaboration graph
[legend]
List of all members.

Protected Types

enum  Nodetype { PT_ATOM, PT_ARRAY, PT_MAP, PT_NULL }

Protected Member Functions

 Parse_Tree_Data ()
 Parse_Tree_Data (const Parse_Tree_Data &rhs, bool dummy_deep_copy)
void ref ()
void unref ()
void set_nodetype (Nodetype nodetype)

Protected Attributes

int _refcount
Nodetype _nodetype
std::vector< Parse_Tree_array
std::map< std::string, Parse_Tree_map
std::vector< std::string > _map_fields
std::string _atom

Friends

class Parse_Tree

Detailed Description

Definition at line 40 of file parse_tree.h.


Member Enumeration Documentation

Enumerator:
PT_ATOM 
PT_ARRAY 
PT_MAP 
PT_NULL 

Definition at line 44 of file parse_tree.h.

00044                 {
00045     PT_ATOM,
00046     PT_ARRAY,
00047     PT_MAP,
00048     PT_NULL
00049   };


Constructor & Destructor Documentation

claraty::Parse_Tree_Data::Parse_Tree_Data (  )  [protected]

Definition at line 33 of file parse_tree.cc.

00033                                  :
00034   _refcount(1), _nodetype(PT_NULL), _array(), _map(), _atom()
00035 {
00036 }

claraty::Parse_Tree_Data::Parse_Tree_Data ( const Parse_Tree_Data rhs,
bool  dummy_deep_copy 
) [protected]

Definition at line 38 of file parse_tree.cc.

References _array, _map, _nodetype, Parse_Tree, PT_ARRAY, and PT_MAP.

00039   : _refcount(1), _nodetype(rhs._nodetype), _array(rhs._array.size()), _map(),
00040     _map_fields(rhs._map_fields), _atom(rhs._atom)
00041 {
00042   if (_nodetype == PT_ARRAY)
00043     for (size_t i = 0; i < _array.size(); i++)
00044       _array[i] = Parse_Tree(rhs._array[i], true);
00045   else if (_nodetype == PT_MAP) {
00046     for (map<string, Parse_Tree>::const_iterator it = rhs._map.begin();
00047          it != rhs._map.end(); ++it)
00048       _map[it->first] = Parse_Tree(it->second, true);
00049   }
00050 }


Member Function Documentation

void claraty::Parse_Tree_Data::ref (  )  [protected]

Definition at line 53 of file parse_tree.cc.

References _refcount.

Referenced by claraty::Parse_Tree::operator=(), and claraty::Parse_Tree::Parse_Tree().

00054 {
00055   _refcount++;
00056 }

void claraty::Parse_Tree_Data::unref (  )  [protected]

Definition at line 58 of file parse_tree.cc.

References _refcount.

Referenced by claraty::Parse_Tree::operator=(), and claraty::Parse_Tree::~Parse_Tree().

00059 {
00060   _refcount--;
00061   if (!_refcount) delete this;
00062 }

void claraty::Parse_Tree_Data::set_nodetype ( Nodetype  nodetype  )  [protected]

Definition at line 64 of file parse_tree.cc.

References _array, _atom, _map, _map_fields, _nodetype, PT_ARRAY, PT_ATOM, and PT_MAP.

00065 {
00066   if (_nodetype == nodetype) return;
00067   if (_nodetype != PT_MAP)   { _map.clear(); _map_fields.clear(); }
00068   if (_nodetype != PT_ARRAY) { _array.clear(); }
00069   if (_nodetype != PT_ATOM)  { _atom=""; }
00070   _nodetype= nodetype;
00071 }


Friends And Related Function Documentation

friend class Parse_Tree [friend]

Definition at line 41 of file parse_tree.h.

Referenced by Parse_Tree_Data().


Member Data Documentation

Definition at line 59 of file parse_tree.h.

Referenced by ref(), and unref().

std::vector<Parse_Tree> claraty::Parse_Tree_Data::_array [protected]

Definition at line 61 of file parse_tree.h.

Referenced by Parse_Tree_Data(), set_nodetype(), and claraty::Parse_Tree::size().

std::vector<std::string> claraty::Parse_Tree_Data::_map_fields [protected]

Definition at line 63 of file parse_tree.h.

Referenced by claraty::Parse_Tree::pretty_print_map(), and set_nodetype().


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