Make image get function return std::optional if the image is not found

This commit is contained in:
Ylva Selling
2022-12-16 16:44:09 -05:00
parent 42f1b48372
commit 29fe0e7975
5 changed files with 17 additions and 13 deletions
+3 -3
View File
@@ -35,9 +35,9 @@ namespace openspace {
namespace documentation { struct Documentation; }
struct ImageData {
std::string name = "";
std::string name;
std::string thumbnailUrl;
std::string imageUrl = "";
std::string imageUrl;
std::string credits;
std::string creditsUrl;
std::string collection;
@@ -52,7 +52,7 @@ class WwtDataHandler {
public:
void loadImages(const std::string& root, const std::filesystem::path& directory);
int nLoadedImages() const;
const ImageData& image(const std::string& imageUrl) const;
std::optional<const ImageData> image(const std::string& imageUrl) const;
const std::map<std::string, ImageData>& images() const;
private: