# ItemFactory.hpp

Go to the documentation of this file.

    00001 /*
    00002  * Copyright (c) 2001-2006
    00003  *     DecisionSoft Limited. All rights reserved.
    00004  * Copyright (c) 2004-2006
    00005  *     Progress Software Corporation. All rights reserved.
    00006  * Copyright (c) 2004-2006
    00007  *     Oracle. All rights reserved.
    00008  *
    00009  * See the file LICENSE for redistribution information.
    00010  *
    00011  * $Id: ItemFactory.hpp,v 1.12 2006/11/01 16:37:12 jpcs Exp $
    00012  */
    00013
    00014 /*
    00015   Factory base class
    00016 */
    00017
    00018 #ifndef _ITEMFACTORY_HPP
    00019 #define _ITEMFACTORY_HPP
    00020
    00021 #include <xqilla/framework/XQillaExport.hpp>
    00022 #include <xqilla/mapm/m_apm.h>
    00023 #include <xqilla/items/ATAnyURIOrDerived.hpp>
    00024 #include <xqilla/items/ATBooleanOrDerived.hpp>
    00025 #include <xqilla/items/ATDateOrDerived.hpp>
    00026 #include <xqilla/items/ATDateTimeOrDerived.hpp>
    00027 #include <xqilla/items/ATDecimalOrDerived.hpp>
    00028 #include <xqilla/items/ATDoubleOrDerived.hpp>
    00029 #include <xqilla/items/ATDurationOrDerived.hpp>
    00030 #include <xqilla/items/ATFloatOrDerived.hpp>
    00031 #include <xqilla/items/ATGDayOrDerived.hpp>
    00032 #include <xqilla/items/ATGMonthOrDerived.hpp>
    00033 #include <xqilla/items/ATGMonthDayOrDerived.hpp>
    00034 #include <xqilla/items/ATGYearMonthOrDerived.hpp>
    00035 #include <xqilla/items/ATGYearOrDerived.hpp>
    00036 #include <xqilla/items/ATQNameOrDerived.hpp>
    00037 #include <xqilla/items/ATStringOrDerived.hpp>
    00038 #include <xqilla/items/ATTimeOrDerived.hpp>
    00039 #include <xqilla/items/ATUntypedAtomic.hpp>
    00040 #include <xqilla/items/Node.hpp>
    00041
    00042 #include <xercesc/util/XMemory.hpp>
    00043
    00044 class XQILLA_API ItemFactory : public XERCES_CPP_NAMESPACE_QUALIFIER XMemory
    00045 {
    00046 public:
    00047   virtual ~ItemFactory() {};
    00048
    00049   /* @name Atomic type factory methods */
    00050
    00051   virtual AnyAtomicType::AtomicObjectType getPrimitiveTypeIndex(const XMLCh* typeURI, const XMLCh* typeName, bool &isPrimitive) const = 0;
    00052   virtual AnyAtomicType::Ptr createDerivedFromAtomicType(AnyAtomicType::AtomicObjectType typeIndex, const XMLCh* value,
    00053                                                          const DynamicContext* context) = 0;
    00054   virtual AnyAtomicType::Ptr createDerivedFromAtomicType(AnyAtomicType::AtomicObjectType typeIndex, const XMLCh* typeURI,
    00055                                                          const XMLCh* typeName, const XMLCh* value, const DynamicContext* context) = 0;
    00056   virtual AnyAtomicType::Ptr createDerivedFromAtomicType(const XMLCh* typeURI, const XMLCh* typeName, const XMLCh* value, const DynamicContext* context) = 0;
    00057
    00058   /* @name Node factory methods */
    00059
    00060   class XQILLA_API ElementChild {
    00061   public:
    00062     ElementChild(const Node::Ptr &n) : node(n), clone(true) {}
    00063     ElementChild(const Node::Ptr &n, bool c) : node(n), clone(c) {}
    00064     operator const Node::Ptr &() { return node; }
    00065     const Node *operator ->() const { return node.get(); }
    00066
    00067     Node::Ptr node;
    00068     bool clone;
    00069   };
    00070
    00071   virtual Node::Ptr cloneNode(const Node::Ptr node, const DynamicContext *context) const = 0;
    00072   virtual Node::Ptr createTextNode(const XMLCh *value, const DynamicContext *context) const = 0;
    00073   virtual Node::Ptr createCommentNode(const XMLCh *value, const DynamicContext *context) const = 0;
    00074   virtual Node::Ptr createPINode(const XMLCh *name, const XMLCh *value, const DynamicContext *context) const = 0;
    00075   virtual Node::Ptr createAttributeNode(const XMLCh *uri, const XMLCh *prefix, const XMLCh *name,
    00076                                         const XMLCh *value, const DynamicContext *context) const = 0;
    00077   virtual Node::Ptr createElementNode(const XMLCh *uri, const XMLCh *prefix, const XMLCh *name,
    00078                                       const std::vector<Node::Ptr> &attrList, const std::vector<ElementChild> &childList,
    00079                                       const DynamicContext *context) const = 0;
    00080   virtual Node::Ptr createDocumentNode(const std::vector<Node::Ptr> &childList, const DynamicContext *context) const = 0;
    00081   virtual const XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* createNamespaceNode(const XMLCh* prefix, const XMLCh* uri, const XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* parentNode, const DynamicContext *context) const = 0;
    00082
    00083   /* @name Number factory methods */
    00084
    00085   virtual ATDoubleOrDerived::Ptr createDouble(const MAPM value, const DynamicContext* context) = 0;
    00086   virtual ATDoubleOrDerived::Ptr createDouble(const XMLCh* value, const DynamicContext* context) = 0;
    00087   virtual ATDoubleOrDerived::Ptr createDoubleOrDerived(const XMLCh* typeURI, const XMLCh* typeName, const MAPM value, const DynamicContext* context) = 0;
    00088   virtual ATDoubleOrDerived::Ptr createDoubleOrDerived(const XMLCh* typeURI, const XMLCh* typeName, const XMLCh* value, const DynamicContext* context) = 0;
    00089
    00090   virtual ATFloatOrDerived::Ptr createFloat(const MAPM value, const DynamicContext* context) = 0;
    00091   virtual ATFloatOrDerived::Ptr createFloat(const XMLCh* value, const DynamicContext* context) = 0;
    00092   virtual ATFloatOrDerived::Ptr createFloatOrDerived(const XMLCh* typeURI, const XMLCh* typeName, const MAPM value, const DynamicContext* context) = 0;
    00093   virtual ATFloatOrDerived::Ptr createFloatOrDerived(const XMLCh* typeURI, const XMLCh* typeName, const XMLCh* value, const DynamicContext* context) = 0;
    00094
    00095   virtual ATDecimalOrDerived::Ptr createInteger(const int value, const DynamicContext* context) = 0;
    00096   virtual ATDecimalOrDerived::Ptr createInteger(const MAPM value, const DynamicContext* context) = 0;
    00097   virtual ATDecimalOrDerived::Ptr createInteger(const XMLCh* value, const DynamicContext* context) = 0;
    00098   virtual ATDecimalOrDerived::Ptr createNonNegativeInteger(const MAPM value, const DynamicContext* context) = 0;
    00099
    00100   virtual ATDecimalOrDerived::Ptr createDecimal(const MAPM value, const DynamicContext* context) = 0;
    00101   virtual ATDecimalOrDerived::Ptr createDecimal(const XMLCh* value, const DynamicContext* context) = 0;
    00102   virtual ATDecimalOrDerived::Ptr createDecimalOrDerived(const XMLCh* typeURI, const XMLCh* typeName, const MAPM value, const DynamicContext* context) = 0;
    00103   virtual ATDecimalOrDerived::Ptr createDecimalOrDerived(const XMLCh* typeURI, const XMLCh* typeName, const XMLCh* value, const DynamicContext* context) = 0;
    00104
    00105   /* @name Date / time factory methods */
    00106
    00107   virtual ATDateOrDerived::Ptr createDate(const XMLCh* value, const DynamicContext* context) = 0;
    00108   virtual ATDateOrDerived::Ptr createDateOrDerived(const XMLCh* typeURI, const XMLCh* typeName, const XMLCh* value, const DynamicContext* context) = 0;
    00109
    00110   virtual ATDateTimeOrDerived::Ptr createDateTime(const XMLCh* value, const DynamicContext* context) = 0;
    00111   virtual ATDateTimeOrDerived::Ptr createDateTimeOrDerived(const XMLCh* typeURI, const XMLCh* typeName, const XMLCh* value, const DynamicContext* context) = 0;
    00112
    00113   virtual ATTimeOrDerived::Ptr createTime(const XMLCh* value, const DynamicContext* context) = 0;
    00114   virtual ATTimeOrDerived::Ptr createTimeOrDerived(const XMLCh* typeURI, const XMLCh* typeName, const XMLCh* value, const DynamicContext* context) = 0;
    00115
    00116   virtual ATGDayOrDerived::Ptr createGDayOrDerived(const XMLCh* typeURI, const XMLCh* typeName, const XMLCh* value, const DynamicContext* context) = 0;
    00117   virtual ATGMonthDayOrDerived::Ptr createGMonthDayOrDerived(const XMLCh* typeURI, const XMLCh* typeName, const XMLCh* value, const DynamicContext* context) = 0;
    00118   virtual ATGMonthOrDerived::Ptr createGMonthOrDerived(const XMLCh* typeURI, const XMLCh* typeName, const XMLCh* value, const DynamicContext* context) = 0;
    00119   virtual ATGYearMonthOrDerived::Ptr createGYearMonthOrDerived(const XMLCh* typeURI, const XMLCh* typeName, const XMLCh* value, const DynamicContext* context) = 0;
    00120   virtual ATGYearOrDerived::Ptr createGYearOrDerived(const XMLCh* typeURI, const XMLCh* typeName, const XMLCh* value, const DynamicContext* context) = 0;
    00121
    00122   virtual ATDurationOrDerived::Ptr createDayTimeDuration(const XMLCh* value, const DynamicContext* context) = 0;
    00123   virtual ATDurationOrDerived::Ptr createDayTimeDuration(const MAPM &seconds, const DynamicContext* context) = 0;
    00124   virtual ATDurationOrDerived::Ptr createYearMonthDuration(const XMLCh* value, const DynamicContext* context) = 0;
    00125   virtual ATDurationOrDerived::Ptr createYearMonthDuration(const MAPM &months, const DynamicContext* context) = 0;
    00126   virtual ATDurationOrDerived::Ptr createDurationOrDerived(const XMLCh* typeURI, const XMLCh* typeName, const XMLCh* value, const DynamicContext* context) = 0;
    00127
    00128   /* @name Other factory methods */
    00129
    00130   virtual ATStringOrDerived::Ptr createString(const XMLCh* value, const DynamicContext* context) = 0;
    00131   virtual ATStringOrDerived::Ptr createStringOrDerived(const XMLCh* typeURI, const XMLCh* typeName, const XMLCh* value, const DynamicContext* context) = 0;
    00132
    00133   virtual ATUntypedAtomic::Ptr createUntypedAtomic(const XMLCh* value, const DynamicContext* context) = 0;
    00134
    00135   virtual ATBooleanOrDerived::Ptr createBoolean(bool value, const DynamicContext* context) = 0;
    00136   virtual ATBooleanOrDerived::Ptr createBoolean(const XMLCh* value, const DynamicContext* context) = 0;
    00137   virtual ATBooleanOrDerived::Ptr createBooleanOrDerived(const XMLCh* typeURI, const XMLCh* typeName, bool value, const DynamicContext* context) = 0;
    00138   virtual ATBooleanOrDerived::Ptr createBooleanOrDerived(const XMLCh* typeURI, const XMLCh* typeName, const XMLCh* value, const DynamicContext* context) = 0;
    00139
    00140   virtual ATAnyURIOrDerived::Ptr createAnyURI(const XMLCh* value, const DynamicContext* context) = 0;
    00141
    00142   virtual ATQNameOrDerived::Ptr createQName(const XMLCh* uri, const XMLCh* prefix, const XMLCh* name, const DynamicContext* context) = 0;
    00143   virtual ATQNameOrDerived::Ptr createQNameOrDerived(const XMLCh* typeURI, const XMLCh *prefix, const XMLCh* typeName, const XMLCh* uri, const XMLCh* name, const DynamicContext* context) = 0;
    00144
    00145 };
    00146
    00147 #endif