From 94c0e3ed10dd58b122ddecb4192b19365e8befe8 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Thu, 23 Nov 2017 19:37:45 +0400 Subject: [PATCH] Move toUpper() from StringUtils to the JournalViewModel --- apps/openmw/mwgui/journalviewmodel.cpp | 19 ++++++++++++++++++- components/misc/stringops.hpp | 18 ------------------ 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/apps/openmw/mwgui/journalviewmodel.cpp b/apps/openmw/mwgui/journalviewmodel.cpp index d7b233ff3..6ff68c9c5 100644 --- a/apps/openmw/mwgui/journalviewmodel.cpp +++ b/apps/openmw/mwgui/journalviewmodel.cpp @@ -314,7 +314,7 @@ struct JournalViewModelImpl : JournalViewModel for (MWBase::Journal::TTopicIter i = journal->topicBegin (); i != journal->topicEnd (); ++i) { Utf8Stream stream (i->first.c_str()); - uint32_t first = Misc::StringUtils::toUpper(stream.peek()); + uint32_t first = toUpper(stream.peek()); if (first != character) continue; @@ -323,6 +323,23 @@ struct JournalViewModelImpl : JournalViewModel } } + static uint32_t toUpper(uint32_t ch) + { + // Russian alphabet + if (ch >= 0x0430 && ch < 0x0450) + ch -= 0x20; + + // Cyrillic IO character + if (ch == 0x0451) + ch -= 0x50; + + // Latin alphabet + if (ch >= 0x61 && ch < 0x80) + ch -= 0x20; + + return ch; + } + struct TopicEntryImpl : BaseEntry { MWDialogue::Topic const & mTopic; diff --git a/components/misc/stringops.hpp b/components/misc/stringops.hpp index 1edb5ea61..9f4931d72 100644 --- a/components/misc/stringops.hpp +++ b/components/misc/stringops.hpp @@ -1,7 +1,6 @@ #ifndef MISC_STRINGOPS_H #define MISC_STRINGOPS_H -#include #include #include #include @@ -57,23 +56,6 @@ public: }; } - static uint32_t toUpper(uint32_t ch) - { - // Russian alphabet - if (ch >= 0x0430 && ch < 0x0450) - ch -= 0x20; - - // Cyrillic YO character - if (ch == 0x0451) - ch -= 0x50; - - // Latin alphabet - if (ch >= 0x61 && ch < 0x80) - ch -= 0x20; - - return ch; - } - static bool ciLess(const std::string &x, const std::string &y) { return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end(), ci()); }