Reads data from a metadata file. More...
#include <Metadata.h>
Public Member Functions | |
void | addAuthor (const Meta::Contact &author) |
void | addConflict (const Meta::Dependency &dep) |
void | addContentItem (const std::string &tag, const Metadata &item) |
void | addDepend (const Meta::Dependency &dep) |
void | addFile (const boost::filesystem::path &path) |
void | addGenericMetadata (const std::string &tag, const Meta::GenericMetadata &genericMetadata) |
void | addLicense (const Meta::License &license) |
void | addMaintainer (const Meta::Contact &maintainer) |
void | addReplace (const Meta::Dependency &dep) |
void | addTag (const std::string &tag) |
void | addUrl (const Meta::Url &url) |
std::vector< Meta::Contact > | author () const |
std::string | classname () const |
std::vector< Meta::Dependency > | conflict () const |
std::multimap< std::string, Metadata > | content () const |
Access the metadata for the content elements of this package. More... | |
std::vector< Meta::Dependency > | depend () const |
std::string | description () const |
XERCES_CPP_NAMESPACE::DOMElement * | dom () const |
Directly access the DOM tree to support unrecognized multi-level metadata. More... | |
std::vector< boost::filesystem::path > | file () const |
Meta::Version | freecadmax () const |
Meta::Version | freecadmin () const |
boost::filesystem::path | icon () const |
std::vector< Meta::License > | license () const |
std::vector< Meta::Contact > | maintainer () const |
Metadata () | |
Metadata (const boost::filesystem::path &metadataFile) | |
Read the data from a file on disk. More... | |
Metadata (const XERCES_CPP_NAMESPACE::DOMNode *domNode, int format) | |
Construct a Metadata object from a DOM node. More... | |
std::string | name () const |
std::vector< Meta::GenericMetadata > | operator[] (const std::string &tag) const |
Convenience accessor for unrecognized simple metadata. More... | |
void | removeContentItem (const std::string &tag, const std::string &itemName) |
std::vector< Meta::Dependency > | replace () const |
bool | satisfies (const Meta::Dependency &) |
Determine whether this package satisfies the given dependency. More... | |
void | setClassname (const std::string &name) |
void | setDescription (const std::string &description) |
void | setFreeCADMax (const Meta::Version &version) |
void | setFreeCADMin (const Meta::Version &version) |
void | setIcon (const boost::filesystem::path &path) |
void | setName (const std::string &name) |
void | setSubdirectory (const boost::filesystem::path &path) |
void | setVersion (const Meta::Version &version) |
boost::filesystem::path | subdirectory () const |
bool | supportsCurrentFreeCAD () const |
Determine whether the current metadata specifies support for the currently-running version of FreeCAD. More... | |
std::vector< std::string > | tag () const |
std::vector< Meta::Url > | url () const |
Meta::Version | version () const |
void | write (const boost::filesystem::path &file) const |
Write the metadata to an XML file. More... | |
~Metadata () | |
Reads data from a metadata file.
The metadata format is based on https://ros.org/reps/rep-0149.html, modified for FreeCAD use. Full format documentation is available at the FreeCAD Wiki: https://wiki.freecadweb.org/Package_Metadata
Metadata::Metadata | ( | ) |
|
explicit |
Read the data from a file on disk.
This constructor takes a path to an XML file and loads the XML from that file as metadata.
App::Metadata::Metadata | ( | const XERCES_CPP_NAMESPACE::DOMNode * | domNode, |
int | format | ||
) |
Metadata::~Metadata | ( | ) |
void Metadata::addAuthor | ( | const Meta::Contact & | author | ) |
References author().
void Metadata::addConflict | ( | const Meta::Dependency & | dep | ) |
void Metadata::addDepend | ( | const Meta::Dependency & | dep | ) |
void Metadata::addFile | ( | const boost::filesystem::path & | path | ) |
void App::Metadata::addGenericMetadata | ( | const std::string & | tag, |
const Meta::GenericMetadata & | genericMetadata | ||
) |
void Metadata::addLicense | ( | const Meta::License & | license | ) |
References license().
void Metadata::addMaintainer | ( | const Meta::Contact & | maintainer | ) |
References maintainer().
void Metadata::addReplace | ( | const Meta::Dependency & | dep | ) |
void Metadata::addTag | ( | const std::string & | tag | ) |
References tag().
std::vector< Meta::Contact > Metadata::author | ( | ) | const |
Referenced by addAuthor(), and addonmanager_macro.Macro::fill_details_from_wiki().
std::string Metadata::classname | ( | ) | const |
std::vector< Meta::Dependency > Metadata::conflict | ( | ) | const |
std::multimap< std::string, Metadata > Metadata::content | ( | ) | const |
Access the metadata for the content elements of this package.
In addition to the overall package metadata, this class reads in metadata contained in a <content> element. Each entry in the content element is an element representing some type of package content (e.g. add-on, macro, theme, etc.). This class places no restriction on the types, it is up to client code to place requirements on the metadata included here.
For example, themes might be specified: <content> <theme> <name>High Contrast</name> </theme> </content>
std::vector< Meta::Dependency > Metadata::depend | ( | ) | const |
std::string Metadata::description | ( | ) | const |
Referenced by Addon.Addon::set_metadata(), setDescription(), and Addon.Addon::to_cache().
XERCES_CPP_NAMESPACE::DOMElement * Metadata::dom | ( | ) | const |
Directly access the DOM tree to support unrecognized multi-level metadata.
std::vector< fs::path > Metadata::file | ( | ) | const |
Referenced by exportIFCHelper.ContextCreator::createAutomaticProject(), exportIFCHelper.ContextCreator::createCustomProject(), exportIFCHelper.ContextCreator::createGeometricRepresentationContext(), exportIFCHelper.ContextCreator::createGeometricRepresentationSubContext(), exportIFCHelper.ContextCreator::createMapConversion(), exportIFCHelper.ContextCreator::createTargetCRS(), exportIFCHelper.ContextCreator::createTrueNorth(), importIFClegacy.IfcFile::read(), and write().
Meta::Version App::Metadata::freecadmax | ( | ) | const |
Meta::Version App::Metadata::freecadmin | ( | ) | const |
fs::path Metadata::icon | ( | ) | const |
Referenced by addonmanager_macro.Macro::clean_icon(), addonmanager_macro.Macro::fill_details_from_wiki(), PathScripts.PathIconViewProvider.ViewProvider::getIcon(), PathScripts.PathOpGui.TaskPanelPage::getIcon(), addonmanager_macro.Macro::install(), addonmanager_macro.Macro::parse_wiki_page_for_icon(), and addonmanager_macro.Macro::remove().
std::vector< Meta::License > Metadata::license | ( | ) | const |
Referenced by addLicense().
std::vector< Meta::Contact > Metadata::maintainer | ( | ) | const |
Referenced by addMaintainer().
std::string Metadata::name | ( | ) | const |
Referenced by draftguitools.gui_groups.Ui_AddNamedGroup::accept(), prototype.Node::addtofreecad(), Addon.Addon::disable(), Addon.Addon::enable(), addonmanager_macro.Macro::filename(), gzip_utf8.GzipFile::filename(), addonmanager_macro.Macro::fill_details_from_code(), addonmanager_macro.Macro::fill_details_from_wiki(), Addon.Addon::get_cached_icon_filename(), ifc4.ifcapproval::hasidentifierorname(), addonmanager_macro.Macro::install(), Addon.Addon::is_disabled(), femsolver.elmer.sifio.Section::keys(), automotive_design.si_unit::named_unit_dimensions(), Mod.PartDesign.WizardShaft.SegmentFunction.SegmentFunction::output(), prototype.Node::pprint(), prototype.Node::pprint2(), PathScripts.PathSetupSheetGui.OpTaskPanel::propertyGroup(), PathScripts.PathSetupSheetGui.OpTaskPanel::propertyName(), PathScripts.PathJobGui.TaskPanel::reject(), addonmanager_macro.Macro::remove(), setClassname(), setName(), Addon.Addon::to_cache(), ifc2x3.ifcexternalreference::wr1(), ifc2x3.ifcdocumentreference::wr1(), ifc4.ifcexternalreference::wr1(), ifc4.ifcdocumentreference::wr1(), and automotive_design.general_property_association::wr2().
std::vector< Meta::GenericMetadata > Metadata::operator[] | ( | const std::string & | tag | ) | const |
Convenience accessor for unrecognized simple metadata.
If the XML parser encounters tags that it does not recognize, and those tags have no children, a GenericMetadata object is created. Those objects can be accessed using operator[], which returns a (potentially empty) vector containing all instances of the given tag. It cannot be used to create a new tag, however. See addGenericMetadata().
References tag().
void App::Metadata::removeContentItem | ( | const std::string & | tag, |
const std::string & | itemName | ||
) |
std::vector< Meta::Dependency > Metadata::replace | ( | ) | const |
bool Metadata::satisfies | ( | const Meta::Dependency & | dep | ) |
Determine whether this package satisfies the given dependency.
References App::Meta::Dependency::condition, App::Application::Config(), App::Meta::Dependency::package, App::Expression::parse(), App::Meta::Dependency::version_eq, App::Meta::Dependency::version_gt, App::Meta::Dependency::version_gte, App::Meta::Dependency::version_lt, and App::Meta::Dependency::version_lte.
void Metadata::setClassname | ( | const std::string & | name | ) |
References name().
void Metadata::setDescription | ( | const std::string & | description | ) |
References description().
void App::Metadata::setFreeCADMax | ( | const Meta::Version & | version | ) |
void App::Metadata::setFreeCADMin | ( | const Meta::Version & | version | ) |
void Metadata::setIcon | ( | const boost::filesystem::path & | path | ) |
void Metadata::setName | ( | const std::string & | name | ) |
References name().
Referenced by Gui::PreferencePackManager::save().
void App::Metadata::setSubdirectory | ( | const boost::filesystem::path & | path | ) |
void Metadata::setVersion | ( | const Meta::Version & | version | ) |
References version().
Referenced by Gui::PreferencePackManager::save().
boost::filesystem::path App::Metadata::subdirectory | ( | ) | const |
bool App::Metadata::supportsCurrentFreeCAD | ( | ) | const |
Determine whether the current metadata specifies support for the currently-running version of FreeCAD.
Does not interrogate content items, which must be querried individually.
References App::Application::Config().
std::vector< std::string > Metadata::tag | ( | ) | const |
Referenced by PathScripts.PathDressupHoldingTags.MapWireToTag::add(), addContentItem(), addTag(), PathScripts.PathDressupHoldingTags.MapWireToTag::cleanupEdges(), PathScripts.PathDressupHoldingTags.MapWireToTag::commandsForEdges(), Dice3DS.dom3ds.ChunkBase::document_html(), Dice3DS.dom3ds.ChunkBase::dump_header(), ArchPanel.PanelCut::getWires(), operator[](), PathScripts.PathDressupHoldingTags.MapWireToTag::shell(), and FreeCADInit.FCADLogger::trace().
std::vector< Meta::Url > Metadata::url | ( | ) | const |
Meta::Version Metadata::version | ( | ) | const |
void Metadata::write | ( | const boost::filesystem::path & | file | ) | const |