1 #include "ACEXML/common/SAXExceptions.h"
2 #include "ACEXML/parser/debug_validator/Debug_Attributes_Builder.h"
4 ACEXML_Debug_Attribute_Builder::ACEXML_Debug_Attribute_Builder ()
6 default_decl_ (INVALID
)
10 ACEXML_Debug_Attribute_Builder::ACEXML_Debug_Attribute_Builder (const ACEXML_Debug_Attribute_Builder
&rhs
)
13 default_decl_ (rhs
.default_decl_
),
14 default_value_ (rhs
.default_value_
),
15 att_value_queue_ (rhs
.att_value_queue_
)
19 ACEXML_Debug_Attribute_Builder::~ACEXML_Debug_Attribute_Builder ()
24 ACEXML_Debug_Attribute_Builder::setName (const ACEXML_Char
*n
)
26 this->name_
.set (n
, 0);
31 ACEXML_Debug_Attribute_Builder::getName (void)
33 return this->name_
.fast_rep ();
37 ACEXML_Debug_Attribute_Builder::setAttType (const ATT_TYPE type
)
39 if (this->type_
== ERROR_TYPE
)
44 ACEXML_THROW_RETURN (ACEXML_SAXParseException (ACE_TEXT("Attribute type redefinition in Debug Validator")), -1);
49 ACEXML_Debug_Attribute_Builder::insertList (const ACEXML_Char
*n
)
51 ACEXML_String
str (n
, 0, 0);
53 this->att_value_queue_
.enqueue_tail (str
);
58 ACEXML_Debug_Attribute_Builder::setDefault (const DEFAULT_DECL def
,
59 const ACEXML_Char
*value
)
61 this->default_decl_
= def
;
62 this->default_value_
.set (value
, 0);
67 ACEXML_Debug_Attribute_Builder::validAttr (void)
69 // @@ Not implemented. Always return 1 (true) for now.
74 ACEXML_Debug_Attribute_Builder::dump (void)
76 cout
<< this->name_
<< " ";
110 ACEXML_STRING_QUEUE_ITERATOR
iter (this->att_value_queue_
);
111 ACEXML_String
*n
= 0;
113 while (iter
.advance () != 0)
124 cout
<< "*** UNKNOWN TYPE ***";
128 switch (this->default_decl_
)
137 cout
<< "#FIXED " << this->default_value_
;
140 cout
<< "**** UNDEFINED DEFAULT DECL ****";
144 // ========================================
146 ACEXML_Debug_Attributes_Builder::ACEXML_Debug_Attributes_Builder ()
150 ACEXML_Debug_Attributes_Builder::~ACEXML_Debug_Attributes_Builder ()
155 ACEXML_Debug_Attributes_Builder::setElement (const ACEXML_Char
*,
157 const ACEXML_Char
*qName
)
159 this->element_name_
.set (qName
, 0);
163 ACEXML_Attribute_Def_Builder
*
164 ACEXML_Debug_Attributes_Builder::getAttribute_Def_Builder ()
166 ACEXML_Attribute_Def_Builder
*tmp
;
169 ACEXML_Debug_Attribute_Builder (),
175 ACEXML_Debug_Attributes_Builder::insertAttribute (
176 ACEXML_Attribute_Def_Builder
*def
)
178 ACEXML_Attribute_Def_Builder::VAR
ptr (def
);
182 ACEXML_String
attname (def
->getName (), 0, 0);
183 ACEXML_Debug_Attribute_Builder
*ptr
=
184 dynamic_cast<ACEXML_Debug_Attribute_Builder
*> (def
);
185 this->attributes_
.bind (attname
, *ptr
);
188 ACEXML_THROW_RETURN (ACEXML_SAXParseException (ACE_TEXT("ACEXML_Debug_Attributes_Builder internal error")), -1);
192 ACEXML_Debug_Attributes_Builder::dump (void)
195 cout
<< "<!ATTLIST " << this->element_name_
<< endl
;
197 ACEXML_ATT_MAP_ITER
iter (this->attributes_
);
198 ACEXML_ATT_MAP_ENTRY
*item
;
200 while (iter
.advance () != 0)
204 item
->int_id_
.dump ();