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