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

Revision 358, 9.8 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: ListDatatypeValidator.hpp,v 1.13 2004/09/08 13:56:53 peiyongz Exp $
19 * $Log: ListDatatypeValidator.hpp,v $
20 * Revision 1.13  2004/09/08 13:56:53  peiyongz
21 * Apache License Version 2.0
22 *
23 * Revision 1.12  2004/01/29 11:51:22  cargilld
24 * Code cleanup changes to get rid of various compiler diagnostic messages.
25 *
26 * Revision 1.11  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.10  2003/12/17 00:18:39  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.9  2003/11/28 18:53:07  peiyongz
34 * Support for getCanonicalRepresentation
35 *
36 * Revision 1.8  2003/11/12 20:32:03  peiyongz
37 * Statless Grammar: ValidationContext
38 *
39 * Revision 1.7  2003/09/30 21:31:30  peiyongz
40 * Implementation of Serialization/Deserialization
41 *
42 * Revision 1.6  2003/05/15 18:53:26  knoaman
43 * Partial implementation of the configurable memory manager.
44 *
45 * Revision 1.5  2002/12/18 14:17:55  gareth
46 * Fix to bug #13438. When you eant a vector that calls delete[] on its members you should use RefArrayVectorOf.
47 *
48 * Revision 1.4  2002/12/16 22:28:25  knoaman
49 * Make isAtomic inline.
50 *
51 * Revision 1.3  2002/11/20 19:57:44  peiyongz
52 * validate content as a whole against pattern.
53 *
54 * Revision 1.2  2002/11/04 14:53:28  tng
55 * C++ Namespace Support.
56 *
57 * Revision 1.1.1.1  2002/02/01 22:22:42  peiyongz
58 * sane_include
59 *
60 * Revision 1.11  2001/11/22 20:23:20  peiyongz
61 * _declspec(dllimport) and inline warning C4273
62 *
63 * Revision 1.10  2001/11/15 16:08:15  peiyongz
64 * checkContent() made virtual to allow ListDTV participate in the building of
65 * its own (in AbstractStringValidator's init())
66 *
67 * Revision 1.9  2001/10/11 19:32:27  peiyongz
68 * To overwrite inheritFacet()
69 *
70 * Revision 1.8  2001/10/09 20:56:21  peiyongz
71 * inherit from AbstractStringValidator instead of DatatypeValidator to reuse
72 * the code.
73 *
74 * Revision 1.7  2001/08/29 19:03:40  peiyongz
75 * Bugzilla# 2816:on AIX 4.2, xlC 3 r ev.1, Compilation error on inline method
76 *
77 * Revision 1.6  2001/08/24 17:12:01  knoaman
78 * Add support for anySimpleType.
79 * Remove parameter 'baseValidator' from the virtual method 'newInstance'.
80 *
81 * Revision 1.5  2001/08/21 20:05:41  peiyongz
82 * put back changes introduced in 1.3
83 *
84 * Revision 1.3  2001/08/16 14:41:38  knoaman
85 * implementation of virtual methods.
86 *
87 * Revision 1.2  2001/07/24 21:23:40  tng
88 * Schema: Use DatatypeValidator for ID/IDREF/ENTITY/ENTITIES/NOTATION.
89 *
90 * Revision 1.1  2001/07/11 21:37:17  peiyongz
91 * ListDatatypeDTV
92 *
93 */
94
95#if !defined(LIST_DATATYPEVALIDATOR_HPP)
96#define LIST_DATATYPEVALIDATOR_HPP
97
98#include <xercesc/validators/datatype/AbstractStringValidator.hpp>
99#include <xercesc/validators/schema/SchemaSymbols.hpp>
100
101XERCES_CPP_NAMESPACE_BEGIN
102
103class VALIDATORS_EXPORT ListDatatypeValidator : public AbstractStringValidator
104{
105public:
106
107    // -----------------------------------------------------------------------
108    //  Public ctor/dtor
109    // -----------------------------------------------------------------------
110        /** @name Constructors and Destructor */
111    //@{
112
113    ListDatatypeValidator
114    (
115        MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
116    );
117    ListDatatypeValidator
118    (
119        DatatypeValidator* const baseValidator
120        , RefHashTableOf<KVStringPair>* const facets
121        , RefArrayVectorOf<XMLCh>* const enums
122        , const int finalSet
123        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
124    );
125    virtual ~ListDatatypeValidator();
126
127        //@}
128
129    /** @name Getter Functions */
130    //@{
131    /**
132      * Returns whether the type is atomic or not
133      */
134    virtual bool isAtomic() const;
135
136    virtual const XMLCh* getCanonicalRepresentation
137                        (
138                          const XMLCh*         const rawData
139                        ,       MemoryManager* const memMgr = 0
140                        ,       bool                 toValidate = false
141                        ) const;
142
143    //@}
144
145    // -----------------------------------------------------------------------
146    // Validation methods
147    // -----------------------------------------------------------------------
148    /** @name Validation Function */
149    //@{
150
151    /**
152     * validate that a string matches the boolean datatype
153     * @param content A string containing the content to be validated
154     *
155     * @exception throws InvalidDatatypeException if the content is
156     * is not valid.
157     */
158
159        virtual void validate
160                 (
161                  const XMLCh*             const content
162                ,       ValidationContext* const context = 0
163                ,       MemoryManager*     const manager = XMLPlatformUtils::fgMemoryManager
164                  );
165
166    //@}
167
168    // -----------------------------------------------------------------------
169    // Compare methods
170    // -----------------------------------------------------------------------
171    /** @name Compare Function */
172    //@{
173
174    /**
175     * Compare two boolean data types
176     *
177     * @param content1
178     * @param content2
179     * @return
180     */
181    int compare(const XMLCh* const, const XMLCh* const
182        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
183        );
184
185    //@}
186
187    /**
188      * Returns an instance of the base datatype validator class
189          * Used by the DatatypeValidatorFactory.
190      */
191    virtual DatatypeValidator* newInstance
192    (
193        RefHashTableOf<KVStringPair>* const facets
194        , RefArrayVectorOf<XMLCh>* const enums
195        , const int finalSet
196        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
197    );
198
199    DatatypeValidator* getItemTypeDTV() const;
200
201    /***
202     * Support for Serialization/De-serialization
203     ***/
204    DECL_XSERIALIZABLE(ListDatatypeValidator)
205
206protected:
207
208    //
209    // ctor provided to be used by derived classes: No
210    //
211
212    virtual void checkValueSpace(const XMLCh* const content
213                                , MemoryManager* const manager);
214
215    virtual int  getLength(const XMLCh* const content
216            , MemoryManager* const manager) const;
217
218    //
219    // Overwrite AbstractStringValidator's
220    //
221    virtual void inspectFacetBase(MemoryManager* const manager);
222
223    virtual void inheritFacet();
224
225    virtual void checkContent(const XMLCh*             const content
226                            ,       ValidationContext* const context
227                            , bool                           asBase
228                            ,       MemoryManager*     const manager);
229
230private:
231
232    void checkContent(      BaseRefVectorOf<XMLCh>*        tokenVector
233                    , const XMLCh*                  const  content
234                    ,       ValidationContext*      const  context
235                    ,       bool                           asBase
236                    ,       MemoryManager*          const  manager
237                    );
238
239    bool valueSpaceCheck(BaseRefVectorOf<XMLCh>* tokenVector
240                       , const XMLCh*   const enumStr
241                       , MemoryManager* const manager) const;
242
243// -----------------------------------------------------------------------
244// Getter methods
245// -----------------------------------------------------------------------
246
247    inline const XMLCh* const   getContent() const;
248
249// -----------------------------------------------------------------------
250// Setter methods
251// -----------------------------------------------------------------------
252
253    inline void                 setContent(const XMLCh* const content);
254
255    // -----------------------------------------------------------------------
256    //  Unimplemented constructors and operators
257    // -----------------------------------------------------------------------
258    ListDatatypeValidator(const ListDatatypeValidator&);
259    ListDatatypeValidator& operator=(const ListDatatypeValidator&);
260
261    // -----------------------------------------------------------------------
262    //  Private data members
263    //
264    //  fContent
265    //      temporary var referenceing the content to be validated,
266    //      for error reporting purpose.
267    //
268    // -----------------------------------------------------------------------
269     const XMLCh*         fContent;
270};
271
272// -----------------------------------------------------------------------
273// Getter methods
274// -----------------------------------------------------------------------
275inline const XMLCh* const ListDatatypeValidator::getContent() const
276{
277    return fContent;
278}
279
280inline bool ListDatatypeValidator::isAtomic() const
281{
282    return false;
283}
284
285// -----------------------------------------------------------------------
286// Setter methods
287// -----------------------------------------------------------------------
288inline void ListDatatypeValidator::setContent(const XMLCh* const content)
289{
290    fContent = content;
291}
292
293XERCES_CPP_NAMESPACE_END
294
295#endif
296
297/**
298  * End of file ListDatatypeValidator.hpp
299  */
Note: See TracBrowser for help on using the repository browser.