source: icXML/icXML-devel/src/xercesc/dom/DOMTypeInfo.hpp @ 6297

Last change on this file since 6297 was 2722, checked in by cameron, 7 years ago

Original Xerces files with import mods for icxercesc

File size: 9.2 KB
Line 
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements.  See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License.  You may obtain a copy of the License at
8 *
9 *      http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#if !defined(XERCESC_INCLUDE_GUARD_DOMTYPEINFO_HPP)
19#define XERCESC_INCLUDE_GUARD_DOMTYPEINFO_HPP
20
21//------------------------------------------------------------------------------------
22//  Includes
23//------------------------------------------------------------------------------------
24#include <icxercesc/util/XMLString.hpp>
25
26
27XERCES_CPP_NAMESPACE_BEGIN
28
29/**
30  * The <code>DOMTypeInfo</code> interface represent a type used by
31  * <code>DOMElement</code> or <code>DOMAttr</code> nodes, specified in the
32  * schemas associated with the document. The type is a pair of a namespace URI
33  * and name properties, and depends on the document's schema.
34  */
35class CDOM_EXPORT DOMTypeInfo
36{
37protected:
38    // -----------------------------------------------------------------------
39    //  Hidden constructors
40    // -----------------------------------------------------------------------
41    /** @name Hidden constructors */
42    //@{
43    DOMTypeInfo() {};
44    //@}
45
46private:
47    // -----------------------------------------------------------------------
48    // Unimplemented constructors and operators
49    // -----------------------------------------------------------------------
50    /** @name Unimplemented constructors and operators */
51    //@{
52    DOMTypeInfo(const DOMTypeInfo &);
53    DOMTypeInfo & operator = (const DOMTypeInfo &);
54    //@}
55
56public:
57
58    // -----------------------------------------------------------------------
59    //  All constructors are hidden, just the destructor is available
60    // -----------------------------------------------------------------------
61    /** @name Destructor */
62    //@{
63    /**
64     * Destructor
65     *
66     */
67    virtual ~DOMTypeInfo() {};
68    //@}
69
70    // -----------------------------------------------------------------------
71    //  Class Types
72    // -----------------------------------------------------------------------
73    /** @name Public Contants */
74    //@{
75    /**
76     * These are the available values for the derivationMethod parameter used by the
77     * method <code>DOMTypeInfo::isDerivedFrom()</code>. It is a set of possible types
78     * of derivation, and the values represent bit positions. If a bit in the derivationMethod
79     * parameter is set to 1, the corresponding type of derivation will be taken into account
80     * when evaluating the derivation between the reference type definition and the other type
81     * definition. When using the isDerivedFrom method, combining all of them in the
82     * derivationMethod parameter is equivalent to invoking the method for each of them separately
83     * and combining the results with the OR boolean function. This specification only defines
84     * the type of derivation for XML Schema.
85     *
86     * In addition to the types of derivation listed below, please note that:
87     *  - any type derives from xsd:anyType.
88     *  - any simple type derives from xsd:anySimpleType by restriction.
89     *  - any complex type does not derive from xsd:anySimpleType by restriction.
90     *
91     * <p><code>DERIVATION_EXTENSION:</code>
92     * If the document's schema is an XML Schema [XML Schema Part 1], this constant represents the
93     * derivation by extension. The reference type definition is derived by extension from the other
94     * type definition if the other type definition can be reached recursively following the
95     * {base type definition} property from the reference type definition, and at least one of the
96     * derivation methods involved is an extension.</p>
97     *
98     * <p><code>DERIVATION_LIST:</code>
99     * If the document's schema is an XML Schema [XML Schema Part 1], this constant represents the list.
100     * The reference type definition is derived by list from the other type definition if there exists
101     * two type definitions T1 and T2 such as the reference type definition is derived from T1 by
102     * DERIVATION_RESTRICTION or DERIVATION_EXTENSION, T2 is derived from the other type definition by
103     * DERIVATION_RESTRICTION, T1 has {variety} list, and T2 is the {item type definition}. Note that
104     * T1 could be the same as the reference type definition, and T2 could be the same as the other
105     * type definition.</p>
106     *
107     * <p><code>DERIVATION_RESTRICTION:</code>
108     * If the document's schema is an XML Schema [XML Schema Part 1], this constant represents the
109     * derivation by restriction if complex types are involved, or a restriction if simple types are
110     * involved.
111     * The reference type definition is derived by restriction from the other type definition if the
112     * other type definition is the same as the reference type definition, or if the other type definition
113     * can be reached recursively following the {base type definition} property from the reference type
114     * definition, and all the derivation methods involved are restriction.</p>
115     *
116     * <p><code>DERIVATION_UNION:</code>
117     * If the document's schema is an XML Schema [XML Schema Part 1], this constant represents the union
118     * if simple types are involved.
119     * The reference type definition is derived by union from the other type definition if there exists
120     * two type definitions T1 and T2 such as the reference type definition is derived from T1 by
121     * DERIVATION_RESTRICTION or DERIVATION_EXTENSION, T2 is derived from the other type definition by
122     * DERIVATION_RESTRICTION, T1 has {variety} union, and one of the {member type definitions} is T2.
123     * Note that T1 could be the same as the reference type definition, and T2 could be the same as the
124     * other type definition.</p>
125     *
126     * @since DOM Level 3
127     *
128     */
129    enum DerivationMethods {
130         DERIVATION_RESTRICTION = 0x001,
131         DERIVATION_EXTENSION   = 0x002,
132         DERIVATION_UNION       = 0x004,
133         DERIVATION_LIST        = 0x008
134        };
135    //@}
136
137    //@{
138    // -----------------------------------------------------------------------
139    //  Getter methods
140    // -----------------------------------------------------------------------
141    /**
142     * Returns The name of a type declared for the associated <code>DOMElement</code>
143     * or <code>DOMAttr</code>, or null if unknown.
144     *
145     * @return The name of a type declared for the associated <code>DOMElement</code>
146     * or <code>DOMAttribute</code>, or null if unknown.
147     * @since DOM level 3
148     */
149    virtual const XMLCh* getTypeName() const = 0;
150
151    /**
152     * The namespace of the type declared for the associated <code>DOMElement</code>
153     * or <code>DOMAttr</code> or null if the <code>DOMElement</code> does not have
154     * declaration or if no namespace information is available.
155     *
156     * @return The namespace of the type declared for the associated <code>DOMElement</code>
157     * or <code>DOMAttr</code> or null if the <code>DOMElement</code> does not have
158     * declaration or if no namespace information is available.
159     * @since DOM level 3
160     */
161    virtual const XMLCh* getTypeNamespace() const = 0;
162    //@}
163
164    //@{
165    /**
166     * This method returns if there is a derivation between the reference type definition,
167     * i.e. the DOMTypeInfo on which the method is being called, and the other type definition,
168     * i.e. the one passed as parameters.
169     *
170     * @param typeNamespaceArg The namespace of the other type definition.
171     * @param typeNameArg The name of the other type definition.
172     * @param derivationMethod The type of derivation and conditions applied between two types,
173     *                         as described in the list of constants provided in this interface.
174     * @return If the document's schema is a DTD or no schema is associated with the document,
175     *         this method will always return false.
176     *         If the document's schema is an XML Schema, the method will true if the reference
177     *         type definition is derived from the other type definition according to the derivation
178     *         parameter. If the value of the parameter is 0 (no bit is set to 1 for the
179     *         derivationMethod parameter), the method will return true if the other type definition
180     *         can be reached by recursing any combination of {base type definition},
181     *         {item type definition}, or {member type definitions} from the reference type definition.
182     * @since DOM level 3
183     */
184    virtual bool isDerivedFrom(const XMLCh* typeNamespaceArg,
185                               const XMLCh* typeNameArg,
186                               DerivationMethods derivationMethod) const = 0;
187    //@}
188};
189
190XERCES_CPP_NAMESPACE_END
191
192#endif
193
194/**
195 * End of file DOMTypeInfo.hpp
196 */
Note: See TracBrowser for help on using the repository browser.