Element_Def_Builder.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Element_Def_Builder.h
00006  *
00007  *  Element_Def_Builder.h,v 1.7 2003/07/19 19:04:10 dhinton Exp
00008  *
00009  *  @author Nanbor Wang <nanbor@cs.wustl.edu>
00010  */
00011 //=============================================================================
00012 #ifndef _ACEXML_ELEMENT_DEF_BUILDER_H_
00013 #define _ACEXML_ELEMENT_DEF_BUILDER_H_
00014 
00015 #include /**/ "ace/pre.h"
00016 #include "ACEXML/common/ACEXML_Export.h"
00017 
00018 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00019 #pragma once
00020 #endif /* ACE_LACKS_PRAGMA_ONCE */
00021 #include "ace/Auto_Ptr.h"
00022 #include "ACEXML/common/XML_Types.h"
00023 #include "ACEXML/common/Env.h"
00024 #include "ACEXML/common/SAXExceptions.h"
00025 
00026 /**
00027  * @class ACEXML_Element_Def_Builder Element_Def_Builder.h "common/Element_Def_Builder.h"
00028  *
00029  * @brief An abstract virtual class that defines the interface to define an
00030  * element definition.
00031  *
00032  * This class defines how to define an element definition after parsing a
00033  * DTD.
00034  */
00035 class ACEXML_Export ACEXML_Element_Def_Builder
00036 {
00037 public:
00038 
00039   typedef auto_ptr<ACEXML_Element_Def_Builder> VAR;
00040 
00041   typedef enum {
00042     EMPTY,
00043     ANY,
00044     MIXED,
00045     CHILDREN,
00046     UNDEFINED
00047   } CONTENT_TYPE;
00048 
00049   typedef enum {
00050     ONE,
00051     ZERO_OR_MORE,
00052     ONE_OR_MORE,
00053     ONE_OR_ZERO
00054   } CARDINALITY;
00055 
00056   virtual ~ACEXML_Element_Def_Builder () = 0;
00057 
00058   /**
00059    * Define the name of the element.
00060    *
00061    * @retval 0 if valid, -1 otherwise.
00062    */
00063   virtual int setElementName (const ACEXML_Char *namespaceURI,
00064                               const ACEXML_Char *localName,
00065                               const ACEXML_Char *qName ACEXML_ENV_ARG_DECL)
00066         ACE_THROW_SPEC ((ACEXML_SAXException)) = 0;
00067 
00068   /**
00069    * Define the content type of the element.
00070    *
00071    * @retval 0 if valid, -1 otherwise.
00072    */
00073   virtual int setContentType (CONTENT_TYPE type ACEXML_ENV_ARG_DECL)
00074         ACE_THROW_SPEC ((ACEXML_SAXException)) = 0;
00075 
00076   /**
00077    * Insert one more element into Mixed definition.
00078    */
00079   virtual int insertMixedElement (const ACEXML_Char *namespaceURI,
00080                                   const ACEXML_Char *localName,
00081                                   const ACEXML_Char *qName ACEXML_ENV_ARG_DECL)
00082         ACE_THROW_SPEC ((ACEXML_SAXException)) = 0;
00083 
00084   /**
00085    * Start a new group of children.
00086    */
00087   virtual int startChildGroup () = 0;
00088 
00089   /**
00090    * End a new group of children.
00091    *
00092    * @retval 0 on success.
00093    */
00094   virtual int endChildGroup (CARDINALITY card ACEXML_ENV_ARG_DECL) = 0;
00095 
00096   /**
00097    * Set the type of current child group to Choice.
00098    *
00099    * @retval 0 on success, -1 if the type of the child group has
00100    * already been set and this action conflicts with the previous
00101    * setting.
00102    */
00103   virtual int setChoice () = 0;
00104 
00105   /**
00106    * Set the type of current child group to Sequence.
00107    *
00108    * @retval 0 on success, -1 if the type of the child group has
00109    * already been set and this action conflicts with the previous
00110    * setting.
00111    */
00112   virtual int setSequence () = 0;
00113 
00114   /**
00115    * Insert an new element into the current child group.
00116    *
00117    * @retval 0 on success, -1 otherwise.
00118    */
00119   virtual int insertElement  (const ACEXML_Char *namespaceURI,
00120                               const ACEXML_Char *localName,
00121                               const ACEXML_Char *qName ACEXML_ENV_ARG_DECL)
00122         ACE_THROW_SPEC ((ACEXML_SAXException)) = 0;
00123 
00124   /**
00125    * Dump the content of the attribute definition.
00126    */
00127   virtual void dump (void) = 0;
00128 };
00129 
00130 
00131 #include /**/ "ace/post.h"
00132 
00133 #endif /* _ACEXML_ELEMENT_DEF_BUILDER_H_ */

Generated on Thu Nov 9 11:45:36 2006 for ACEXML by doxygen 1.3.6