about summary refs log tree commit diff
path: root/src/libexpr/get-drvs.hh
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-11-19T13·09+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-11-19T13·09+0100
commit0f24400d90daf65cf20142a662f8245008437e2c (patch)
tree0daf395a2ff226203b9560edc74ebe1efd89862c /src/libexpr/get-drvs.hh
parent990126cde03428509191bed132f38050034d342e (diff)
Generalise meta attributes
Diffstat (limited to 'src/libexpr/get-drvs.hh')
-rw-r--r--src/libexpr/get-drvs.hh46
1 files changed, 22 insertions, 24 deletions
diff --git a/src/libexpr/get-drvs.hh b/src/libexpr/get-drvs.hh
index af3998e40024..b5aebc188355 100644
--- a/src/libexpr/get-drvs.hh
+++ b/src/libexpr/get-drvs.hh
@@ -11,50 +11,50 @@
 namespace nix {
 
 
-struct MetaValue
-{
-    enum { tpNone, tpString, tpStrings, tpInt } type;
-    string stringValue;
-    Strings stringValues;
-    int intValue;
-};
-
-
-typedef std::map<string, MetaValue> MetaInfo;
-
-
 struct DrvInfo
 {
 public:
     typedef std::map<string, Path> Outputs;
 
 private:
+    EvalState * state;
+
     string drvPath;
     string outPath;
     string outputName;
     Outputs outputs;
 
-    bool metaInfoRead;
-    MetaInfo meta;
-
     bool failed; // set if we get an AssertionError
 
+    Bindings * attrs, * meta;
+
+    Bindings * getMeta();
+
 public:
     string name;
     string attrPath; /* path towards the derivation */
     string system;
 
-    /* !!! make this private */
-    Bindings * attrs;
+    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) { };
+
+    string queryDrvPath();
+    string queryOutPath();
+    string queryOutputName();
+    Outputs queryOutputs();
 
-    DrvInfo() : metaInfoRead(false), failed(false), attrs(0) { };
+    StringSet queryMetaNames();
+    Value * queryMeta(const string & name);
+    string queryMetaString(const string & name);
+    int queryMetaInt(const string & name, int def);
+    bool queryMetaBool(const string & name, bool def);
+    void setMeta(const string & name, Value * v);
 
-    string queryDrvPath(EvalState & state) const;
-    string queryOutPath(EvalState & state) const;
-    string queryOutputName(EvalState & state) const;
-    Outputs queryOutputs(EvalState & state);
+    /*
     MetaInfo queryMetaInfo(EvalState & state) const;
     MetaValue queryMetaInfo(EvalState & state, const string & name) const;
+    */
 
     void setDrvPath(const string & s)
     {
@@ -66,8 +66,6 @@ public:
         outPath = s;
     }
 
-    void setMetaInfo(const MetaInfo & meta);
-
     void setFailed() { failed = true; };
     bool hasFailed() { return failed; };
 };