about summary refs log tree commit diff
path: root/src/libexpr/get-drvs.hh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-07-17T17·02+0200
committerEelco Dolstra <edolstra@gmail.com>2017-07-20T11·33+0200
commit90825dea518ea078f0783a72cc471a5b3716d198 (patch)
treeb6f6fed6e8c7a96a6769344060409f19a56290b9 /src/libexpr/get-drvs.hh
parent3162ad5ff497b92fc25cd3f397eaff01d67340cc (diff)
Add "nix search" command
Diffstat (limited to 'src/libexpr/get-drvs.hh')
-rw-r--r--src/libexpr/get-drvs.hh39
1 files changed, 17 insertions, 22 deletions
diff --git a/src/libexpr/get-drvs.hh b/src/libexpr/get-drvs.hh
index 37fcbe829d3c..82fb8a3ac6a8 100644
--- a/src/libexpr/get-drvs.hh
+++ b/src/libexpr/get-drvs.hh
@@ -17,31 +17,32 @@ public:
 private:
     EvalState * state;
 
-    string drvPath;
-    string outPath;
-    string outputName;
+    mutable string name;
+    mutable string system;
+    mutable string drvPath;
+    mutable string outPath;
+    mutable string outputName;
     Outputs outputs;
 
-    bool failed; // set if we get an AssertionError
+    bool failed = false; // set if we get an AssertionError
 
-    Bindings * attrs, * meta;
+    Bindings * attrs = nullptr, * meta = nullptr;
 
     Bindings * getMeta();
 
     bool checkMeta(Value & v);
 
 public:
-    string name;
     string attrPath; /* path towards the derivation */
-    string system;
 
-    DrvInfo(EvalState & state) : state(&state), failed(false), attrs(0), meta(0) { };
-    DrvInfo(EvalState & state, const string & name, const string & attrPath, const string & system, Bindings * attrs)
-        : state(&state), failed(false), attrs(attrs), meta(0), name(name), attrPath(attrPath), system(system) { };
+    DrvInfo(EvalState & state) : state(&state) { };
+    DrvInfo(EvalState & state, const string & attrPath, Bindings * attrs);
 
-    string queryDrvPath();
-    string queryOutPath();
-    string queryOutputName();
+    string queryName() const;
+    string querySystem() const;
+    string queryDrvPath() const;
+    string queryOutPath() const;
+    string queryOutputName() const;
     /** Return the list of outputs. The "outputs to install" are determined by `mesa.outputsToInstall`. */
     Outputs queryOutputs(bool onlyOutputsToInstall = false);
 
@@ -58,15 +59,9 @@ public:
     MetaValue queryMetaInfo(EvalState & state, const string & name) const;
     */
 
-    void setDrvPath(const string & s)
-    {
-        drvPath = s;
-    }
-
-    void setOutPath(const string & s)
-    {
-        outPath = s;
-    }
+    void setName(const string & s) { name = s; }
+    void setDrvPath(const string & s) { drvPath = s; }
+    void setOutPath(const string & s) { outPath = s; }
 
     void setFailed() { failed = true; };
     bool hasFailed() { return failed; };