source: icXML/icXML-devel/src/xercesc/framework/psvi/XSNamespaceItem.hpp @ 2722

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

Original Xerces files with import mods for icxercesc

File size: 8.0 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/*
19 * $Id: XSNamespaceItem.hpp 527149 2007-04-10 14:56:39Z amassari $
20 */
21
22#if !defined(XERCESC_INCLUDE_GUARD_XSNAMESPACEITEM_HPP)
23#define XERCESC_INCLUDE_GUARD_XSNAMESPACEITEM_HPP
24
25#include <icxercesc/util/PlatformUtils.hpp>
26#include <xercesc/framework/psvi/XSObject.hpp>
27#include <xercesc/framework/psvi/XSNamedMap.hpp>
28
29XERCES_CPP_NAMESPACE_BEGIN
30
31/**
32 * This class contains all properties of the Schema Namespace Information infoitem. 
33 * These items correspond to the result of processing a schema document
34 * and all its included/redefined schema documents.  It corresponds to the
35 * schema component discussed in the schema specifications, but since it
36 * is not like other components does not inherit from the XSObject interface.
37 * This is *always* owned by the validator /parser object from which
38 * it is obtained.  It is designed to be subclassed; subclasses will
39 * specify under what conditions it may be relied upon to have meaningful contents.
40 */
41
42// forward declarations
43class XSAnnotation;
44class XSAttributeDeclaration;
45class XSAttributeGroupDefinition;
46class XSElementDeclaration;
47class XSModelGroupDefinition;
48class XSNotationDeclaration;
49class XSTypeDefinition;
50class SchemaGrammar;
51class XSModel;
52
53class XMLPARSER_EXPORT XSNamespaceItem : public XMemory
54{
55public:
56
57    //  Constructors and Destructor
58    // -----------------------------------------------------------------------
59    /** @name Constructors */
60    //@{
61
62    /**
63      * The default constructor
64      *
65      * @param  xsModel
66      * @param  grammar
67      * @param  manager     The configurable memory manager
68      */
69    XSNamespaceItem
70    (
71        XSModel* const         xsModel
72        , SchemaGrammar* const grammar
73        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
74    );
75
76    XSNamespaceItem
77    (
78        XSModel* const         xsModel
79        , const XMLCh* const   schemaNamespace
80        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
81    );
82
83    //@};
84
85    /** @name Destructor */
86    //@{
87    ~XSNamespaceItem();
88    //@}
89
90    //---------------------
91    /** @name XSNamespaceItem methods */
92
93    //@{
94
95    /**
96     * [schema namespace]: A namespace name or <code>null</code>
97     * corresponding to the target namespace of the schema document.
98     */
99    const XMLCh *getSchemaNamespace() const;
100
101    /**
102     * [schema components]: a list of top-level components, i.e. element
103     * declarations, attribute declarations, etc.
104     * @param objectType The type of the declaration, i.e.
105     *   <code>ELEMENT_DECLARATION</code>,
106     *   <code>TYPE_DEFINITION</code> and any other component type that
107     * may be a property of a schema component.
108     * @return A list of top-level definition of the specified type in
109     *   <code>objectType</code> or <code>null</code>.
110     */
111    XSNamedMap<XSObject> *getComponents(XSConstants::COMPONENT_TYPE objectType);
112
113    /**
114     *  [annotations]: a set of annotations.
115     */
116    XSAnnotationList *getAnnotations();
117    const XSAnnotationList *getAnnotations() const;
118
119    /**
120     * Convenience method. Returns a top-level element declaration.
121     * @param name The name of the declaration.
122     * @return A top-level element declaration or <code>null</code> if such
123     *   declaration does not exist.
124     */
125    XSElementDeclaration *getElementDeclaration(const XMLCh *name);
126
127    /**
128     * Convenience method. Returns a top-level attribute declaration.
129     * @param name The name of the declaration.
130     * @return A top-level attribute declaration or <code>null</code> if such
131     *   declaration does not exist.
132     */
133    XSAttributeDeclaration *getAttributeDeclaration(const XMLCh *name);
134
135    /**
136     * Convenience method. Returns a top-level simple or complex type
137     * definition.
138     * @param name The name of the definition.
139     * @return An <code>XSTypeDefinition</code> or <code>null</code> if such
140     *   definition does not exist.
141     */
142    XSTypeDefinition *getTypeDefinition(const XMLCh *name);
143
144    /**
145     * Convenience method. Returns a top-level attribute group definition.
146     * @param name The name of the definition.
147     * @return A top-level attribute group definition or <code>null</code> if
148     *   such definition does not exist.
149     */
150    XSAttributeGroupDefinition *getAttributeGroup(const XMLCh *name);
151
152    /**
153     * Convenience method. Returns a top-level model group definition.
154     * @param name The name of the definition.
155     * @return A top-level model group definition definition or
156     *   <code>null</code> if such definition does not exist.
157     */
158    XSModelGroupDefinition *getModelGroupDefinition(const XMLCh *name);
159
160    /**
161     * Convenience method. Returns a top-level notation declaration.
162     * @param name The name of the declaration.
163     * @return A top-level notation declaration or <code>null</code> if such
164     *   declaration does not exist.
165     */
166    XSNotationDeclaration *getNotationDeclaration(const XMLCh *name);
167
168    /**
169     * [document location] - a list of locations URI for the documents that
170     * contributed to the XSModel.
171     */
172    const StringList *getDocumentLocations();
173
174    //@}
175
176    //----------------------------------
177    /** methods needed by implementation */
178
179    //@{
180
181
182    //@}
183private:
184
185    // -----------------------------------------------------------------------
186    //  Unimplemented constructors and operators
187    // -----------------------------------------------------------------------
188    XSNamespaceItem(const XSNamespaceItem&);
189    XSNamespaceItem & operator=(const XSNamespaceItem &);
190
191protected:
192    friend class XSModel;
193    friend class XSObjectFactory;
194    // -----------------------------------------------------------------------
195    //  data members
196    // -----------------------------------------------------------------------
197    // fMemoryManager:
198    //  used for any memory allocations
199    MemoryManager* const    fMemoryManager;
200    SchemaGrammar*          fGrammar;
201    XSModel*                fXSModel;
202
203    /* Need a XSNamedMap for each component    top-level?
204       that is top level.
205              ATTRIBUTE_DECLARATION     = 1,       
206              ELEMENT_DECLARATION       = 2,       
207              TYPE_DEFINITION           = 3,       
208              ATTRIBUTE_USE             = 4,       no
209              ATTRIBUTE_GROUP_DEFINITION= 5,       
210              MODEL_GROUP_DEFINITION    = 6,       
211              MODEL_GROUP               = 7,       no
212              PARTICLE                  = 8,       no
213              WILDCARD                  = 9,       no
214              IDENTITY_CONSTRAINT       = 10,      no
215              NOTATION_DECLARATION      = 11,       
216              ANNOTATION                = 12,      no
217              FACET                     = 13,      no
218              MULTIVALUE_FACET          = 14       no
219    */
220    XSNamedMap<XSObject>*                   fComponentMap[XSConstants::MULTIVALUE_FACET];
221    XSAnnotationList*                       fXSAnnotationList;
222    RefHashTableOf<XSObject>*               fHashMap[XSConstants::MULTIVALUE_FACET];
223    const XMLCh*                            fSchemaNamespace;
224};
225
226inline XSAnnotationList* XSNamespaceItem::getAnnotations()
227{
228    return fXSAnnotationList;
229}
230
231inline const XSAnnotationList* XSNamespaceItem::getAnnotations() const
232{
233    return fXSAnnotationList;
234}
235
236inline const XMLCh *XSNamespaceItem::getSchemaNamespace() const
237{
238    return fSchemaNamespace;
239}
240
241
242
243XERCES_CPP_NAMESPACE_END
244
245#endif
Note: See TracBrowser for help on using the repository browser.