diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-09-04 21:06:23 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-09-04 21:06:23 +0000 |
commit | 75068e7d753cf6cbe45a4bf294000dca9bd41d8b (patch) | |
tree | c6274cc10caab08349b5585206034f41ca4a575f /src/nix-env/main.cc | |
parent | aab88127321344d5818d823bff515d127108d058 (diff) |
* Use a proper namespace.
* Optimise header file usage a bit.
* Compile the parser as C++.
Diffstat (limited to 'src/nix-env/main.cc')
-rw-r--r-- | src/nix-env/main.cc | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/nix-env/main.cc b/src/nix-env/main.cc index b3caaeac8..7a6824b63 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"); |