diff options
-rw-r--r-- | src/uscxml/util/String.cpp | 5 | ||||
-rw-r--r-- | src/uscxml/util/String.h | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/uscxml/util/String.cpp b/src/uscxml/util/String.cpp index 7c89230..24c7d42 100644 --- a/src/uscxml/util/String.cpp +++ b/src/uscxml/util/String.cpp @@ -25,11 +25,12 @@ namespace uscxml { #define ISWHITESPACE(char) (isspace(char)) -std::string macro_escaped(std::string const& s) { +std::string escapedMacro(std::string const& s) { + // inspired by http://stackoverflow.com/questions/2417588/escaping-a-c-string std::string returnValue=""; for (std::string::const_iterator iter = s.begin(), end = s.end(); iter != end; ++iter) { char c = *iter; - if (' ' <= c and c <= '~' and c != '\\' and c != '"') { + if (' ' <= c && c <= '~' && c != '\\' && c != '"') { returnValue += c; } else { diff --git a/src/uscxml/util/String.h b/src/uscxml/util/String.h index b0832c8..9acd288 100644 --- a/src/uscxml/util/String.h +++ b/src/uscxml/util/String.h @@ -25,7 +25,7 @@ namespace uscxml { -std::string macro_escaped(std::string const& s); +std::string escapedMacro(std::string const& s); std::list<std::string> tokenize(const std::string& line, const char seperator = ' ', bool trimWhiteSpace = true); std::string spaceNormalize(const std::string& text); bool nameMatch(const std::string& eventDescs, const std::string& event); |