aboutsummaryrefslogtreecommitdiff
path: root/src/StringUtil.hh
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-04-26 18:12:16 (GMT)
committerfluxgen <fluxgen>2003-04-26 18:12:16 (GMT)
commit3e92ad1010694d789dcceb383059587641928f9f (patch)
tree1fc2e7ac295f2ea1b379b43ab0337f3a5aafdb86 /src/StringUtil.hh
parent2065e654a357c6bf45c5747e25b713415eab8983 (diff)
downloadfluxbox_pavel-3e92ad1010694d789dcceb383059587641928f9f.zip
fluxbox_pavel-3e92ad1010694d789dcceb383059587641928f9f.tar.bz2
moved to FbTk
Diffstat (limited to 'src/StringUtil.hh')
-rw-r--r--src/StringUtil.hh79
1 files changed, 0 insertions, 79 deletions
diff --git a/src/StringUtil.hh b/src/StringUtil.hh
deleted file mode 100644
index 68c8440..0000000
--- a/src/StringUtil.hh
+++ /dev/null
@@ -1,79 +0,0 @@
1// StringUtil.hh for fluxbox
2// Copyright (c) 2001 - 2002 Henrik Kinnunen (fluxgen@linuxmail.org)
3//
4// Permission is hereby granted, free of charge, to any person obtaining a
5// copy of this software and associated documentation files (the "Software"),
6// to deal in the Software without restriction, including without limitation
7// the rights to use, copy, modify, merge, publish, distribute, sublicense,
8// and/or sell copies of the Software, and to permit persons to whom the
9// Software is furnished to do so, subject to the following conditions:
10//
11// The above copyright notice and this permission notice shall be included in
12// all copies or substantial portions of the Software.
13//
14// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE.
21
22//$Id: StringUtil.hh,v 1.11 2002/12/01 13:41:59 rathnor Exp $
23
24#ifndef STRINGUTIL_HH
25#define STRINGUTIL_HH
26
27#include <string>
28
29namespace StringUtil
30{
31
32char *strdup(const char *);
33
34//Similar to `strstr' but this function ignores the case of both strings
35const char *strcasestr(const char *str, const char *ptn);
36
37std::string expandFilename(const std::string &filename);
38int getStringBetween(std::string& out, const char *instr, const char first, const char last,
39 const char *ok_chars=" \t\n");
40
41void toLower(char * const conv);
42
43//--------- stringtok ----------------------------------
44// Breaks a string into tokens
45//--------------------------------------------------
46template <typename Container>
47static void
48stringtok (Container &container, std::string const &in,
49 const char * const delimiters = " \t\n")
50{
51 const std::string::size_type len = in.length();
52 std::string::size_type i = 0;
53
54 while ( i < len ) {
55 // eat leading whitespace
56 i = in.find_first_not_of(delimiters, i);
57 if (i == std::string::npos)
58 return; // nothing left but white space
59
60 // find the end of the token
61 std::string::size_type j = in.find_first_of(delimiters, i);
62
63 // push token
64 if (j == std::string::npos) {
65 container.push_back(in.substr(i));
66 return;
67 } else
68 container.push_back(in.substr(i, j-i));
69
70 // set up for next loop
71 i = j + 1;
72 }
73}
74
75};//end namespace StringUtil
76
77
78
79#endif // STRINGUTIL_HH