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/libutil/util.hh | |
parent | aab88127321344d5818d823bff515d127108d058 (diff) |
* Use a proper namespace.
* Optimise header file usage a bit.
* Compile the parser as C++.
Diffstat (limited to 'src/libutil/util.hh')
-rw-r--r-- | src/libutil/util.hh | 59 |
1 files changed, 5 insertions, 54 deletions
diff --git a/src/libutil/util.hh b/src/libutil/util.hh index 125ba2695..b4a61ae04 100644 --- a/src/libutil/util.hh +++ b/src/libutil/util.hh @@ -1,58 +1,15 @@ #ifndef __UTIL_H #define __UTIL_H -#include <string> -#include <list> -#include <set> -#include <sstream> +#include "types.hh" #include <sys/types.h> #include <dirent.h> #include <unistd.h> #include <signal.h> -#include <boost/format.hpp> -using namespace std; -using namespace boost; - - -class Error : public exception -{ -protected: - string err; -public: - Error(const format & f); - ~Error() throw () { }; - const char * what() const throw () { return err.c_str(); } - const string & msg() const throw () { return err; } - Error & addPrefix(const format & f); -}; - -class SysError : public Error -{ -public: - SysError(const format & f); -}; - -#define MakeError(newClass, superClass) \ - class newClass : public superClass \ - { \ - public: \ - newClass(const format & f) : superClass(f) { }; \ - }; - -MakeError(UsageError, Error) - - -typedef list<string> Strings; -typedef set<string> StringSet; - - -/* Paths are just strings. */ -typedef string Path; -typedef list<Path> Paths; -typedef set<Path> PathSet; +namespace nix { /* Return an environment variable. */ @@ -138,15 +95,6 @@ typedef enum { ltFlat /* no nesting */ } LogType; -typedef enum { - lvlError, - lvlInfo, - lvlTalkative, - lvlChatty, - lvlDebug, - lvlVomit -} Verbosity; - extern LogType logType; extern Verbosity verbosity; /* suppress msgs > this */ @@ -307,5 +255,8 @@ struct SwitchToOriginalUser ~SwitchToOriginalUser(); }; + +} + #endif /* !__UTIL_H */ |