libyui-ncurses  2.44.1
 All Classes Functions Variables
stringutil.h
1 /*
2  Copyright (C) 2000-2012 Novell, Inc
3  This library is free software; you can redistribute it and/or modify
4  it under the terms of the GNU Lesser General Public License as
5  published by the Free Software Foundation; either version 2.1 of the
6  License, or (at your option) version 3.0 of the License. This library
7  is distributed in the hope that it will be useful, but WITHOUT ANY
8  WARRANTY; without even the implied warranty of MERCHANTABILITY or
9  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10  License for more details. You should have received a copy of the GNU
11  Lesser General Public License along with this library; if not, write
12  to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
13  Floor, Boston, MA 02110-1301 USA
14 */
15 
16 
17 /*-/
18 
19  File: stringutil.h
20 
21  Author: Michael Andres <ma@suse.de>
22 
23 /-*/
24 
25 #ifndef stringutil_h
26 #define stringutil_h
27 
28 #include <iosfwd>
29 #include <sstream>
30 
31 #include <string>
32 #include <vector>
33 
34 namespace strutil
35 {
36  /** StringStream with autoconversion to std::string. */
37  struct StrStr
38  {
39  template<class _Tp>
40  StrStr & operator<<( const _Tp & val )
41  { _str << val; return *this; }
42 
43  operator std::string() const
44  { return _str.str(); }
45 
46  std::ostringstream _str;
47  };
48 
49 
50  extern unsigned split( const std::string line_tv,
51  std::vector<std::string> & words_Vtr,
52  const std::string sep_tv = " \t",
53  const bool singlesep_bv = false );
54 
55 } // namespace strutil
56 
57 namespace std
58 {
59  ostream & operator<<( ostream &, const wstring & );
60 }
61 
62 #endif // stringutil_h