ISIS Core Library 0.7.2 (api 3.0.0)

/scr/tee1/isis/lib/Core/CoreUtils/istring.hpp

Go to the documentation of this file.
00001 /*
00002     <one line to give the program's name and a brief idea of what it does.>
00003     Copyright (C) <year>  <name of author>
00004 
00005     This program is free software: you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation, either version 3 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program.  If not, see <http://www.gnu.org/licenses/>.
00017 
00018 */
00019 
00020 #ifndef UTIL_ISTRING_HPP
00021 #define UTIL_ISTRING_HPP
00022 
00023 #include <string>
00024 #include <locale>
00025 #include <boost/lexical_cast.hpp>
00026 
00027 namespace isis
00028 {
00029 namespace util
00030 {
00032 namespace _internal
00033 {
00034 struct ichar_traits: public std::char_traits<char> {
00035     static const std::locale loc;
00036     static bool eq ( const char_type &c1, const char_type &c2 );
00037     static bool lt ( const char_type &c1, const char_type &c2 );
00038     static int compare ( const char_type *s1, const char_type *s2, std::size_t n );
00039     static const char_type *find ( const char_type *s, std::size_t n, const char_type &a );
00040 };
00041 }
00043 
00044 typedef std::basic_string<char, _internal::ichar_traits>    istring;
00045 }
00046 }
00047 
00048 namespace std
00049 {
00050 template<typename charT, typename traits>
00051 basic_ostream<charT, traits>& operator<<( basic_ostream<charT, traits> &out, const isis::util::istring &s )
00052 {
00053     return out << s.c_str();
00054 }
00055 }
00056 
00057 namespace boost
00058 {
00059 // specialization for boost::lexical_cast to differ std::string and util::istring
00060 template<> isis::util::istring lexical_cast<isis::util::istring, std::string>        ( const std::string         &arg );
00061 // specialization for boost::lexical_cast to differ std::string and util::istring
00062 template<> std::string         lexical_cast<std::string,         isis::util::istring>( const isis::util::istring &arg );
00063 }
00064 #endif // UTIL_ISTRING_HPP