Claw 1.7.0
|
00001 /* 00002 CLAW - a C++ Library Absolutely Wonderful 00003 00004 CLAW is a free library without any particular aim but being useful to 00005 anyone. 00006 00007 Copyright (C) 2005-2011 Julien Jorge 00008 00009 This library is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU Lesser General Public 00011 License as published by the Free Software Foundation; either 00012 version 2.1 of the License, or (at your option) any later version. 00013 00014 This library is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public 00020 License along with this library; if not, write to the Free Software 00021 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00022 00023 contact: julien.jorge@gamned.org 00024 */ 00030 #ifndef __CLAW_STRING_ALGORITHM_HPP__ 00031 #define __CLAW_STRING_ALGORITHM_HPP__ 00032 00033 #include <cstddef> 00034 00035 namespace claw 00036 { 00037 namespace text 00038 { 00039 template<typename StreamType, typename StringType> 00040 StreamType& getline( StreamType& is, StringType& str ); 00041 00042 template<typename StringType> 00043 void trim_left( StringType& str, 00044 const typename StringType::value_type* const s = " " ); 00045 00046 template<typename StringType> 00047 void trim_right( StringType& str, 00048 const typename StringType::value_type* const s = " " ); 00049 00050 template<typename StringType> 00051 void trim( StringType& str, 00052 const typename StringType::value_type* const s = " " ); 00053 00054 template<typename StringType> 00055 void squeeze( StringType& str, 00056 const typename StringType::value_type* const s ); 00057 00058 template<typename StringType> 00059 std::size_t 00060 replace( StringType& str, const StringType& e1, const StringType& e2 ); 00061 00062 template<typename T, typename StringType> 00063 bool is_of_type( const StringType& str ); 00064 00065 template<typename Sequence> 00066 void split 00067 ( Sequence& sequence, const typename Sequence::value_type& str, 00068 const typename Sequence::value_type::value_type sep ); 00069 00070 template<typename Sequence> 00071 void split 00072 ( Sequence& sequence, typename Sequence::value_type::const_iterator first, 00073 typename Sequence::value_type::const_iterator last, 00074 const typename Sequence::value_type::value_type sep ); 00075 00076 template<typename InputIterator, typename OutputIterator> 00077 void c_escape 00078 ( InputIterator first, InputIterator last, OutputIterator out ); 00079 00080 template<typename StringType> 00081 bool glob_match( const StringType& pattern, const StringType& text, 00082 const typename StringType::value_type any_sequence = '*', 00083 const typename StringType::value_type zero_or_one = '?', 00084 const typename StringType::value_type any = '.' ); 00085 00086 template<typename StringType> 00087 bool glob_potential_match 00088 ( const StringType& pattern, const StringType& text, 00089 const typename StringType::value_type any_sequence = '*', 00090 const typename StringType::value_type zero_or_one = '?', 00091 const typename StringType::value_type any = '.' ); 00092 00093 } // namespace text 00094 } // namespace claw 00095 00096 #include <claw/impl/string_algorithm.tpp> 00097 00098 #endif // __CLAW_STRING_ALGORITHM_HPP__