From e6c28c5209b5508a61affc947179260cec0d2733 Mon Sep 17 00:00:00 2001 From: methodus Date: Thu, 29 Nov 2012 00:17:50 +0100 Subject: Added some SQLite pragmas which should reduce accesses on the file system for writing --- common/tools.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'common') diff --git a/common/tools.cpp b/common/tools.cpp index 6f02d2a..1e40ccc 100644 --- a/common/tools.cpp +++ b/common/tools.cpp @@ -74,6 +74,18 @@ StringVector GetNetworkInterfaces(bool skipLoop){ return interfaces; } +string Trim(const std::string& str, const std::string& whitespace) +{ + const unsigned long int strBegin = str.find_first_not_of(whitespace); + if (strBegin == std::string::npos) + return ""; // no content + + const unsigned long int strEnd = str.find_last_not_of(whitespace); + const unsigned long int strRange = strEnd - strBegin + 1; + + return str.substr(strBegin, strRange); +} + string ToString(long number){ stringstream ss; ss << number; -- cgit v1.2.3