Xalan-C++ API Reference 1.12.0
XSLException.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(XSLEXCEPTION_HEADER_GUARD_1357924680)
19#define XSLEXCEPTION_HEADER_GUARD_1357924680
20
21
22
23// Base include file. Must be first.
25
26
27
30
31
32
33namespace XALAN_CPP_NAMESPACE {
34
35
36
37typedef xercesc::Locator LocatorType;
38using xercesc::Locator;
39
40
41
43{
44public:
45
46 /**
47 * Constructor
48 *
49 * @param theMessage The message to display when exception thrown
50 * @param theManager The MemoryManager instance to use.
51 * @param theLocator The locator instance for error reporting, if any.
52 */
55 MemoryManager& theManager,
56 const Locator* theLocator);
57
58 /**
59 * Constructor. Use this constructor when the message has
60 * already been formatted.
61 *
62 * @param theMessage The message to display when exception thrown
63 * @param theManager The MemoryManager instance to use.
64 */
67 MemoryManager& theManager);
68
70
71 virtual
73
74 /**
75 * Retrieve type of exception
76 *
77 * @return type of exception
78 */
79 virtual const XalanDOMChar*
80 getType() const = 0;
81
82 /**
83 * Retrieve message for exception
84 *
85 * @return exception message
86 */
87 const XalanDOMString&
88 getMessage() const
89 {
90 return m_message;
91 }
92
93 /**
94 * Get the URI for the associated document, if any
95 *
96 * @return The URI.
97 */
98 const XalanDOMString&
99 getURI() const
100 {
101 return m_uri;
102 }
103
104 /**
105 * Retrieve the line number.
106 *
107 * @return the line number
108 */
111 {
112 return m_lineNumber;
113 }
114
115 /**
116 * Retrieve the column number.
117 *
118 * @return the column number
119 */
122 {
123 return m_columnNumber;
124 }
125
126 const MemoryManager&
128 {
129 return m_memoryManager;
130 }
131
132 MemoryManager&
134 {
135 return m_memoryManager;
136 }
137
140
141 static XalanDOMString&
144 const XalanDOMString& theURI,
147 const XalanDOMChar* theType,
149 {
150 return defaultFormat(
151 theMessage.c_str(),
152 theMessage.size(),
153 theURI.c_str(),
154 theURI.size(),
157 theType,
158 XalanDOMString::length(theType),
159 theBuffer);
160 }
161
162 static XalanDOMString&
165 const XalanDOMChar* theURI,
168 const XalanDOMChar* theType,
170 {
171 assert(theMessage != 0);
172
173 return defaultFormat(
175 XalanDOMString::length(theMessage),
176 theURI,
177 theURI == 0 ? 0 : XalanDOMString::length(theURI),
180 theType,
181 theType == 0 ? 0 : XalanDOMString::length(theType),
182 theBuffer);
183 }
184
185 static XalanDOMString&
189 const XalanDOMChar* theURI,
193 const XalanDOMChar* theType,
196
197protected:
198
199 MemoryManager& m_memoryManager;
200
201private:
202
203 const XalanDOMString m_message;
204 const XalanDOMString m_uri;
205
206 const XalanFileLoc m_lineNumber;
207 const XalanFileLoc m_columnNumber;
208
209 // When true, the message has already formatted.
210 const bool m_formatted;
211};
212
213
214
215}
216
217
218
219#endif // XSLEXCEPTION_HEADER_GUARD_1357924680
#define XALAN_PLATFORMSUPPORT_EXPORT
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
static XalanDOMString & defaultFormat(const XalanDOMChar *theMessage, const XalanDOMString::size_type theMessageLength, const XalanDOMChar *theURI, const XalanDOMString::size_type theURILength, XalanFileLoc theLineNumber, XalanFileLoc theColumnNumber, const XalanDOMChar *theType, const XalanDOMString::size_type theTypeLength, XalanDOMString &theBuffer)
XSLException(const XSLException &other)
MemoryManager & getMemoryManager()
static XalanDOMString & defaultFormat(const XalanDOMString &theMessage, const XalanDOMString &theURI, XalanFileLoc theLineNumber, XalanFileLoc theColumnNumber, const XalanDOMChar *theType, XalanDOMString &theBuffer)
XalanDOMString & defaultFormat(XalanDOMString &theBuffer) const
const XalanDOMString & getURI() const
Get the URI for the associated document, if any.
XSLException(const XalanDOMString &theMessage, MemoryManager &theManager)
Constructor.
const XalanDOMString & getMessage() const
Retrieve message for exception.
XalanFileLoc getColumnNumber() const
Retrieve the column number.
const MemoryManager & getMemoryManager() const
static XalanDOMString & defaultFormat(const XalanDOMChar *theMessage, const XalanDOMChar *theURI, XalanFileLoc theLineNumber, XalanFileLoc theColumnNumber, const XalanDOMChar *theType, XalanDOMString &theBuffer)
virtual const XalanDOMChar * getType() const =0
Retrieve type of exception.
XSLException(const XalanDOMString &theMessage, MemoryManager &theManager, const Locator *theLocator)
Constructor.
XalanFileLoc getLineNumber() const
Retrieve the line number.
MemoryManager & m_memoryManager
xercesc::Locator LocatorType