MCPcopy Create free account
hub / github.com/MayaPosch/NymphCast / appendToXML

Method appendToXML

src/server/gui/app/MetaData.cpp:98–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96}
97
98void MetaDataList::appendToXML(pugi::xml_node& parent, bool ignoreDefaults, const std::string& relativeTo) const
99{
100 const std::vector<MetaDataDecl>& mdd = getMDD();
101
102 for(auto mddIter = mdd.cbegin(); mddIter != mdd.cend(); mddIter++)
103 {
104 auto mapIter = mMap.find(mddIter->key);
105 if(mapIter != mMap.cend())
106 {
107 // we have this value!
108 // if it's just the default (and we ignore defaults), don't write it
109 if(ignoreDefaults && mapIter->second == mddIter->defaultValue)
110 continue;
111
112 // try and make paths relative if we can
113 std::string value = mapIter->second;
114 if (mddIter->type == MD_PATH)
115 value = Utils::FileSystem::createRelativePath(value, relativeTo, true);
116
117 parent.append_child(mapIter->first.c_str()).text().set(value.c_str());
118 }
119 }
120}
121
122void MetaDataList::set(const std::string& key, const std::string& value)
123{

Callers 1

addFileDataNodeFunction · 0.80

Calls 6

createRelativePathFunction · 0.85
textMethod · 0.80
append_childMethod · 0.80
c_strMethod · 0.80
findMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected