ximol/encoders/error.hpp

Go to the documentation of this file.
00001 /*****************************************************************************\
00002  *                                                                           *
00003  * library XiMoL                                                             *
00004  * Copyright (C) 2002, 2003, 2004 Florent Tournois                           *
00005  *                                                                           *
00006  * This library is free software; you can redistribute it and/or             *
00007  * modify it under the terms of the GNU Lesser General Public                *
00008  * License as published by the Free Software Foundation; either              *
00009  * version 2.1 of the License, or (at your option) any later version.        *
00010  *                                                                           *
00011  * This library is distributed in the hope that it will be useful,           *
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of            *
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
00014  * Lesser General Public License for more details.                           *
00015  *                                                                           *
00016  * You should have received a copy of the GNU Lesser General Public          *
00017  * License along with this library; if not, write to the Free Software       *
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA   *
00019  *                                                                           *
00020 \*****************************************************************************/
00021 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00022 /** \file 
00023         \brief Declare the error class and macros.
00024     Define an encoders::error derived from ximol::error. 
00025 
00026         @ingroup exceptions encoders
00027 
00028         \author Tournois Florent
00029         \version 1.0
00030 
00031     $Id: error.hpp,v 1.11 2004/03/04 18:45:29 tournois Exp $
00032     $Log: error.hpp,v $
00033     Revision 1.11  2004/03/04 18:45:29  tournois
00034     Compatibility with gcc.
00035 
00036     Revision 1.10  2004/02/22 10:27:34  tournois
00037     Add some doc.
00038 
00039     Revision 1.9  2004/02/22 09:54:20  tournois
00040     Change years on the copyright.
00041 
00042     Revision 1.8  2004/01/25 17:32:17  tournois
00043     no message
00044 
00045     Revision 1.7  2004/01/18 11:40:58  tournois
00046     Add the pattern facet.
00047 
00048     Revision 1.6  2003/11/16 13:25:25  tournois
00049     Change the error to use wide string.
00050     Change the translation to use wide string.
00051 
00052     Revision 1.5  2003/11/15 19:06:39  tournois
00053     no message
00054 
00055     Revision 1.4  2003/11/02 19:23:01  tournois
00056     Go to the boost coding standard.
00057     Change all name to lower case.
00058 
00059     Revision 1.3  2003/10/25 13:53:39  hfp
00060     review and separation
00061 
00062     Revision 1.2  2003/09/24 08:28:17  tournois
00063     Create the namespace Encoders, Parser, Xml
00064     Change the library organization.
00065     add VC7.1 project for this organization.
00066 
00067  */
00068 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00069 #ifndef XIMOL_ENCODERS_ERROR_HPP_
00070 #define XIMOL_ENCODERS_ERROR_HPP_
00071 
00072 #include <ximol/error.hpp>
00073 
00074 //-----------------------------------------------------------------------------
00075 /** Macro to throw the error.
00076  *  @ingroup exceptions
00077  *   This macro create the exception, and you could put to
00078  *      some additional information.
00079  *      \code
00080  *      XIMOL_ENCODERS_THROW << _(L"error description") 
00081  *                           << XIMOL_ENCODERS_AS_ERROR;
00082  *      \endcode
00083  *      
00084  *      @see error
00085  *      @see XIMOL_ENCODERS_AS_ERROR 
00086  */
00087 //-----------------------------------------------------------------------------
00088 #define XIMOL_ENCODERS_THROW { XIMOL_ENCODERS_NAMESPACE_PATH::error err; err  
00089 
00090 //-----------------------------------------------------------------------------
00091 /** Macro to throw the error.
00092  *  @ingroup exceptions
00093  *  This macro throw effectively the exception.
00094  *
00095  *      \code
00096  *      XIMOL_ENCODERS_THROW << _(L"error description") 
00097  *                           << XIMOL_ENCODERS_AS_ERROR;
00098  *      \endcode
00099  *
00100  *      @see error
00101  *      @see XIMOL_ENCODERS_AS_ERROR 
00102  */
00103 //-----------------------------------------------------------------------------
00104 #define XIMOL_ENCODERS_AS_ERROR  ""; throw err; };
00105 
00106 XIMOL_ENCODERS_BEGIN_NAMESPACE
00107 
00108 //=============================================================================
00109 /// Implementation of the ximol encoder error.
00110 /** @ingroup exceptions encoders
00111     To use this class, you must use the macros XIMOL_ENCODERS_THROW_ERROR,
00112         and XIMOL_ENCODERS_AS_ERROR. You could also use the translation function.
00113 
00114         \code
00115         XIMOL_ENCODERS_THROW << _(L"error description") 
00116                              << XIMOL_ENCODERS_AS_ERROR;
00117         \endcode
00118 
00119   */
00120 //=============================================================================
00121 class XIMOL_EXPORT error 
00122         : public XIMOL_NAMESPACE_PATH::error
00123 {
00124 protected: // nested types
00125         typedef XIMOL_NAMESPACE_PATH::error base_type;
00126 
00127 public: // constructor(s) & destructor
00128     ///@name constructor(s) & destructor
00129     //@{
00130         error();
00131         explicit error(const ::std::wstring& str);
00132         error(const error& err);
00133         ~error() throw();
00134     //@}
00135       
00136 }; // end of class error
00137 
00138 XIMOL_ENCODERS_END_NAMESPACE
00139 
00140 #endif // #ifndef XIMOL_ENCODERS_ERROR_HPP_


Donate to the XiMoL project SourceForge.net Logo If you have any questions about XiMoL, you could write to tournois@users.sourceforge.net.