1 | /*
|
---|
2 | * Copyright 2002,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: EncodingValidator.hpp,v 1.4 2004/09/08 13:56:21 peiyongz Exp $
|
---|
19 | */
|
---|
20 |
|
---|
21 | #if !defined(ENCODINGVALIDATOR_HPP)
|
---|
22 | #define ENCODINGVALIDATOR_HPP
|
---|
23 |
|
---|
24 | // ---------------------------------------------------------------------------
|
---|
25 | // Includes
|
---|
26 | // ---------------------------------------------------------------------------
|
---|
27 | #include <xercesc/util/ValueHashTableOf.hpp>
|
---|
28 |
|
---|
29 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
30 |
|
---|
31 | /**
|
---|
32 | * A singleton class that checks whether an encoding name is a valid IANA
|
---|
33 | * encoding
|
---|
34 | */
|
---|
35 |
|
---|
36 | class XMLUTIL_EXPORT EncodingValidator {
|
---|
37 |
|
---|
38 | public:
|
---|
39 | // -----------------------------------------------------------------------
|
---|
40 | // Validation methods
|
---|
41 | // -----------------------------------------------------------------------
|
---|
42 | bool isValidEncoding(const XMLCh* const encName);
|
---|
43 |
|
---|
44 | // -----------------------------------------------------------------------
|
---|
45 | // Instance methods
|
---|
46 | // -----------------------------------------------------------------------
|
---|
47 | static EncodingValidator* instance();
|
---|
48 |
|
---|
49 | // -----------------------------------------------------------------------
|
---|
50 | // Notification that lazy data has been deleted
|
---|
51 | // -----------------------------------------------------------------------
|
---|
52 | static void reinitInstance();
|
---|
53 |
|
---|
54 | private:
|
---|
55 | // -----------------------------------------------------------------------
|
---|
56 | // Constructor and destructors
|
---|
57 | // -----------------------------------------------------------------------
|
---|
58 | EncodingValidator();
|
---|
59 | ~EncodingValidator();
|
---|
60 |
|
---|
61 | // -----------------------------------------------------------------------
|
---|
62 | // Private Helpers methods
|
---|
63 | // -----------------------------------------------------------------------
|
---|
64 | /*
|
---|
65 | * Initializes the registry with a set of valid IANA encoding names
|
---|
66 | */
|
---|
67 | void initializeRegistry();
|
---|
68 |
|
---|
69 | // -----------------------------------------------------------------------
|
---|
70 | // Private data members
|
---|
71 | //
|
---|
72 | // fEncodingRegistry
|
---|
73 | // Contains a set of IANA encoding names
|
---|
74 | //
|
---|
75 | // fInstance
|
---|
76 | // An EncodingValidator singleton instance
|
---|
77 | // -----------------------------------------------------------------------
|
---|
78 | ValueHashTableOf<bool>* fEncodingRegistry;
|
---|
79 | static EncodingValidator* fInstance;
|
---|
80 | };
|
---|
81 |
|
---|
82 | XERCES_CPP_NAMESPACE_END
|
---|
83 |
|
---|
84 | #endif
|
---|
85 |
|
---|
86 | /**
|
---|
87 | * End file EncodingValidator.hpp
|
---|
88 | */
|
---|