strings.hh

Go to the documentation of this file.
00001 /*
00002 ** TowBowlTactics, an adaptation of the tabletop game Blood Bowl.
00003 ** 
00004 ** Copyright (C) 2006 The TBT Team.
00005 ** 
00006 ** This program is free software; you can redistribute it and/or
00007 ** modify it under the terms of the GNU General Public License
00008 ** as published by the Free Software Foundation; either version 2
00009 ** of the License, or (at your option) any later version.
00010 ** 
00011 ** The complete GNU General Public Licence Notice can be found as the
00012 ** `NOTICE' file in the root directory.
00013 ** 
00014 ** The TBT Team consists of people listed in the `AUTHORS' file.
00015 */
00016 
00017 #ifndef XML_STRINGS_HH
00018 # define XML_STRINGS_HH
00019 
00025 # include <string>
00026 # include <cassert>
00027 # include <xercesc/util/XMLUniDefs.hpp>
00028 # include <xercesc/util/XMLString.hpp>
00029 
00030 namespace xml
00031 {
00033   inline std::string xml2str(const XMLCh* xmlstr)
00034   {
00035     assert(xmlstr != 0);
00036 
00037     char* cstr = xercesc::XMLString::transcode(xmlstr);
00038     assert(cstr != 0);
00039     
00040     std::string ret(cstr);
00041     xercesc::XMLString::release(&cstr);
00042 
00043     return ret;
00044   }
00045 
00047   inline std::ostream& operator<< (std::ostream& os, const XMLCh* xmlstr)
00048   {
00049     return os << xml2str(xmlstr);
00050   }
00051 }
00052 
00053 #endif // ! VCSN_XML_STRINGS_HH

Generated on Sat Jun 23 16:07:24 2007 for Stechec/TBT by  doxygen 1.4.7