-
-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathHybridWebImageFactorySpec.hpp
More file actions
76 lines (63 loc) · 2.56 KB
/
Copy pathHybridWebImageFactorySpec.hpp
File metadata and controls
76 lines (63 loc) · 2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
///
/// HybridWebImageFactorySpec.hpp
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © Marc Rousavy @ Margelo
///
#pragma once
#if __has_include(<NitroModules/HybridObject.hpp>)
#include <NitroModules/HybridObject.hpp>
#else
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
#endif
// Forward declaration of `HybridImageLoaderSpec` to properly resolve imports.
namespace margelo::nitro::image { class HybridImageLoaderSpec; }
// Forward declaration of `AsyncImageLoadOptions` to properly resolve imports.
namespace margelo::nitro::web::image { struct AsyncImageLoadOptions; }
// Forward declaration of `HybridImageSpec` to properly resolve imports.
namespace margelo::nitro::image { class HybridImageSpec; }
#include <memory>
#include <NitroImage/HybridImageLoaderSpec.hpp>
#include <string>
#include "AsyncImageLoadOptions.hpp"
#include <optional>
#include <NitroImage/HybridImageSpec.hpp>
#include <NitroModules/Promise.hpp>
namespace margelo::nitro::web::image {
using namespace margelo::nitro;
/**
* An abstract base class for `WebImageFactory`
* Inherit this class to create instances of `HybridWebImageFactorySpec` in C++.
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
* @example
* ```cpp
* class HybridWebImageFactory: public HybridWebImageFactorySpec {
* public:
* HybridWebImageFactory(...): HybridObject(TAG) { ... }
* // ...
* };
* ```
*/
class HybridWebImageFactorySpec: public virtual HybridObject {
public:
// Constructor
explicit HybridWebImageFactorySpec(): HybridObject(TAG) { }
// Destructor
~HybridWebImageFactorySpec() override = default;
public:
// Properties
virtual double getMaxMemoryBytes() = 0;
virtual void setMaxMemoryBytes(double maxMemoryBytes) = 0;
public:
// Methods
virtual std::shared_ptr<margelo::nitro::image::HybridImageLoaderSpec> createWebImageLoader(const std::string& url, const std::optional<AsyncImageLoadOptions>& options) = 0;
virtual std::shared_ptr<Promise<std::shared_ptr<margelo::nitro::image::HybridImageSpec>>> loadFromURLAsync(const std::string& url, const std::optional<AsyncImageLoadOptions>& options) = 0;
virtual void preload(const std::string& url) = 0;
protected:
// Hybrid Setup
void loadHybridMethods() override;
protected:
// Tag for logging
static constexpr auto TAG = "WebImageFactory";
};
} // namespace margelo::nitro::web::image