Xalan-C++ API Reference 1.12.0
ProblemListenerBase.hpp
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18#if !defined(XALAN_PROBLEMLISTENERBASE_HEADER_GUARD)
19#define XALAN_PROBLEMLISTENERBASE_HEADER_GUARD
20
21
22
23// Base include file. Must be first.
25
26
27
28#include "LocalMsgIndex.hpp"
29
30
31
32namespace XERCES_CPP_NAMESPACE
33{
34 class Locator;
35}
36
37
38
39namespace XALAN_CPP_NAMESPACE {
40
41
42
43using xercesc::Locator;
44
45
46class XalanDOMString;
47class XalanNode;
48class PrintWriter;
49
50
51
52/**
53 * This is the abstract class that is used when reporting a problem
54 * some kind, that requires a message, an error or a warning.
55 */
57{
58public:
59
60 // Sources of problem. The upper case versions
61 // of these enums are deprecated.
62 enum eSource { eXMLPARSER = 0,
63 eXMLParser = 0,
64 eXSLPROCESSOR = 1,
65 eXSLTProcessor = 1,
66 eXPATH = 2,
67 eXPath = 2,
68 eSourceCount };
69
70 // A typedef for compatibility.
72
73 // Severity of problem. The upper case versions
74 // of these enums are deprecated.
75 enum eClassification { eMESSAGE = 0,
76 eMessage = 0,
77 eWARNING = 1,
78 eWarning = 1,
79 eERROR = 2,
80 eError = 2,
81 eClassificationCount };
82
84
85 virtual
87
88 /**
89 * Function that is called when a problem event occurs.
90 *
91 * @param source Either eXMLParser, eXSLProcessor, or eXPATH.
92 * @param classification Either eMessage, eWarning, or eError.
93 * @param locator The current Locator instance for the stylesheet. Maybe be a null pointer.
94 * @param sourceNode The current source node, if any.
95 * @param msg The error message.
96 */
97 virtual void
99 eSource source,
101 const XalanDOMString& msg,
102 const Locator* locator,
103 const XalanNode* sourceNode) = 0;
104
105 /**
106 * Function that is called when a problem event occurs. This version
107 * assumes location information is already formatted into the message.
108 *
109 * @param source either eXMLPARSER, eXSLPROCESSOR, or eXPATH
110 * @param classification either eMESSAGE, eERROR or eWARNING
111 * @param msg string message explaining the problem.
112 */
113 virtual void
115 eSource source,
117 const XalanDOMString& msg,
118 const XalanNode* sourceNode) = 0;
119
120 /**
121 * Function to format a problem call to a PrintWriter instance.
122 * This is a bare-bones implementation that uses localized strings.
123 *
124 * @param pw The PrintWriter instance to use.
125 * @param source Either eXMLParser, eXSLProcessor, or eXPATH.
126 * @param classification Either eMessage, eWarning, or eError.
127 * @param locator The current Locator instance for the stylesheet. Maybe be a null pointer.
128 * @param sourceNode The current source node, if any.
129 * @param msg The error message.
130 */
131 static void
134 eSource source,
136 const XalanDOMString& msg,
137 const Locator* locator,
138 const XalanNode* sourceNode);
139
140 /**
141 * Function to format a problem call to a PrintWriter instance.
142 * This is a bare-bones implementation that uses localized strings.
143 *
144 * @param pw The PrintWriter instance to use.
145 * @param source either eXMLPARSER, eXSLPROCESSOR, or eXPATH
146 * @param classification either eMESSAGE, eERROR or eWARNING
147 * @param msg string message explaining the problem.
148 */
149 static void
152 eSource source,
154 const XalanDOMString& msg,
155 const XalanNode* sourceNode);
156
157protected:
158
159 static const XalanMessages::Codes s_messageCodes[eSourceCount][eClassificationCount];
160};
161
162
163
164}
165
166
167
168#endif // XALAN_PROBLEMLISTENER_HEADER_GUARD
#define XALAN_PLATFORMSUPPORT_EXPORT
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
This is the abstract class that is used when reporting a problem some kind, that requires a message,...
virtual void problem(eSource source, eClassification classification, const XalanDOMString &msg, const Locator *locator, const XalanNode *sourceNode)=0
Function that is called when a problem event occurs.
static void defaultFormat(PrintWriter &pw, eSource source, eClassification classification, const XalanDOMString &msg, const Locator *locator, const XalanNode *sourceNode)
Function to format a problem call to a PrintWriter instance.
virtual void problem(eSource source, eClassification classification, const XalanDOMString &msg, const XalanNode *sourceNode)=0
Function that is called when a problem event occurs.
static void defaultFormat(PrintWriter &pw, eSource source, eClassification classification, const XalanDOMString &msg, const XalanNode *sourceNode)
Function to format a problem call to a PrintWriter instance.