error.h

Go to the documentation of this file.
00001 /*
00002  *
00003  *  D-Bus++ - C++ bindings for D-Bus
00004  *
00005  *  Copyright (C) 2005-2007  Paolo Durante <shackan@gmail.com>
00006  *
00007  *
00008  *  This library is free software; you can redistribute it and/or
00009  *  modify it under the terms of the GNU Lesser General Public
00010  *  License as published by the Free Software Foundation; either
00011  *  version 2.1 of the License, or (at your option) any later version.
00012  *
00013  *  This library 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 GNU
00016  *  Lesser General Public License for more details.
00017  *
00018  *  You should have received a copy of the GNU Lesser General Public
00019  *  License along with this library; if not, write to the Free Software
00020  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021  *
00022  */
00023 
00024 
00025 #ifndef __DBUSXX_ERROR_H
00026 #define __DBUSXX_ERROR_H
00027 
00028 #include "api.h"
00029 #include "util.h"
00030 
00031 #include <exception>
00032 
00033 namespace DBus
00034 {
00035 
00036 class Message;
00037 class InternalError;
00038 
00039 class DXXAPI Error : public std::exception
00040 {
00041 public:
00042 
00043   Error();
00044 
00045   Error(InternalError &);
00046 
00047   Error(const char *name, const char *message);
00048 
00049   Error(Message &);
00050 
00051   ~Error() throw();
00052 
00053   const char *what() const throw();
00054 
00055   const char *name() const;
00056 
00057   const char *message() const;
00058 
00059   void set(const char *name, const char *message);
00060   // parameters MUST be static strings
00061 
00062   bool is_set() const;
00063 
00064   operator bool() const
00065   {
00066     return is_set();
00067   }
00068 
00069 private:
00070 
00071   RefPtrI<InternalError> _int;
00072 };
00073 
00074 struct DXXAPI ErrorFailed : public Error
00075 {
00076   ErrorFailed(const char *message)
00077     : Error("org.freedesktop.DBus.Error.Failed", message)
00078   {}
00079 };
00080 
00081 struct DXXAPI ErrorNoMemory : public Error
00082 {
00083   ErrorNoMemory(const char *message)
00084     : Error("org.freedesktop.DBus.Error.NoMemory", message)
00085   {}
00086 };
00087 
00088 struct DXXAPI ErrorServiceUnknown : public Error
00089 {
00090   ErrorServiceUnknown(const char *message)
00091     : Error("org.freedesktop.DBus.Error.ServiceUnknown", message)
00092   {}
00093 };
00094 
00095 struct DXXAPI ErrorNameHasNoOwner : public Error
00096 {
00097   ErrorNameHasNoOwner(const char *message)
00098     : Error("org.freedesktop.DBus.Error.NameHasNoOwner", message)
00099   {}
00100 };
00101 
00102 struct DXXAPI ErrorNoReply : public Error
00103 {
00104   ErrorNoReply(const char *message)
00105     : Error("org.freedesktop.DBus.Error.NoReply", message)
00106   {}
00107 };
00108 
00109 struct DXXAPI ErrorIOError : public Error
00110 {
00111   ErrorIOError(const char *message)
00112     : Error("org.freedesktop.DBus.Error.IOError", message)
00113   {}
00114 };
00115 
00116 struct DXXAPI ErrorBadAddress : public Error
00117 {
00118   ErrorBadAddress(const char *message)
00119     : Error("org.freedesktop.DBus.Error.BadAddress", message)
00120   {}
00121 };
00122 
00123 struct DXXAPI ErrorNotSupported : public Error
00124 {
00125   ErrorNotSupported(const char *message)
00126     : Error("org.freedesktop.DBus.Error.NotSupported", message)
00127   {}
00128 };
00129 
00130 struct DXXAPI ErrorLimitsExceeded : public Error
00131 {
00132   ErrorLimitsExceeded(const char *message)
00133     : Error("org.freedesktop.DBus.Error.LimitsExceeded", message)
00134   {}
00135 };
00136 
00137 struct DXXAPI ErrorAccessDenied : public Error
00138 {
00139   ErrorAccessDenied(const char *message)
00140     : Error("org.freedesktop.DBus.Error.AccessDenied", message)
00141   {}
00142 };
00143 
00144 struct DXXAPI ErrorAuthFailed : public Error
00145 {
00146   ErrorAuthFailed(const char *message)
00147     : Error("org.freedesktop.DBus.Error.AuthFailed", message)
00148   {}
00149 };
00150 
00151 struct DXXAPI ErrorNoServer : public Error
00152 {
00153   ErrorNoServer(const char *message)
00154     : Error("org.freedesktop.DBus.Error.NoServer", message)
00155   {}
00156 };
00157 
00158 struct DXXAPI ErrorTimeout : public Error
00159 {
00160   ErrorTimeout(const char *message)
00161     : Error("org.freedesktop.DBus.Error.Timeout", message)
00162   {}
00163 };
00164 
00165 struct DXXAPI ErrorNoNetwork : public Error
00166 {
00167   ErrorNoNetwork(const char *message)
00168     : Error("org.freedesktop.DBus.Error.NoNetwork", message)
00169   {}
00170 };
00171 
00172 struct DXXAPI ErrorAddressInUse : public Error
00173 {
00174   ErrorAddressInUse(const char *message)
00175     : Error("org.freedesktop.DBus.Error.AddressInUse", message)
00176   {}
00177 };
00178 
00179 struct DXXAPI ErrorDisconnected : public Error
00180 {
00181   ErrorDisconnected(const char *message)
00182     : Error("org.freedesktop.DBus.Error.Disconnected", message)
00183   {}
00184 };
00185 
00186 struct DXXAPI ErrorInvalidArgs : public Error
00187 {
00188   ErrorInvalidArgs(const char *message)
00189     : Error("org.freedesktop.DBus.Error.InvalidArgs", message)
00190   {}
00191 };
00192 
00193 struct DXXAPI ErrorFileNotFound : public Error
00194 {
00195   ErrorFileNotFound(const char *message)
00196     : Error("org.freedesktop.DBus.Error.FileNotFound", message)
00197   {}
00198 };
00199 
00200 struct DXXAPI ErrorUnknownMethod : public Error
00201 {
00202   ErrorUnknownMethod(const char *message)
00203     : Error("org.freedesktop.DBus.Error.UnknownMethod", message)
00204   {}
00205 };
00206 
00207 struct DXXAPI ErrorTimedOut : public Error
00208 {
00209   ErrorTimedOut(const char *message)
00210     : Error("org.freedesktop.DBus.Error.TimedOut", message)
00211   {}
00212 };
00213 
00214 struct DXXAPI ErrorMatchRuleNotFound : public Error
00215 {
00216   ErrorMatchRuleNotFound(const char *message)
00217     : Error("org.freedesktop.DBus.Error.MatchRuleNotFound", message)
00218   {}
00219 };
00220 
00221 struct DXXAPI ErrorMatchRuleInvalid : public Error
00222 {
00223   ErrorMatchRuleInvalid(const char *message)
00224     : Error("org.freedesktop.DBus.Error.MatchRuleInvalid", message)
00225   {}
00226 };
00227 
00228 struct DXXAPI ErrorSpawnExecFailed : public Error
00229 {
00230   ErrorSpawnExecFailed(const char *message)
00231     : Error("org.freedesktop.DBus.Error.Spawn.ExecFailed", message)
00232   {}
00233 };
00234 
00235 struct DXXAPI ErrorSpawnForkFailed : public Error
00236 {
00237   ErrorSpawnForkFailed(const char *message)
00238     : Error("org.freedesktop.DBus.Error.Spawn.ForkFailed", message)
00239   {}
00240 };
00241 
00242 struct DXXAPI ErrorSpawnChildExited : public Error
00243 {
00244   ErrorSpawnChildExited(const char *message)
00245     : Error("org.freedesktop.DBus.Error.Spawn.ChildExited", message)
00246   {}
00247 };
00248 
00249 struct DXXAPI ErrorSpawnChildSignaled : public Error
00250 {
00251   ErrorSpawnChildSignaled(const char *message)
00252     : Error("org.freedesktop.DBus.Error.Spawn.ChildSignaled", message)
00253   {}
00254 };
00255 
00256 struct DXXAPI ErrorSpawnFailed : public Error
00257 {
00258   ErrorSpawnFailed(const char *message)
00259     : Error("org.freedesktop.DBus.Error.Spawn.Failed", message)
00260   {}
00261 };
00262 
00263 struct DXXAPI ErrorInvalidSignature : public Error
00264 {
00265   ErrorInvalidSignature(const char *message)
00266     : Error("org.freedesktop.DBus.Error.InvalidSignature", message)
00267   {}
00268 };
00269 
00270 struct DXXAPI ErrorUnixProcessIdUnknown : public Error
00271 {
00272   ErrorUnixProcessIdUnknown(const char *message)
00273     : Error("org.freedesktop.DBus.Error.UnixProcessIdUnknown", message)
00274   {}
00275 };
00276 
00277 struct DXXAPI ErrorSELinuxSecurityContextUnknown : public Error
00278 {
00279   ErrorSELinuxSecurityContextUnknown(const char *message)
00280     : Error("org.freedesktop.DBus.Error.SELinuxSecurityContextUnknown", message)
00281   {}
00282 };
00283 
00284 } /* namespace DBus */
00285 
00286 #endif//__DBUSXX_ERROR_H