source: icXML/icXML-devel/tests/src/ParserTest/ParserTest.hpp @ 2726

Last change on this file since 2726 was 2726, checked in by cameron, 6 years ago

Add original Xerces tests and samples directories

File size: 3.3 KB
Line 
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: ParserTest.hpp 470088 2006-11-01 20:35:12Z amassari $
20 */
21
22// ---------------------------------------------------------------------------
23//  Some types used by this program
24// ---------------------------------------------------------------------------
25enum OutputTypes
26{
27    OutputType_None
28    , OutputType_Debug
29    , OutputType_JCCanon
30    , OutputType_SunCanon
31    , OutputType_XML
32};
33
34
35
36// ---------------------------------------------------------------------------
37//  Includes that everyone uses inside this program
38// ---------------------------------------------------------------------------
39#include "ParserTest_Parser.hpp"
40#include <stdlib.h>
41#include <xercesc/util/PlatformUtils.hpp>
42
43#if defined(XERCES_NEW_IOSTREAMS)
44#include <iostream>
45#else
46#include <iostream.h>
47#endif
48
49
50// ---------------------------------------------------------------------------
51//  This is a simple class that lets us do easy (though not terribly efficient)
52//  trancoding of XMLCh data to local code page for display.
53// ---------------------------------------------------------------------------
54class StrX
55{
56public :
57    // -----------------------------------------------------------------------
58    //  Constructors and Destructor
59    // -----------------------------------------------------------------------
60        StrX(const XMLCh* const toTranscode, const unsigned int len = 0) :
61
62        fLocalForm(0)
63    {
64        // Call the private transcoding method
65        transcode(toTranscode, len);
66    }
67
68    ~StrX()
69    {
70        XMLString::release(&fLocalForm);
71    }
72
73
74    // -----------------------------------------------------------------------
75    //  Getter methods
76    // -----------------------------------------------------------------------
77    const char* localForm() const
78    {
79        return fLocalForm;
80    }
81
82
83private :
84    // -----------------------------------------------------------------------
85    //  Private helper methods
86    // -----------------------------------------------------------------------
87        void transcode (const XMLCh* const toTranscode, const unsigned int len);
88
89
90    // -----------------------------------------------------------------------
91    //  Private data members
92    //
93    //  fLocalForm
94    //      This is the local code page form of the string.
95    // -----------------------------------------------------------------------
96    char*   fLocalForm;
97};
98
99inline XERCES_STD_QUALIFIER ostream& operator<<(XERCES_STD_QUALIFIER ostream& target, const StrX& toDump)
100{
101    target << toDump.localForm();
102    return target;
103}
Note: See TracBrowser for help on using the repository browser.