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

Method loadLayoutFromFile

src/eepp/ui/uiscenenode.cpp:478–505  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

476}
477
478UIWidget* UISceneNode::loadLayoutFromFile( const std::string& layoutPath, Node* parent,
479 const Uint32& marker ) {
480 if ( FileSystem::fileExists( layoutPath ) ) {
481 pugi::xml_document doc;
482 pugi::xml_parse_result result =
483 doc.load_file( layoutPath.c_str(), pugi::parse_default | pugi::parse_ws_pcdata );
484
485 if ( result ) {
486 return loadLayoutNodes( doc.first_child(), NULL != parent ? parent : this, marker );
487 } else {
488 Log::error( "Couldn't load UI Layout: %s", layoutPath.c_str() );
489 Log::error( "Error description: %s", result.description() );
490 Log::error( "Error offset: %d", result.offset );
491 std::string data;
492 FileSystem::fileGet( layoutPath, data );
493 Log::error( "Error context: %s", getErrorContext( result.offset, data ) );
494 }
495 } else if ( PackManager::instance()->isFallbackToPacksActive() ) {
496 std::string path( layoutPath );
497 Pack* pack = PackManager::instance()->exists( path );
498
499 if ( NULL != pack ) {
500 return loadLayoutFromPack( pack, path, parent );
501 }
502 }
503
504 return NULL;
505}
506
507UIWidget* UISceneNode::loadLayoutFromString( const char* layoutString, Node* parent,
508 const Uint32& marker ) {

Callers 2

loadLayoutMethod · 0.80
UTESTFunction · 0.80

Calls 4

errorFunction · 0.85
getErrorContextFunction · 0.85
c_strMethod · 0.80
existsMethod · 0.45

Tested by 1

UTESTFunction · 0.64