aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk
diff options
context:
space:
mode:
authorMark Tiefenbruck <mark@fluxbox.org>2007-12-20 20:23:56 (GMT)
committerMark Tiefenbruck <mark@fluxbox.org>2007-12-20 20:23:56 (GMT)
commit03dce043b78103a977bd6c48b81bb1b462aaac5f (patch)
tree6cc49956acf8c4049f7d6702058534d29c1c15c2 /src/FbTk
parentb90a7e21a9f56f8e9f92c7ec357cbf683e6fd712 (diff)
downloadfluxbox_paul-03dce043b78103a977bd6c48b81bb1b462aaac5f.zip
fluxbox_paul-03dce043b78103a977bd6c48b81bb1b462aaac5f.tar.bz2
added ForEach key command
Diffstat (limited to 'src/FbTk')
-rw-r--r--src/FbTk/StringUtil.hh21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/FbTk/StringUtil.hh b/src/FbTk/StringUtil.hh
index d3c131e..bca48bc 100644
--- a/src/FbTk/StringUtil.hh
+++ b/src/FbTk/StringUtil.hh
@@ -67,6 +67,27 @@ std::string::size_type removeTrailingWhitespace(std::string &str);
67/// splits input at first non-leading whitespace and returns both parts 67/// splits input at first non-leading whitespace and returns both parts
68void getFirstWord(const std::string &in, std::string &first, std::string &rest); 68void getFirstWord(const std::string &in, std::string &first, std::string &rest);
69 69
70template <typename Container>
71static void stringTokensBetween(Container &container, const std::string &in,
72 std::string &rest, char first, char last,
73 const char *ok_chars = " \t\n", bool allow_nesting = true) {
74
75 std::string token;
76 int err = 0, pos = 0;
77
78 while (true) {
79 err = getStringBetween(token, in.c_str() + pos, first, last, ok_chars,
80 allow_nesting);
81 if (err == 0)
82 break;
83 container.push_back(token);
84 pos += err;
85 }
86
87 rest = in.c_str() + pos;
88
89}
90
70/// Breaks a string into tokens 91/// Breaks a string into tokens
71template <typename Container> 92template <typename Container>
72static void 93static void