mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-24 18:32:19 -05:00
Add Alternate Headers XML logger (#4207)
This commit is contained in:
parent
f99993af85
commit
839fcffe17
@ -17,6 +17,7 @@ std::shared_ptr<Ship::IResource> SetAlternateHeadersFactory::ReadResource(std::s
|
|||||||
auto headerName = reader->ReadString();
|
auto headerName = reader->ReadString();
|
||||||
if (!headerName.empty()) {
|
if (!headerName.empty()) {
|
||||||
setAlternateHeaders->headers.push_back(std::static_pointer_cast<Scene>(Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(headerName.c_str())));
|
setAlternateHeaders->headers.push_back(std::static_pointer_cast<Scene>(Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(headerName.c_str())));
|
||||||
|
setAlternateHeaders->headerFileNames.push_back(headerName);
|
||||||
} else {
|
} else {
|
||||||
setAlternateHeaders->headers.push_back(nullptr);
|
setAlternateHeaders->headers.push_back(nullptr);
|
||||||
}
|
}
|
||||||
@ -41,7 +42,7 @@ std::shared_ptr<Ship::IResource> SetAlternateHeadersFactoryXML::ReadResource(std
|
|||||||
std::string childName = child->Name();
|
std::string childName = child->Name();
|
||||||
if (childName == "AlternateHeader") {
|
if (childName == "AlternateHeader") {
|
||||||
for (uint32_t i = 0; i < setAlternateHeaders->numHeaders; i++) {
|
for (uint32_t i = 0; i < setAlternateHeaders->numHeaders; i++) {
|
||||||
auto headerName = std::string(child->Attribute("HeaderName"));
|
auto headerName = std::string(child->Attribute("Path"));
|
||||||
if (!headerName.empty()) {
|
if (!headerName.empty()) {
|
||||||
setAlternateHeaders->headers.push_back(std::static_pointer_cast<Scene>(Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(headerName.c_str())));
|
setAlternateHeaders->headers.push_back(std::static_pointer_cast<Scene>(Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(headerName.c_str())));
|
||||||
} else {
|
} else {
|
||||||
|
@ -73,6 +73,12 @@ void LogAlternateHeadersAsXML(std::shared_ptr<Ship::IResource> resource) {
|
|||||||
tinyxml2::XMLElement* root = doc.NewElement("SetAlternateHeaders");
|
tinyxml2::XMLElement* root = doc.NewElement("SetAlternateHeaders");
|
||||||
doc.InsertFirstChild(root);
|
doc.InsertFirstChild(root);
|
||||||
|
|
||||||
|
for (size_t i = 0; i < setAlternateHeaders->headerFileNames.size(); i++) {
|
||||||
|
tinyxml2::XMLElement* entry = doc.NewElement("Header");
|
||||||
|
entry->SetAttribute("Path", setAlternateHeaders->headerFileNames[i].c_str());
|
||||||
|
root->InsertEndChild(entry);
|
||||||
|
}
|
||||||
|
|
||||||
tinyxml2::XMLPrinter printer;
|
tinyxml2::XMLPrinter printer;
|
||||||
doc.Accept(&printer);
|
doc.Accept(&printer);
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ class SetAlternateHeaders : public SceneCommand<void> {
|
|||||||
size_t GetPointerSize();
|
size_t GetPointerSize();
|
||||||
|
|
||||||
uint32_t numHeaders;
|
uint32_t numHeaders;
|
||||||
|
std::vector<std::string> headerFileNames;
|
||||||
std::vector<std::shared_ptr<Scene>> headers;
|
std::vector<std::shared_ptr<Scene>> headers;
|
||||||
};
|
};
|
||||||
}; // namespace LUS
|
}; // namespace LUS
|
||||||
|
Loading…
Reference in New Issue
Block a user