Main Page | User's Guide | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members

Talos-0.3/String.hxx

00001 // Copyright (C) 2004 Vivien Mallet 00002 // 00003 // This file is part of Talos library. 00004 // Talos library provides miscellaneous tools to make up for C++ 00005 // lacks and to ease C++ programming. 00006 // 00007 // Talos is free software; you can redistribute it and/or modify 00008 // it under the terms of the GNU General Public License as published by 00009 // the Free Software Foundation; either version 2 of the License, or 00010 // (at your option) any later version. 00011 // 00012 // Talos is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License (file "license") for more details. 00016 // 00017 // For more information, please see the Talos home page: 00018 // http://spacetown.free.fr/lib/talos/ 00019 00020 00021 #ifndef TALOS_FILE_STRING_HXX 00022 00023 00024 namespace Talos 00025 { 00026 00027 template<typename T> 00028 string to_str(const T& input); 00029 00030 template<typename T> 00031 std::string to_str_fill(const T& input, int l=2) 00032 { 00033 std::ostringstream output; 00034 output.width(l); 00035 output.fill('0'); 00036 output << input; 00037 return output.str(); 00038 } 00039 00040 string fill(const string& input, int l = 2, char c = ' ', 00041 ios_base& pos(ios_base&) = left) 00042 { 00043 std::ostringstream output; 00044 output.width(l); 00045 output.fill(c); 00046 output << pos << input; 00047 return output.str(); 00048 } 00049 00050 template <class T> 00051 void to_num(const string& s, T& num); 00052 00053 template <class T> 00054 T to_num(const string& s); 00055 00056 template <class T> 00057 void convert(const string& s, T& num); 00058 void convert(const string& s, string& num); 00059 00060 template <class T> 00061 T convert(const string& s); 00062 00063 string lower_case(string str); 00064 string upper_case(string str); 00065 00066 bool is_num(const string& s); 00067 00068 bool is_integer(const string& s); 00069 00070 bool is_unsigned_integer(const string& s); 00071 00072 string find_replace(string str, string old_str, string new_str = ""); 00073 00074 string trim(string str, string delimiters = " \n\t"); 00075 00076 string trim_beg(string str, string delimiters = " \n\t"); 00077 00078 string trim_end(string str, string delimiters = " \n\t"); 00079 00080 template <class T> 00081 void split(string str, vector<T>& vect, string delimiters = " \n\t"); 00082 vector<string> split(string str, string delimiters = " \n\t"); 00083 00084 template <class T> 00085 void split_markup(string str, vector<T>& elements, vector<bool>& is_markup, 00086 string delimiters = "$"); 00087 00088 template <class T> 00089 void print(const vector<T>& v); 00090 00091 } // namespace Talos. 00092 00093 00094 #define TALOS_FILE_STRING_HXX 00095 #endif

Generated on Sun Oct 3 19:22:03 2004 for Talos by doxygen 1.3.8