* Use a proper namespace.

* Optimise header file usage a bit.
* Compile the parser as C++.
This commit is contained in:
Eelco Dolstra 2006-09-04 21:06:23 +00:00
parent aab8812732
commit 75068e7d75
61 changed files with 650 additions and 268 deletions

View file

@ -1,3 +1,7 @@
#include "db.hh"
#include "util.hh"
#include "pathlocks.hh"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@ -7,9 +11,8 @@
#include <db_cxx.h>
#include "db.hh"
#include "util.hh"
#include "pathlocks.hh"
namespace nix {
/* Wrapper class to ensure proper destruction. */
@ -112,7 +115,7 @@ Db * Database::getDb(TableId table)
if (table == 0)
throw Error("database table is not open "
"(maybe you don't have sufficient permission?)");
map<TableId, Db *>::iterator i = tables.find(table);
std::map<TableId, Db *>::iterator i = tables.find(table);
if (i == tables.end())
throw Error("unknown table id");
return i->second;
@ -263,10 +266,10 @@ void Database::close()
try {
for (map<TableId, Db *>::iterator i = tables.begin();
for (std::map<TableId, Db *>::iterator i = tables.begin();
i != tables.end(); )
{
map<TableId, Db *>::iterator j = i;
std::map<TableId, Db *>::iterator j = i;
++j;
closeTable(i->first);
i = j;
@ -433,3 +436,6 @@ void Database::enumTable(const Transaction & txn, TableId table,
} catch (DbException e) { rethrow(e); }
}
}