summaryrefslogtreecommitdiff
path: root/ACEXML/parser/debug_validator/Element_Tree.cpp
blob: e9275061b52449f601d6b0a4f561976fb57ebb1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// $Id$

#include "ACEXML/parser/debug_validator/Element_Tree.h"

#if !defined (__ACEXML_INLINE__)
# include "ACEXML/parser/debug_validator/Element_Tree.i"
#endif /* __ACEXML_INLINE__ */

ACEXML_Element_Tree_Node::~ACEXML_Element_Tree_Node ()
{
  delete this->next_;
}

ACE_ALLOC_HOOK_DEFINE (ACEXML_Element_Tree_Node)

void
ACEXML_Element_Tree_Name_Node::dump ()
{
  cout << this->name_;
}

ACE_ALLOC_HOOK_DEFINE (ACEXML_Element_Tree_Name_Node)

ACEXML_Element_Tree_List_Node::~ACEXML_Element_Tree_List_Node (void)
{
  delete this->head_;
}

int
ACEXML_Element_Tree_List_Node::insert (ACEXML_Element_Tree_Node *node)
{
  if (this->head_ == 0)
    {
      this->tail_ = this->head_ = node;
    }
  else
    {
      this->tail_->next (node);
      this->tail_ = node;
    }
  return 0;
}

void
ACEXML_Element_Tree_List_Node::dump (void)
{
  ACEXML_Element_Tree_Node *ptr = this->head_;
  const ACEXML_Char *separator = (this->type_ == SEQUENCE) ? ACE_TEXT(" , ") : ACE_TEXT(" | ");

  cout << "(";

  if (ptr != 0)
    {
      ptr->dump ();
      ptr = ptr->next ();

      while (ptr != 0)
        {
          cout << separator;
          ptr->dump ();
          ptr->next ();
        }
    }

  cout << ")";
}

ACE_ALLOC_HOOK_DEFINE (ACEXML_Element_Tree_List_Node)



ACE_ALLOC_HOOK_DEFINE (ACEXML_Element_Tree_List_Stack)