diff options
author | Théophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com> | 2023-01-11 07:09:37 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-11 07:09:37 +0100 |
commit | a3ba80357d3a792eb1690011f253c64840c6ae72 (patch) | |
tree | 4f151ec354a73e44adf0131808fbab314f7fb3a9 /src/libstore/outputs-spec.hh | |
parent | f58c30111261a3ad50a6cb462cb2df7c49aa82e4 (diff) | |
parent | 5576d5e987e907bf13ae6c7fe79ececce4e86e2d (diff) |
Merge pull request #7543 from obsidiansystems/typed-string-context
Parse string context elements properly
Diffstat (limited to 'src/libstore/outputs-spec.hh')
-rw-r--r-- | src/libstore/outputs-spec.hh | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/libstore/outputs-spec.hh b/src/libstore/outputs-spec.hh new file mode 100644 index 000000000..e2cf1d12b --- /dev/null +++ b/src/libstore/outputs-spec.hh @@ -0,0 +1,32 @@ +#pragma once + +#include <variant> + +#include "util.hh" + +#include "nlohmann/json_fwd.hpp" + +namespace nix { + +typedef std::set<std::string> OutputNames; + +struct AllOutputs { + bool operator < (const AllOutputs & _) const { return false; } +}; + +struct DefaultOutputs { + bool operator < (const DefaultOutputs & _) const { return false; } +}; + +typedef std::variant<DefaultOutputs, AllOutputs, OutputNames> OutputsSpec; + +/* Parse a string of the form 'prefix^output1,...outputN' or + 'prefix^*', returning the prefix and the outputs spec. */ +std::pair<std::string, OutputsSpec> parseOutputsSpec(const std::string & s); + +std::string printOutputsSpec(const OutputsSpec & outputsSpec); + +void to_json(nlohmann::json &, const OutputsSpec &); +void from_json(const nlohmann::json &, OutputsSpec &); + +} |