source: obsolete/tags/VUT/0.4/GtpVisibilityPreprocessor/support/xerces/include/xercesc/validators/datatype/AbstractNumericFacetValidator.hpp @ 358

Revision 358, 8.1 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: AbstractNumericFacetValidator.hpp,v 1.13 2004/09/08 13:56:52 peiyongz Exp $
19 * $Log: AbstractNumericFacetValidator.hpp,v $
20 * Revision 1.13  2004/09/08 13:56:52  peiyongz
21 * Apache License Version 2.0
22 *
23 * Revision 1.12  2004/03/19 01:18:08  peiyongz
24 * Let base dv to store/load (Max,Min)(Inc,Exc)sives
25 *
26 * Revision 1.11  2004/01/29 11:51:22  cargilld
27 * Code cleanup changes to get rid of various compiler diagnostic messages.
28 *
29 * Revision 1.10  2003/12/17 00:18:38  cargilld
30 * Update to memory management so that the static memory manager (one used to call Initialize) is only for static data.
31 *
32 * Revision 1.9  2003/11/12 20:32:03  peiyongz
33 * Statless Grammar: ValidationContext
34 *
35 * Revision 1.8  2003/10/17 21:13:24  peiyongz
36 * loadNumber() moved to XMLNumber
37 *
38 * Revision 1.7  2003/10/02 19:21:06  peiyongz
39 * Implementation of Serialization/Deserialization
40 *
41 * Revision 1.6  2003/05/15 18:53:26  knoaman
42 * Partial implementation of the configurable memory manager.
43 *
44 * Revision 1.5  2002/12/18 14:17:55  gareth
45 * Fix to bug #13438. When you eant a vector that calls delete[] on its members you should use RefArrayVectorOf.
46 *
47 * Revision 1.4  2002/11/04 14:53:27  tng
48 * C++ Namespace Support.
49 *
50 * Revision 1.3  2002/10/18 16:52:14  peiyongz
51 * Patch to Bug#13640: Getter methods not public in
52 *                                    DecimalDatatypeValidator
53 *
54 * Revision 1.2  2002/02/14 15:17:31  peiyongz
55 * getEnumString()
56 *
57 * Revision 1.1.1.1  2002/02/01 22:22:39  peiyongz
58 * sane_include
59 *
60 * Revision 1.3  2001/11/22 20:23:20  peiyongz
61 * _declspec(dllimport) and inline warning C4273
62 *
63 * Revision 1.2  2001/11/12 20:37:57  peiyongz
64 * SchemaDateTimeException defined
65 *
66 * Revision 1.1  2001/10/01 16:13:56  peiyongz
67 * DTV Reorganization:new classes: AbstractNumericFactValidator/ AbstractNumericValidator
68 *
69 */
70
71#if !defined(ABSTRACT_NUMERIC_FACET_VALIDATOR_HPP)
72#define ABSTRACT_NUMERIC_FACET_VALIDATOR_HPP
73
74#include <xercesc/validators/datatype/DatatypeValidator.hpp>
75#include <xercesc/util/RefArrayVectorOf.hpp>
76#include <xercesc/util/XMLNumber.hpp>
77
78XERCES_CPP_NAMESPACE_BEGIN
79
80class VALIDATORS_EXPORT AbstractNumericFacetValidator : public DatatypeValidator
81{
82public:
83
84    // -----------------------------------------------------------------------
85    //  Public ctor/dtor
86    // -----------------------------------------------------------------------
87        /** @name Constructor. */
88    //@{
89
90    virtual ~AbstractNumericFacetValidator();
91
92        //@}
93
94        virtual const RefArrayVectorOf<XMLCh>* getEnumString() const;
95
96    /***
97     * Support for Serialization/De-serialization
98     ***/
99    DECL_XSERIALIZABLE(AbstractNumericFacetValidator)
100
101protected:
102
103    AbstractNumericFacetValidator
104    (
105        DatatypeValidator* const baseValidator
106        , RefHashTableOf<KVStringPair>* const facets
107        , const int finalSet
108        , const ValidatorType type
109        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
110    );
111
112    void init(RefArrayVectorOf<XMLCh>*  const enums
113        , MemoryManager* const manager);
114
115    //
116    // Abstract interface
117    //
118    virtual void assignAdditionalFacet(const XMLCh* const key
119                                     , const XMLCh* const value
120                                     , MemoryManager* const manager);
121
122    virtual void inheritAdditionalFacet();
123
124    virtual void checkAdditionalFacetConstraints(MemoryManager* const manager) const;
125
126    virtual void checkAdditionalFacetConstraintsBase(MemoryManager* const manager) const;
127
128    virtual int  compareValues(const XMLNumber* const lValue
129                             , const XMLNumber* const rValue) = 0;
130
131    virtual void checkContent(const XMLCh*             const content
132                            ,       ValidationContext* const context
133                            , bool                           asBase
134                            ,       MemoryManager*     const manager) = 0;
135
136// -----------------------------------------------------------------------
137// Setter methods
138// -----------------------------------------------------------------------
139
140    virtual void  setMaxInclusive(const XMLCh* const) = 0;
141
142    virtual void  setMaxExclusive(const XMLCh* const) = 0;
143
144    virtual void  setMinInclusive(const XMLCh* const) = 0;
145
146    virtual void  setMinExclusive(const XMLCh* const) = 0;
147
148    virtual void  setEnumeration(MemoryManager* const manager) = 0;
149
150    static const int INDETERMINATE;
151
152public:
153// -----------------------------------------------------------------------
154// Getter methods
155// -----------------------------------------------------------------------
156
157    inline XMLNumber* const            getMaxInclusive() const;
158
159    inline XMLNumber* const            getMaxExclusive() const;
160
161    inline XMLNumber* const            getMinInclusive() const;
162
163    inline XMLNumber* const            getMinExclusive() const;
164
165    inline RefVectorOf<XMLNumber>*     getEnumeration() const;
166
167protected:
168    // -----------------------------------------------------------------------
169    //  Protected data members
170    //
171    //      Allow access to derived class
172    //
173    // -----------------------------------------------------------------------
174    bool                     fMaxInclusiveInherited;
175    bool                     fMaxExclusiveInherited;
176    bool                     fMinInclusiveInherited;
177    bool                     fMinExclusiveInherited;
178    bool                     fEnumerationInherited;
179
180    XMLNumber*               fMaxInclusive;
181    XMLNumber*               fMaxExclusive;
182    XMLNumber*               fMinInclusive;
183    XMLNumber*               fMinExclusive;
184
185    RefVectorOf<XMLNumber>*  fEnumeration;    // save the actual value
186    RefArrayVectorOf<XMLCh>*      fStrEnumeration;
187
188private:
189
190    void assignFacet(MemoryManager* const manager);
191
192    void inspectFacet(MemoryManager* const manager);
193
194    void inspectFacetBase(MemoryManager* const manager);
195
196    void inheritFacet();
197
198    void storeClusive(XSerializeEngine&
199                    , bool
200                    , XMLNumber*);
201
202    void loadClusive(XSerializeEngine&
203                   , bool&
204                   , XMLNumber*&
205                   , XMLNumber::NumberType
206                   , int );
207
208    // -----------------------------------------------------------------------
209    //  Unimplemented constructors and operators
210    // -----------------------------------------------------------------------
211    AbstractNumericFacetValidator(const AbstractNumericFacetValidator&);
212    AbstractNumericFacetValidator& operator=(const AbstractNumericFacetValidator&);
213};
214
215// -----------------------------------------------------------------------
216// Getter methods
217// -----------------------------------------------------------------------
218
219inline XMLNumber* const AbstractNumericFacetValidator::getMaxInclusive() const
220{
221    return fMaxInclusive;
222}
223
224inline XMLNumber* const AbstractNumericFacetValidator::getMaxExclusive() const
225{
226    return fMaxExclusive;
227}
228
229inline XMLNumber* const AbstractNumericFacetValidator::getMinInclusive() const
230{
231    return fMinInclusive;
232}
233
234inline XMLNumber* const AbstractNumericFacetValidator::getMinExclusive() const
235{
236    return fMinExclusive;
237}
238
239inline RefVectorOf<XMLNumber>* AbstractNumericFacetValidator::getEnumeration() const
240{
241    return fEnumeration;
242}
243
244XERCES_CPP_NAMESPACE_END
245
246#endif
247
248/**
249  * End of file AbstractNumericFacetValidator.hpp
250  */
Note: See TracBrowser for help on using the repository browser.