App::Metadata Class Reference

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::Contactauthor () const
 
std::string classname () const
 
std::vector< Meta::Dependencyconflict () const
 
std::multimap< std::string, Metadatacontent () const
 Access the metadata for the content elements of this package. More...
 
std::vector< Meta::Dependencydepend () 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::Licenselicense () const
 
std::vector< Meta::Contactmaintainer () 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::GenericMetadataoperator[] (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::Dependencyreplace () 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::Urlurl () const
 
Meta::Version version () const
 
void write (const boost::filesystem::path &file) const
 Write the metadata to an XML file. More...
 
 ~Metadata ()
 

Detailed Description

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

Constructor & Destructor Documentation

◆ Metadata() [1/3]

Metadata::Metadata ( )

◆ Metadata() [2/3]

App::Metadata::Metadata ( const boost::filesystem::path &  metadataFile)
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.

◆ Metadata() [3/3]

App::Metadata::Metadata ( const XERCES_CPP_NAMESPACE::DOMNode *  domNode,
int  format 
)

Construct a Metadata object from a DOM node.

This node may have any tag name: it is only accessed via its children, which are expected to follow the standard Metadata format for the contents of the <package> element.

◆ ~Metadata()

Metadata::~Metadata ( )

Member Function Documentation

◆ addAuthor()

void Metadata::addAuthor ( const Meta::Contact author)

References author().

◆ addConflict()

void Metadata::addConflict ( const Meta::Dependency dep)

◆ addContentItem()

void Metadata::addContentItem ( const std::string &  tag,
const Metadata item 
)

References tag().

◆ addDepend()

void Metadata::addDepend ( const Meta::Dependency dep)

◆ addFile()

void Metadata::addFile ( const boost::filesystem::path &  path)

◆ addGenericMetadata()

void App::Metadata::addGenericMetadata ( const std::string &  tag,
const Meta::GenericMetadata genericMetadata 
)

◆ addLicense()

void Metadata::addLicense ( const Meta::License license)

References license().

◆ addMaintainer()

void Metadata::addMaintainer ( const Meta::Contact maintainer)

References maintainer().

◆ addReplace()

void Metadata::addReplace ( const Meta::Dependency dep)

◆ addTag()

void Metadata::addTag ( const std::string &  tag)

References tag().

◆ addUrl()

void Metadata::addUrl ( const Meta::Url url)

References url().

◆ author()

std::vector< Meta::Contact > Metadata::author ( ) const

◆ classname()

std::string Metadata::classname ( ) const

◆ conflict()

std::vector< Meta::Dependency > Metadata::conflict ( ) const

◆ content()

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>

◆ depend()

std::vector< Meta::Dependency > Metadata::depend ( ) const

◆ description()

std::string Metadata::description ( ) const

◆ dom()

XERCES_CPP_NAMESPACE::DOMElement * Metadata::dom ( ) const

Directly access the DOM tree to support unrecognized multi-level metadata.

◆ file()

◆ freecadmax()

Meta::Version App::Metadata::freecadmax ( ) const

◆ freecadmin()

Meta::Version App::Metadata::freecadmin ( ) const

◆ icon()

◆ license()

std::vector< Meta::License > Metadata::license ( ) const

Referenced by addLicense().

◆ maintainer()

std::vector< Meta::Contact > Metadata::maintainer ( ) const

Referenced by addMaintainer().

◆ name()

◆ operator[]()

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().

◆ removeContentItem()

void App::Metadata::removeContentItem ( const std::string &  tag,
const std::string &  itemName 
)

◆ replace()

std::vector< Meta::Dependency > Metadata::replace ( ) const

◆ satisfies()

◆ setClassname()

void Metadata::setClassname ( const std::string &  name)

References name().

◆ setDescription()

void Metadata::setDescription ( const std::string &  description)

References description().

◆ setFreeCADMax()

void App::Metadata::setFreeCADMax ( const Meta::Version version)

◆ setFreeCADMin()

void App::Metadata::setFreeCADMin ( const Meta::Version version)

◆ setIcon()

void Metadata::setIcon ( const boost::filesystem::path &  path)

◆ setName()

void Metadata::setName ( const std::string &  name)

References name().

Referenced by Gui::PreferencePackManager::save().

◆ setSubdirectory()

void App::Metadata::setSubdirectory ( const boost::filesystem::path &  path)

◆ setVersion()

void Metadata::setVersion ( const Meta::Version version)

References version().

Referenced by Gui::PreferencePackManager::save().

◆ subdirectory()

boost::filesystem::path App::Metadata::subdirectory ( ) const

◆ supportsCurrentFreeCAD()

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().

◆ tag()

◆ url()

◆ version()

◆ write()

void Metadata::write ( const boost::filesystem::path &  file) const

Write the metadata to an XML file.

References file().

Referenced by gzip_utf8.GzipFile::seek().


The documentation for this class was generated from the following files: