about summary refs log tree commit diff
path: root/src/nix-env
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2006-09-04T21·06+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-09-04T21·06+0000
commit75068e7d753cf6cbe45a4bf294000dca9bd41d8b (patch)
treec6274cc10caab08349b5585206034f41ca4a575f /src/nix-env
parentaab88127321344d5818d823bff515d127108d058 (diff)
* Use a proper namespace.
* Optimise header file usage a bit.
* Compile the parser as C++.

Diffstat (limited to 'src/nix-env')
-rw-r--r--src/nix-env/main.cc19
-rw-r--r--src/nix-env/names.cc7
-rw-r--r--src/nix-env/names.hh9
-rw-r--r--src/nix-env/profiles.cc8
-rw-r--r--src/nix-env/profiles.hh8
5 files changed, 40 insertions, 11 deletions
diff --git a/src/nix-env/main.cc b/src/nix-env/main.cc
index b3caaeac82..7a6824b63a 100644
--- a/src/nix-env/main.cc
+++ b/src/nix-env/main.cc
@@ -13,6 +13,9 @@
 #include "attr-path.hh"
 #include "pathlocks.hh"
 #include "xml-writer.hh"
+#include "store.hh"
+#include "db.hh"
+#include "util.hh"
 
 #include <cerrno>
 #include <ctime>
@@ -23,6 +26,10 @@
 #include <unistd.h>
 
 
+using namespace nix;
+using std::cout;
+
+
 typedef enum {
     srcNixExprDrvs,
     srcNixExprs,
@@ -224,7 +231,7 @@ static DrvInfos filterBySelector(EvalState & state,
     for (DrvNames::iterator i = selectors.begin();
          i != selectors.end(); ++i)
     {
-        typedef list<pair<DrvInfo, unsigned int> > Matches;
+        typedef list<std::pair<DrvInfo, unsigned int> > Matches;
         Matches matches;
         unsigned int n = 0;
         for (DrvInfos::const_iterator j = allElems.begin();
@@ -233,7 +240,7 @@ static DrvInfos filterBySelector(EvalState & state,
             DrvName drvName(j->name);
             if (i->matches(drvName)) {
                 i->hits++;
-                matches.push_back(pair<DrvInfo, unsigned int>(*j, n));
+                matches.push_back(std::pair<DrvInfo, unsigned int>(*j, n));
             }
         }
 
@@ -244,7 +251,7 @@ static DrvInfos filterBySelector(EvalState & state,
         if (newestOnly) {
 
             /* Map from package names to derivations. */
-            typedef map<string, pair<DrvInfo, unsigned int> > Newest;
+            typedef map<string, std::pair<DrvInfo, unsigned int> > Newest;
             Newest newest;
             StringSet multiple;
 
@@ -350,7 +357,7 @@ static void queryInstSources(EvalState & state,
                 assertStorePath(*i);
 
                 DrvInfo elem;
-                elem.attrs = shared_ptr<ATermMap>(new ATermMap(0)); /* ugh... */
+                elem.attrs = boost::shared_ptr<ATermMap>(new ATermMap(0)); /* ugh... */
                 string name = baseNameOf(*i);
                 string::size_type dash = name.find('-');
                 if (dash != string::npos)
@@ -667,7 +674,7 @@ void printTable(Table & table)
             if (column < nrColumns - 1)
                 cout << string(widths[column] - j->size() + 2, ' ');
         }
-        cout << endl;
+        cout << std::endl;
     }
 }
 
@@ -801,7 +808,7 @@ static void opQuery(Globals & globals,
     
     /* Print the desired columns, or XML output. */
     Table table;
-    ostringstream dummy;
+    std::ostringstream dummy;
     XMLWriter xml(true, *(xmlOutput ? &cout : &dummy));
     XMLOpenElement xmlRoot(xml, "items");
     
diff --git a/src/nix-env/names.cc b/src/nix-env/names.cc
index 93bcfda24e..a425b8d076 100644
--- a/src/nix-env/names.cc
+++ b/src/nix-env/names.cc
@@ -1,4 +1,8 @@
 #include "names.hh"
+#include "util.hh"
+
+
+namespace nix {
 
 
 DrvName::DrvName()
@@ -115,3 +119,6 @@ DrvNames drvNamesFromArgs(const Strings & opArgs)
         result.push_back(DrvName(*i));
     return result;
 }
+
+ 
+}
diff --git a/src/nix-env/names.hh b/src/nix-env/names.hh
index aeb923546f..e189302d6d 100644
--- a/src/nix-env/names.hh
+++ b/src/nix-env/names.hh
@@ -1,10 +1,10 @@
 #ifndef __NAMES_H
 #define __NAMES_H
 
-#include <string>
-#include <list>
+#include "types.hh"
 
-#include "util.hh"
+
+namespace nix {
 
 
 struct DrvName
@@ -27,4 +27,7 @@ int compareVersions(const string & v1, const string & v2);
 DrvNames drvNamesFromArgs(const Strings & opArgs);
 
 
+}
+
+
 #endif /* !__NAMES_H */
diff --git a/src/nix-env/profiles.cc b/src/nix-env/profiles.cc
index 6ec12e604c..0db5bda5e9 100644
--- a/src/nix-env/profiles.cc
+++ b/src/nix-env/profiles.cc
@@ -1,4 +1,5 @@
 #include "profiles.hh"
+#include "util.hh"
 
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -7,6 +8,9 @@
 #include <stdio.h>
 
 
+namespace nix {
+
+
 static bool cmpGensByNumber(const Generation & a, const Generation & b)
 {
     return a.number < b.number;
@@ -126,3 +130,7 @@ void switchLink(Path link, Path target)
     if (rename(tmp.c_str(), link.c_str()) != 0)
         throw SysError(format("renaming `%1%' to `%2%'") % tmp % link);
 }
+
+ 
+}
+
diff --git a/src/nix-env/profiles.hh b/src/nix-env/profiles.hh
index dc27d1c83d..2bd05045ea 100644
--- a/src/nix-env/profiles.hh
+++ b/src/nix-env/profiles.hh
@@ -1,9 +1,10 @@
 #ifndef __PROFILES_H
 #define __PROFILES_H
 
-#include <string>
+#include "types.hh"
 
-#include "util.hh"
+
+namespace nix {
 
 
 struct Generation
@@ -35,4 +36,7 @@ void deleteGeneration(const Path & profile, unsigned int gen);
 void switchLink(Path link, Path target);
 
 
+}
+
+
 #endif /* !__PROFILES_H */