mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-01 03:21:41 +00:00
Move toUpper() from StringUtils to the JournalViewModel
This commit is contained in:
parent
a8bf4cdd98
commit
94c0e3ed10
@ -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::TEntryIter, TopicEntry>
|
||||
{
|
||||
MWDialogue::Topic const & mTopic;
|
||||
|
@ -1,7 +1,6 @@
|
||||
#ifndef MISC_STRINGOPS_H
|
||||
#define MISC_STRINGOPS_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <cctype>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
@ -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());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user