|
DBus-1-TQt
1.0
|
00001 /* qdbuserror.h TQT_DBusError object 00002 * 00003 * Copyright (C) 2005 Harald Fernengel <harry@kdevelop.org> 00004 * Copyright (C) 2005 Kevin Krammer <kevin.krammer@gmx.at> 00005 * 00006 * Licensed under the Academic Free License version 2.1 00007 * 00008 * This program is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * This program is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with this program; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 00021 * USA. 00022 * 00023 */ 00024 00025 #ifndef TQDBUSERROR_H 00026 #define TQDBUSERROR_H 00027 00028 #include "tqdbusmacros.h" 00029 #include <tqstring.h> 00030 00031 struct DBusError; 00032 00040 class TQDBUS_EXPORT TQT_DBusError 00041 { 00042 public: 00059 enum ErrorType 00060 { 00066 InvalidError, 00067 00076 Failed, 00077 00083 NoMemory, 00084 00088 ServiceUnknown, 00089 00097 NameHasNoOwner, 00098 00104 NoReply, 00105 00114 IOError, 00115 00124 BadAddress, 00125 00134 NotSupported, 00135 00141 LimitsExceeded, 00142 00152 AccessDenied, 00153 00159 AuthFailed, 00160 00164 NoServer, 00165 00174 Timeout, 00175 00179 NoNetwork, 00180 00186 Disconnected, 00187 00197 InvalidArgs, 00198 00204 FileNotFound, 00205 00211 FileExists, 00212 00218 UnknownMethod, 00219 00226 TimedOut, 00227 00241 InvalidSignature, 00242 00248 UserDefined 00249 }; 00250 00254 TQT_DBusError(); 00255 00261 TQT_DBusError(const DBusError *error); 00262 00271 TQT_DBusError(const TQString& error, const TQString& message); 00272 00282 inline TQString name() const { return nm; } 00283 00295 inline TQString message() const { return msg; } 00296 00307 inline ErrorType type() const { return errorType; } 00308 00316 inline bool dbusErrorSet() const { return m_dbusErrorSet; } 00317 00321 inline void setDBUSError(bool err) const { m_dbusErrorSet = err; } 00322 00331 bool isValid() const; 00332 00340 static TQT_DBusError stdFailed(const TQString& message); 00341 00349 static TQT_DBusError stdNoMemory(const TQString& message); 00350 00358 static TQT_DBusError stdNoReply(const TQString& message); 00359 00367 static TQT_DBusError stdIOError(const TQString& message); 00368 00376 static TQT_DBusError stdNotSupported(const TQString& message); 00377 00385 static TQT_DBusError stdLimitsExceeded(const TQString& message); 00386 00394 static TQT_DBusError stdAccessDenied(const TQString& message); 00395 00403 static TQT_DBusError stdAuthFailed(const TQString& message); 00404 00412 static TQT_DBusError stdTimeout(const TQString& message); 00413 00421 static TQT_DBusError stdInvalidArgs(const TQString& message); 00422 00430 static TQT_DBusError stdFileNotFound(const TQString& message); 00431 00439 static TQT_DBusError stdFileExists(const TQString& message); 00440 00448 static TQT_DBusError stdUnknownMethod(const TQString& message); 00449 00457 static TQT_DBusError stdInvalidSignature(const TQString& message); 00458 00459 private: 00460 ErrorType errorType; 00461 mutable bool m_dbusErrorSet; 00462 00463 TQString nm, msg; 00464 00473 TQT_DBusError(ErrorType type, const TQString& message); 00474 }; 00475 00476 #endif