1 | /*
|
---|
2 | * Copyright 1999-2000,2004 The Apache Software Foundation.
|
---|
3 | *
|
---|
4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
---|
5 | * you may not use this file except in compliance with the License.
|
---|
6 | * You may obtain a copy of the License at
|
---|
7 | *
|
---|
8 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
9 | *
|
---|
10 | * Unless required by applicable law or agreed to in writing, software
|
---|
11 | * distributed under the License is distributed on an "AS IS" BASIS,
|
---|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
13 | * See the License for the specific language governing permissions and
|
---|
14 | * limitations under the License.
|
---|
15 | */
|
---|
16 |
|
---|
17 | /*
|
---|
18 | * $Log: PParse.hpp,v $
|
---|
19 | * Revision 1.7 2004/09/08 13:55:32 peiyongz
|
---|
20 | * Apache License Version 2.0
|
---|
21 | *
|
---|
22 | * Revision 1.6 2003/05/30 09:36:35 gareth
|
---|
23 | * Use new macros for iostream.h and std:: issues.
|
---|
24 | *
|
---|
25 | * Revision 1.5 2003/02/05 18:53:23 tng
|
---|
26 | * [Bug 11915] Utility for freeing memory.
|
---|
27 | *
|
---|
28 | * Revision 1.4 2000/03/02 19:53:44 roddey
|
---|
29 | * This checkin includes many changes done while waiting for the
|
---|
30 | * 1.1.0 code to be finished. I can't list them all here, but a list is
|
---|
31 | * available elsewhere.
|
---|
32 | *
|
---|
33 | * Revision 1.3 2000/02/11 02:45:15 abagchi
|
---|
34 | * Removed StrX::transcode
|
---|
35 | *
|
---|
36 | * Revision 1.2 2000/02/06 07:47:20 rahulj
|
---|
37 | * Year 2K copyright swat.
|
---|
38 | *
|
---|
39 | * Revision 1.1.1.1 1999/11/09 01:09:45 twl
|
---|
40 | * Initial checkin
|
---|
41 | *
|
---|
42 | * Revision 1.4 1999/11/08 20:43:38 rahul
|
---|
43 | * Swat for adding in Product name and CVS comment log variable.
|
---|
44 | *
|
---|
45 | */
|
---|
46 |
|
---|
47 | // ---------------------------------------------------------------------------
|
---|
48 | // Includes for all the program files to see
|
---|
49 | // ---------------------------------------------------------------------------
|
---|
50 | #if defined(XERCES_NEW_IOSTREAMS)
|
---|
51 | #include <iostream>
|
---|
52 | #else
|
---|
53 | #include <iostream.h>
|
---|
54 | #endif
|
---|
55 | #include <string.h>
|
---|
56 | #include <stdlib.h>
|
---|
57 | #include "PParseHandlers.hpp"
|
---|
58 |
|
---|
59 |
|
---|
60 |
|
---|
61 | // ---------------------------------------------------------------------------
|
---|
62 | // This is a simple class that lets us do easy (though not terribly efficient)
|
---|
63 | // trancoding of XMLCh data to local code page for display.
|
---|
64 | // ---------------------------------------------------------------------------
|
---|
65 | class StrX
|
---|
66 | {
|
---|
67 | public :
|
---|
68 | // -----------------------------------------------------------------------
|
---|
69 | // Constructors and Destructor
|
---|
70 | // -----------------------------------------------------------------------
|
---|
71 | StrX(const XMLCh* const toTranscode)
|
---|
72 | {
|
---|
73 | // Call the private transcoding method
|
---|
74 | fLocalForm = XMLString::transcode(toTranscode);
|
---|
75 | }
|
---|
76 |
|
---|
77 | ~StrX()
|
---|
78 | {
|
---|
79 | XMLString::release(&fLocalForm);
|
---|
80 | }
|
---|
81 |
|
---|
82 |
|
---|
83 | // -----------------------------------------------------------------------
|
---|
84 | // Getter methods
|
---|
85 | // -----------------------------------------------------------------------
|
---|
86 | const char* localForm() const
|
---|
87 | {
|
---|
88 | return fLocalForm;
|
---|
89 | }
|
---|
90 |
|
---|
91 |
|
---|
92 | private :
|
---|
93 | // -----------------------------------------------------------------------
|
---|
94 | // Private data members
|
---|
95 | //
|
---|
96 | // fLocalForm
|
---|
97 | // This is the local code page form of the string.
|
---|
98 | // -----------------------------------------------------------------------
|
---|
99 | char* fLocalForm;
|
---|
100 | };
|
---|
101 |
|
---|
102 | inline XERCES_STD_QUALIFIER ostream& operator<<(XERCES_STD_QUALIFIER ostream& target, const StrX& toDump)
|
---|
103 | {
|
---|
104 | target << toDump.localForm();
|
---|
105 | return target;
|
---|
106 | }
|
---|