diff options
author | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2010-05-13 19:57:49 +0200 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2010-05-16 23:25:35 +0200 |
commit | 32a27a534582b63324444b4650f08637834232fd (patch) | |
tree | 9e7f349f948864e551711a8c479a24cb0496f387 /src/utils/stringfilter.cpp | |
parent | 1e164776a737b57c54a71f6eab8f93263146b089 (diff) | |
download | manaserv-32a27a534582b63324444b4650f08637834232fd.tar.gz manaserv-32a27a534582b63324444b4650f08637834232fd.tar.bz2 manaserv-32a27a534582b63324444b4650f08637834232fd.tar.xz manaserv-32a27a534582b63324444b4650f08637834232fd.zip |
Random cleanups, adding const, removing unnecessary clear calls
Reviewed-by: Jared Adams
Diffstat (limited to 'src/utils/stringfilter.cpp')
-rw-r--r-- | src/utils/stringfilter.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/utils/stringfilter.cpp b/src/utils/stringfilter.cpp index de46491b..4a9d19cc 100644 --- a/src/utils/stringfilter.cpp +++ b/src/utils/stringfilter.cpp @@ -31,14 +31,12 @@ namespace utils StringFilter::StringFilter(): mInitialized(false) { - mSlangs.clear(); // Does this make any sense here? loadSlangFilterList(); } StringFilter::~StringFilter() { writeSlangFilterList(); - mSlangs.clear(); // Does this make any sense here? } bool StringFilter::loadSlangFilterList() @@ -71,7 +69,7 @@ void StringFilter::writeSlangFilterList() //mConfig->setValue("SlangsList", slangsList); } -bool StringFilter::filterContent(const std::string& text) +bool StringFilter::filterContent(const std::string &text) const { if (!mInitialized) { LOG_DEBUG("Slangs List is not initialized."); @@ -84,7 +82,7 @@ bool StringFilter::filterContent(const std::string& text) std::transform(text.begin(), text.end(), upperCaseText.begin(), (int(*)(int))std::toupper); - for (SlangIterator i = mSlangs.begin(); i != mSlangs.end(); ++i) + for (Slangs::const_iterator i = mSlangs.begin(); i != mSlangs.end(); ++i) { // We look for slangs into the sentence. std::string upperCaseSlang = *i; @@ -100,7 +98,7 @@ bool StringFilter::filterContent(const std::string& text) return isContentClean; } -bool StringFilter::isEmailValid(const std::string& email) +bool StringFilter::isEmailValid(const std::string &email) const { unsigned int min = Configuration::getValue("account_minEmailLength", 7); unsigned int max = Configuration::getValue("account_maxEmailLength", 128); @@ -119,7 +117,7 @@ bool StringFilter::isEmailValid(const std::string& email) (email.find_first_of(' ') == std::string::npos); } -bool StringFilter::findDoubleQuotes(const std::string &text) +bool StringFilter::findDoubleQuotes(const std::string &text) const { return (text.find('"', 0) != std::string::npos); } |