aflibException.h

00001     /*
00002 
00003     Copyright (C) 2000 Stefan Westerfeld
00004                        stefan@space.twc.de
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License as published by the Free Software Foundation; either
00009     version 2 of the License, or (at your option) any later version.
00010   
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Library General Public License for more details.
00015    
00016     You should have received a copy of the GNU Library General Public License
00017     along with this library; see the file COPYING.LIB.  If not, write to
00018     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00019     Boston, MA 02111-1307, USA.
00020 
00021 
00022     Some inspiration taken from glib.
00023     Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
00024     Modified by the GLib Team and others 1997-1999.
00025 
00026     */
00027 
00028 #ifndef _aflibException_H_
00029 #define _aflibException_H_
00030 
00031 #include "aflib.h"
00032 
00033 #include <string>
00034 #include <string.h>
00035 #include <errno.h>
00036 #include <iostream>
00037 
00038 class aflibException {
00039 
00040     std::string _errstr;
00041     aflibError _status;
00042     
00043     public:
00044 
00045     aflibException() { _status = AFLIB_SUCCESS; 
00046         _errstr = "AFLIB_SUCCESS";};
00047 
00048     aflibException(aflibError status);
00049     aflibException(aflibError status ,const char *fmt,...);
00050 
00051     const aflibError&
00052         getStatus() const { return _status; };
00053 
00054     const char*
00055         getErrorStr() const { return _errstr.c_str(); };
00056 
00057     void
00058         clear(){ 
00059             _status = AFLIB_SUCCESS;
00060             _errstr = "AFLIB SUCCESS";
00061         };
00062 
00063     bool
00064         operator!() const { return _status != AFLIB_SUCCESS;};
00065 
00066     bool
00067         operator==(aflibError status) const { return _status == status;};
00068     
00069     bool
00070         operator!=(aflibError status) const { return _status != status;};
00071     
00072       friend std::ostream&
00073          operator << (
00074                std::ostream& o,
00075                const aflibException& exception);
00076 
00077 };
00078 
00079 #endif

Generated on Tue Jan 16 12:42:55 2007 for Open Source Audio Library Project by  doxygen 1.4.6