X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/578bfd0aed2ec993f4ad85fa6a7094a852261422..44c8b5dff8871485d071f92cd154dc1c14c3c015:/apt-pkg/contrib/error.h diff --git a/apt-pkg/contrib/error.h b/apt-pkg/contrib/error.h index 06b998e5e..90747ff7e 100644 --- a/apt-pkg/contrib/error.h +++ b/apt-pkg/contrib/error.h @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: error.h,v 1.1 1998/07/02 02:58:13 jgg Exp $ +// $Id: error.h,v 1.8 2001/05/07 05:06:52 jgg Exp $ /* ###################################################################### Global Erorr Class - Global error mechanism @@ -37,39 +37,42 @@ ##################################################################### */ /*}}}*/ -// Header section: pkglib #ifndef PKGLIB_ERROR_H #define PKGLIB_ERROR_H +#include + #include -#include class GlobalError { struct Item { - string Text; + std::string Text; bool Error; + Item *Next; }; - vector List; + Item *List; bool PendingFlag; + void Insert(Item *I); public: // Call to generate an error from a library call. - bool Errno(const char *Function,const char *Description,...); + bool Errno(const char *Function,const char *Description,...) __like_printf_2 __cold; + bool WarningE(const char *Function,const char *Description,...) __like_printf_2 __cold; /* A warning should be considered less severe than an error, and may be ignored by the client. */ - bool Error(const char *Description,...); - bool Warning(const char *Description,...); + bool Error(const char *Description,...) __like_printf_1 __cold; + bool Warning(const char *Description,...) __like_printf_1 __cold; // Simple accessors inline bool PendingError() {return PendingFlag;}; - inline bool empty() {return List.empty();}; - bool PopMessage(string &Text); - void Discard() {List.erase(List.begin(),List.end()); PendingFlag = false;}; + inline bool empty() {return List == 0;}; + bool PopMessage(std::string &Text); + void Discard(); // Usefull routine to dump to cerr void DumpErrors(); @@ -77,8 +80,8 @@ class GlobalError GlobalError(); }; -/* The 'extra-ansi' syntax is used to help with collisions. This is the - single global instance of this class. */ -extern GlobalError *_error; +// The 'extra-ansi' syntax is used to help with collisions. +GlobalError *_GetErrorObj(); +#define _error _GetErrorObj() #endif