exceptions.h

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 msg message
00036    */
00037   InterfaceGeneratorInvalidDocumentException(const char *msg)
00038     : fawkes::Exception("Interface document invalid.")
00039   {
00040     append(msg);
00041   }
00042 };
00043 
00044 /** Thrown if document contains illegal content.
00045  * This happens if there was content in the file which was while syntactically correct
00046  * semantically wrong. Examples for this are more than one data segment or no one at all.
00047  */
00048 class InterfaceGeneratorInvalidContentException : public fawkes::Exception {
00049  public:
00050   /** Constructor
00051    * @param msg message
00052    */
00053   InterfaceGeneratorInvalidContentException(const char *msg)
00054     : fawkes::Exception()
00055   {
00056     append("Invalid content: %s", msg);
00057   }
00058 };
00059 
00060 
00061 /** Thrown if illegal type is supplied.
00062  * Only a few basic types are allowed. If a typo occured or an unknown type was used
00063  * this exception is thrown.
00064  */
00065 class InterfaceGeneratorInvalidTypeException : public fawkes::Exception {
00066  public:
00067   /** Constructor
00068    * @param item item type
00069    * @param name item name
00070    * @param type invalid data type
00071    */
00072   InterfaceGeneratorInvalidTypeException(const char *item, const char *name, const char *type)
00073     : fawkes::Exception()
00074   {
00075     append("Invalid type for %s item '%s': %s", item, name, type);
00076   }
00077 };
00078 
00079 /** Thrown if illegal value is supplied.
00080  * Thrown if wrong value was supplied for a given value
00081  */
00082 class InterfaceGeneratorInvalidValueException : public fawkes::Exception {
00083  public:
00084   /** Constructor
00085    * @param name item name
00086    * @param type data type
00087    * @param value invalid value
00088    */
00089  InterfaceGeneratorInvalidValueException(const char *name, const char *type, const char *value)
00090     : fawkes::Exception()
00091   {
00092     append("Invalid value for '%s' of type %s: %s", name, type, value);
00093   }
00094 };
00095 
00096 /** Thrown if illegal attribute is supplied.
00097  * Thrown if illegal attribute was supplied for a given value
00098  */
00099 class InterfaceGeneratorInvalidAttributeException : public fawkes::Exception {
00100  public:
00101   /** Constructor
00102    * @param name item name
00103    * @param type data type
00104    * @param attr invalid attribute
00105    */
00106  InterfaceGeneratorInvalidAttributeException(const char *name, const char *type, const char *attr)
00107     : fawkes::Exception()
00108   {
00109     append("Attribute '%s' may not be specified for '%s' of type %s", attr, name, type);
00110   }
00111 };
00112 
00113 
00114 /** Thrown if illegal flag is supplied.
00115  * Thrown if illegal flag was supplied for a given value
00116  */
00117 class InterfaceGeneratorInvalidFlagException : public fawkes::Exception {
00118  public:
00119   /** Constructor
00120    * @param name item name
00121    * @param flag invalid flag
00122    */
00123  InterfaceGeneratorInvalidFlagException(const char *name, const char *flag)
00124     : fawkes::Exception()
00125   {
00126     append("Illegal flag '%s' set for %s", flag, name);
00127   }
00128 };
00129 
00130 
00131 /** Thrown if required attribute is missing supplied.
00132  * Thrown if required attribute was not supplied for a given value
00133  */
00134 class InterfaceGeneratorMissingAttributeException : public fawkes::Exception {
00135  public:
00136   /** Constructor
00137    * @param name item name
00138    * @param type data type
00139    * @param attr missing attribute
00140    */
00141  InterfaceGeneratorMissingAttributeException(const char *name, const char *type, const char *attr)
00142     : fawkes::Exception()
00143   {
00144     append("Attribute '%s' is required '%s' of type %s", attr, name, type);
00145   }
00146 };
00147 
00148 
00149 /** Thrown if name is ambiguous. */
00150 class InterfaceGeneratorAmbiguousNameException : public fawkes::Exception {
00151  public:
00152   /** Constructor
00153    * @param name ambiguous name
00154    * @param item item type
00155    */
00156  InterfaceGeneratorAmbiguousNameException(const char *name, const char *item)
00157     : fawkes::Exception()
00158   {
00159     append("There are multiple %s items with name '%s'", item, name);
00160   }
00161 };
00162 
00163 
00164 #endif

Generated on Tue Feb 22 13:31:23 2011 for Fawkes API by  doxygen 1.4.7