source: icXML/icXML-devel/src/xercesc/validators/datatype/AbstractNumericFacetValidator.hpp @ 2722

Last change on this file since 2722 was 2722, checked in by cameron, 6 years ago

Original Xerces files with import mods for icxercesc

File size: 6.3 KB
Line 
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements.  See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License.  You may obtain a copy of the License at
8 *
9 *      http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18/*
19 * $Id: AbstractNumericFacetValidator.hpp 673155 2008-07-01 17:55:39Z dbertoni $
20 */
21
22#if !defined(XERCESC_INCLUDE_GUARD_ABSTRACT_NUMERIC_FACET_VALIDATOR_HPP)
23#define XERCESC_INCLUDE_GUARD_ABSTRACT_NUMERIC_FACET_VALIDATOR_HPP
24
25#include <xercesc/validators/datatype/DatatypeValidator.hpp>
26#include <xercesc/util/RefArrayVectorOf.hpp>
27#include <xercesc/util/XMLNumber.hpp>
28
29XERCES_CPP_NAMESPACE_BEGIN
30
31class VALIDATORS_EXPORT AbstractNumericFacetValidator : public DatatypeValidator
32{
33public:
34
35    // -----------------------------------------------------------------------
36    //  Public ctor/dtor
37    // -----------------------------------------------------------------------
38        /** @name Constructor. */
39    //@{
40
41    virtual ~AbstractNumericFacetValidator();
42
43        //@}
44
45        virtual const RefArrayVectorOf<XMLCh>* getEnumString() const;
46
47    /***
48     * Support for Serialization/De-serialization
49     ***/
50    DECL_XSERIALIZABLE(AbstractNumericFacetValidator)
51
52protected:
53
54    AbstractNumericFacetValidator
55    (
56        DatatypeValidator* const baseValidator
57        , RefHashTableOf<KVStringPair>* const facets
58        , const int finalSet
59        , const ValidatorType type
60        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
61    );
62
63    void init(RefArrayVectorOf<XMLCh>*  const enums
64        , MemoryManager* const manager);
65
66    //
67    // Abstract interface
68    //
69    virtual void assignAdditionalFacet(const XMLCh* const key
70                                     , const XMLCh* const value
71                                     , MemoryManager* const manager);
72
73    virtual void inheritAdditionalFacet();
74
75    virtual void checkAdditionalFacetConstraints(MemoryManager* const manager) const;
76
77    virtual void checkAdditionalFacetConstraintsBase(MemoryManager* const manager) const;
78
79    virtual int  compareValues(const XMLNumber* const lValue
80                             , const XMLNumber* const rValue) = 0;
81
82    virtual void checkContent(const XMLCh*             const content
83                            ,       ValidationContext* const context
84                            , bool                           asBase
85                            ,       MemoryManager*     const manager) = 0;
86
87// -----------------------------------------------------------------------
88// Setter methods
89// -----------------------------------------------------------------------
90
91    virtual void  setMaxInclusive(const XMLCh* const) = 0;
92
93    virtual void  setMaxExclusive(const XMLCh* const) = 0;
94
95    virtual void  setMinInclusive(const XMLCh* const) = 0;
96
97    virtual void  setMinExclusive(const XMLCh* const) = 0;
98
99    virtual void  setEnumeration(MemoryManager* const manager) = 0;
100
101    static const int INDETERMINATE;
102
103public:
104// -----------------------------------------------------------------------
105// Getter methods
106// -----------------------------------------------------------------------
107
108    inline XMLNumber*                  getMaxInclusive() const;
109
110    inline XMLNumber*                  getMaxExclusive() const;
111
112    inline XMLNumber*                  getMinInclusive() const;
113
114    inline XMLNumber*                  getMinExclusive() const;
115
116    inline RefVectorOf<XMLNumber>*     getEnumeration() const;
117
118protected:
119    // -----------------------------------------------------------------------
120    //  Protected data members
121    //
122    //      Allow access to derived class
123    //
124    // -----------------------------------------------------------------------
125    bool                     fMaxInclusiveInherited;
126    bool                     fMaxExclusiveInherited;
127    bool                     fMinInclusiveInherited;
128    bool                     fMinExclusiveInherited;
129    bool                     fEnumerationInherited;
130
131    XMLNumber*               fMaxInclusive;
132    XMLNumber*               fMaxExclusive;
133    XMLNumber*               fMinInclusive;
134    XMLNumber*               fMinExclusive;
135
136    RefVectorOf<XMLNumber>*  fEnumeration;    // save the actual value
137    RefArrayVectorOf<XMLCh>*      fStrEnumeration;
138
139private:
140
141    void assignFacet(MemoryManager* const manager);
142
143    void inspectFacet(MemoryManager* const manager);
144
145    void inspectFacetBase(MemoryManager* const manager);
146
147    void inheritFacet();
148
149    void storeClusive(XSerializeEngine&
150                    , bool
151                    , XMLNumber*);
152
153    void loadClusive(XSerializeEngine&
154                   , bool&
155                   , XMLNumber*&
156                   , XMLNumber::NumberType
157                   , int );
158
159    // -----------------------------------------------------------------------
160    //  Unimplemented constructors and operators
161    // -----------------------------------------------------------------------
162    AbstractNumericFacetValidator(const AbstractNumericFacetValidator&);
163    AbstractNumericFacetValidator& operator=(const AbstractNumericFacetValidator&);
164};
165
166// -----------------------------------------------------------------------
167// Getter methods
168// -----------------------------------------------------------------------
169
170inline XMLNumber* AbstractNumericFacetValidator::getMaxInclusive() const
171{
172    return fMaxInclusive;
173}
174
175inline XMLNumber* AbstractNumericFacetValidator::getMaxExclusive() const
176{
177    return fMaxExclusive;
178}
179
180inline XMLNumber* AbstractNumericFacetValidator::getMinInclusive() const
181{
182    return fMinInclusive;
183}
184
185inline XMLNumber* AbstractNumericFacetValidator::getMinExclusive() const
186{
187    return fMinExclusive;
188}
189
190inline RefVectorOf<XMLNumber>* AbstractNumericFacetValidator::getEnumeration() const
191{
192    return fEnumeration;
193}
194
195XERCES_CPP_NAMESPACE_END
196
197#endif
198
199/**
200  * End of file AbstractNumericFacetValidator.hpp
201  */
Note: See TracBrowser for help on using the repository browser.