Add meta information to Asset class

This commit is contained in:
Alexander Bock
2020-05-05 00:00:48 +02:00
parent b4eb168c76
commit 875404246f
8 changed files with 64 additions and 14 deletions
+13
View File
@@ -51,6 +51,15 @@ public:
using StateChangeCallback = std::function<void(State)>;
using CallbackHandle = size_t;
struct MetaInformation {
std::string name;
std::string version;
std::string description;
std::string author;
std::string url;
std::string license;
};
/**
* Root asset constructor
*/
@@ -136,6 +145,8 @@ public:
std::string resolveLocalResource(std::string resourceName) const;
void setMetaInformation(MetaInformation metaInformation);
private:
void setState(State state);
@@ -157,6 +168,8 @@ private:
// Absolute path to asset file
std::string _assetPath;
MetaInformation _metaInformation;
// Required assets
std::vector<std::shared_ptr<Asset>> _requiredAssets;
+1 -1
View File
@@ -32,7 +32,7 @@ namespace openspace {
class AssetListener {
public:
virtual ~AssetListener() = default;
virtual void assetStateChanged(std::shared_ptr<Asset> asset, Asset::State state) = 0;
virtual void assetStateChanged(Asset* asset, Asset::State state) = 0;
virtual void assetRequested(Asset* parent,
std::shared_ptr<Asset> child) = 0;
+1 -1
View File
@@ -157,7 +157,7 @@ public:
/**
* Notify listeners about asset state change
*/
void assetStateChanged(std::shared_ptr<Asset> asset, Asset::State state);
void assetStateChanged(Asset* asset, Asset::State state);
/**
* Notify listeners about new requests
+1 -1
View File
@@ -61,7 +61,7 @@ public:
void removeAll();
std::shared_ptr<Asset> rootAsset();
void assetStateChanged(std::shared_ptr<Asset> asset, Asset::State state) override;
void assetStateChanged(Asset* asset, Asset::State state) override;
void assetRequested(Asset* parent,
std::shared_ptr<Asset> child) override;
void assetUnrequested(Asset* parent,