Template Class Interface

Inheritance Relationships

Derived Types

Class Documentation

template<typename Format>
class uconfig::Interface

Abstract interface for the Format.

Separates uconfig::Format from uconfig::Object instances. Derived instances wraps different objects and used to parse/emit them using Format.

tparam Format

Format this interface interacts with.

Subclassed by uconfig::ConfigIface< Format >, uconfig::ValueIface< T, Format >, uconfig::VariableIface< T, Format >, uconfig::VectorIface< T, Format >

Public Types

typedef Format format_type

Alias to the Format.

typedef Format::source_type source_type

Source this interface parses from.

typedef Format::dest_type dest_type

Destination this interface emits to.

Public Functions

virtual ~Interface() = default

Destructor.

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

Parse the source using parser.

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

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

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

Throws

uconfig::ParseError – May be thrown if throw_on_fail.

Returns

true if something has been parsed, false otherwise.

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

Emit to the 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 – May be thrown if throw_on_fail.

virtual const std::string &Path() const noexcept = 0

Get path of the object according to the Format.

virtual bool Initialized() const noexcept = 0

Check if wrapped object has any value in it.

virtual bool Optional() const noexcept = 0

Check if wrapped object declared as optional.