loolwsd/LOOLProtocol.cpp | 13 +++++++++++++ loolwsd/LOOLProtocol.hpp | 1 + 2 files changed, 14 insertions(+)
New commits: commit f4fc6d0c29e407d60feaaf7f353c35267d4acbed Author: Ashod Nakashian <[email protected]> Date: Sun May 22 11:26:30 2016 -0400 loolwsd: new name=value pair parser for strings Change-Id: I01c56f9c452fe0ac75b3d9f2aa67787c5bb4d8c6 Reviewed-on: https://gerrit.libreoffice.org/25336 Reviewed-by: Ashod Nakashian <[email protected]> Tested-by: Ashod Nakashian <[email protected]> diff --git a/loolwsd/LOOLProtocol.cpp b/loolwsd/LOOLProtocol.cpp index a00127c..ec820db 100644 --- a/loolwsd/LOOLProtocol.cpp +++ b/loolwsd/LOOLProtocol.cpp @@ -70,6 +70,19 @@ namespace LOOLProtocol return false; } + bool parseNameValuePair(const std::string& token, std::string& name, std::string& value) + { + const auto mid = token.find_first_of('='); + if (mid != std::string::npos) + { + name = token.substr(0, mid); + value = token.substr(mid + 1); + return true; + } + + return false; + } + bool getTokenInteger(const std::string& token, const std::string& name, int& value) { size_t nextIdx; diff --git a/loolwsd/LOOLProtocol.hpp b/loolwsd/LOOLProtocol.hpp index 7b2a76e..f239bca 100644 --- a/loolwsd/LOOLProtocol.hpp +++ b/loolwsd/LOOLProtocol.hpp @@ -39,6 +39,7 @@ namespace LOOLProtocol bool stringToInteger(const std::string& input, int& value); bool parseNameIntegerPair(const std::string& token, std::string& name, int& value); + bool parseNameValuePair(const std::string& token, std::string& name, std::string& value); bool getTokenInteger(const std::string& token, const std::string& name, int& value); bool getTokenString(const std::string& token, const std::string& name, std::string& value); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
