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: DoubleDatatypeValidator.hpp 527149 2007-04-10 14:56:39Z amassari $
20  */
21 
22 #if !defined(XERCESC_INCLUDE_GUARD_DOUBLE_DATATYPEVALIDATOR_HPP)
23 #define XERCESC_INCLUDE_GUARD_DOUBLE_DATATYPEVALIDATOR_HPP
24 
25 #include <xercesc/validators/datatype/AbstractNumericValidator.hpp>
26 #include <xercesc/util/RefVectorOf.hpp>
27 #include <xercesc/util/XMLDouble.hpp>
28 
29 XERCES_CPP_NAMESPACE_BEGIN
30 
31 class VALIDATORS_EXPORT DoubleDatatypeValidator : public AbstractNumericValidator
32 {
33 public:
34 
35     // -----------------------------------------------------------------------
36     //  Public ctor/dtor
37     // -----------------------------------------------------------------------
38 	/** @name Constructors and Destructor */
39     //@{
40 
41     DoubleDatatypeValidator
42     (
43         MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
44     );
45     DoubleDatatypeValidator
46     (
47         DatatypeValidator* const baseValidator
48         , RefHashTableOf<KVStringPair>* const facets
49         , RefArrayVectorOf<XMLCh>* const enums
50         , const int finalSet
51         , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
52     );
53     virtual ~DoubleDatatypeValidator();
54 
55 	//@}
56 
57     // -----------------------------------------------------------------------
58     // Compare methods
59     // -----------------------------------------------------------------------
60     /** @name Compare Function */
61     //@{
62 
63     /**
64      * Compare two boolean data types
65      *
66      * @param content1
67      * @param content2
68      * @return
69      */
70     virtual int compare(const XMLCh* const, const XMLCh* const
71         , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
72         );
73 
74     //@}
75 
76     /**
77       * Returns an instance of the base datatype validator class
78 	  * Used by the DatatypeValidatorFactory.
79       */
80     virtual DatatypeValidator* newInstance
81     (
82         RefHashTableOf<KVStringPair>* const facets
83         , RefArrayVectorOf<XMLCh>* const enums
84         , const int finalSet
85         , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
86     );
87 
88     /***
89      * Support for Serialization/De-serialization
90      ***/
91     DECL_XSERIALIZABLE(DoubleDatatypeValidator)
92 
93 protected:
94 
95 // -----------------------------------------------------------------------
96 // ctor provided to be used by derived classes
97 // -----------------------------------------------------------------------
98     DoubleDatatypeValidator
99     (
100         DatatypeValidator* const baseValidator
101         , RefHashTableOf<KVStringPair>* const facets
102         , const int finalSet
103         , const ValidatorType type
104         , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
105     );
106 
107 // -----------------------------------------------------------------------
108 // Abstract interface from AbstractNumericFacetValidator
109 // -----------------------------------------------------------------------
110 
111     virtual int  compareValues(const XMLNumber* const lValue
112                              , const XMLNumber* const rValue);
113 
114     virtual void  setMaxInclusive(const XMLCh* const);
115 
116     virtual void  setMaxExclusive(const XMLCh* const);
117 
118     virtual void  setMinInclusive(const XMLCh* const);
119 
120     virtual void  setMinExclusive(const XMLCh* const);
121 
122     virtual void  setEnumeration(MemoryManager* const manager);
123 
124 // -----------------------------------------------------------------------
125 // Abstract interface from AbstractNumericValidator
126 // -----------------------------------------------------------------------
127 
128     virtual void checkContent(const XMLCh*             const content
129                             ,       ValidationContext* const context
130                             , bool                           asBase
131                             ,       MemoryManager*     const manager);
132 private:
133     // -----------------------------------------------------------------------
134     // Unimplemented constructors and operators
135     // -----------------------------------------------------------------------
136     DoubleDatatypeValidator(const DoubleDatatypeValidator &);
137     DoubleDatatypeValidator& operator = (const  DoubleDatatypeValidator&);
138 };
139 
140 XERCES_CPP_NAMESPACE_END
141 
142 #endif
143 
144 /**
145   * End of file DoubleDatatypeValidator.hpp
146   */
147