- Main Page
- Namespaces
- Classes
- Files
- Related Pages

# /Users/fpy/titan-1-5-MBARI/Mers/Utils/Io/Xml/ScopedTranscoder.h

    00001
    00002 //
    00003 // Copyright (c) 2005           Model-based Embedded and Robotic Systems Group
    00004 // All Rights Reserved          Massachusetts Institute of Technology
    00005 //
    00006 // This software is provided as is. Model-based Embedded and Robotic Systems
    00007 // (MERS) group does not assume any responsibility.
    00008 //
    00010
    00011 #ifndef MERS_UTILS_IO_XML_SCOPEDTRANSCODER_H
    00012 #define MERS_UTILS_IO_XML_SCOPEDTRANSCODER_H
    00013
    00014 #include <xercesc/util/XMLString.hpp>
    00015
    00016 namespace Mers {
    00017 namespace Utils {
    00018 namespace Io {
    00019 namespace Xml {
    00020
    00034         class CScopedTranscoder
    00035         {
    00036         public:
    00041                 CScopedTranscoder( const XMLCh * message ) :
    00042                         m_message( XERCES_CPP_NAMESPACE::XMLString::transcode( message ) )
    00043                 {}
    00044
    00048                 ~CScopedTranscoder() {
    00049                         XERCES_CPP_NAMESPACE::XMLString::release( &m_message );
    00050                 }
    00051
    00055                 inline operator const char *() const {
    00056                         return m_message;
    00057                 }
    00058
    00059         protected:
    00061                 char * m_message;
    00062
    00063         private:
    00065                 CScopedTranscoder();
    00066                 CScopedTranscoder(const CScopedTranscoder & );
    00067                 const CScopedTranscoder & operator =(const CScopedTranscoder & );
    00068         };
    00069
    00071
    00085         class XMLScopedTranscoder
    00086         {
    00087         public:
    00092                 XMLScopedTranscoder( const char * message ) :
    00093                         m_message( XERCES_CPP_NAMESPACE::XMLString::transcode( message ) )
    00094                 {}
    00095
    00099                 ~XMLScopedTranscoder() {
    00100                         XERCES_CPP_NAMESPACE::XMLString::release( &m_message );
    00101                 }
    00102
    00106                 inline operator const XMLCh *() const {
    00107                         return m_message;
    00108                 }
    00109
    00110         protected:
    00112                 XMLCh * m_message;
    00113
    00114         private:
    00116                 XMLScopedTranscoder();
    00117                 XMLScopedTranscoder(const XMLScopedTranscoder & );
    00118                 const XMLScopedTranscoder & operator =(const XMLScopedTranscoder & );
    00119         };
    00120
    00121 }
    00122 }
    00123 }
    00124 }
    00125
    00126 #endif
    00127