diff options
author | Carlo Nucera <carlo.nucera@protonmail.com> | 2020-07-28 15:36:45 -0400 |
---|---|---|
committer | Carlo Nucera <carlo.nucera@protonmail.com> | 2020-07-28 15:36:45 -0400 |
commit | cfe96bd7ce06c3153b036447f9a933f2231a2029 (patch) | |
tree | 991e0e5b2adda907a9305e622fa54f7a401969d5 /src/libfetchers/attrs.hh | |
parent | d9fb9e9f26e29d9d9001af700deada32ca740cf6 (diff) | |
parent | b8eea7e81af53905be7845dffc6d0a83ea8edc97 (diff) |
Merge branch 'master' of github.com:NixOS/nix into ca-drv
Diffstat (limited to 'src/libfetchers/attrs.hh')
-rw-r--r-- | src/libfetchers/attrs.hh | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/libfetchers/attrs.hh b/src/libfetchers/attrs.hh index d6e0ae000..4b4630c80 100644 --- a/src/libfetchers/attrs.hh +++ b/src/libfetchers/attrs.hh @@ -13,9 +13,14 @@ namespace nix::fetchers { template<typename T> struct Explicit { T t; + + bool operator ==(const Explicit<T> & other) const + { + return t == other.t; + } }; -typedef std::variant<std::string, int64_t, Explicit<bool>> Attr; +typedef std::variant<std::string, uint64_t, Explicit<bool>> Attr; typedef std::map<std::string, Attr> Attrs; Attrs jsonToAttrs(const nlohmann::json & json); @@ -26,9 +31,9 @@ std::optional<std::string> maybeGetStrAttr(const Attrs & attrs, const std::strin std::string getStrAttr(const Attrs & attrs, const std::string & name); -std::optional<int64_t> maybeGetIntAttr(const Attrs & attrs, const std::string & name); +std::optional<uint64_t> maybeGetIntAttr(const Attrs & attrs, const std::string & name); -int64_t getIntAttr(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); |