Revision 2029f0eb6ccd57468ba64b629d8ab2b5a8ddb80b authored by Rene Brun on 14 March 2004, 18:15:47 UTC, committed by Rene Brun on 14 March 2004, 18:15:47 UTC
for the case kExpo (shift by 1 in the use of parameters)


git-svn-id: http://root.cern.ch/svn/root/trunk@8400 27541ba8-7e3a-0410-8455-c3a389f83636
1 parent 4c44cc3
Raw File
_exception.h
#ifndef G__EXCEPTION_H
#define G__EXCEPTION_H

//namespace std {

class exception;
class bad_exception;
typedef void (*unexpected_handler)();
unexpected_handler set_unexpected(unexpected_handler f) /* throw() */ ;
void unexpected();
typedef void (*terminate_handler)();
terminate_handler set_terminate(terminate_handler f) /* throw() */ ;
void terminate();
bool uncaught_exception();

/////////////////////////////////////////////////////////////////////////
class exception {
 public:
  exception() /* throw() */ { msg=0; }
  exception(const exception& x) /* throw() */ {
    if(x.msg) {
      msg = new char[strlen(x.msg)+1];
      strcpy(msg,x.msg);
    }
    else msg = 0;
  }
  exception& operator=(const exception& x) /* throw() */ {
    delete[] msg;
    if(x.msg) {
      msg = new char[strlen(x.msg)+1];
      strcpy(msg,x.msg);
    }
    else msg = 0;
  }
  virtual ~exception() /* throw() */ { delete[] msg; }
  virtual const char* what() const /* throw() */{return(msg);}

  exception(const char* msgin) { 
    msg = new char[strlen(msgin)+1];
    strcpy(msg,msgin);
  }
 private:
  char* msg;
};

/////////////////////////////////////////////////////////////////////////
class bad_exception : public exception {
 public:
  bad_exception() /* throw() */ {}
  bad_exception(const bad_exception&) /* throw() */ {}
  bad_exception& operator=(const bad_exception&) /* throw() */ {}
  virtual ~bad_exception() /* throw() */ {}
  virtual const char* what() const /* throw() */ {return("Unknown bad_exception");} 
};

#ifdef __MAKECINT__

#pragma link off class exception;
#pragma link off class bad_exception;
#pragma link off function set_unexpected;
#pragma link off function unexpected;
#pragma link off function set_terminate;
#pragma link off function terminate;
#pragma link off function uncaught_exception;
#pragma link off typedef bool;

#endif

//}

#endif
back to top