source: NonGTP/Xerces/xerces-c_2_8_0/include/xercesc/validators/datatype/AnySimpleTypeDatatypeValidator.hpp @ 2674

Revision 2674, 5.9 KB checked in by mattausch, 16 years ago (diff)
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: AnySimpleTypeDatatypeValidator.hpp 568078 2007-08-21 11:43:25Z amassari $
20 */
21
22#if !defined(ANYSIMPLETYPEDATATYPEVALIDATOR_HPP)
23#define ANYSIMPLETYPEDATATYPEVALIDATOR_HPP
24
25#include <xercesc/validators/datatype/DatatypeValidator.hpp>
26
27XERCES_CPP_NAMESPACE_BEGIN
28
29class VALIDATORS_EXPORT AnySimpleTypeDatatypeValidator : public DatatypeValidator
30{
31public:
32    // -----------------------------------------------------------------------
33    //  Public Constructor
34    // -----------------------------------------------------------------------
35        /** @name Constructor */
36    //@{
37
38    AnySimpleTypeDatatypeValidator
39    (
40        MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
41    );
42
43        //@}
44
45    // -----------------------------------------------------------------------
46    //  Public Destructor
47    // -----------------------------------------------------------------------
48        /** @name Destructor. */
49    //@{
50
51    virtual ~AnySimpleTypeDatatypeValidator();
52
53        //@}
54
55        virtual const RefArrayVectorOf<XMLCh>* getEnumString() const;
56
57    // -----------------------------------------------------------------------
58    // Getter methods
59    // -----------------------------------------------------------------------
60    /** @name Getter Functions */
61    //@{
62
63    /**
64      * Returns whether the type is atomic or not
65      */
66    virtual bool isAtomic() const;
67
68    //@}
69
70    // -----------------------------------------------------------------------
71    // Validation methods
72    // -----------------------------------------------------------------------
73    /** @name Validation Function */
74    //@{
75
76     /**
77           * Checks that the "content" string is valid datatype.
78       * If invalid, a Datatype validation exception is thrown.
79           *
80           * @param  content   A string containing the content to be validated
81           *
82           */
83        virtual void validate
84                 (
85                  const XMLCh*             const content
86                ,       ValidationContext* const context = 0
87                ,       MemoryManager*     const manager = XMLPlatformUtils::fgMemoryManager
88                  );
89
90    /**
91      * Checks whether a given type can be used as a substitute
92      *
93      * @param  toCheck    A datatype validator of the type to be used as a
94      *                    substitute
95      *
96      */
97
98    bool isSubstitutableBy(const DatatypeValidator* const toCheck);
99
100         //@}
101
102    // -----------------------------------------------------------------------
103    // Compare methods
104    // -----------------------------------------------------------------------
105    /** @name Compare Function */
106    //@{
107
108    /**
109      * Compares content in the Domain value vs. lexical value.
110      *
111      * @param  value1    string to compare
112      *
113      * @param  value2    string to compare
114      *
115      */
116    int compare(const XMLCh* const value1, const XMLCh* const value2
117        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
118        );
119
120    //@}
121
122    /**
123      * Returns an instance of the base datatype validator class
124          * Used by the DatatypeValidatorFactory.
125      */
126        virtual DatatypeValidator* newInstance
127    (
128        RefHashTableOf<KVStringPair>* const facets
129        , RefArrayVectorOf<XMLCh>* const enums
130        , const int finalSet
131        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
132    );
133
134    /***
135     * Support for Serialization/De-serialization
136     ***/
137    DECL_XSERIALIZABLE(AnySimpleTypeDatatypeValidator)
138
139private:
140    // -----------------------------------------------------------------------
141    //  Unimplemented constructors and operators
142    // -----------------------------------------------------------------------
143    AnySimpleTypeDatatypeValidator(const AnySimpleTypeDatatypeValidator&);
144    AnySimpleTypeDatatypeValidator& operator=(const AnySimpleTypeDatatypeValidator&);
145};
146
147
148// ---------------------------------------------------------------------------
149//  DatatypeValidator: Getters
150// ---------------------------------------------------------------------------
151inline bool AnySimpleTypeDatatypeValidator::isAtomic() const {
152
153    return false;
154}
155
156
157// ---------------------------------------------------------------------------
158//  DatatypeValidators: Compare methods
159// ---------------------------------------------------------------------------
160inline int AnySimpleTypeDatatypeValidator::compare(const XMLCh* const,
161                                                   const XMLCh* const
162                                                   , MemoryManager* const)
163{
164    return -1;
165}
166
167// ---------------------------------------------------------------------------
168//  DatatypeValidators: Validation methods
169// ---------------------------------------------------------------------------
170inline bool
171AnySimpleTypeDatatypeValidator::isSubstitutableBy(const DatatypeValidator* const)
172{
173    return true;
174}
175
176inline void
177AnySimpleTypeDatatypeValidator::validate(const XMLCh*             const
178                                       ,       ValidationContext* const
179                                       ,       MemoryManager*     const)
180{
181    return;
182}
183
184XERCES_CPP_NAMESPACE_END
185
186#endif
187
188/**
189  * End of file AnySimpleTypeDatatypeValidator.hpp
190  */
191
Note: See TracBrowser for help on using the repository browser.