| 120 | }; |
| 121 | |
| 122 | class ReadObjectContext : public IReadObjectContext |
| 123 | { |
| 124 | private: |
| 125 | const IFileDataRetriever* _fileDataRetriever; |
| 126 | |
| 127 | std::string _identifier; |
| 128 | bool _loadImages; |
| 129 | std::string _basePath; |
| 130 | bool _wasVerbose = false; |
| 131 | bool _wasWarning = false; |
| 132 | bool _wasError = false; |
| 133 | |
| 134 | public: |
| 135 | bool WasVerbose() const |
| 136 | { |
| 137 | return _wasVerbose; |
| 138 | } |
| 139 | bool WasWarning() const |
| 140 | { |
| 141 | return _wasWarning; |
| 142 | } |
| 143 | bool WasError() const |
| 144 | { |
| 145 | return _wasError; |
| 146 | } |
| 147 | |
| 148 | ReadObjectContext(const std::string& identifier, bool loadImages, const IFileDataRetriever* fileDataRetriever) |
| 149 | : _fileDataRetriever(fileDataRetriever) |
| 150 | , _identifier(identifier) |
| 151 | , _loadImages(loadImages) |
| 152 | { |
| 153 | } |
| 154 | |
| 155 | std::string_view GetObjectIdentifier() override |
| 156 | { |
| 157 | return _identifier; |
| 158 | } |
| 159 | |
| 160 | bool ShouldLoadImages() override |
| 161 | { |
| 162 | return _loadImages; |
| 163 | } |
| 164 | |
| 165 | std::vector<uint8_t> GetData(std::string_view path) override |
| 166 | { |
| 167 | if (_fileDataRetriever != nullptr) |
| 168 | { |
| 169 | return _fileDataRetriever->GetData(path); |
| 170 | } |
| 171 | return {}; |
| 172 | } |
| 173 | |
| 174 | ObjectAsset GetAsset(std::string_view path) override |
| 175 | { |
| 176 | if (_fileDataRetriever != nullptr) |
| 177 | { |
| 178 | return _fileDataRetriever->GetAsset(path); |
| 179 | } |
no outgoing calls
no test coverage detected