Claw  1.7.3
string_algorithm.hpp
Go to the documentation of this file.
1 /*
2  CLAW - a C++ Library Absolutely Wonderful
3 
4  CLAW is a free library without any particular aim but being useful to
5  anyone.
6 
7  Copyright (C) 2005-2011 Julien Jorge
8 
9  This library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU Lesser General Public
11  License as published by the Free Software Foundation; either
12  version 2.1 of the License, or (at your option) any later version.
13 
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public
20  License along with this library; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 
23  contact: julien.jorge@gamned.org
24 */
30 #ifndef __CLAW_STRING_ALGORITHM_HPP__
31 #define __CLAW_STRING_ALGORITHM_HPP__
32 
33 #include <cstddef>
34 
35 namespace claw
36 {
37  namespace text
38  {
39  template<typename StreamType, typename StringType>
40  StreamType& getline( StreamType& is, StringType& str );
41 
42  template<typename StringType>
43  void trim_left( StringType& str,
44  const typename StringType::value_type* const s = " " );
45 
46  template<typename StringType>
47  void trim_right( StringType& str,
48  const typename StringType::value_type* const s = " " );
49 
50  template<typename StringType>
51  void trim( StringType& str,
52  const typename StringType::value_type* const s = " " );
53 
54  template<typename StringType>
55  void squeeze( StringType& str,
56  const typename StringType::value_type* const s );
57 
58  template<typename StringType>
59  std::size_t
60  replace( StringType& str, const StringType& e1, const StringType& e2 );
61 
62  template<typename T, typename StringType>
63  bool is_of_type( const StringType& str );
64 
65  template<typename Sequence>
66  void split
67  ( Sequence& sequence, const typename Sequence::value_type& str,
68  const typename Sequence::value_type::value_type sep );
69 
70  template<typename Sequence>
71  void split
72  ( Sequence& sequence, typename Sequence::value_type::const_iterator first,
73  typename Sequence::value_type::const_iterator last,
74  const typename Sequence::value_type::value_type sep );
75 
76  template<typename InputIterator, typename OutputIterator>
77  void c_escape
78  ( InputIterator first, InputIterator last, OutputIterator out );
79 
80  template<typename StringType>
81  bool glob_match( const StringType& pattern, const StringType& text,
82  const typename StringType::value_type any_sequence = '*',
83  const typename StringType::value_type zero_or_one = '?',
84  const typename StringType::value_type any = '.' );
85 
86  template<typename StringType>
88  ( const StringType& pattern, const StringType& text,
89  const typename StringType::value_type any_sequence = '*',
90  const typename StringType::value_type zero_or_one = '?',
91  const typename StringType::value_type any = '.' );
92 
93  } // namespace text
94 } // namespace claw
95 
97 
98 #endif // __CLAW_STRING_ALGORITHM_HPP__