| 96 | } |
| 97 | |
| 98 | void 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 | |
| 122 | void MetaDataList::set(const std::string& key, const std::string& value) |
| 123 | { |
no test coverage detected