// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: error.h,v 1.1 1998/07/02 02:58:13 jgg Exp $
+// $Id: error.h,v 1.6 1999/01/18 06:20:08 jgg Exp $
/* ######################################################################
Global Erorr Class - Global error mechanism
##################################################################### */
/*}}}*/
-// Header section: pkglib
#ifndef PKGLIB_ERROR_H
#define PKGLIB_ERROR_H
+#ifdef __GNUG__
+#pragma interface "apt-pkg/error.h"
+#endif
+
#include <string>
-#include <vector.h>
class GlobalError
{
{
string Text;
bool Error;
+ Item *Next;
};
- vector<Item> 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 WarningE(const char *Function,const char *Description,...);
/* A warning should be considered less severe than an error, and may be
ignored by the client. */
// Simple accessors
inline bool PendingError() {return PendingFlag;};
- inline bool empty() {return List.empty();};
+ inline bool empty() {return List == 0;};
bool PopMessage(string &Text);
- void Discard() {List.erase(List.begin(),List.end()); PendingFlag = false;};
+ void Discard();
// Usefull routine to dump to cerr
void DumpErrors();
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