~ubuntu-branches/ubuntu/maverick/openturns/maverick

« back to all changes in this revision

Viewing changes to lib/src/Base/Common/XMLStringConverter.hxx

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Prud'homme
  • Date: 2008-11-18 06:32:22 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20081118063222-pa0qncclrerrqkg2
Tags: 0.12.2-1
* New upstream release
* Bug fix: "New upstream release available (0.12.2)", thanks to Jerome
  Robert (Closes: #506005).
* Applied patch by J. Robert.
* debian/control: build-depends on libxml2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
//                                               -*- C++ -*-
2
 
/**
3
 
 *  @file  XMLStringConverter.hxx
4
 
 *  @brief The class XMLStringConverter transcode Unicode strings to local strings
5
 
 *
6
 
 *  (C) Copyright 2005-2007 EDF-EADS-Phimeca
7
 
 *
8
 
 *  This library is free software; you can redistribute it and/or
9
 
 *  modify it under the terms of the GNU Lesser General Public
10
 
 *  License as published by the Free Software Foundation; either
11
 
 *  version 2.1 of the License.
12
 
 *
13
 
 *  This library is distributed in the hope that it will be useful
14
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
 
 *  Lesser General Public License for more details.
17
 
 *
18
 
 *  You should have received a copy of the GNU Lesser General Public
19
 
 *  License along with this library; if not, write to the Free Software
20
 
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
21
 
 *
22
 
 *  @author: $LastChangedBy: dutka $
23
 
 *  @date:   $LastChangedDate: 2008-05-21 17:44:02 +0200 (mer, 21 mai 2008) $
24
 
 *  Id:      $Id: XMLStringConverter.hxx 818 2008-05-21 15:44:02Z dutka $
25
 
 */
26
 
#ifndef OPENTURNS_XMLSTRINGCONVERTER_HXX
27
 
#define OPENTURNS_XMLSTRINGCONVERTER_HXX
28
 
 
29
 
#include <iostream>              // for std::ostream
30
 
#include "OT.hxx"
31
 
#include <xercesc/util/XMLUniDefs.hpp>
32
 
#include <xercesc/util/XMLUni.hpp>
33
 
#include <xercesc/util/XMLString.hpp>
34
 
 
35
 
#define XERCES XERCES_CPP_NAMESPACE_QUALIFIER
36
 
 
37
 
namespace OpenTURNS
38
 
{
39
 
 
40
 
  namespace Base
41
 
  {
42
 
 
43
 
    namespace Common
44
 
    {
45
 
 
46
 
      /**
47
 
       * @class XMLStringConverter
48
 
       *
49
 
       * This class can cast XML strings to STL strings.
50
 
       */
51
 
 
52
 
      class XMLStringConverter
53
 
      {
54
 
      public:
55
 
 
56
 
        /** 
57
 
         * Default constructor
58
 
         */
59
 
        explicit XMLStringConverter(const XMLCh * toTranscode)
60
 
          : localString_(XERCES XMLString::transcode(toTranscode)) {}
61
 
 
62
 
        /** Destructor */
63
 
        ~XMLStringConverter()
64
 
        { XERCES XMLString::release(&localString_); }
65
 
 
66
 
        /**
67
 
         * String converter
68
 
         */
69
 
        operator String() const
70
 
        { return localString_; }
71
 
 
72
 
 
73
 
      protected:
74
 
 
75
 
      private:
76
 
 
77
 
        /** The internal form of the string in local encoding */
78
 
        char * localString_;
79
 
 
80
 
      }
81
 
 
82
 
        ; /* class XMLStringConverter */
83
 
 
84
 
 
85
 
 
86
 
    } /* namespace Common */
87
 
  } /* namespace Base */
88
 
} /* namespace OpenTURNS */
89
 
 
90
 
#endif /* OPENTURNS_XMLSTRINGCONVERTER_HXX */