source: NonGTP/Xerces/xerces/include/xercesc/validators/schema/XercesGroupInfo.hpp @ 358

Revision 358, 6.4 KB checked in by bittner, 19 years ago (diff)

xerces added

Line 
1/*
2 * Copyright 2001,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 * $Id: XercesGroupInfo.hpp,v 1.9 2004/09/08 13:56:58 peiyongz Exp $
19 */
20
21#if !defined(XERCESGROUPINFO_HPP)
22#define XERCESGROUPINFO_HPP
23
24
25/**
26  * The class act as a place holder to store group information.
27  *
28  * The class is intended for internal use.
29  */
30
31// ---------------------------------------------------------------------------
32//  Includes
33// ---------------------------------------------------------------------------
34#include <xercesc/util/RefVectorOf.hpp>
35#include <xercesc/validators/schema/SchemaElementDecl.hpp>
36
37#include <xercesc/internal/XSerializable.hpp>
38
39XERCES_CPP_NAMESPACE_BEGIN
40
41// ---------------------------------------------------------------------------
42//  Forward Declarations
43// ---------------------------------------------------------------------------
44class ContentSpecNode;
45class XSDLocator;
46
47
48class VALIDATORS_EXPORT XercesGroupInfo : public XSerializable, public XMemory
49{
50public:
51    // -----------------------------------------------------------------------
52    //  Public Constructors/Destructor
53    // -----------------------------------------------------------------------
54    XercesGroupInfo
55    (
56        unsigned int groupNameId
57        , unsigned int groupNamespaceId
58        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
59    );
60    ~XercesGroupInfo();
61
62    // -----------------------------------------------------------------------
63    //  Getter methods
64    // -----------------------------------------------------------------------
65    bool                     getCheckElementConsistency() const;
66    int                      getScope() const;
67    unsigned int             elementCount() const;
68    ContentSpecNode*         getContentSpec() const;
69    SchemaElementDecl*       elementAt(const unsigned int index);
70    const SchemaElementDecl* elementAt(const unsigned int index) const;
71    XSDLocator*              getLocator() const;
72    XercesGroupInfo*         getBaseGroup() const;
73    unsigned int             getNameId() const;
74    unsigned int             getNamespaceId() const;
75
76        // -----------------------------------------------------------------------
77    //  Setter methods
78    // -----------------------------------------------------------------------
79    void setScope(const int other);
80    void setContentSpec(ContentSpecNode* const other);
81    void addElement(SchemaElementDecl* const toAdd);
82    void setLocator(XSDLocator* const aLocator);
83    void setBaseGroup(XercesGroupInfo* const baseGroup);
84    void setCheckElementConsistency(const bool aValue);
85
86    /***
87     * Support for Serialization/De-serialization
88     ***/
89    DECL_XSERIALIZABLE(XercesGroupInfo)
90    XercesGroupInfo(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
91
92private:
93    // -----------------------------------------------------------------------
94    //  Unimplemented contstructors and operators
95    // -----------------------------------------------------------------------
96    XercesGroupInfo(const XercesGroupInfo& elemInfo);
97    XercesGroupInfo& operator= (const XercesGroupInfo& other);
98
99    // -----------------------------------------------------------------------
100    //  Private data members
101    // -----------------------------------------------------------------------
102    bool                            fCheckElementConsistency;
103    int                             fScope;
104    unsigned int                    fNameId;
105    unsigned int                    fNamespaceId;
106    ContentSpecNode*                fContentSpec;
107    RefVectorOf<SchemaElementDecl>* fElements;
108    XercesGroupInfo*                fBaseGroup; // redefine by restriction
109    XSDLocator*                     fLocator;
110};
111
112// ---------------------------------------------------------------------------
113//  XercesGroupInfo: Getter methods
114// ---------------------------------------------------------------------------
115inline int XercesGroupInfo::getScope() const {
116
117    return fScope;
118}
119
120inline unsigned int XercesGroupInfo::elementCount() const {
121
122    return fElements->size();
123}
124
125inline ContentSpecNode* XercesGroupInfo::getContentSpec() const {
126
127    return fContentSpec;
128}
129
130inline SchemaElementDecl*
131XercesGroupInfo::elementAt(const unsigned int index) {
132
133    return fElements->elementAt(index);
134}
135
136inline const SchemaElementDecl*
137XercesGroupInfo::elementAt(const unsigned int index) const {
138
139    return fElements->elementAt(index);
140}
141
142inline XSDLocator* XercesGroupInfo::getLocator() const {
143
144    return fLocator;
145}
146
147inline XercesGroupInfo* XercesGroupInfo::getBaseGroup() const {
148
149    return fBaseGroup;
150}
151
152inline bool XercesGroupInfo::getCheckElementConsistency() const {
153
154    return fCheckElementConsistency;
155}
156
157inline unsigned int XercesGroupInfo::getNameId() const
158{
159    return fNameId;
160}
161
162inline unsigned int XercesGroupInfo::getNamespaceId() const
163{
164    return fNamespaceId;
165}
166
167// ---------------------------------------------------------------------------
168//  XercesGroupInfo: Setter methods
169// ---------------------------------------------------------------------------}
170inline void XercesGroupInfo::setScope(const int other) {
171
172    fScope = other;
173}
174
175inline void XercesGroupInfo::setContentSpec(ContentSpecNode* const other) {
176
177    fContentSpec = other;
178}
179
180inline void XercesGroupInfo::addElement(SchemaElementDecl* const elem) {
181
182    if (!fElements->containsElement(elem))
183        fElements->addElement(elem);
184}
185
186inline void XercesGroupInfo::setBaseGroup(XercesGroupInfo* const baseGroup) {
187
188    fBaseGroup = baseGroup;
189}
190
191inline void XercesGroupInfo::setCheckElementConsistency(const bool aValue) {
192
193    fCheckElementConsistency = aValue;
194}
195
196XERCES_CPP_NAMESPACE_END
197
198#endif
199
200/**
201  * End of file XercesGroupInfo.hpp
202  */
203
Note: See TracBrowser for help on using the repository browser.