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 ()
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);
48 ACEXML_Debug_Attribute_Builder::insertList (const ACEXML_Char
*n
)
50 ACEXML_String
str (n
, 0, 0);
52 this->att_value_queue_
.enqueue_tail (str
);
57 ACEXML_Debug_Attribute_Builder::setDefault (const DEFAULT_DECL def
,
58 const ACEXML_Char
*value
)
60 this->default_decl_
= def
;
61 this->default_value_
.set (value
, 0);
66 ACEXML_Debug_Attribute_Builder::validAttr ()
68 // @@ Not implemented. Always return 1 (true) for now.
73 ACEXML_Debug_Attribute_Builder::dump ()
75 cout
<< this->name_
<< " ";
109 ACEXML_STRING_QUEUE_ITERATOR
iter (this->att_value_queue_
);
110 ACEXML_String
*n
= 0;
112 while (iter
.advance () != 0)
123 cout
<< "*** UNKNOWN TYPE ***";
127 switch (this->default_decl_
)
136 cout
<< "#FIXED " << this->default_value_
;
139 cout
<< "**** UNDEFINED DEFAULT DECL ****";
143 // ========================================
145 ACEXML_Debug_Attributes_Builder::ACEXML_Debug_Attributes_Builder ()
149 ACEXML_Debug_Attributes_Builder::~ACEXML_Debug_Attributes_Builder ()
154 ACEXML_Debug_Attributes_Builder::setElement (const ACEXML_Char
*,
156 const ACEXML_Char
*qName
)
158 this->element_name_
.set (qName
, 0);
162 ACEXML_Attribute_Def_Builder
*
163 ACEXML_Debug_Attributes_Builder::getAttribute_Def_Builder ()
165 ACEXML_Attribute_Def_Builder
*tmp
;
168 ACEXML_Debug_Attribute_Builder (),
174 ACEXML_Debug_Attributes_Builder::insertAttribute (
175 ACEXML_Attribute_Def_Builder
*def
)
177 ACEXML_Attribute_Def_Builder::VAR
ptr (def
);
181 ACEXML_String
attname (def
->getName (), 0, 0);
182 ACEXML_Debug_Attribute_Builder
*ptr
=
183 dynamic_cast<ACEXML_Debug_Attribute_Builder
*> (def
);
184 this->attributes_
.bind (attname
, *ptr
);
187 ACEXML_THROW_RETURN (ACEXML_SAXParseException (ACE_TEXT("ACEXML_Debug_Attributes_Builder internal error")), -1);
191 ACEXML_Debug_Attributes_Builder::dump ()
194 cout
<< "<!ATTLIST " << this->element_name_
<< endl
;
196 ACEXML_ATT_MAP_ITER
iter (this->attributes_
);
197 ACEXML_ATT_MAP_ENTRY
*item
;
199 while (iter
.advance () != 0)
203 item
->int_id_
.dump ();