MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / LoadBuffer

Method LoadBuffer

engine/Poseidon/UI/Controls/UIControlsExt.cpp:1341–1770  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1339}
1340
1341void CHTMLContainer::LoadBuffer(const char* filenameHint, const char* utf8Text, bool add)
1342{
1343 if (!add)
1344 {
1345 Init(); // clear current content
1346 }
1347 _filename = filenameHint ? filenameHint : "";
1348
1349 std::string utf8Buf = utf8Text ? utf8Text : "";
1350
1351 QIStream in;
1352 in.init(utf8Buf.data(), static_cast<int>(utf8Buf.size()));
1353
1354 HTMLStackItem item(HTMLNone, HALeft, HFP);
1355 HTMLStack stack;
1356 RString href = "";
1357 int section = -1;
1358 bool bottom = false;
1359 int c;
1360 while (true)
1361 {
1362 I_AM_ALIVE();
1363
1364 c = in.get();
1365 if (in.eof() || in.fail())
1366 {
1367 break;
1368 }
1369
1370 if (c == '<')
1371 {
1372 // tag
1373 RString tag = ReadTag(in);
1374 switch (item.context)
1375 {
1376 case HTMLNone:
1377 if (stricmp(tag, "html") == 0)
1378 {
1379 stack.Push(item);
1380 item.context = HTMLHTML;
1381 }
1382 break;
1383 case HTMLHTML:
1384 if (stricmp(tag, "/html") == 0)
1385 {
1386 item = stack.Pop();
1387 }
1388 else if (stricmp(tag, "head") == 0)
1389 {
1390 stack.Push(item);
1391 item.context = HTMLHead;
1392 }
1393 else if (stricmp(tag, "body") == 0)
1394 {
1395 stack.Push(item);
1396 item.context = HTMLBody;
1397 if (section >= 0)
1398 {

Callers 3

LoadMissionPreviewHtmlFunction · 0.80
OnChangeMissionMethod · 0.80
LoadLocalizedMissionHtmlFunction · 0.80

Calls 15

ReadParagraphPropertiesFunction · 0.85
ReadTablePropertiesFunction · 0.85
ConvertURLFunction · 0.85
sizeMethod · 0.80
PopMethod · 0.80
GetLangIDMethod · 0.80
ReadTagFunction · 0.70
SkipSpacesFunction · 0.70
ReadPropertyNameFunction · 0.70
ReadPropertyValueFunction · 0.70
SkipTagFunction · 0.70
ReadTextFunction · 0.70

Tested by

no test coverage detected