3 //=============================================================================
5 * @file Debug_Attributes_Builder.h
7 * @author Nanbor Wang <nanbor@cs.wustl.edu>
9 //=============================================================================
10 #ifndef _ACEXML_DEBUG_ATTRIBUTES_BUILDER_H_
11 #define _ACEXML_DEBUG_ATTRIBUTES_BUILDER_H_
13 #include /**/ "ace/pre.h"
14 #include "ACEXML/parser/debug_validator/Debug_DTD_Manager_Export.h"
16 #if !defined (ACE_LACKS_PRAGMA_ONCE)
18 #endif /* ACE_LACKS_PRAGMA_ONCE */
20 #include "ACEXML/common/Attributes_Def_Builder.h"
21 #include "ace/Hash_Map_Manager.h"
22 #include "ace/Unbounded_Queue.h"
24 typedef ACE_Unbounded_Queue
<ACEXML_String
> ACEXML_STRING_QUEUE
;
25 typedef ACE_Unbounded_Queue_Iterator
<ACEXML_String
> ACEXML_STRING_QUEUE_ITERATOR
;
28 * @class ACEXML_Debug_Attribute_Builder Debug_Attributes_Builder.h "parser/debug_validator/Debug_Attributes_Builder.h"
30 * This class prints out the Attribute definition for debugging purpose.
32 class ACEXML_DEBUG_DTD_MANAGER_Export ACEXML_Debug_Attribute_Builder
33 : public ACEXML_Attribute_Def_Builder
36 ACEXML_Debug_Attribute_Builder ();
38 ACEXML_Debug_Attribute_Builder (const ACEXML_Debug_Attribute_Builder
&rhs
);
40 virtual ~ACEXML_Debug_Attribute_Builder ();
43 * Specify the name of the attribute.
45 virtual int setName (const ACEXML_Char
*n
);
46 virtual const ACEXML_Char
*getName ();
49 * Set the attribute type.
51 virtual int setAttType (const ATT_TYPE type
);
54 * Insert an element for NOTATION or ENUMERATION type attribute.
56 virtual int insertList (const ACEXML_Char
*Name
);
59 * Set default attribute declaration.
61 virtual int setDefault (const DEFAULT_DECL def
, const ACEXML_Char
*value
);
64 * Check validity of the current attribute definition being built.
66 * @retval 0 if the attribute is not a valid combo.
68 virtual int validAttr ();
72 * Dump the content of the attribute definition.
79 /// Type of attribute.
82 /// Default value type.
83 DEFAULT_DECL default_decl_
;
85 /// Default attribute value.
86 ACEXML_String default_value_
;
88 /// Holds a queue of enumerated attribute values.
89 ACEXML_STRING_QUEUE att_value_queue_
;
92 typedef ACE_Hash_Map_Entry
<ACEXML_String
,
93 ACEXML_Debug_Attribute_Builder
> ACEXML_ATT_MAP_ENTRY
;
95 typedef ACE_Hash_Map_Manager_Ex
<ACEXML_String
,
96 ACEXML_Debug_Attribute_Builder
,
97 ACE_Hash
<ACEXML_String
>,
98 ACE_Equal_To
<ACEXML_String
>,
99 ACE_Null_Mutex
> ACEXML_ATT_MAP
;
101 typedef ACE_Hash_Map_Iterator_Ex
<ACEXML_String
,
102 ACEXML_Debug_Attribute_Builder
,
103 ACE_Hash
<ACEXML_String
>,
104 ACE_Equal_To
<ACEXML_String
>,
105 ACE_Null_Mutex
> ACEXML_ATT_MAP_ITER
;
107 typedef ACE_Hash_Map_Reverse_Iterator_Ex
<ACEXML_String
,
108 ACEXML_Debug_Attribute_Builder
,
109 ACE_Hash
<ACEXML_String
>,
110 ACE_Equal_To
<ACEXML_String
>,
111 ACE_Null_Mutex
> ACEXML_ATT_MAP_REVERSE_ITER
;
114 * @class ACEXML_Debug_Attributes_Builder Debug_Attributes_Builder.h "parser/debug_validator/Debug_Attributes_Builder.h"
116 * This class prints out Attribute definitions for debugging purpose.
118 class ACEXML_DEBUG_DTD_MANAGER_Export ACEXML_Debug_Attributes_Builder
119 : public ACEXML_Attributes_Def_Builder
122 ACEXML_Debug_Attributes_Builder ();
124 virtual ~ACEXML_Debug_Attributes_Builder ();
127 * Set the element name that the attribute builder applies.
129 * @retval 0 if valid, -1 otherwise.
131 virtual int setElement (const ACEXML_Char
*namespaceURI
,
132 const ACEXML_Char
*localName
,
133 const ACEXML_Char
*qName ACEXML_ENV_ARG_DECL
)
137 * Acquire an Attribute_Builder.
139 virtual ACEXML_Attribute_Def_Builder
*getAttribute_Def_Builder ();
142 * Add a definition for one attribute.
144 virtual int insertAttribute (ACEXML_Attribute_Def_Builder
*def ACEXML_ENV_ARG_DECL
);
148 * Dump the content of the attribute definition.
150 virtual void dump ();
152 /// The name of the element type these attributes applied.
153 ACEXML_String element_name_
;
155 /// Collection of attributes.
156 ACEXML_ATT_MAP attributes_
;
160 #include /**/ "ace/post.h"
162 #endif /* _ACEXML_DEBUG_ATTRIBUTES_BUILDER_H_ */