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: XSDErrorReporter.hpp,v 1.8 2004/09/08 13:56:57 peiyongz Exp $
|
---|
19 | */
|
---|
20 |
|
---|
21 |
|
---|
22 | #if !defined(XSDERRORREPORTER_HPP)
|
---|
23 | #define XSDERRORREPORTER_HPP
|
---|
24 |
|
---|
25 | #include <xercesc/util/XMemory.hpp>
|
---|
26 |
|
---|
27 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
28 |
|
---|
29 | class Locator;
|
---|
30 | class XMLErrorReporter;
|
---|
31 |
|
---|
32 |
|
---|
33 | /**
|
---|
34 | * This class reports schema errors
|
---|
35 | */
|
---|
36 | class VALIDATORS_EXPORT XSDErrorReporter : public XMemory
|
---|
37 | {
|
---|
38 | public:
|
---|
39 | // -----------------------------------------------------------------------
|
---|
40 | // Constructors are hidden, only the virtual destructor is exposed
|
---|
41 | // -----------------------------------------------------------------------
|
---|
42 | XSDErrorReporter(XMLErrorReporter* const errorReporter = 0);
|
---|
43 |
|
---|
44 | virtual ~XSDErrorReporter()
|
---|
45 | {
|
---|
46 | }
|
---|
47 |
|
---|
48 | // -----------------------------------------------------------------------
|
---|
49 | // Getter methods
|
---|
50 | // -----------------------------------------------------------------------
|
---|
51 | bool getExitOnFirstFatal() const;
|
---|
52 |
|
---|
53 | // -----------------------------------------------------------------------
|
---|
54 | // Setter methods
|
---|
55 | // -----------------------------------------------------------------------
|
---|
56 | void setErrorReporter(XMLErrorReporter* const errorReporter);
|
---|
57 | void setExitOnFirstFatal(const bool newValue);
|
---|
58 |
|
---|
59 | // -----------------------------------------------------------------------
|
---|
60 | // Report error methods
|
---|
61 | // -----------------------------------------------------------------------
|
---|
62 | void emitError(const unsigned int toEmit,
|
---|
63 | const XMLCh* const msgDomain,
|
---|
64 | const Locator* const aLocator);
|
---|
65 | void emitError(const unsigned int toEmit,
|
---|
66 | const XMLCh* const msgDomain,
|
---|
67 | const Locator* const aLocator,
|
---|
68 | const XMLCh* const text1,
|
---|
69 | const XMLCh* const text2 = 0,
|
---|
70 | const XMLCh* const text3 = 0,
|
---|
71 | const XMLCh* const text4 = 0,
|
---|
72 | MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
73 | );
|
---|
74 |
|
---|
75 | private:
|
---|
76 | // -----------------------------------------------------------------------
|
---|
77 | // Unimplemented constructors and destructor
|
---|
78 | // -----------------------------------------------------------------------
|
---|
79 | XSDErrorReporter(const XSDErrorReporter&);
|
---|
80 | XSDErrorReporter& operator=(const XSDErrorReporter&);
|
---|
81 |
|
---|
82 | // -----------------------------------------------------------------------
|
---|
83 | // Private data members
|
---|
84 | // -----------------------------------------------------------------------
|
---|
85 | bool fExitOnFirstFatal;
|
---|
86 | XMLErrorReporter* fErrorReporter;
|
---|
87 | };
|
---|
88 |
|
---|
89 |
|
---|
90 | // ---------------------------------------------------------------------------
|
---|
91 | // XSDErrorReporter: Getter methods
|
---|
92 | // ---------------------------------------------------------------------------
|
---|
93 | inline bool XSDErrorReporter::getExitOnFirstFatal() const
|
---|
94 | {
|
---|
95 | return fExitOnFirstFatal;
|
---|
96 | }
|
---|
97 |
|
---|
98 | // ---------------------------------------------------------------------------
|
---|
99 | // XSDErrorReporter: Setter methods
|
---|
100 | // ---------------------------------------------------------------------------
|
---|
101 | inline void XSDErrorReporter::setExitOnFirstFatal(const bool newValue)
|
---|
102 | {
|
---|
103 | fExitOnFirstFatal = newValue;
|
---|
104 | }
|
---|
105 |
|
---|
106 | inline void XSDErrorReporter::setErrorReporter(XMLErrorReporter* const errorReporter)
|
---|
107 | {
|
---|
108 | fErrorReporter = errorReporter;
|
---|
109 | }
|
---|
110 |
|
---|
111 | XERCES_CPP_NAMESPACE_END
|
---|
112 |
|
---|
113 | #endif
|
---|