http://xml.apache.org/http://www.apache.org/http://www.w3.org/

Home

Readme
Release Info

Installation
Download
Build

FAQs
Samples
API Docs

DOM C++ Binding
Programming
Migration Guide

Feedback
Bug-Reporting
PDF Document

CVS Repository
Mail Archive

API Docs for SAX and DOM
 

Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

SAXException.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright 1999-2000,2004 The Apache Software Foundation.
00003  * 
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  * 
00008  *      http://www.apache.org/licenses/LICENSE-2.0
00009  * 
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 /*
00018  * $Log: SAXException.hpp,v $
00019  * Revision 1.7  2004/09/08 13:56:19  peiyongz
00020  * Apache License Version 2.0
00021  *
00022  * Revision 1.6  2003/12/01 23:23:26  neilg
00023  * fix for bug 25118; thanks to Jeroen Witmond
00024  *
00025  * Revision 1.5  2003/08/13 15:43:24  knoaman
00026  * Use memory manager when creating SAX exceptions.
00027  *
00028  * Revision 1.4  2003/05/15 18:27:05  knoaman
00029  * Partial implementation of the configurable memory manager.
00030  *
00031  * Revision 1.3  2002/12/06 13:17:29  tng
00032  * [Bug 9083] Make SAXNotSupportedException and SAXNotRecognizedException to be exportable
00033  *
00034  * Revision 1.2  2002/11/04 14:56:26  tng
00035  * C++ Namespace Support.
00036  *
00037  * Revision 1.1.1.1  2002/02/01 22:22:08  peiyongz
00038  * sane_include
00039  *
00040  * Revision 1.8  2000/09/07 23:55:02  andyh
00041  * Fix SAXException assignment operator.  Now non-virtual, and
00042  * SAXParseException invokes base class operator.
00043  *
00044  * Revision 1.7  2000/08/09 22:06:04  jpolast
00045  * more functionality to SAXException and its children.
00046  * msgs are now functional for SAXNotSupportedEx and
00047  * SAXNotRecognizedEx
00048  *
00049  * Revision 1.6  2000/08/02 18:04:02  jpolast
00050  * include SAXNotSupportedException and
00051  * SAXNotRecognizedException needed for sax2
00052  *
00053  * Revision 1.5  2000/02/24 20:12:55  abagchi
00054  * Swat for removing Log from API docs
00055  *
00056  * Revision 1.4  2000/02/09 19:15:17  abagchi
00057  * Inserted documentation for new APIs
00058  *
00059  * Revision 1.3  2000/02/06 07:47:58  rahulj
00060  * Year 2K copyright swat.
00061  *
00062  * Revision 1.2  1999/12/18 00:21:23  roddey
00063  * Fixed a small reported memory leak
00064  *
00065  * Revision 1.1.1.1  1999/11/09 01:07:47  twl
00066  * Initial checkin
00067  *
00068  * Revision 1.2  1999/11/08 20:45:02  rahul
00069  * Swat for adding in Product name and CVS comment log variable.
00070  *
00071  */
00072 
00073 
00074 #ifndef SAXEXCEPTION_HPP
00075 #define SAXEXCEPTION_HPP
00076 
00077 #include <xercesc/util/XMLString.hpp>
00078 #include <xercesc/util/XMLUni.hpp>
00079 #include <xercesc/util/XMemory.hpp>
00080 
00081 XERCES_CPP_NAMESPACE_BEGIN
00082 
00083 
00103 class  SAXException : public XMemory
00104 {
00105 public:
00112     SAXException(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) :
00113 
00114         fMsg(XMLString::replicate(XMLUni::fgZeroLenString, manager))
00115         , fMemoryManager(manager)
00116     {
00117     }
00118 
00126     SAXException(const XMLCh* const msg,
00127                  MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) :
00128 
00129         fMsg(XMLString::replicate(msg, manager))
00130         , fMemoryManager(manager)
00131     {
00132     }
00133 
00141     SAXException(const char* const msg,
00142                  MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) :
00143 
00144         fMsg(XMLString::transcode(msg, manager))
00145         , fMemoryManager(manager)
00146     {
00147     }
00148 
00154     SAXException(const SAXException& toCopy) :
00155 
00156         fMsg(XMLString::replicate(toCopy.fMsg, toCopy.fMemoryManager))
00157         , fMemoryManager(toCopy.fMemoryManager)
00158     {
00159     }
00160 
00162     virtual ~SAXException()
00163     {
00164         fMemoryManager->deallocate(fMsg);//delete [] fMsg;
00165     }
00166 
00168 
00169 
00177     SAXException& operator=(const SAXException& toCopy)
00178     {
00179         if (this == &toCopy)
00180             return *this;
00181 
00182         fMemoryManager->deallocate(fMsg);//delete [] fMsg;
00183         fMsg = XMLString::replicate(toCopy.fMsg, toCopy.fMemoryManager);
00184         fMemoryManager = toCopy.fMemoryManager;
00185         return *this;
00186     }
00188 
00195     virtual const XMLCh* getMessage() const
00196     {
00197         return fMsg;
00198     }
00200 
00201 
00202 protected :
00203     // -----------------------------------------------------------------------
00204     //  Protected data members
00205     //
00206     //  fMsg
00207     //      This is the text of the error that is being thrown.
00208     // -----------------------------------------------------------------------
00209     XMLCh*  fMsg;
00210     MemoryManager* fMemoryManager;
00211 };
00212 
00213 class  SAXNotSupportedException : public SAXException
00214 {
00215 
00216 public:
00217     SAXNotSupportedException(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
00218 
00226     SAXNotSupportedException(const XMLCh* const msg,
00227                              MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
00228 
00236     SAXNotSupportedException(const char* const msg,
00237                              MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
00238 
00244     SAXNotSupportedException(const SAXException& toCopy);
00245 };
00246 
00247 class  SAXNotRecognizedException : public SAXException
00248 {
00249 public:
00250     SAXNotRecognizedException(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
00251 
00259     SAXNotRecognizedException(const XMLCh* const msg,
00260                               MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
00261 
00269     SAXNotRecognizedException(const char* const msg,
00270                               MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
00271 
00277     SAXNotRecognizedException(const SAXException& toCopy);
00278 };
00279 
00280 XERCES_CPP_NAMESPACE_END
00281 
00282 #endif


Copyright © 1994-2004 The Apache Software Foundation. All Rights Reserved.