Debug_Attributes_Builder.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file   Debug_Attributes_Builder.h
00006  *
00007  *  $Id: Debug_Attributes_Builder.h 78907 2007-07-16 10:22:58Z sowayaa $
00008  *
00009  *  @author Nanbor Wang <nanbor@cs.wustl.edu>
00010  */
00011 //=============================================================================
00012 #ifndef _ACEXML_DEBUG_ATTRIBUTES_BUILDER_H_
00013 #define _ACEXML_DEBUG_ATTRIBUTES_BUILDER_H_
00014 
00015 #include /**/ "ace/pre.h"
00016 #include "ACEXML/parser/debug_validator/Debug_DTD_Manager_Export.h"
00017 
00018 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00019 #pragma once
00020 #endif /* ACE_LACKS_PRAGMA_ONCE */
00021 
00022 #include "ACEXML/common/Attributes_Def_Builder.h"
00023 #include "ace/Hash_Map_Manager.h"
00024 #include "ace/Unbounded_Queue.h"
00025 
00026 typedef ACE_Unbounded_Queue<ACEXML_String> ACEXML_STRING_QUEUE;
00027 typedef ACE_Unbounded_Queue_Iterator<ACEXML_String> ACEXML_STRING_QUEUE_ITERATOR;
00028 
00029 /**
00030  * @class ACEXML_Debug_Attribute_Builder Debug_Attributes_Builder.h "parser/debug_validator/Debug_Attributes_Builder.h"
00031  *
00032  * This class prints out the Attribute definition for debugging purpose.
00033  */
00034 class ACEXML_DEBUG_DTD_MANAGER_Export ACEXML_Debug_Attribute_Builder
00035   : public ACEXML_Attribute_Def_Builder
00036 {
00037 public:
00038   ACEXML_Debug_Attribute_Builder ();
00039 
00040   ACEXML_Debug_Attribute_Builder (const ACEXML_Debug_Attribute_Builder &rhs);
00041 
00042   virtual ~ACEXML_Debug_Attribute_Builder ();
00043 
00044   /**
00045    * Specify the name of the attribute.
00046    */
00047   virtual int setName (const ACEXML_Char *n);
00048   virtual const ACEXML_Char *getName (void);
00049 
00050   /**
00051    * Set the attribute type.
00052    */
00053   virtual int setAttType (const ATT_TYPE type ACEXML_ENV_ARG_DECL);
00054 
00055   /**
00056    * Insert an element for NOTATION or ENUMERATION type attribute.
00057    */
00058   virtual int insertList (const ACEXML_Char *Name ACEXML_ENV_ARG_DECL);
00059 
00060   /**
00061    * Set default attribute declaration.
00062    */
00063   virtual int setDefault (const DEFAULT_DECL def,
00064                           const ACEXML_Char *value ACEXML_ENV_ARG_DECL)
00065     ;
00066 
00067   /**
00068    * Check validity of the current attribute definition being built.
00069    *
00070    * @retval 0 if the attribute is not a valid combo.
00071    */
00072   virtual int validAttr (void);
00073 
00074 
00075   /**
00076    * Dump the content of the attribute definition.
00077    */
00078   virtual void dump (void);
00079 private:
00080   /// Attribute name.
00081   ACEXML_String name_;
00082 
00083   /// Type of attribute.
00084   ATT_TYPE type_;
00085 
00086   /// Default value type.
00087   DEFAULT_DECL default_decl_;
00088 
00089   /// Default attribute value.
00090   ACEXML_String default_value_;
00091 
00092   /// Holds a queue of enumerated attribute values.
00093   ACEXML_STRING_QUEUE att_value_queue_;
00094 };
00095 
00096 typedef ACE_Hash_Map_Entry<ACEXML_String,
00097                            ACEXML_Debug_Attribute_Builder> ACEXML_ATT_MAP_ENTRY;
00098 
00099 typedef ACE_Hash_Map_Manager_Ex <ACEXML_String,
00100                                  ACEXML_Debug_Attribute_Builder,
00101                                  ACE_Hash<ACEXML_String>,
00102                                  ACE_Equal_To<ACEXML_String>,
00103                                  ACE_Null_Mutex> ACEXML_ATT_MAP;
00104 
00105 typedef ACE_Hash_Map_Iterator_Ex<ACEXML_String,
00106                                  ACEXML_Debug_Attribute_Builder,
00107                                  ACE_Hash<ACEXML_String>,
00108                                  ACE_Equal_To<ACEXML_String>,
00109                                  ACE_Null_Mutex> ACEXML_ATT_MAP_ITER;
00110 
00111 typedef ACE_Hash_Map_Reverse_Iterator_Ex<ACEXML_String,
00112                                          ACEXML_Debug_Attribute_Builder,
00113                                          ACE_Hash<ACEXML_String>,
00114                                          ACE_Equal_To<ACEXML_String>,
00115                                          ACE_Null_Mutex> ACEXML_ATT_MAP_REVERSE_ITER;
00116 
00117 /**
00118  * @class ACEXML_Debug_Attributes_Builder Debug_Attributes_Builder.h "parser/debug_validator/Debug_Attributes_Builder.h"
00119  *
00120  * This class prints out Attribute definitions for debugging purpose.
00121  */
00122 class ACEXML_DEBUG_DTD_MANAGER_Export ACEXML_Debug_Attributes_Builder
00123   : public ACEXML_Attributes_Def_Builder
00124 {
00125 public:
00126   ACEXML_Debug_Attributes_Builder ();
00127 
00128   virtual ~ACEXML_Debug_Attributes_Builder ();
00129 
00130   /**
00131    * Set the element name that the attribute builder applies.
00132    *
00133    * @retval 0 if valid, -1 otherwise.
00134    */
00135   virtual int setElement (const ACEXML_Char *namespaceURI,
00136                           const ACEXML_Char *localName,
00137                           const ACEXML_Char *qName ACEXML_ENV_ARG_DECL)
00138     ;
00139 
00140   /**
00141    * Acquire an Attribute_Builder.
00142    */
00143   virtual ACEXML_Attribute_Def_Builder *getAttribute_Def_Builder ();
00144 
00145   /**
00146    * Add a definition for one attribute.
00147    */
00148   virtual int insertAttribute (ACEXML_Attribute_Def_Builder *def ACEXML_ENV_ARG_DECL);
00149 
00150 
00151   /**
00152    * Dump the content of the attribute definition.
00153    */
00154   virtual void dump (void);
00155 protected:
00156   /// The name of the element type these attributes applied.
00157   ACEXML_String element_name_;
00158 
00159   /// Collection of attributes.
00160   ACEXML_ATT_MAP attributes_;
00161 };
00162 
00163 
00164 #include /**/ "ace/post.h"
00165 
00166 #endif /* _ACEXML_DEBUG_ATTRIBUTES_BUILDER_H_ */

Generated on Sun Jan 27 13:04:14 2008 for ACEXML by doxygen 1.3.6