9 #include <boost/format.hpp>
15 /* Inherit some names from other namespaces for convenience. */
26 FormatOrString(const string
& s
) : s(s
) { };
27 FormatOrString(const format
& f
) : s(f
.str()) { };
28 FormatOrString(const char * s
) : s(s
) { };
32 /* BaseError should generally not be caught, as it has Interrupted as
33 a subclass. Catch Error instead. */
34 class BaseError
: public std::exception
37 string prefix_
; // used for location traces etc.
40 unsigned int status
; // exit status
41 BaseError(const FormatOrString
& fs
, unsigned int status
= 1);
42 ~BaseError() throw () { };
43 const char * what() const throw () { return err
.c_str(); }
44 const string
& msg() const throw () { return err
; }
45 const string
& prefix() const throw () { return prefix_
; }
46 BaseError
& addPrefix(const FormatOrString
& fs
);
49 #define MakeError(newClass, superClass) \
50 class newClass : public superClass \
53 newClass(const FormatOrString & fs, unsigned int status = 1) : superClass(fs, status) { }; \
56 MakeError(Error
, BaseError
)
58 class SysError
: public Error
62 SysError(const FormatOrString
& fs
);
66 typedef list
<string
> Strings
;
67 typedef set
<string
> StringSet
;
70 /* Paths are just strings. */
72 typedef list
<Path
> Paths
;
73 typedef set
<Path
> PathSet
;