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

Revision 358, 9.2 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: DecimalDatatypeValidator.hpp,v 1.15 2004/09/08 13:56:52 peiyongz Exp $
19 * $Log: DecimalDatatypeValidator.hpp,v $
20 * Revision 1.15  2004/09/08 13:56:52  peiyongz
21 * Apache License Version 2.0
22 *
23 * Revision 1.14  2004/01/29 11:51:22  cargilld
24 * Code cleanup changes to get rid of various compiler diagnostic messages.
25 *
26 * Revision 1.13  2003/12/23 21:50:36  peiyongz
27 * Absorb exception thrown in getCanonicalRepresentation and return 0,
28 * only validate when required
29 *
30 * Revision 1.11  2003/12/17 00:18:38  cargilld
31 * Update to memory management so that the static memory manager (one used to call Initialize) is only for static data.
32 *
33 * Revision 1.10  2003/11/28 18:53:07  peiyongz
34 * Support for getCanonicalRepresentation
35 *
36 * Revision 1.9  2003/11/12 20:32:03  peiyongz
37 * Statless Grammar: ValidationContext
38 *
39 * Revision 1.8  2003/10/02 19:21:06  peiyongz
40 * Implementation of Serialization/Deserialization
41 *
42 * Revision 1.7  2003/08/14 03:00:11  knoaman
43 * Code refactoring to improve performance of validation.
44 *
45 * Revision 1.6  2003/05/22 02:10:52  knoaman
46 * Default the memory manager.
47 *
48 * Revision 1.5  2003/05/15 18:53:26  knoaman
49 * Partial implementation of the configurable memory manager.
50 *
51 * Revision 1.4  2002/12/18 14:17:55  gareth
52 * Fix to bug #13438. When you eant a vector that calls delete[] on its members you should use RefArrayVectorOf.
53 *
54 * Revision 1.3  2002/11/04 14:53:28  tng
55 * C++ Namespace Support.
56 *
57 * Revision 1.2  2002/10/17 20:49:05  peiyongz
58 * Patch to Bug#13640: Getter methods not public in DecimalDatatypeValidator
59 *
60 * Revision 1.1.1.1  2002/02/01 22:22:41  peiyongz
61 * sane_include
62 *
63 * Revision 1.10  2001/11/22 20:23:20  peiyongz
64 * _declspec(dllimport) and inline warning C4273
65 *
66 * Revision 1.9  2001/10/09 20:52:43  peiyongz
67 * init():removed
68 *
69 * Revision 1.8  2001/10/01 21:04:40  peiyongz
70 * DTV Reorganization:fix to memory leak in compare() method.
71 *
72 * Revision 1.7  2001/10/01 16:16:38  peiyongz
73 * DTV Reorganization:derived from AbstractNumericValidator
74 *
75 */
76
77#if !defined(DECIMAL_DATATYPEVALIDATOR_HPP)
78#define DECIMAL_DATATYPEVALIDATOR_HPP
79
80#include <xercesc/validators/datatype/AbstractNumericValidator.hpp>
81#include <xercesc/util/RefVectorOf.hpp>
82
83XERCES_CPP_NAMESPACE_BEGIN
84
85class XMLBigDecimal;
86
87class VALIDATORS_EXPORT DecimalDatatypeValidator : public AbstractNumericValidator
88{
89public:
90
91    // -----------------------------------------------------------------------
92    //  Public ctor/dtor
93    // -----------------------------------------------------------------------
94        /** @name Constructors and Destructor */
95    //@{
96
97    DecimalDatatypeValidator
98    (
99        MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
100    );
101    DecimalDatatypeValidator
102    (
103        DatatypeValidator* const baseValidator
104        , RefHashTableOf<KVStringPair>* const facets
105        , RefArrayVectorOf<XMLCh>* const enums
106        , const int finalSet
107        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
108    );
109    virtual ~DecimalDatatypeValidator();
110
111        //@}
112
113    // -----------------------------------------------------------------------
114    // Compare methods
115    // -----------------------------------------------------------------------
116    /** @name Compare Function */
117    //@{
118
119    /**
120     * Compare two boolean data types
121     *
122     * @param content1
123     * @param content2
124     * @return
125     */
126    virtual int compare(const XMLCh* const, const XMLCh* const
127        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
128        );
129
130    //@}
131
132    /**
133      * Returns an instance of the base datatype validator class
134          * Used by the DatatypeValidatorFactory.
135      */
136    virtual DatatypeValidator* newInstance
137    (
138        RefHashTableOf<KVStringPair>* const facets
139        , RefArrayVectorOf<XMLCh>* const enums
140        , const int finalSet
141        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
142    );
143
144    virtual const XMLCh* getCanonicalRepresentation
145                        (
146                          const XMLCh*         const rawData
147                        ,       MemoryManager* const memMgr = 0
148                        ,       bool                 toValidate = false
149                        ) const;
150
151    /***
152     * Support for Serialization/De-serialization
153     ***/
154    DECL_XSERIALIZABLE(DecimalDatatypeValidator)
155
156protected:
157
158// -----------------------------------------------------------------------
159// ctor provided to be used by derived classes
160// -----------------------------------------------------------------------
161    DecimalDatatypeValidator
162    (
163        DatatypeValidator* const baseValidator
164        , RefHashTableOf<KVStringPair>* const facets
165        , const int finalSet
166        , const ValidatorType type
167        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
168    );
169
170// -----------------------------------------------------------------------
171// Abstract interface from AbstractNumericFacetValidator
172// -----------------------------------------------------------------------
173
174    virtual void assignAdditionalFacet(const XMLCh* const key
175                                     , const XMLCh* const value
176                                     , MemoryManager* const manager);
177
178    virtual void inheritAdditionalFacet();
179
180    virtual void checkAdditionalFacetConstraints(MemoryManager* const manager) const;
181
182    virtual void checkAdditionalFacetConstraintsBase(MemoryManager* const manager) const;
183
184    virtual int  compareValues(const XMLNumber* const lValue
185                             , const XMLNumber* const rValue);
186
187    virtual void  setMaxInclusive(const XMLCh* const);
188
189    virtual void  setMaxExclusive(const XMLCh* const);
190
191    virtual void  setMinInclusive(const XMLCh* const);
192
193    virtual void  setMinExclusive(const XMLCh* const);
194
195    virtual void  setEnumeration(MemoryManager* const manager);
196
197// -----------------------------------------------------------------------
198// Abstract interface from AbstractNumericValidator
199// -----------------------------------------------------------------------
200
201    virtual void checkContent(const XMLCh*             const content
202                            ,       ValidationContext* const context
203                            , bool                           asBase
204                            ,       MemoryManager*     const manager);
205public:
206
207// -----------------------------------------------------------------------
208// Getter methods
209// -----------------------------------------------------------------------
210
211    inline unsigned int                    getTotalDigits() const;
212
213    inline unsigned int                    getFractionDigits() const;
214
215private:
216// -----------------------------------------------------------------------
217// Setter methods
218// -----------------------------------------------------------------------
219
220    inline void  setTotalDigits(unsigned int);
221
222    inline void  setFractionDigits(unsigned int);
223
224    // -----------------------------------------------------------------------
225    //  Private data members
226    //
227    // -----------------------------------------------------------------------
228    unsigned int         fTotalDigits;
229    unsigned int         fFractionDigits;
230
231
232    // -----------------------------------------------------------------------
233    //  Unimplemented constructors and operators
234    // -----------------------------------------------------------------------
235    DecimalDatatypeValidator(const DecimalDatatypeValidator&);
236    DecimalDatatypeValidator& operator=(const DecimalDatatypeValidator&);
237};
238
239// -----------------------------------------------------------------------
240// Getter methods
241// -----------------------------------------------------------------------
242
243inline unsigned int DecimalDatatypeValidator::getTotalDigits() const
244{
245    return fTotalDigits;
246}
247
248inline unsigned int DecimalDatatypeValidator::getFractionDigits() const
249{
250    return fFractionDigits;
251}
252
253// -----------------------------------------------------------------------
254// Setter methods
255// -----------------------------------------------------------------------
256
257inline void DecimalDatatypeValidator::setTotalDigits(unsigned int newTotalDigits)
258{
259    fTotalDigits = newTotalDigits;
260}
261
262inline void DecimalDatatypeValidator::setFractionDigits(unsigned int newFractionDigits)
263{
264    fFractionDigits = newFractionDigits;
265}
266
267XERCES_CPP_NAMESPACE_END
268
269#endif
270
271/**
272  * End of file DecimalDatatypeValidator.hpp
273  */
Note: See TracBrowser for help on using the repository browser.