kcrash.h
00001 /* 00002 * This file is part of the KDE Libraries 00003 * Copyright (C) 2000 Timo Hummel <timo.hummel@sap.com> 00004 * Tom Braun <braunt@fh-konstanz.de> 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Library General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Library General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Library General Public License 00016 * along with this library; see the file COPYING.LIB. If not, write to 00017 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00018 * Boston, MA 02111-1307, USA. 00019 * 00020 */ 00021 00022 #ifndef __KCRASH_H 00023 #define __KCRASH_H 00024 00025 #include <qstring.h> 00026 00036 class KCrash 00037 { 00038 private: // ;o) 00039 static const char *appName; 00040 static const char *appPath; 00041 00042 public: 00047 static void defaultCrashHandler (int signal); 00048 00053 typedef void (*HandlerType)(int); 00054 00066 static void setCrashHandler (HandlerType handler = defaultCrashHandler); 00067 00072 static HandlerType crashHandler() { return _crashHandler; } 00073 00081 static void setEmergencySaveFunction (HandlerType saveFunction = (HandlerType)0); 00086 static HandlerType emergencySaveFunction() { return _emergencySaveFunction; } 00087 00093 static void setApplicationPath (QString path) { appPath = qstrdup(path.local8Bit().data()); } 00094 00100 static void setApplicationName (QString name) { appName = qstrdup(name.local8Bit().data()); } 00101 00102 protected: 00106 static HandlerType _crashHandler; 00110 static HandlerType _emergencySaveFunction; 00111 }; 00112 00113 #endif 00114