Vaucanson 1.4
|
00001 // strings.hxx: this file is part of the Vaucanson project. 00002 // 00003 // Vaucanson, a generic library for finite state machines. 00004 // 00005 // Copyright (C) 2004, 2005, 2006, 2007 The Vaucanson Group. 00006 // 00007 // This program is free software; you can redistribute it and/or 00008 // modify it under the terms of the GNU General Public License 00009 // as published by the Free Software Foundation; either version 2 00010 // of the License, or (at your option) any later version. 00011 // 00012 // The complete GNU General Public Licence Notice can be found as the 00013 // `COPYING' file in the root directory. 00014 // 00015 // The Vaucanson Group consists of people listed in the `AUTHORS' file. 00016 // 00017 #ifndef VCSN_XML_STRINGS_HXX 00018 # define VCSN_XML_STRINGS_HXX 00019 00020 # include <vaucanson/misc/contract.hh> 00021 00022 namespace vcsn 00023 { 00024 namespace xml 00025 { 00026 00027 /*----------------. 00028 | Converter tools | 00029 `----------------*/ 00030 00031 // Transcode \a cpp to XML. 00032 inline 00033 XMLCh* 00034 transcode (const char* ccp) 00035 { 00036 return xercesc::XMLString::transcode(ccp); 00037 } 00038 00039 // Transcode \a s to XML. 00040 inline 00041 XMLCh* 00042 transcode (const std::string& s) 00043 { 00044 return transcode (s.c_str()); 00045 } 00046 00047 inline 00048 std::string 00049 xmlstr(const XMLCh* xmlstr) 00050 { 00051 assertion(xmlstr != 0); 00052 00053 char* cstr = xercesc::XMLString::transcode(xmlstr); 00054 assertion(cstr != 0); 00055 00056 std::string ret (cstr); 00057 xercesc::XMLString::release(&cstr); 00058 00059 return ret; 00060 } 00061 00062 } // End of namespace xml. 00063 00064 } // End of namespace vcsn. 00065 00066 #endif // ! VCSN_XML_STRINGS_HXX