1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18 /*
19 * $Id: InputSource.cpp 471747 2006-11-06 14:31:56Z amassari $
20 */
21
22
23 // ---------------------------------------------------------------------------
24 // Includes
25 // ---------------------------------------------------------------------------
26 #include <xercesc/sax/InputSource.hpp>
27 #include <xercesc/util/XMLString.hpp>
28
29 XERCES_CPP_NAMESPACE_BEGIN
30
31 // ---------------------------------------------------------------------------
32 // InputSource: Destructor
33 // ---------------------------------------------------------------------------
~InputSource()34 InputSource::~InputSource()
35 {
36 fMemoryManager->deallocate(fEncoding);
37 fMemoryManager->deallocate(fPublicId);
38 fMemoryManager->deallocate(fSystemId);
39 }
40
41
42 // ---------------------------------------------------------------------------
43 // InputSource: Setter methods
44 // ---------------------------------------------------------------------------
setEncoding(const XMLCh * const encodingStr)45 void InputSource::setEncoding(const XMLCh* const encodingStr)
46 {
47 fMemoryManager->deallocate(fEncoding);
48 fEncoding = XMLString::replicate(encodingStr, fMemoryManager);
49 }
50
51
setPublicId(const XMLCh * const publicId)52 void InputSource::setPublicId(const XMLCh* const publicId)
53 {
54 fMemoryManager->deallocate(fPublicId);
55 fPublicId = XMLString::replicate(publicId, fMemoryManager);
56 }
57
58
setSystemId(const XMLCh * const systemId)59 void InputSource::setSystemId(const XMLCh* const systemId)
60 {
61 fMemoryManager->deallocate(fSystemId);
62 fSystemId = XMLString::replicate(systemId, fMemoryManager);
63 }
64
65
66
67 // ---------------------------------------------------------------------------
68 // InputSource: Hidden Constructors
69 // ---------------------------------------------------------------------------
InputSource(MemoryManager * const manager)70 InputSource::InputSource(MemoryManager* const manager) :
71
72 fMemoryManager(manager)
73 , fEncoding(0)
74 , fPublicId(0)
75 , fSystemId(0)
76 , fFatalErrorIfNotFound(true)
77 {
78 }
79
InputSource(const XMLCh * const systemId,MemoryManager * const manager)80 InputSource::InputSource(const XMLCh* const systemId,
81 MemoryManager* const manager) :
82
83 fMemoryManager(manager)
84 , fEncoding(0)
85 , fPublicId(0)
86 , fSystemId(0)
87 , fFatalErrorIfNotFound(true)
88 {
89 fSystemId = XMLString::replicate(systemId, fMemoryManager);
90 }
91
InputSource(const XMLCh * const systemId,const XMLCh * const publicId,MemoryManager * const manager)92 InputSource::InputSource(const XMLCh* const systemId
93 , const XMLCh* const publicId
94 , MemoryManager* const manager) :
95
96 fMemoryManager(manager)
97 , fEncoding(0)
98 , fPublicId(0)
99 , fSystemId(0)
100 , fFatalErrorIfNotFound(true)
101 {
102 fPublicId = XMLString::replicate(publicId, fMemoryManager);
103 fSystemId = XMLString::replicate(systemId, fMemoryManager);
104 }
105
InputSource(const char * const systemId,MemoryManager * const manager)106 InputSource::InputSource(const char* const systemId,
107 MemoryManager* const manager) :
108
109 fMemoryManager(manager)
110 , fEncoding(0)
111 , fPublicId(0)
112 , fSystemId(0)
113 , fFatalErrorIfNotFound(true)
114 {
115 fSystemId = XMLString::transcode(systemId, fMemoryManager);
116 }
117
InputSource(const char * const systemId,const char * const publicId,MemoryManager * const manager)118 InputSource::InputSource(const char* const systemId
119 , const char* const publicId
120 , MemoryManager* const manager) :
121
122 fMemoryManager(manager)
123 , fEncoding(0)
124 , fPublicId(0)
125 , fSystemId(0)
126 , fFatalErrorIfNotFound(true)
127 {
128 fPublicId = XMLString::transcode(publicId, fMemoryManager);
129 fSystemId = XMLString::transcode(systemId, fMemoryManager);
130 }
131
132 XERCES_CPP_NAMESPACE_END
133
134