From b68611144a92b266ab20b7db8fbce723bb499b70 Mon Sep 17 00:00:00 2001 From: kukin-konstantin Date: Mon, 20 Mar 2017 18:43:36 +0300 Subject: fix errors --- src/tools/FileTools.cpp | 10 ++++++++++ src/tools/StringTools.cpp | 2 -- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src/tools') diff --git a/src/tools/FileTools.cpp b/src/tools/FileTools.cpp index e92e96d..14c322c 100644 --- a/src/tools/FileTools.cpp +++ b/src/tools/FileTools.cpp @@ -22,4 +22,14 @@ std::string read(const std::string& filePath) { throw errno; } +bool write(const std::string& content, const std::string& filePath) { + ofstream out(filePath, ios::out | ios::binary); + if (out) { + out << content; + out.close(); + return true; + } + return false; +} + }; diff --git a/src/tools/StringTools.cpp b/src/tools/StringTools.cpp index ab7da46..0e68dcc 100644 --- a/src/tools/StringTools.cpp +++ b/src/tools/StringTools.cpp @@ -90,12 +90,10 @@ string generateRandomString(size_t length) { string urlEncode(const string& value, const std::string& additionalLegitChars) { static const string legitPunctuation = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.-~:"; std::stringstream ss; - std::string t; for (auto const &c : value) { if ((legitPunctuation.find(c) == std::string::npos) && (additionalLegitChars.find(c)==std::string::npos)) { ss << '%' << std::uppercase << std::setfill('0') << std::setw(2) << std::hex << (unsigned int)(unsigned char)c; - t = ss.str(); } else { ss << c; } -- cgit v1.2.3