InscoperAPI/API/Base/Image/Metadata.h¶
Namespaces¶
| Name |
|---|
| Inscoper Inscoper namespace. |
Classes¶
| Name | |
|---|---|
| class | Inscoper::Metadata Metadata class represents a container for image metadata. |
Source code¶
#ifndef METADATA_H
#define METADATA_H
#include <iostream>
#include <map>
#include <memory>
#include <string>
#include <typeinfo>
#include <variant>
#include <vector>
#include <Global.h>
namespace Inscoper {
class INSCOPER_EXPORT Metadata {
public:
using Value = std::variant<bool, // 0
unsigned char, // 1
char, // 2
unsigned short, // 3
short, // 4
unsigned int, // 5
int, // 6
unsigned long long int, // 7
long long int, // 8
float, // 9
double, // 10
const char *, // 11
std::string, // 12
std::vector<Metadata>, // 13
std::map<std::string, Metadata>, // 14
std::shared_ptr<Metadata> // 15
>;
Metadata();
Metadata(const Metadata &md);
Metadata(Metadata *md);
template <typename T> Metadata(T data) : _data(data) {
}
virtual ~Metadata() {
}
template <typename T> operator T() const {
return std::visit(
[](auto const &val) {
if constexpr (std::is_convertible_v<decltype(val), T>) {
return T(val);
} else {
throw std::bad_variant_access{};
return T{};
}
},
_data);
}
void copy(const Metadata &md);
std::size_t index() const;
std::type_info const &type() const;
virtual std::string serialize() const;
virtual std::string toString() const;
void fromString(std::string value, std::size_t index) INSCOPER_EXCEPTION;
private:
Value _data;
};
typedef std::shared_ptr<Metadata> MetadataPtr;
} // namespace Inscoper
#endif // METADATA_H
Updated on 2026-09-03 at 12:14:17 +0200