Plus  - Minimal XML for C++ (Version 0.9.2) Giancarlo Niccolai
Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

mxml_error.h

Go to the documentation of this file.
00001 /*
00002    Mini XML lib PLUS for C++
00003 
00004    Error class
00005 
00006    Author: Giancarlo Niccolai <gian@niccolai.ws>
00007 
00008    $Id: mxml_error.h,v 1.1.1.1 2003/08/13 00:13:29 jonnymind Exp $
00009 */
00010 
00011 #ifndef MXML_ERROR_H
00012 #define MXML_ERROR_H
00013 
00014 #include <mxml_element.h>
00015 #include <string>
00016 
00017 namespace MXML {
00018 
00019 typedef enum {
00020    malformedError=1,
00021    ioError,
00022    notFoundError
00023 } errorType;
00024 
00025 class Error
00026 {
00027 private:
00028    int m_code;
00029    const Element *m_generator;
00030 
00031 public:
00032 
00036 enum codes
00037 {
00038    errNone = 0,
00039    errIo,
00040    errNomem,
00041    errOutChar,
00042    errInvalidNode,
00043    errInvalidAtt,
00044    errMalformedAtt,
00045    errInvalidChar,
00046    errUnclosed,
00047    errUnclosedEntity,
00048    errWrongEntity,
00049    errChildNotFound,
00050    errAttrNotFound,
00051    errHyerarcy,
00052    errCommentInvalid
00053 };
00054 
00055 protected:
00056    Error( const codes code, const Element *generator )
00057    {
00058       m_code = code;
00059       m_generator = generator;
00060    }
00061 
00062 public:
00063    virtual const errorType type() const = 0;
00064    const std::string description();
00065 
00069    friend std::ostream& operator<<( std::ostream &stream, Error &err );
00070 };
00071 
00072 
00073 class MalformedError: public Error
00074 {
00075 public:
00076    MalformedError( const codes code, const Element *generator  ):
00077       Error( code, generator ) {};
00078    virtual const errorType type() const  { return malformedError; }
00079 };
00080 
00081 class IOError: public Error
00082 {
00083 public:
00084    IOError( const codes code, const Element *generator  ): Error( code, generator ) {};
00085    virtual const errorType type() const { return ioError; }
00086 };
00087 
00088 class NotFoundError: public Error
00089 {
00090 public:
00091    NotFoundError( const codes code, const Element *generator  ): Error( code, generator ) {};
00092    virtual const errorType type() const { return notFoundError; }
00093 };
00094 
00095 }
00096 
00097 #endif

Generated on Sun Apr 11 02:08:19 2004 for Mxml Plus by doxygen 1.3.5