source: trunk/VUT/GtpVisibilityPreprocessor/support/xerces/samples/StdInParse/StdInParse.hpp @ 358

Revision 358, 3.5 KB checked in by bittner, 19 years ago (diff)

xerces added

Line 
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: StdInParse.hpp,v $
19 * Revision 1.8  2004/09/08 13:55:34  peiyongz
20 * Apache License Version 2.0
21 *
22 * Revision 1.7  2003/05/30 09:36:36  gareth
23 * Use new macros for iostream.h and std:: issues.
24 *
25 * Revision 1.6  2003/02/05 18:53:25  tng
26 * [Bug 11915] Utility for freeing memory.
27 *
28 * Revision 1.5  2002/02/01 22:41:37  peiyongz
29 * sane_include
30 *
31 * Revision 1.4  2000/03/02 19:53:50  roddey
32 * This checkin includes many changes done while waiting for the
33 * 1.1.0 code to be finished. I can't list them all here, but a list is
34 * available elsewhere.
35 *
36 * Revision 1.3  2000/02/11 02:48:03  abagchi
37 * Removed StrX::transcode
38 *
39 * Revision 1.2  2000/02/06 07:47:25  rahulj
40 * Year 2K copyright swat.
41 *
42 * Revision 1.1.1.1  1999/11/09 01:09:27  twl
43 * Initial checkin
44 *
45 * Revision 1.1  1999/11/08 23:03:21  rahul
46 * Changed extension from .Hpp to .hpp
47 *
48 * Revision 1.4  1999/11/08 20:43:42  rahul
49 * Swat for adding in Product name and CVS comment log variable.
50 *
51 */
52
53
54// ---------------------------------------------------------------------------
55//  Includes for all the program files to see
56// ---------------------------------------------------------------------------
57#include <string.h>
58#include <stdlib.h>
59#if defined(XERCES_NEW_IOSTREAMS)
60#include <iostream>
61#else
62#include <iostream.h>
63#endif
64#include <xercesc/util/PlatformUtils.hpp>
65#include "StdInParseHandlers.hpp"
66
67
68// ---------------------------------------------------------------------------
69//  This is a simple class that lets us do easy (though not terribly efficient)
70//  trancoding of XMLCh data to local code page for display.
71// ---------------------------------------------------------------------------
72class StrX
73{
74public :
75    // -----------------------------------------------------------------------
76    //  Constructors and Destructor
77    // -----------------------------------------------------------------------
78    StrX(const XMLCh* const toTranscode)
79    {
80        // Call the private transcoding method
81        fLocalForm = XMLString::transcode(toTranscode);
82    }
83
84    ~StrX()
85    {
86        XMLString::release(&fLocalForm);
87    }
88
89    // -----------------------------------------------------------------------
90    //  Getter methods
91    // -----------------------------------------------------------------------
92    const char* localForm() const
93    {
94        return fLocalForm;
95    }
96
97private :
98    // -----------------------------------------------------------------------
99    //  Private data members
100    //
101    //  fLocalForm
102    //      This is the local code page form of the string.
103    // -----------------------------------------------------------------------
104    char*   fLocalForm;
105};
106
107inline XERCES_STD_QUALIFIER ostream& operator<<(XERCES_STD_QUALIFIER ostream& target, const StrX& toDump)
108{
109    target << toDump.localForm();
110    return target;
111}
Note: See TracBrowser for help on using the repository browser.