00001 /* Tronc commun. 00002 * 00003 * PegSoft modules subsystem library (c) 2005 PegSoft 00004 * Contact us at pegsoft@pegsoft.net 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License version 2 as 00008 * published by the Free Software Foundation. 00009 * 00010 * This program is distributed in the hope that it will be useful, but 00011 * WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this software (the COPYING file); if not, write to the 00017 * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, 00018 * USA. 00019 * 00020 */ 00021 00027 #ifndef MODULES_INTERFACE_H 00028 #define MODULES_INTERFACE_H 00029 00030 /*************************************************************************/ 00031 00032 namespace modules 00033 { 00034 00035 /*************************************************************************/ 00036 00038 typedef uint32_t PSIID; 00039 00040 /*************************************************************************/ 00041 00043 00059 class Interface 00060 { 00061 public: 00063 static PSIID const IID = 0x4227894c; 00064 00066 virtual ~Interface() { } 00067 00069 00079 virtual Interface *supports(PSIID sid) { return 0; } 00080 }; 00081 00082 /*************************************************************************/ 00083 00085 00089 class ErrorInterface : public Interface 00090 { 00091 public: 00093 static PSIID const IID = 0x42e694d6; 00094 00096 static size_t const error_len = 1024; 00097 00099 ErrorInterface() : Interface() { m_error[0] = '\0'; } 00101 ErrorInterface(ErrorInterface const &ei) : Interface(ei) 00102 { m_error[0] = '\0'; } 00104 virtual ErrorInterface &operator=(ErrorInterface const &right); 00105 00107 char const *error() const { return m_error; } 00108 protected: 00110 char m_error[error_len]; 00111 00113 void errorf(char const *format, ...) FORMAT(printf,2,3); 00114 }; 00115 00116 /*************************************************************************/ 00117 00118 } /* namespace modules */ 00119 00120 /*************************************************************************/ 00121 00122 #endif /* MODULES_INTERFACE_H */