forked from lix-project/lix
f4ab297b31
`///@file` makes them show up in the internal API dos. A tiny few were missing `#pragma once`.
36 lines
902 B
C++
36 lines
902 B
C++
#pragma once
|
|
///@file
|
|
|
|
#include "types.hh"
|
|
|
|
#include <variant>
|
|
|
|
#include <nlohmann/json_fwd.hpp>
|
|
|
|
#include <optional>
|
|
|
|
namespace nix::fetchers {
|
|
|
|
typedef std::variant<std::string, uint64_t, Explicit<bool>> Attr;
|
|
typedef std::map<std::string, Attr> Attrs;
|
|
|
|
Attrs jsonToAttrs(const nlohmann::json & json);
|
|
|
|
nlohmann::json attrsToJSON(const Attrs & attrs);
|
|
|
|
std::optional<std::string> maybeGetStrAttr(const Attrs & attrs, const std::string & name);
|
|
|
|
std::string getStrAttr(const Attrs & attrs, const std::string & name);
|
|
|
|
std::optional<uint64_t> maybeGetIntAttr(const Attrs & attrs, const std::string & name);
|
|
|
|
uint64_t getIntAttr(const Attrs & attrs, const std::string & name);
|
|
|
|
std::optional<bool> maybeGetBoolAttr(const Attrs & attrs, const std::string & name);
|
|
|
|
bool getBoolAttr(const Attrs & attrs, const std::string & name);
|
|
|
|
std::map<std::string, std::string> attrsToQuery(const Attrs & attrs);
|
|
|
|
}
|