Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * exceptions.h - Interface generator exceptions 00004 * 00005 * Generated: Tue Oct 10 18:11:59 2006 00006 * Copyright 2006 Tim Niemueller [www.niemueller.de] 00007 * 00008 ****************************************************************************/ 00009 00010 /* This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU Library General Public License for more details. 00019 * 00020 * Read the full text in the LICENSE.GPL file in the doc directory. 00021 */ 00022 00023 #ifndef __INTERFACES_GENERATOR_EXCEPTIONS_H_ 00024 #define __INTERFACES_GENERATOR_EXCEPTIONS_H_ 00025 00026 #include <core/exception.h> 00027 00028 /** Thrown if document was invalid. 00029 * This may happen if the document is not well-formed or if the file does not 00030 * exist. 00031 */ 00032 class InterfaceGeneratorInvalidDocumentException : public fawkes::Exception { 00033 public: 00034 /** Constructor 00035 * @param format message format string, followed by the appropriate number of 00036 * arguments. Cf. printf man page for valid format. 00037 */ 00038 InterfaceGeneratorInvalidDocumentException(const char *format, ...) 00039 : fawkes::Exception() 00040 { 00041 va_list arg; 00042 va_start(arg, format); 00043 append_va(format, arg); 00044 va_end(arg); 00045 } 00046 }; 00047 00048 /** Thrown if document contains illegal content. 00049 * This happens if there was content in the file which was while syntactically correct 00050 * semantically wrong. Examples for this are more than one data segment or no one at all. 00051 */ 00052 class InterfaceGeneratorInvalidContentException : public fawkes::Exception { 00053 public: 00054 /** Constructor 00055 * @param format message format string, followed by the appropriate number of 00056 * arguments. Cf. printf man page for valid format. 00057 */ 00058 InterfaceGeneratorInvalidContentException(const char *format, ...) 00059 : fawkes::Exception() 00060 { 00061 va_list arg; 00062 va_start(arg, format); 00063 append_va(format, arg); 00064 va_end(arg); 00065 } 00066 }; 00067 00068 00069 /** Thrown if illegal type is supplied. 00070 * Only a few basic types are allowed. If a typo occured or an unknown type was used 00071 * this exception is thrown. 00072 */ 00073 class InterfaceGeneratorInvalidTypeException : public fawkes::Exception { 00074 public: 00075 /** Constructor 00076 * @param item item type 00077 * @param name item name 00078 * @param type invalid data type 00079 */ 00080 InterfaceGeneratorInvalidTypeException(const char *item, const char *name, const char *type) 00081 : fawkes::Exception() 00082 { 00083 append("Invalid type for %s item '%s': %s", item, name, type); 00084 } 00085 }; 00086 00087 /** Thrown if illegal value is supplied. 00088 * Thrown if wrong value was supplied for a given value 00089 */ 00090 class InterfaceGeneratorInvalidValueException : public fawkes::Exception { 00091 public: 00092 /** Constructor 00093 * @param name item name 00094 * @param type data type 00095 * @param value invalid value 00096 */ 00097 InterfaceGeneratorInvalidValueException(const char *name, const char *type, const char *value) 00098 : fawkes::Exception() 00099 { 00100 append("Invalid value for '%s' of type %s: %s", name, type, value); 00101 } 00102 }; 00103 00104 /** Thrown if illegal attribute is supplied. 00105 * Thrown if illegal attribute was supplied for a given value 00106 */ 00107 class InterfaceGeneratorInvalidAttributeException : public fawkes::Exception { 00108 public: 00109 /** Constructor 00110 * @param name item name 00111 * @param type data type 00112 * @param attr invalid attribute 00113 */ 00114 InterfaceGeneratorInvalidAttributeException(const char *name, const char *type, const char *attr) 00115 : fawkes::Exception() 00116 { 00117 append("Attribute '%s' may not be specified for '%s' of type %s", attr, name, type); 00118 } 00119 }; 00120 00121 00122 /** Thrown if illegal flag is supplied. 00123 * Thrown if illegal flag was supplied for a given value 00124 */ 00125 class InterfaceGeneratorInvalidFlagException : public fawkes::Exception { 00126 public: 00127 /** Constructor 00128 * @param name item name 00129 * @param flag invalid flag 00130 */ 00131 InterfaceGeneratorInvalidFlagException(const char *name, const char *flag) 00132 : fawkes::Exception() 00133 { 00134 append("Illegal flag '%s' set for %s", flag, name); 00135 } 00136 }; 00137 00138 00139 /** Thrown if required attribute is missing supplied. 00140 * Thrown if required attribute was not supplied for a given value 00141 */ 00142 class InterfaceGeneratorMissingAttributeException : public fawkes::Exception { 00143 public: 00144 /** Constructor 00145 * @param name item name 00146 * @param type data type 00147 * @param attr missing attribute 00148 */ 00149 InterfaceGeneratorMissingAttributeException(const char *name, const char *type, const char *attr) 00150 : fawkes::Exception() 00151 { 00152 append("Attribute '%s' is required '%s' of type %s", attr, name, type); 00153 } 00154 }; 00155 00156 00157 /** Thrown if name is ambiguous. */ 00158 class InterfaceGeneratorAmbiguousNameException : public fawkes::Exception { 00159 public: 00160 /** Constructor 00161 * @param name ambiguous name 00162 * @param item item type 00163 */ 00164 InterfaceGeneratorAmbiguousNameException(const char *name, const char *item) 00165 : fawkes::Exception() 00166 { 00167 append("There are multiple %s items with name '%s'", item, name); 00168 } 00169 }; 00170 00171 00172 #endif