1 | /*
|
---|
2 | * Copyright 2003,2004 The Apache Software Foundation.
|
---|
3 | *
|
---|
4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
---|
5 | * you may not use this file except in compliance with the License.
|
---|
6 | * You may obtain a copy of the License at
|
---|
7 | *
|
---|
8 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
9 | *
|
---|
10 | * Unless required by applicable law or agreed to in writing, software
|
---|
11 | * distributed under the License is distributed on an "AS IS" BASIS,
|
---|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
13 | * See the License for the specific language governing permissions and
|
---|
14 | * limitations under the License.
|
---|
15 | */
|
---|
16 |
|
---|
17 | /*
|
---|
18 | * $Log: XSObject.hpp,v $
|
---|
19 | * Revision 1.12 2004/09/08 13:56:09 peiyongz
|
---|
20 | * Apache License Version 2.0
|
---|
21 | *
|
---|
22 | * Revision 1.11 2004/05/04 19:02:40 cargilld
|
---|
23 | * Enable IDs to work on all kinds of schema components
|
---|
24 | *
|
---|
25 | * Revision 1.10 2003/12/01 23:23:26 neilg
|
---|
26 | * fix for bug 25118; thanks to Jeroen Witmond
|
---|
27 | *
|
---|
28 | * Revision 1.9 2003/11/25 15:10:44 jberry
|
---|
29 | * Eliminate some compiler warnings concerning comments inside of comments
|
---|
30 | *
|
---|
31 | * Revision 1.8 2003/11/21 17:34:04 knoaman
|
---|
32 | * PSVI update
|
---|
33 | *
|
---|
34 | * Revision 1.7 2003/11/15 21:18:39 neilg
|
---|
35 | * fixes for compilation under gcc
|
---|
36 | *
|
---|
37 | * Revision 1.6 2003/11/14 22:47:53 neilg
|
---|
38 | * fix bogus log message from previous commit...
|
---|
39 | *
|
---|
40 | * Revision 1.5 2003/11/14 22:33:30 neilg
|
---|
41 | * Second phase of schema component model implementation.
|
---|
42 | * Implement XSModel, XSNamespaceItem, and the plumbing necessary
|
---|
43 | * to connect them to the other components.
|
---|
44 | * Thanks to David Cargill.
|
---|
45 | *
|
---|
46 | * Revision 1.4 2003/11/06 15:30:04 neilg
|
---|
47 | * first part of PSVI/schema component model implementation, thanks to David Cargill. This covers setting the PSVIHandler on parser objects, as well as implementing XSNotation, XSSimpleTypeDefinition, XSIDCDefinition, and most of XSWildcard, XSComplexTypeDefinition, XSElementDeclaration, XSAttributeDeclaration and XSAttributeUse.
|
---|
48 | *
|
---|
49 | * Revision 1.3 2003/10/24 10:59:26 gareth
|
---|
50 | * changed C comments to C++ comments to prevent compiler warnings.
|
---|
51 | * (rephrased that message to eliminate compiler warnings on the message--this is recursive!)
|
---|
52 | *
|
---|
53 | * Revision 1.2 2003/10/10 18:37:51 neilg
|
---|
54 | * update XSModel and XSObject interface so that IDs can be used to query components in XSModels, and so that those IDs can be recovered from components
|
---|
55 | *
|
---|
56 | * Revision 1.1 2003/09/16 14:33:36 neilg
|
---|
57 | * PSVI/schema component model classes, with Makefile/configuration changes necessary to build them
|
---|
58 | *
|
---|
59 | */
|
---|
60 |
|
---|
61 | #if !defined(XSOBJECT_HPP)
|
---|
62 | #define XSOBJECT_HPP
|
---|
63 |
|
---|
64 | #include <xercesc/util/PlatformUtils.hpp>
|
---|
65 | #include <xercesc/framework/psvi/XSConstants.hpp>
|
---|
66 |
|
---|
67 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
68 |
|
---|
69 | /**
|
---|
70 | * The XSObject forms the base of the Schema Component Model. It contains
|
---|
71 | * all properties common to the majority of XML Schema components.
|
---|
72 | * This is *always* owned by the validator /parser object from which
|
---|
73 | * it is obtained. It is designed to be subclassed; subclasses will
|
---|
74 | * specify under what conditions it may be relied upon to have meaningful contents.
|
---|
75 | */
|
---|
76 |
|
---|
77 | // forward declarations
|
---|
78 | class XSNamespaceItem;
|
---|
79 | class XSModel;
|
---|
80 |
|
---|
81 | class XMLPARSER_EXPORT XSObject : public XMemory
|
---|
82 | {
|
---|
83 | public:
|
---|
84 |
|
---|
85 | // Constructors and Destructor
|
---|
86 | // -----------------------------------------------------------------------
|
---|
87 | /** @name Constructors */
|
---|
88 | //@{
|
---|
89 |
|
---|
90 | /**
|
---|
91 | * The default constructor
|
---|
92 | *
|
---|
93 | * @param compType
|
---|
94 | * @param xsModel
|
---|
95 | * @param manager The configurable memory manager
|
---|
96 | */
|
---|
97 | XSObject
|
---|
98 | (
|
---|
99 | XSConstants::COMPONENT_TYPE compType
|
---|
100 | , XSModel* const xsModel
|
---|
101 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
102 | );
|
---|
103 |
|
---|
104 | //@};
|
---|
105 |
|
---|
106 | /** @name Destructor */
|
---|
107 | //@{
|
---|
108 | virtual ~XSObject();
|
---|
109 | //@}
|
---|
110 |
|
---|
111 | //---------------------
|
---|
112 | /** @name XSObject methods */
|
---|
113 |
|
---|
114 | //@{
|
---|
115 |
|
---|
116 | /**
|
---|
117 | * The <code>type</code> of this object, i.e.
|
---|
118 | * <code>ELEMENT_DECLARATION</code>.
|
---|
119 | */
|
---|
120 | XSConstants::COMPONENT_TYPE getType() const;
|
---|
121 |
|
---|
122 | /**
|
---|
123 | * The name of type <code>NCName</code> of this declaration as defined in
|
---|
124 | * XML Namespaces.
|
---|
125 | */
|
---|
126 | virtual const XMLCh* getName();
|
---|
127 |
|
---|
128 | /**
|
---|
129 | * The [target namespace] of this object, or <code>null</code> if it is
|
---|
130 | * unspecified.
|
---|
131 | */
|
---|
132 | virtual const XMLCh* getNamespace();
|
---|
133 |
|
---|
134 | /**
|
---|
135 | * A namespace schema information item corresponding to the target
|
---|
136 | * namespace of the component, if it's globally declared; or null
|
---|
137 | * otherwise.
|
---|
138 | */
|
---|
139 | virtual XSNamespaceItem *getNamespaceItem();
|
---|
140 |
|
---|
141 | /**
|
---|
142 | * Optional. Return a unique identifier for a component within this XSModel, to
|
---|
143 | * optimize querying. May not be defined for all types of component.
|
---|
144 | * @return id unique for this type of component within this XSModel or 0
|
---|
145 | * to indicate that this is not supported for this type of component.
|
---|
146 | */
|
---|
147 | virtual unsigned int getId() const;
|
---|
148 |
|
---|
149 | //@}
|
---|
150 |
|
---|
151 | //----------------------------------
|
---|
152 | /** methods needed by implementation */
|
---|
153 |
|
---|
154 | //@{
|
---|
155 | /**
|
---|
156 | * Set the id to be returned on getId().
|
---|
157 | */
|
---|
158 | void setId(unsigned int id);
|
---|
159 | //@}
|
---|
160 |
|
---|
161 | private:
|
---|
162 |
|
---|
163 | // -----------------------------------------------------------------------
|
---|
164 | // Unimplemented constructors and operators
|
---|
165 | // -----------------------------------------------------------------------
|
---|
166 | XSObject(const XSObject&);
|
---|
167 | XSObject & operator=(const XSObject &);
|
---|
168 |
|
---|
169 | protected:
|
---|
170 |
|
---|
171 | // -----------------------------------------------------------------------
|
---|
172 | // data members
|
---|
173 | // -----------------------------------------------------------------------
|
---|
174 | // fMemoryManager:
|
---|
175 | // used for any memory allocations
|
---|
176 | // fComponentType
|
---|
177 | // the type of the actual component
|
---|
178 | XSConstants::COMPONENT_TYPE fComponentType;
|
---|
179 | XSModel* fXSModel;
|
---|
180 | MemoryManager* fMemoryManager;
|
---|
181 | unsigned int fId;
|
---|
182 | };
|
---|
183 |
|
---|
184 | inline XSConstants::COMPONENT_TYPE XSObject::getType() const
|
---|
185 | {
|
---|
186 | return fComponentType;
|
---|
187 | }
|
---|
188 |
|
---|
189 | XERCES_CPP_NAMESPACE_END
|
---|
190 |
|
---|
191 | #endif
|
---|