"Fossies" - the Fresh Open Source Software Archive

Member "qdiff-0.9.1/tbaseexception.h" (21 Oct 2008, 1808 Bytes) of package /linux/privat/old/qdiff-0.9.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "tbaseexception.h" see the Fossies "Dox" file reference documentation.

    1 /*GPL*START*
    2  * tbaseexception - basic exceptions (used by tstring)
    3  * 
    4  * Copyright (C) 1998 by Johannes Overmann <overmann@iname.com>
    5  * Copyright (C) 2008 by Tong Sun <suntong001@users.sourceforge.net>
    6  * 
    7  * This program is free software; you can redistribute it and/or modify
    8  * it under the terms of the GNU General Public License as published by
    9  * the Free Software Foundation; either version 2 of the License, or
   10  * (at your option) any later version.
   11  * 
   12  * This program is distributed in the hope that it will be useful,
   13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
   14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   15  * GNU General Public License for more details.
   16  * 
   17  * You should have received a copy of the GNU General Public License along
   18  * with this program; if not, write to the Free Software Foundation, Inc.,
   19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
   20  * *GPL*END*/  
   21 
   22 #ifndef _ngw_tbaseexception_h_
   23 #define _ngw_tbaseexception_h_
   24 
   25 #include <string.h>
   26 
   27 // history:
   28 // 1999:
   29 // 17:02 04 Jun derived from terror.h
   30 
   31 
   32 // base class of all exceptions 
   33 class TException {
   34  public:
   35    virtual ~TException() { } 
   36 };
   37 
   38 // general exceptions, also base classes
   39 class TIndexOutOfRangeException: public TException {
   40  public:
   41    TIndexOutOfRangeException(int lower, int index, int upper): 
   42    lower(lower), index(index), upper(upper) {}
   43    int lower, index, upper;
   44 };
   45 
   46 class TZeroBasedIndexOutOfRangeException: public TIndexOutOfRangeException {
   47  public:
   48    TZeroBasedIndexOutOfRangeException(int index, int total_num):
   49    TIndexOutOfRangeException(0, index, total_num-1) {}
   50 };
   51 
   52 class TErrnoException: public TException {
   53  public:
   54    TErrnoException(int err): err(err) {}
   55    const char *str() const {return strerror(err);}
   56    int err;
   57 };
   58 
   59 #endif