diff options
Diffstat (limited to 'ACEXML/common/Element_Def_Builder.h')
-rw-r--r-- | ACEXML/common/Element_Def_Builder.h | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/ACEXML/common/Element_Def_Builder.h b/ACEXML/common/Element_Def_Builder.h new file mode 100644 index 00000000000..65be6629dfb --- /dev/null +++ b/ACEXML/common/Element_Def_Builder.h @@ -0,0 +1,122 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Element_Def_Builder.h + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= +#ifndef _ACEXML_ELEMENT_DEF_BUILDER_H_ +#define _ACEXML_ELEMENT_DEF_BUILDER_H_ + +#include "XML_Types.h" + +/** + * @ class ACEXML_Element_Def_Builder Element_Def_Builder.h "common/Element_Def_Builder.h" + * + * @ brief An abstract virtual class that defines the interface + * to define an element definition. + * + * This class defines how to define an element definition after + * parsing a DTD. + */ +class ACEXML_Export ACEXML_Element_Def_Builder +{ +public: + + typedef enum { + EMPTY, + ANY, + MIXED, + CHILDREN + } CONTENT_TYPE; + + typedef enum { + ONE, + ZERO_OR_MORE, + ONE_OR_MORE, + ONE_OR_ZERO + } CARDINALITY; + + virtual ~ACEXML_Element_Def_Builder () = 0; + + /** + * Define the name of the element. + * + * @retval 0 if valid, -1 otherwise. + */ + virtual int setElementName (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + = 0; + + /** + * Define the content type of the element. + * + * @retval 0 if valid, -1 otherwise. + */ + virtual int setContentType (CONTENT_TYPE type, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + = 0; + + /** + * Insert one more element into Mixed definition. + */ + virtual int insertMixedElement (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + = 0; + + /** + * Start a new group of children. + */ + virtual int startChildGroup () = 0; + + /** + * End a new group of children. + * + * @retval 0 on success. + */ + virtual int endChildGroup (CARDINALITY card, + ACEXML_Env &xmlenv) = 0; + + /** + * Set the type of current child group to Choice. + * + * @retval 0 on success, -1 if the type of the child group has + * already been set and this action conflicts with the previous + * setting. + */ + virtual int setChoice () = 0; + + /** + * Set the type of current child group to Sequence. + * + * @retval 0 on success, -1 if the type of the child group has + * already been set and this action conflicts with the previous + * setting. + */ + virtual int setSequence () = 0; + + /** + * Insert an new element into the current child group. + * + * @retval 0 on success, -1 otherwise. + */ + virtual int insertElement (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + = 0; +}; + +#endif /* _ACEXML_ELEMENT_DEF_BUILDER_H_ */ |