Class Format

Inheritance Relationships

Derived Types

Class Documentation

class uconfig::Format

Abstract format interface.

Subclassed by uconfig::EnvFormat, uconfig::RapidjsonFormat< AllocatorT >

Public Types

using source_type = void

Source of the format to parse from.

using dest_type = void

Destination of the format to emit to.

Public Functions

virtual ~Format() = default

Destructor.

template<typename T>
std::optional<T> Parse(const source_type *source, const std::string &path) const

Parse the value at path from source.

Template Parameters

T – Type to parse.

Parameters
  • [in] source – Source to parse value from.

  • [in] path – Path where the value resides in source.

Returns

Value wrapped in std::optional or std::nullopt.

template<typename T>
void Emit(dest_type *dest, const std::string &path, const T &value) const

Emit the value at path to dest.

Template Parameters

T – Type to emit.

Parameters
  • [in] dest – Destination to emit to.

  • [in] path – Path where to emit.

  • [in] value – Value to emit.

virtual std::string VectorElementPath(const std::string &vector_path, std::size_t index) const noexcept = 0

Construct path to a vector element at index accroding to the format.

Parameters
  • [in] vector_path – Path to the vector itself.

  • [in] index – Position in the vector to make path to.

Returns

Path to the vector element at index.

Public Static Attributes

static const std::string name = "[NO FORMAT]"

Name of the format. Used to form nice error-strings.