ACEXML_Debug_Element_Builder Class Reference

#include <parser/debug_validator/Debug_Element_Builder.h>

Inheritance diagram for ACEXML_Debug_Element_Builder:

Inheritance graph
[legend]
Collaboration diagram for ACEXML_Debug_Element_Builder:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ACEXML_Debug_Element_Builder ()
virtual ~ACEXML_Debug_Element_Builder ()
virtual int setElementName (const ACEXML_Char *namespaceURI, const ACEXML_Char *localName, const ACEXML_Char *qName ACEXML_ENV_ARG_DECL) ACE_THROW_SPEC((ACEXML_SAXException))
virtual int setContentType (CONTENT_TYPE type ACEXML_ENV_ARG_DECL) ACE_THROW_SPEC((ACEXML_SAXException))
virtual int insertMixedElement (const ACEXML_Char *namespaceURI, const ACEXML_Char *localName, const ACEXML_Char *qName ACEXML_ENV_ARG_DECL) ACE_THROW_SPEC((ACEXML_SAXException))
virtual int startChildGroup ()
virtual int endChildGroup (CARDINALITY card ACEXML_ENV_ARG_DECL)
virtual int setChoice ()
virtual int setSequence ()
virtual int insertElement (const ACEXML_Char *namespaceURI, const ACEXML_Char *localName, const ACEXML_Char *qName ACEXML_ENV_ARG_DECL) ACE_THROW_SPEC((ACEXML_SAXException))
virtual void dump (void)

Private Attributes

CONTENT_TYPE type_
ACEXML_String element_
ACEXML_Element_Tree_List_Noderoot_
ACEXML_Element_Tree_List_Stack active_list_

Detailed Description

This class prints out the element definition for debugging purpose.

Todo:
This class is not namespace-aware.

Definition at line 32 of file Debug_Element_Builder.h.


Constructor & Destructor Documentation

ACEXML_Debug_Element_Builder::ACEXML_Debug_Element_Builder  ) 
 

Definition at line 6 of file Debug_Element_Builder.cpp.

00007   : type_ (UNDEFINED),
00008     root_ (0)
00009 {
00010 }

ACEXML_Debug_Element_Builder::~ACEXML_Debug_Element_Builder  )  [virtual]
 

Definition at line 12 of file Debug_Element_Builder.cpp.

00013 {
00014   delete this->root_;
00015 }


Member Function Documentation

void ACEXML_Debug_Element_Builder::dump void   )  [virtual]
 

Dump the content of the attribute definition.

Implements ACEXML_Element_Def_Builder.

Definition at line 124 of file Debug_Element_Builder.cpp.

References element_.

00125 {
00126   cout << "<!ELEMENT " << this->element_;
00127 
00128   // @@ Also dump element contentspec here.
00129   switch (this->type_)
00130     {
00131     case EMPTY:
00132       cout << "EMPTY";
00133       break;
00134     case ANY:
00135       cout << "ANY";
00136       break;
00137     case MIXED:
00138     case CHILDREN:
00139       // @@ Dump the content of this->root_
00140       cout << "*** not implemented ***";
00141       break;
00142     default:
00143       cout << "*** Unidentified element type ***";
00144       break;
00145     }
00146 
00147   cout << ">" << endl;
00148 }

virtual int ACEXML_Debug_Element_Builder::endChildGroup CARDINALITY card  ACEXML_ENV_ARG_DECL  )  [virtual]
 

End a new group of children.

Return values:
0 on success.

Implements ACEXML_Element_Def_Builder.

int ACEXML_Debug_Element_Builder::insertElement const ACEXML_Char namespaceURI,
const ACEXML_Char localName,
const ACEXML_Char *qName  ACEXML_ENV_ARG_DECL
[virtual]
 

Insert an new element into the current child group.

Return values:
0 on success, -1 otherwise.

Implements ACEXML_Element_Def_Builder.

Definition at line 108 of file Debug_Element_Builder.cpp.

References ACE_NEW_RETURN, and ACEXML_Char.

00112 {
00113   ACEXML_Element_Tree_Name_Node *node;
00114 
00115   // @@ We should "throw" an exception here instead of returning -1.
00116   ACE_NEW_RETURN (node,
00117                   ACEXML_Element_Tree_Name_Node (qName),
00118                   -1);
00119 
00120   return this->active_list_.top ()->insert (node);
00121 }

int ACEXML_Debug_Element_Builder::insertMixedElement const ACEXML_Char namespaceURI,
const ACEXML_Char localName,
const ACEXML_Char *qName  ACEXML_ENV_ARG_DECL
[virtual]
 

Insert one more element into Mixed definition.

Implements ACEXML_Element_Def_Builder.

Definition at line 41 of file Debug_Element_Builder.cpp.

References ACE_NEW_RETURN, and ACEXML_Char.

00045 {
00046   ACEXML_Element_Tree_Name_Node *node;
00047 
00048   // @@ We should "throw" an exception here instead of returning -1.
00049   ACE_NEW_RETURN (node,
00050                   ACEXML_Element_Tree_Name_Node (qName),
00051                   -1);
00052 
00053   if (this->root_ == 0)
00054     // @@ Memory leak if fail?
00055     ACE_NEW_RETURN (this->root_,
00056                     ACEXML_Element_Tree_List_Node (),
00057                     -1);
00058 
00059 
00060   return this->root_->insert (node);
00061 }

int ACEXML_Debug_Element_Builder::setChoice  )  [virtual]
 

Set the type of current child group to Choice.

Return values:
0 on success, -1 if the type of the child group has already been set and this action conflicts with the previous setting.

Implements ACEXML_Element_Def_Builder.

Definition at line 94 of file Debug_Element_Builder.cpp.

References active_list_, ACEXML_Element_Tree_List_Node::set(), and ACEXML_Element_Tree_List_Stack::top().

00095 {
00096   this->active_list_.top ()->set (ACEXML_Element_Tree_List_Node::CHOICE);
00097   return 0;
00098 }

int ACEXML_Debug_Element_Builder::setContentType CONTENT_TYPE type  ACEXML_ENV_ARG_DECL  )  [virtual]
 

Define the content type of the element.

Return values:
0 if valid, -1 otherwise.

Implements ACEXML_Element_Def_Builder.

Definition at line 28 of file Debug_Element_Builder.cpp.

References ACE_TEXT, and ACEXML_THROW_RETURN.

00030 {
00031   if (this->type_ == UNDEFINED)
00032     {
00033       this->type_ = type;
00034       return 0;
00035     }
00036 
00037   ACEXML_THROW_RETURN (ACEXML_SAXParseException (ACE_TEXT("Element type redefinition in Debug_Validator.")), -1);
00038 }

int ACEXML_Debug_Element_Builder::setElementName const ACEXML_Char namespaceURI,
const ACEXML_Char localName,
const ACEXML_Char *qName  ACEXML_ENV_ARG_DECL
[virtual]
 

Define the name of the element.

Return values:
0 if valid, -1 otherwise.

Implements ACEXML_Element_Def_Builder.

Definition at line 18 of file Debug_Element_Builder.cpp.

References ACEXML_Char.

00022 {
00023   this->element_.set (qName, 0);
00024   return 0;
00025 }

int ACEXML_Debug_Element_Builder::setSequence  )  [virtual]
 

Set the type of current child group to Sequence.

Return values:
0 on success, -1 if the type of the child group has already been set and this action conflicts with the previous setting.

Implements ACEXML_Element_Def_Builder.

Definition at line 101 of file Debug_Element_Builder.cpp.

References active_list_, ACEXML_Element_Tree_List_Node::set(), and ACEXML_Element_Tree_List_Stack::top().

00102 {
00103   this->active_list_.top ()->set (ACEXML_Element_Tree_List_Node::SEQUENCE);
00104   return 0;
00105 }

int ACEXML_Debug_Element_Builder::startChildGroup  )  [virtual]
 

Start a new group of children.

Implements ACEXML_Element_Def_Builder.

Definition at line 64 of file Debug_Element_Builder.cpp.

References ACE_NEW_RETURN, active_list_, ACEXML_Element_Tree_List_Node::insert(), and ACEXML_Element_Tree_List_Stack::push().

00065 {
00066   ACEXML_Element_Tree_List_Node *lnode;
00067 
00068   ACE_NEW_RETURN (lnode,
00069                   ACEXML_Element_Tree_List_Node (),
00070                   -1);
00071 
00072   if (this->root_ == 0)
00073     {
00074       this->root_ = lnode;
00075     }
00076   else
00077     {
00078       // @@ check error?
00079       this->root_->insert (lnode);
00080     }
00081 
00082   this->active_list_.push (lnode);
00083   return 0;
00084 }


Member Data Documentation

ACEXML_Element_Tree_List_Stack ACEXML_Debug_Element_Builder::active_list_ [private]
 

Definition at line 121 of file Debug_Element_Builder.h.

Referenced by setChoice(), setSequence(), and startChildGroup().

ACEXML_String ACEXML_Debug_Element_Builder::element_ [private]
 

Definition at line 117 of file Debug_Element_Builder.h.

Referenced by dump().

ACEXML_Element_Tree_List_Node* ACEXML_Debug_Element_Builder::root_ [private]
 

Definition at line 119 of file Debug_Element_Builder.h.

CONTENT_TYPE ACEXML_Debug_Element_Builder::type_ [private]
 

Definition at line 115 of file Debug_Element_Builder.h.


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 11:47:48 2006 for ACEXML by doxygen 1.3.6