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: XSAttributeUse.hpp,v $
|
---|
19 | * Revision 1.9 2004/09/08 13:56:08 peiyongz
|
---|
20 | * Apache License Version 2.0
|
---|
21 | *
|
---|
22 | * Revision 1.8 2004/09/02 19:08:09 cargilld
|
---|
23 | * Fix API Doc warning message
|
---|
24 | *
|
---|
25 | * Revision 1.7 2003/12/19 23:02:43 cargilld
|
---|
26 | * Fix compiler messages on OS390.
|
---|
27 | *
|
---|
28 | * Revision 1.6 2003/12/17 20:50:34 knoaman
|
---|
29 | * PSVI: fix for annotation of attributes in attributeGroup/derived types
|
---|
30 | *
|
---|
31 | * Revision 1.5 2003/11/21 17:19:30 knoaman
|
---|
32 | * PSVI update.
|
---|
33 | *
|
---|
34 | * Revision 1.4 2003/11/14 22:47:53 neilg
|
---|
35 | * fix bogus log message from previous commit...
|
---|
36 | *
|
---|
37 | * Revision 1.3 2003/11/14 22:33:30 neilg
|
---|
38 | * Second phase of schema component model implementation.
|
---|
39 | * Implement XSModel, XSNamespaceItem, and the plumbing necessary
|
---|
40 | * to connect them to the other components.
|
---|
41 | * Thanks to David Cargill.
|
---|
42 | *
|
---|
43 | * Revision 1.2 2003/11/06 15:30:04 neilg
|
---|
44 | * 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.
|
---|
45 | *
|
---|
46 | * Revision 1.1 2003/09/16 14:33:36 neilg
|
---|
47 | * PSVI/schema component model classes, with Makefile/configuration changes necessary to build them
|
---|
48 | *
|
---|
49 | */
|
---|
50 |
|
---|
51 | #if !defined(XSATTRIBUTEUSE_HPP)
|
---|
52 | #define XSATTRIBUTEUSE_HPP
|
---|
53 |
|
---|
54 | #include <xercesc/framework/psvi/XSObject.hpp>
|
---|
55 |
|
---|
56 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
57 |
|
---|
58 | /**
|
---|
59 | * This class describes all properties of a Schema Attribute
|
---|
60 | * Use component.
|
---|
61 | * This is *always* owned by the validator /parser object from which
|
---|
62 | * it is obtained.
|
---|
63 | */
|
---|
64 |
|
---|
65 | // forward declarations
|
---|
66 | class XSAttributeDeclaration;
|
---|
67 |
|
---|
68 | class XMLPARSER_EXPORT XSAttributeUse : public XSObject
|
---|
69 | {
|
---|
70 | public:
|
---|
71 |
|
---|
72 | // Constructors and Destructor
|
---|
73 | // -----------------------------------------------------------------------
|
---|
74 | /** @name Constructors */
|
---|
75 | //@{
|
---|
76 |
|
---|
77 | /**
|
---|
78 | * The default constructor
|
---|
79 | * @param xsAttDecl
|
---|
80 | * @param xsModel
|
---|
81 | * @param manager The configurable memory manager
|
---|
82 | */
|
---|
83 | XSAttributeUse
|
---|
84 | (
|
---|
85 | XSAttributeDeclaration* const xsAttDecl,
|
---|
86 | XSModel* const xsModel,
|
---|
87 | MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
88 | );
|
---|
89 |
|
---|
90 | //@};
|
---|
91 |
|
---|
92 | /** @name Destructor */
|
---|
93 | //@{
|
---|
94 | ~XSAttributeUse();
|
---|
95 | //@}
|
---|
96 |
|
---|
97 | //---------------------
|
---|
98 | /** @name XSAttributeUse methods */
|
---|
99 |
|
---|
100 | //@{
|
---|
101 |
|
---|
102 | /**
|
---|
103 | * [required]: determines whether this use of an attribute declaration
|
---|
104 | * requires an appropriate attribute information item to be present, or
|
---|
105 | * merely allows it.
|
---|
106 | */
|
---|
107 | bool getRequired() const;
|
---|
108 |
|
---|
109 | /**
|
---|
110 | * [attribute declaration]: provides the attribute declaration itself,
|
---|
111 | * which will in turn determine the simple type definition used.
|
---|
112 | */
|
---|
113 | XSAttributeDeclaration *getAttrDeclaration() const;
|
---|
114 |
|
---|
115 | /**
|
---|
116 | * Value Constraint: one of default, fixed.
|
---|
117 | */
|
---|
118 | XSConstants::VALUE_CONSTRAINT getConstraintType() const;
|
---|
119 |
|
---|
120 | /**
|
---|
121 | * Value Constraint: The actual value.
|
---|
122 | */
|
---|
123 | const XMLCh *getConstraintValue();
|
---|
124 |
|
---|
125 | //@}
|
---|
126 |
|
---|
127 | //----------------------------------
|
---|
128 | /** methods needed by implementation */
|
---|
129 |
|
---|
130 | //@{
|
---|
131 |
|
---|
132 | //@}
|
---|
133 |
|
---|
134 | private:
|
---|
135 |
|
---|
136 | // set data
|
---|
137 | void set
|
---|
138 | (
|
---|
139 | const bool isRequired
|
---|
140 | , XSConstants::VALUE_CONSTRAINT constraintType
|
---|
141 | , const XMLCh* const constraintValue
|
---|
142 | );
|
---|
143 |
|
---|
144 | friend class XSObjectFactory;
|
---|
145 |
|
---|
146 | // -----------------------------------------------------------------------
|
---|
147 | // Unimplemented constructors and operators
|
---|
148 | // -----------------------------------------------------------------------
|
---|
149 | XSAttributeUse(const XSAttributeUse&);
|
---|
150 | XSAttributeUse & operator=(const XSAttributeUse &);
|
---|
151 |
|
---|
152 | protected:
|
---|
153 |
|
---|
154 | // -----------------------------------------------------------------------
|
---|
155 | // data members
|
---|
156 | // -----------------------------------------------------------------------
|
---|
157 | bool fRequired;
|
---|
158 | XSConstants::VALUE_CONSTRAINT fConstraintType;
|
---|
159 | const XMLCh* fConstraintValue;
|
---|
160 | XSAttributeDeclaration* fXSAttributeDeclaration;
|
---|
161 | };
|
---|
162 |
|
---|
163 | inline XSAttributeDeclaration *XSAttributeUse::getAttrDeclaration() const
|
---|
164 | {
|
---|
165 | return fXSAttributeDeclaration;
|
---|
166 | }
|
---|
167 |
|
---|
168 | inline bool XSAttributeUse::getRequired() const
|
---|
169 | {
|
---|
170 | return fRequired;
|
---|
171 | }
|
---|
172 |
|
---|
173 | inline XSConstants::VALUE_CONSTRAINT XSAttributeUse::getConstraintType() const
|
---|
174 | {
|
---|
175 | return fConstraintType;
|
---|
176 | }
|
---|
177 |
|
---|
178 | const inline XMLCh *XSAttributeUse::getConstraintValue()
|
---|
179 | {
|
---|
180 | return fConstraintValue;
|
---|
181 | }
|
---|
182 |
|
---|
183 | XERCES_CPP_NAMESPACE_END
|
---|
184 |
|
---|
185 | #endif
|
---|