GME
13
|
00001 /* 00002 * Licensed to the Apache Software Foundation (ASF) under one or more 00003 * contributor license agreements. See the NOTICE file distributed with 00004 * this work for additional information regarding copyright ownership. 00005 * The ASF licenses this file to You under the Apache License, Version 2.0 00006 * (the "License"); you may not use this file except in compliance with 00007 * the License. You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 00018 /* 00019 * $Id: SAXParseException.cpp 672273 2008-06-27 13:57:00Z borisk $ 00020 */ 00021 00022 00023 // --------------------------------------------------------------------------- 00024 // Includes 00025 // --------------------------------------------------------------------------- 00026 #include <xercesc/util/XMLString.hpp> 00027 #include <xercesc/sax/Locator.hpp> 00028 #include <xercesc/sax/SAXParseException.hpp> 00029 00030 XERCES_CPP_NAMESPACE_BEGIN 00031 00032 // --------------------------------------------------------------------------- 00033 // SAXParseException: Constructors and Destructor 00034 // --------------------------------------------------------------------------- 00035 SAXParseException::SAXParseException(const XMLCh* const message 00036 , const Locator& locator 00037 , MemoryManager* const manager) : 00038 SAXException(message, manager) 00039 , fColumnNumber(locator.getColumnNumber()) 00040 , fLineNumber(locator.getLineNumber()) 00041 , fPublicId(XMLString::replicate(locator.getPublicId(), manager)) 00042 , fSystemId(XMLString::replicate(locator.getSystemId(), manager)) 00043 { 00044 } 00045 00046 SAXParseException::SAXParseException(const XMLCh* const message 00047 , const XMLCh* const publicId 00048 , const XMLCh* const systemId 00049 , const XMLFileLoc lineNumber 00050 , const XMLFileLoc columnNumber 00051 , MemoryManager* const manager) : 00052 SAXException(message, manager) 00053 , fColumnNumber(columnNumber) 00054 , fLineNumber(lineNumber) 00055 , fPublicId(XMLString::replicate(publicId, manager)) 00056 , fSystemId(XMLString::replicate(systemId, manager)) 00057 { 00058 } 00059 00060 SAXParseException::SAXParseException(const SAXParseException& toCopy) : 00061 00062 SAXException(toCopy) 00063 , fColumnNumber(toCopy.fColumnNumber) 00064 , fLineNumber(toCopy.fLineNumber) 00065 , fPublicId(0) 00066 , fSystemId(0) 00067 { 00068 fPublicId = XMLString::replicate(toCopy.fPublicId, toCopy.fMemoryManager); 00069 fSystemId = XMLString::replicate(toCopy.fSystemId, toCopy.fMemoryManager); 00070 } 00071 00072 SAXParseException::~SAXParseException() 00073 { 00074 fMemoryManager->deallocate(fPublicId);//XMLString::release(&fPublicId); 00075 fMemoryManager->deallocate(fSystemId);//XMLString::release(&fSystemId); 00076 } 00077 00078 00079 // --------------------------------------------------------------------------- 00080 // SAXParseException: Public operators 00081 // --------------------------------------------------------------------------- 00082 SAXParseException& 00083 SAXParseException::operator=(const SAXParseException& toAssign) 00084 { 00085 if (this == &toAssign) 00086 return *this; 00087 00088 fMemoryManager->deallocate(fPublicId);//XMLString::release(&fPublicId); 00089 fMemoryManager->deallocate(fSystemId);//XMLString::release(&fSystemId); 00090 00091 this->SAXException::operator =(toAssign); 00092 fColumnNumber = toAssign.fColumnNumber; 00093 fLineNumber = toAssign.fLineNumber; 00094 00095 fPublicId = XMLString::replicate(toAssign.fPublicId, fMemoryManager); 00096 fSystemId = XMLString::replicate(toAssign.fSystemId, fMemoryManager); 00097 00098 return *this; 00099 } 00100 00101 00102 // --------------------------------------------------------------------------- 00103 // SAXParseException: Getter methods 00104 // --------------------------------------------------------------------------- 00105 const XMLCh* SAXParseException::getPublicId() const 00106 { 00107 return fPublicId; 00108 } 00109 00110 const XMLCh* SAXParseException::getSystemId() const 00111 { 00112 return fSystemId; 00113 } 00114 00115 XMLFileLoc SAXParseException::getLineNumber() const 00116 { 00117 return fLineNumber; 00118 } 00119 00120 XMLFileLoc SAXParseException::getColumnNumber() const 00121 { 00122 return fColumnNumber; 00123 } 00124 00125 XERCES_CPP_NAMESPACE_END