Program Listing for File Env.h¶
↰ Return to documentation for file (uconfig/format/Env.h
)
#pragma once
#include "Format.h"
#include <map>
namespace uconfig {
class EnvFormat: public Format
{
public:
static inline const std::string name = "[ENV]";
using source_type = void;
using dest_type = std::map<std::string, std::string>;
template <typename T>
std::optional<T> Parse(const source_type* /*unused*/, const std::string& path) const;
template <typename T>
void Emit(dest_type* dest, const std::string& path, const T& value) const;
inline virtual std::string VectorElementPath(const std::string& vector_path, std::size_t index) const noexcept override;
private:
template <typename T>
static std::optional<T> FromString(const std::string& str);
template <typename T>
static std::string ToString(const T& value);
};
} // namespace uconfig
#include "impl/Env.ipp"