GME  13
InputSource.cpp
Go to the documentation of this file.
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: InputSource.cpp 471747 2006-11-06 14:31:56Z amassari $
00020  */
00021 
00022 
00023 // ---------------------------------------------------------------------------
00024 //  Includes
00025 // ---------------------------------------------------------------------------
00026 #include    <xercesc/sax/InputSource.hpp>
00027 #include    <xercesc/util/XMLString.hpp>
00028 
00029 XERCES_CPP_NAMESPACE_BEGIN
00030 
00031 // ---------------------------------------------------------------------------
00032 //  InputSource: Destructor
00033 // ---------------------------------------------------------------------------
00034 InputSource::~InputSource()
00035 {
00036     fMemoryManager->deallocate(fEncoding);
00037     fMemoryManager->deallocate(fPublicId);
00038     fMemoryManager->deallocate(fSystemId);
00039 }
00040 
00041 
00042 // ---------------------------------------------------------------------------
00043 //  InputSource: Setter methods
00044 // ---------------------------------------------------------------------------
00045 void InputSource::setEncoding(const XMLCh* const encodingStr)
00046 {
00047     fMemoryManager->deallocate(fEncoding);
00048     fEncoding = XMLString::replicate(encodingStr, fMemoryManager);
00049 }
00050 
00051 
00052 void InputSource::setPublicId(const XMLCh* const publicId)
00053 {
00054     fMemoryManager->deallocate(fPublicId);
00055     fPublicId = XMLString::replicate(publicId, fMemoryManager);
00056 }
00057 
00058 
00059 void InputSource::setSystemId(const XMLCh* const systemId)
00060 {
00061     fMemoryManager->deallocate(fSystemId);
00062     fSystemId = XMLString::replicate(systemId, fMemoryManager);
00063 }
00064 
00065 
00066 
00067 // ---------------------------------------------------------------------------
00068 //  InputSource: Hidden Constructors
00069 // ---------------------------------------------------------------------------
00070 InputSource::InputSource(MemoryManager* const manager) :
00071 
00072     fMemoryManager(manager)
00073     , fEncoding(0)
00074     , fPublicId(0)
00075     , fSystemId(0)
00076     , fFatalErrorIfNotFound(true)
00077 {
00078 }
00079 
00080 InputSource::InputSource(const XMLCh* const systemId,
00081                          MemoryManager* const manager) :
00082 
00083     fMemoryManager(manager)
00084     , fEncoding(0)
00085     , fPublicId(0)
00086     , fSystemId(0)
00087     , fFatalErrorIfNotFound(true)
00088 {
00089     fSystemId = XMLString::replicate(systemId, fMemoryManager);
00090 }
00091 
00092 InputSource::InputSource(const  XMLCh* const   systemId
00093                         , const XMLCh* const   publicId
00094                         , MemoryManager* const manager) :
00095 
00096     fMemoryManager(manager)
00097     , fEncoding(0)
00098     , fPublicId(0)
00099     , fSystemId(0)
00100     , fFatalErrorIfNotFound(true)
00101 {
00102     fPublicId = XMLString::replicate(publicId, fMemoryManager);
00103     fSystemId = XMLString::replicate(systemId, fMemoryManager);
00104 }
00105 
00106 InputSource::InputSource(const char* const systemId,
00107                          MemoryManager* const manager) :
00108 
00109     fMemoryManager(manager)
00110     , fEncoding(0)
00111     , fPublicId(0)
00112     , fSystemId(0)
00113     , fFatalErrorIfNotFound(true)
00114 {
00115     fSystemId = XMLString::transcode(systemId, fMemoryManager);
00116 }
00117 
00118 InputSource::InputSource(const  char* const systemId
00119                         , const char* const publicId
00120                         , MemoryManager* const manager) :
00121 
00122     fMemoryManager(manager)
00123     , fEncoding(0)
00124     , fPublicId(0)
00125     , fSystemId(0)
00126     , fFatalErrorIfNotFound(true)
00127 {
00128     fPublicId = XMLString::transcode(publicId, fMemoryManager);
00129     fSystemId = XMLString::transcode(systemId, fMemoryManager);
00130 }
00131 
00132 XERCES_CPP_NAMESPACE_END
00133