Nix (Dev) 3.5.10
dev - 3.5.10 - 1af9301
Loading...
Searching...
No Matches
ImageResource.hpp
Go to the documentation of this file.
1#ifndef IV_SRC_UI_RESOURCES_IMAGERESOURCE_HPP_
2#define IV_SRC_UI_RESOURCES_IMAGERESOURCE_HPP_
3
4#include "core/enums.hpp"
5#include "core/types.hpp"
7
8#include <optional>
9#include <string>
10
11namespace iv::ui::resources
12{
13
14class ImageResource final
15{
16public:
18 explicit ImageResource(iv::ui::resources::eResourceId resourceId, iv::types::ImageSize size = {0, 0});
19 explicit ImageResource(std::string_view path, iv::types::ImageSize size = {0, 0},
21
22 void update(std::string_view path);
23
24 [[nodiscard]] iv::eImageFormat getFormat() const;
25 [[nodiscard]] std::optional<std::string> getPath() const;
26 [[nodiscard]] std::string getNameResource() const;
27 [[nodiscard]] std::optional<iv::ui::resources::eResourceId> getResourceId() const;
28 [[nodiscard]] iv::types::ImageSize getSize() const;
29
30 void setSize(iv::types::ImageSize _size);
31
32 [[nodiscard]] bool isEmbedded() const;
33 [[nodiscard]] bool isValid() const;
34
35private:
36 bool m_isEmbedded;// True if the resource is embedded
37
38 std::optional<iv::ui::resources::eResourceId> m_resourceIdOpt;// ID of the resource
39 std::optional<std::string> m_pathOpt; // Path to the resource
40
41 iv::eImageFormat m_format; // Format of the resource
42 iv::types::ImageSize m_size;// Size of the image
43 std::string m_nameResource;
44};
45
46}// namespace iv::ui::resources
47
48#endif//IV_SRC_UI_RESOURCES_IMAGERESOURCE_HPP_
Definition ImageResource.hpp:15
std::optional< std::string > getPath() const
Definition ImageResource.cpp:39
iv::eImageFormat getFormat() const
Definition ImageResource.cpp:34
bool m_isEmbedded
Definition ImageResource.hpp:36
iv::eImageFormat m_format
Definition ImageResource.hpp:41
std::optional< iv::ui::resources::eResourceId > getResourceId() const
Definition ImageResource.cpp:54
std::optional< std::string > m_pathOpt
Definition ImageResource.hpp:39
bool isValid() const
Definition ImageResource.cpp:69
void update(std::string_view path)
Definition ImageResource.cpp:28
std::optional< iv::ui::resources::eResourceId > m_resourceIdOpt
Definition ImageResource.hpp:38
std::string m_nameResource
Definition ImageResource.hpp:43
void setSize(iv::types::ImageSize _size)
Definition ImageResource.cpp:59
ImageResource()
Definition ImageResource.cpp:9
iv::types::ImageSize getSize() const
Definition ImageResource.cpp:49
bool isEmbedded() const
Definition ImageResource.cpp:64
std::string getNameResource() const
Definition ImageResource.cpp:44
iv::types::ImageSize m_size
Definition ImageResource.hpp:42
Definition alarms.hpp:10
eResourceId
Definition enums.hpp:8
eImageFormat
Definition enums.hpp:25
Definition types.hpp:145