refactor(core): Clean-up

- use "#pragma once" instead of the regular include guard
- fix errors and warnings reported by cppcheck
This commit is contained in:
Michael Carlberg
2016-05-31 05:58:58 +02:00
parent d0499d4d15
commit 39d3f61497
81 changed files with 588 additions and 730 deletions

View File

@ -8,13 +8,13 @@ namespace string
return lower(s1) == lower(s2);
}
std::string upper(const std::string& s)
{
std::string str(s);
for (auto &c : str)
c = std::toupper(c);
return str;
}
// std::string upper(const std::string& s)
// {
// std::string str(s);
// for (auto &c : str)
// c = std::toupper(c);
// return str;
// }
std::string lower(const std::string& s)
{
@ -41,14 +41,14 @@ namespace string
return replace_all(haystack, {needle, needle}, {needle});
}
std::string strip(const std::string& haystack, const char &needle)
{
std::string str(haystack);
std::string::size_type pos;
while ((pos = str.find(needle)) != std::string::npos)
str.erase(pos, 1);
return str;
}
// std::string strip(const std::string& haystack, const char &needle)
// {
// std::string str(haystack);
// std::string::size_type pos;
// while ((pos = str.find(needle)) != std::string::npos)
// str.erase(pos, 1);
// return str;
// }
std::string strip_trailing_newline(const std::string& haystack)
{