Skip to content

Inscoper::Metadata

Metadata class represents a container for image metadata. More...

#include <Metadata.h>

Public Types

Name
using std::variant< bool, unsigned char, char, unsigned short, short, unsigned int, int, unsigned long long int, long long int, float, double, const char *, std::string, std::vector< Metadata >, std::map< std::string, Metadata >, std::shared_ptr< Metadata > > Value

Public Functions

Name
Metadata()
Default constructor.
Metadata(const Metadata & md)
Copy constructor.
Metadata(Metadata * md)
Converting constructor.
template <typename T >
Metadata(T data)
Constructor from a primitive.
virtual ~Metadata()
Virtual destructor.
template <typename T >
operator T() const
Conversion operator.
void copy(const Metadata & md)
Copy metadata content.
std::size_t index() const
Get the type index of the metadata.
std::type_info const & type() const
Get the type of the metadata.
virtual std::string serialize() const
Serialize the metadata.
virtual std::string toString() const
Convert to string.
void fromString(std::string value, std::size_t index)
Build from string.

Detailed Description

class Inscoper::Metadata;

Metadata class represents a container for image metadata.

This class allows to store metadata of various types (integers, floats, strings, containers) and provides methods for access, conversion, and serialization.

Public Types Documentation

using Value

using Inscoper::Metadata::Value =  std::variant<bool,                            
                             unsigned char,                   
                             char,                            
                             unsigned short,                  
                             short,                           
                             unsigned int,                    
                             int,                             
                             unsigned long long int,          
                             long long int,                   
                             float,                           
                             double,                          
                             const char *,                    
                             std::string,                     
                             std::vector<Metadata>,           
                             std::map<std::string, Metadata>, 
                             std::shared_ptr<Metadata>        
                             >;

Public Functions Documentation

function Metadata

Metadata()

Default constructor.

Initializes a new instance of the Metadata class.

function Metadata

Metadata(
    const Metadata & md
)

Copy constructor.

Parameters:

  • md : The metadata to copy from

Creates a new Metadata instance as a deep copy of an existing one.

function Metadata

Metadata(
    Metadata * md
)

Converting constructor.

Parameters:

  • md : The metadata to copy from

Initializes a new instance of the Metadata class from a pointer.

function Metadata

template <typename T >
inline Metadata(
    T data
)

Constructor from a primitive.

Parameters:

  • data : The value to store

Template Parameters:

  • T : The type of the data

Initializes a new instance of the Metadata class with a value of a supported primitive.

function ~Metadata

inline virtual ~Metadata()

Virtual destructor.

function operator T

template <typename T >
inline operator T() const

Conversion operator.

Exceptions:

  • std::bad_variant_access if conversion is not possible

Template Parameters:

  • T : The target type

Return: The value converted to type T

Converts the stored value to the specified type T.

function copy

void copy(
    const Metadata & md
)

Copy metadata content.

Parameters:

  • md : The metadata to copy

Copies the data from a metadata.

function index

std::size_t index() const

Get the type index of the metadata.

Return: The type index

Retrieves the index of the metadata type.

function type

std::type_info const & type() const

Get the type of the metadata.

Return: The type

Retrieves the type of the metadata.

function serialize

virtual std::string serialize() const

Serialize the metadata.

Return: The serialized form of the metadata

Provides a serialization interface for Metadata. Must be overridden.

function toString

virtual std::string toString() const

Convert to string.

Return: The string representation

Returns a human-readable string representation of the metadata element.

function fromString

void fromString(
    std::string value,
    std::size_t index
)

Build from string.

Parameters:

  • value : The string to parse
  • index : The expected type index

Parses a string and sets the metadata, interpreting it as the specified type index.


Updated on 2026-04-02 at 10:55:36 +0200