MCPcopy Create free account
hub / github.com/SpartanJ/eepp / loadLayoutFromString

Method loadLayoutFromString

src/eepp/ui/uiscenenode.cpp:507–535  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

505}
506
507UIWidget* UISceneNode::loadLayoutFromString( const char* layoutString, Node* parent,
508 const Uint32& marker ) {
509 RegEx voidTagsRegex( VOIDTAG_REGEX );
510
511 pugi::xml_document doc;
512 pugi::xml_parse_result result;
513 std::string fixedLayout;
514 bool needsReplacements = voidTagsRegex.matches( layoutString );
515
516 if ( needsReplacements ) {
517 fixedLayout = voidTagsRegex.gsub( layoutString, "%1 />" );
518 result =
519 doc.load_string( fixedLayout.c_str(), pugi::parse_default | pugi::parse_ws_pcdata );
520 } else {
521 result = doc.load_string( layoutString, pugi::parse_default | pugi::parse_ws_pcdata );
522 }
523
524 if ( result ) {
525 return loadLayoutNodes( doc.first_child(), NULL != parent ? parent : this, marker );
526 } else {
527 Log::error( "Couldn't load UI Layout from string: %s",
528 needsReplacements ? fixedLayout.c_str() : layoutString );
529 Log::error( "Error description: %s", result.description() );
530 Log::error( "Error offset: %d", result.offset );
531 Log::error( "Error context: %s", getErrorContext( result.offset, layoutString ) );
532 }
533
534 return NULL;
535}
536
537UIWidget* UISceneNode::loadLayoutFromString( const std::string& layoutString, Node* parent,
538 const Uint32& marker ) {

Callers 15

initMethod · 0.80
createContainerMethod · 0.80
UIBuildStepMethod · 0.80
UIBuildSettingsMethod · 0.80
createDocDirtyAlertMethod · 0.80
initMethod · 0.80
displayHealthMethod · 0.80
UIWelcomeScreenMethod · 0.80
createContainerMethod · 0.80

Calls 5

errorFunction · 0.85
getErrorContextFunction · 0.85
gsubMethod · 0.80
c_strMethod · 0.80
matchesMethod · 0.45

Tested by 5

createMethod · 0.64
UTESTFunction · 0.64
UTESTFunction · 0.64
UTESTFunction · 0.64
createNewUIMethod · 0.64