aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/outputs-spec.hh
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2023-08-25 09:53:12 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2023-08-25 09:55:07 -0400
commit2f5d3da8062ae58242a8de2bad470a66478edea4 (patch)
tree7d411b5cd956ed8fa819c657982cd5da1de2215f /src/libstore/outputs-spec.hh
parent0a6ac133cfd1c86b8f6062b8b12e5aac8e18df3c (diff)
Introduce `OutputName` and `OutputNameView` type aliases
Hopefully they make the code easier to understand!
Diffstat (limited to 'src/libstore/outputs-spec.hh')
-rw-r--r--src/libstore/outputs-spec.hh26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/libstore/outputs-spec.hh b/src/libstore/outputs-spec.hh
index ae19f1040..1ef99a5fc 100644
--- a/src/libstore/outputs-spec.hh
+++ b/src/libstore/outputs-spec.hh
@@ -13,24 +13,36 @@
namespace nix {
+/**
+ * An (owned) output name. Just a type alias used to make code more
+ * readible.
+ */
+typedef std::string OutputName;
+
+/**
+ * A borrowed output name. Just a type alias used to make code more
+ * readible.
+ */
+typedef std::string_view OutputNameView;
+
struct OutputsSpec {
/**
* A non-empty set of outputs, specified by name
*/
- struct Names : std::set<std::string> {
- using std::set<std::string>::set;
+ struct Names : std::set<OutputName> {
+ using std::set<OutputName>::set;
/* These need to be "inherited manually" */
- Names(const std::set<std::string> & s)
- : std::set<std::string>(s)
+ Names(const std::set<OutputName> & s)
+ : std::set<OutputName>(s)
{ assert(!empty()); }
/**
* Needs to be "inherited manually"
*/
- Names(std::set<std::string> && s)
- : std::set<std::string>(s)
+ Names(std::set<OutputName> && s)
+ : std::set<OutputName>(s)
{ assert(!empty()); }
/* This set should always be non-empty, so we delete this
@@ -57,7 +69,7 @@ struct OutputsSpec {
*/
OutputsSpec() = delete;
- bool contains(const std::string & output) const;
+ bool contains(const OutputName & output) const;
/**
* Create a new OutputsSpec which is the union of this and that.