Program Listing for File Format.h

Return to documentation for file (uconfig/format/Format.h)

#pragma once

#include <optional>
#include <string>

namespace uconfig {

class Format
{
public:
    static inline const std::string name = "[NO FORMAT]";
    using source_type = void;
    using dest_type = void;

    virtual ~Format() = default;

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

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

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

} // namespace uconfig