From 75068e7d753cf6cbe45a4bf294000dca9bd41d8b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 4 Sep 2006 21:06:23 +0000 Subject: * Use a proper namespace. * Optimise header file usage a bit. * Compile the parser as C++. --- src/libutil/util.hh | 59 +++++------------------------------------------------ 1 file changed, 5 insertions(+), 54 deletions(-) (limited to 'src/libutil/util.hh') diff --git a/src/libutil/util.hh b/src/libutil/util.hh index 125ba2695c2c..b4a61ae04a0d 100644 --- a/src/libutil/util.hh +++ b/src/libutil/util.hh @@ -1,58 +1,15 @@ #ifndef __UTIL_H #define __UTIL_H -#include -#include -#include -#include +#include "types.hh" #include #include #include #include -#include -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 Strings; -typedef set StringSet; - - -/* Paths are just strings. */ -typedef string Path; -typedef list Paths; -typedef set 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 */ -- cgit 1.4.1