Union::StylePackage Class
class Union::StylePackage| Header: | #include <StylePackage.h> |
Public Types
| enum class | Error { None, NotFound, MissingFiles, InvalidMetaData, UnknownInputType } |
Public Functions
| StylePackage() | |
| StylePackage(const std::filesystem::path &path) | |
| QStringList | authors() const |
| QString | description() const |
| Union::StylePackage::Error | error() const |
| QString | id() const |
| QString | inputType() const |
| bool | isHidden() const |
| bool | isValid() const |
| QString | license() const |
| std::shared_ptr<Union::Style> | load() |
| QString | name() const |
| std::filesystem::path | path() const |
| QUrl | url() const |
| QString | version() const |
Detailed Description
A bundle of assets that represent a style.
The StylePackage class is a representation of a package containing style assets, along with metadata about that style.
Packages are effectively directories with certain expected contents. At the very least, a package is expected to contain a "metadata.json" file and a "contents" directory. Other files may be required depending on the input format used for the package.
Member Type Documentation
enum class StylePackage::Error
Member Function Documentation
StylePackage::StylePackage()
Default constructor.
Creates an empty and invalid package.
[explicit] StylePackage::StylePackage(const std::filesystem::path &path)
Creates a package pointing at a specific directories.
QStringList StylePackage::authors() const
Returns the list of authors of this package.
This is just a list of author names.
QString StylePackage::description() const
Returns the description of this package.
Union::StylePackage::Error StylePackage::error() const
Returns the error that caused the package to be invalid.
QString StylePackage::id() const
Returns the ID of this package.
This is effectively the filename of the path.
QString StylePackage::inputType() const
Return the input type that is required for this package.
bool StylePackage::isHidden() const
Returns if this package should be shown in listings of packages.
bool StylePackage::isValid() const
Returns if the package is valid.
This will load the package's metadata file to determine the input type for this package, then ask the input plugin to validate the package, if that was not done before.
You can use the error() method to check what kind of problem an invalid package has.
QString StylePackage::license() const
Returns the license of this package.
std::shared_ptr<Union::Style> StylePackage::load()
Load the package fully and use it to create a new Style instance.
QString StylePackage::name() const
Returns the name of this package.
std::filesystem::path StylePackage::path() const
Return the path of this package.
QUrl StylePackage::url() const
Returns the URL of this package.
QString StylePackage::version() const
Returns the version of this package.
Note that there are no constraints on the format of the version.