summaryrefslogtreecommitdiffstats
path: root/src/uscxml/util/String.cpp
diff options
context:
space:
mode:
authorJens Heuschkel <heuschkel@tk.tu-darmstadt.de>2016-11-23 10:24:55 (GMT)
committerJens Heuschkel <heuschkel@tk.tu-darmstadt.de>2016-11-23 10:24:55 (GMT)
commit5dbac430453dac1ec1fb76250797df7222f37f40 (patch)
tree26e3c255ac71afa09267242ea882878a3599b7fa /src/uscxml/util/String.cpp
parente7aa2089b209388afd361b1d094ceeb57b5a6910 (diff)
downloaduscxml-5dbac430453dac1ec1fb76250797df7222f37f40.zip
uscxml-5dbac430453dac1ec1fb76250797df7222f37f40.tar.gz
uscxml-5dbac430453dac1ec1fb76250797df7222f37f40.tar.bz2
butify code again
Diffstat (limited to 'src/uscxml/util/String.cpp')
-rw-r--r--src/uscxml/util/String.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/uscxml/util/String.cpp b/src/uscxml/util/String.cpp
index ae1aa68..6a80756 100644
--- a/src/uscxml/util/String.cpp
+++ b/src/uscxml/util/String.cpp
@@ -26,26 +26,25 @@ namespace uscxml {
#define ISWHITESPACE(char) (isspace(char))
std::string escapeMacro(std::string const &s) {
- // inspired by http://stackoverflow.com/questions/2417588/escaping-a-c-string
- std::string returnValue="";
+ // inspired by http://stackoverflow.com/questions/2417588/escaping-a-c-string
+ std::string returnValue="";
std::string specialChars="";
- for (std::string::const_iterator iter = s.begin(), end = s.end(); iter != end; ++iter) {
- char c = *iter;
- if (('0' <= c && c <= '9') || ('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z') || c == '_') {
- returnValue += c;
- }
- else {
- specialChars += c;
- }
- }
- if (!specialChars.empty()){
+ for (std::string::const_iterator iter = s.begin(), end = s.end(); iter != end; ++iter) {
+ char c = *iter;
+ if (('0' <= c && c <= '9') || ('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z') || c == '_') {
+ returnValue += c;
+ } else {
+ specialChars += c;
+ }
+ }
+ if (!specialChars.empty()) {
// http://www.cplusplus.com/reference/functional/hash/
// returns the same result for a given string within one execution
std::hash<std::string> strHash;
returnValue += "_";
returnValue += strHash(specialChars);
}
- return returnValue;
+ return returnValue;
}
std::list<std::string> tokenize(const std::string& line, const char sep, bool trimWhiteSpace) {