MCPcopy Create free account
hub / github.com/axmolengine/axmol / MyXMLVisitor

Method MyXMLVisitor

core/ui/UIRichText.cpp:447–762  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

445MyXMLVisitor::TagTables MyXMLVisitor::_tagTables;
446
447MyXMLVisitor::MyXMLVisitor(RichText* richText) : _fontElements(20), _richText(richText)
448{
449 MyXMLVisitor::setTagDescription("font", true, [](const ValueMap& tagAttrValueMap) {
450 // supported attributes:
451 // size, color, align, face
452 ValueMap attrValueMap;
453
454 if (auto&& itr = tagAttrValueMap.find("size"); itr != tagAttrValueMap.end())
455 {
456 attrValueMap[RichText::KEY_FONT_SIZE] = itr->second.asString();
457 }
458 if (auto&& itr = tagAttrValueMap.find("color"); itr != tagAttrValueMap.end())
459 {
460 attrValueMap[RichText::KEY_FONT_COLOR_STRING] = itr->second.asString();
461 }
462 if (auto&& itr = tagAttrValueMap.find("face"); itr != tagAttrValueMap.end())
463 {
464 attrValueMap[RichText::KEY_FONT_FACE] = itr->second.asString();
465 }
466
467 return make_pair(attrValueMap, nullptr);
468 });
469
470 MyXMLVisitor::setTagDescription("b", true, [](const ValueMap& /*tagAttrValueMap*/) {
471 // no supported attributes
472 ValueMap attrValueMap;
473 attrValueMap[RichText::KEY_TEXT_BOLD] = true;
474 return make_pair(attrValueMap, nullptr);
475 });
476
477 MyXMLVisitor::setTagDescription("i", true, [](const ValueMap& /*tagAttrValueMap*/) {
478 // no supported attributes
479 ValueMap attrValueMap;
480 attrValueMap[RichText::KEY_TEXT_ITALIC] = true;
481 return make_pair(attrValueMap, nullptr);
482 });
483
484 MyXMLVisitor::setTagDescription("del", true, [](const ValueMap& /*tagAttrValueMap*/) {
485 // no supported attributes
486 ValueMap attrValueMap;
487 attrValueMap[RichText::KEY_TEXT_LINE] = RichText::VALUE_TEXT_LINE_DEL;
488 return make_pair(attrValueMap, nullptr);
489 });
490
491 MyXMLVisitor::setTagDescription("u", true, [](const ValueMap& /*tagAttrValueMap*/) {
492 // no supported attributes
493 ValueMap attrValueMap;
494 attrValueMap[RichText::KEY_TEXT_LINE] = RichText::VALUE_TEXT_LINE_UNDER;
495 return make_pair(attrValueMap, nullptr);
496 });
497
498 MyXMLVisitor::setTagDescription("small", true, [](const ValueMap& /*tagAttrValueMap*/) {
499 ValueMap attrValueMap;
500 attrValueMap[RichText::KEY_FONT_SMALL] = true;
501 return make_pair(attrValueMap, nullptr);
502 });
503
504 MyXMLVisitor::setTagDescription("big", true, [](const ValueMap& /*tagAttrValueMap*/) {

Callers

nothing calls this directly

Calls 15

createFunction · 0.85
asStringMethod · 0.80
asStringRefMethod · 0.80
asIntMethod · 0.80
asFloatMethod · 0.80
setIdMethod · 0.80
findMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45
lengthMethod · 0.45
dataMethod · 0.45
setHeightMethod · 0.45

Tested by

no test coverage detected