MCPcopy Create free account
hub / github.com/diasurgical/DevilutionX / ParseMetadata

Function ParseMetadata

Source/utils/language.cpp:243–264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

241}
242
243void ParseMetadata(string_view metadata)
244{
245 string_view::size_type delim;
246
247 while (!metadata.empty() && ((delim = metadata.find(':')) != string_view::npos)) {
248 const string_view key = TrimLeft(string_view(metadata.data(), delim));
249 string_view val = TrimLeft(string_view(metadata.data() + delim + 1, metadata.size() - delim - 1));
250
251 if ((delim = val.find('\n')) != string_view::npos) {
252 val = string_view(val.data(), delim);
253 metadata.remove_prefix(val.data() - metadata.data() + val.size() + 1);
254 } else {
255 metadata.remove_prefix(metadata.size());
256 }
257
258 // Match "Plural-Forms: nplurals=2; plural=(n != 1);"
259 if (key == "Plural-Forms") {
260 ParsePluralForms(val);
261 break;
262 }
263 }
264}
265
266bool ReadEntry(AssetHandle &handle, const MoEntry &e, char *result)
267{

Callers 1

LanguageInitializeFunction · 0.85

Calls 5

TrimLeftFunction · 0.85
ParsePluralFormsFunction · 0.85
emptyMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected