diff options
author | markt <markt> | 2007-12-13 05:48:00 (GMT) |
---|---|---|
committer | markt <markt> | 2007-12-13 05:48:00 (GMT) |
commit | 8b7464046cea5e521ac46811591b0fce0c45aca1 (patch) | |
tree | 09df752f426a249ae15375a626a98436c8727593 /src/FbTk/StringUtil.cc | |
parent | daca07edafc2e75eb9ee04d35fe80759308a8583 (diff) | |
download | fluxbox-8b7464046cea5e521ac46811591b0fce0c45aca1.zip fluxbox-8b7464046cea5e521ac46811591b0fce0c45aca1.tar.bz2 |
added FbTk::CommandRegistry, decentralized command parsing, and made them auto-register
Diffstat (limited to 'src/FbTk/StringUtil.cc')
-rw-r--r-- | src/FbTk/StringUtil.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/FbTk/StringUtil.cc b/src/FbTk/StringUtil.cc index 869a3b5..9b4928b 100644 --- a/src/FbTk/StringUtil.cc +++ b/src/FbTk/StringUtil.cc | |||
@@ -233,6 +233,18 @@ string::size_type removeTrailingWhitespace(string &str) { | |||
233 | return first_pos; | 233 | return first_pos; |
234 | } | 234 | } |
235 | 235 | ||
236 | void getFirstWord(const std::string &in, std::string &word, std::string &rest) { | ||
237 | word = in; | ||
238 | string::size_type first_pos = StringUtil::removeFirstWhitespace(word); | ||
239 | string::size_type second_pos = word.find_first_of(" \t", first_pos); | ||
240 | if (second_pos != string::npos) { | ||
241 | rest = word.substr(second_pos); | ||
242 | word.erase(second_pos); | ||
243 | removeFirstWhitespace(rest); | ||
244 | removeTrailingWhitespace(rest); | ||
245 | } | ||
246 | } | ||
247 | |||
236 | }; // end namespace StringUtil | 248 | }; // end namespace StringUtil |
237 | 249 | ||
238 | }; // end namespace FbTk | 250 | }; // end namespace FbTk |