MCPcopy Create free account
hub / github.com/MyGUI/mygui / _loadLanguage

Method _loadLanguage

MyGUIEngine/src/MyGUI_LanguageManager.cpp:160–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

158 }
159
160 void LanguageManager::_loadLanguage(IDataStream* _stream, bool _user)
161 {
162 // формат txt
163 std::string read;
164 while (!_stream->eof())
165 {
166 _stream->readline(read, '\n');
167 if (read.empty())
168 continue;
169
170 // заголовок утф
171 if ((uint8)read[0] == 0xEF && read.size() > 2)
172 {
173 read.erase(0, 3);
174 }
175
176 if (read[read.size() - 1] == '\r')
177 read.erase(read.size() - 1, 1);
178 if (read.empty())
179 continue;
180
181 size_t pos = read.find_first_of(" \t");
182 if (_user)
183 {
184 if (pos == std::string::npos)
185 mUserMapLanguage[read].clear();
186 else
187 mUserMapLanguage[read.substr(0, pos)] = read.substr(pos + 1, std::string::npos);
188 }
189 else
190 {
191 if (pos == std::string::npos)
192 mMapLanguage[read].clear();
193 else
194 mMapLanguage[read.substr(0, pos)] = read.substr(pos + 1, std::string::npos);
195 }
196 }
197 }
198
199 UString LanguageManager::replaceTags(const UString& _line) const
200 {

Callers

nothing calls this directly

Calls 8

find_first_ofMethod · 0.80
substrMethod · 0.80
eofMethod · 0.45
readlineMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45
eraseMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected