Template Class ConfigIface

Inheritance Relationships

Base Type

Class Documentation

template<typename Format>
class uconfig::ConfigIface : public uconfig::Interface<Format>

Interface for uconfig::Config objects.

tparam Format

Format this interface interacts with.

Public Functions

template<typename ...FormatTs>
ConfigIface(const std::string &parse_path, Config<FormatTs...> *config)

Constructor.

Note

Does not own config, should not outlive it.

Template Parameters

FormatTs – Type of the formats for config. Should include Format.

Parameters
  • [in] parse_path – Path to the config in terms of Format.

  • [in] config – Pointer to the uconfig::Config to wrap.

ConfigIface(const ConfigIface<Format>&) = default

Copy constructor.

ConfigIface<Format> &operator=(const ConfigIface<Format>&) = default

Copy assignment.

ConfigIface(ConfigIface<Format>&&) noexcept = default

Move constructor.

ConfigIface<Format> &operator=(ConfigIface<Format>&&) noexcept = default

Move assignment.

virtual ~ConfigIface() = default

Destructor.

virtual bool Parse(const format_type &parser, const source_type *source, bool throw_on_fail = true) override

Parse referenced uconfig::Config from source using parser.

Parameters
  • [in] parser – Parser instance to use.

  • [in] source – Source to parse from.

  • [in] throw_on_fail – Will throw an uconfig::ParseError is failed to parse all mandatory values. Default true.

Throws

uconfig::ParseError – Thrown if throw_on_fail.

Returns

true if config has been parsed, false otherwise.

virtual void Emit(const format_type &emitter, dest_type *dest, bool throw_on_fail = true) override

Emit referenced uconfig::Config to destination using emitter.

Parameters
  • [in] emitter – Emitter instance to use.

  • [in] dest – Destination to emit into.

  • [in] throw_on_fail – Will throw an uconfig::EmitError is failed to emit. Default true.

Throws

uconfig::EmitError – Thrown if throw_on_fail.

virtual const std::string &Path() const noexcept override

Get path of the wrapped uconfig::Config.

virtual bool Initialized() const noexcept override

Check if wrapped uconfig::Config has all mandatory values set.

virtual bool Optional() const noexcept override

Check if wrapped uconfig::Config declared as optional.