edelib 2.0.0

edelib/EdbusError.h

00001 /*
00002  * $Id: EdbusError.h 2839 2009-09-28 11:36:20Z karijes $
00003  *
00004  * D-BUS stuff
00005  * Copyright (c) 2008 edelib authors
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2 of the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public License
00018  * along with this library. If not, see <http://www.gnu.org/licenses/>.
00019  */
00020 
00021 #ifndef __EDELIB_EDBUSERROR_H__
00022 #define __EDELIB_EDBUSERROR_H__
00023 
00024 #include "edelib-global.h"
00025 
00026 struct DBusError;
00027 
00028 EDELIB_NS_BEGIN
00029 
00035 enum EdbusErrorType {
00036         EDBUS_ERROR_INVALID,              
00037         EDBUS_ERROR_FAILED,               
00038         EDBUS_ERROR_NO_MEMORY,            
00039         EDBUS_ERROR_SERVICE_UNKNOWN,      
00040         EDBUS_ERROR_NAME_HAS_NO_OWNER,    
00041         EDBUS_ERROR_NO_REPLY,             
00042         EDBUS_ERROR_IO_ERROR,             
00043         EDBUS_ERROR_BAD_ADDRESS,          
00044         EDBUS_ERROR_NOT_SUPPORTED,        
00045         EDBUS_ERROR_LIMITS_EXCEEDED,      
00046         EDBUS_ERROR_ACCESS_DENIED,        
00047         EDBUS_ERROR_AUTH_FAILED,          
00048         EDBUS_ERROR_NO_SERVER,            
00049         EDBUS_ERROR_TIMEOUT,              
00050         EDBUS_ERROR_NO_NETWORK,           
00051         EDBUS_ERROR_DISCONNECTED,         
00052         EDBUS_ERROR_INVALID_ARGS,         
00053         EDBUS_ERROR_FILE_NOT_FOUND,       
00054         EDBUS_ERROR_FILE_EXISTS,          
00055         EDBUS_ERROR_UNKNOWN_METHOD,       
00056         EDBUS_ERROR_TIMED_OUT,            
00057         EDBUS_ERROR_INVALID_SIGNATURE,    
00058         EDBUS_ERROR_USER_DEFINED          
00059 };
00060 
00061 struct EdbusErrorImpl;
00062 
00068 class EdbusError {
00069 private:
00070         EdbusErrorImpl* impl;
00071         void dispose(void);
00072 public:
00076         EdbusError();
00077 
00081         ~EdbusError();
00082 
00086         EdbusError(const DBusError* err);
00087 
00091         EdbusError(const EdbusError& other);
00092 
00096         EdbusError& operator=(const EdbusError& other);
00097 
00101         EdbusError(EdbusErrorType t, const char* msg);
00102 
00106         EdbusErrorType type(void) const;
00107 
00111         const char* name(void) const;
00112 
00116         const char* message(void) const;
00117 
00121         bool valid(void) const { return type() != EDBUS_ERROR_INVALID; }
00122 };
00123 
00124 EDELIB_NS_END
00125 #endif