File: mxml_error.h

package info (click to toggle)
falconpl 0.9.6.9-git20120606-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 46,176 kB
  • sloc: cpp: 181,389; ansic: 109,025; yacc: 2,310; xml: 1,218; sh: 403; objc: 245; makefile: 82; sql: 20
file content (103 lines) | stat: -rw-r--r-- 2,035 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/*
   Mini XML lib PLUS for C++

   Error class

   Author: Giancarlo Niccolai <gian@niccolai.ws>

*/

#ifndef MXML_ERROR_H
#define MXML_ERROR_H

#include <mxml_element.h>
#include <falcon/string.h>
#include <falcon/falcondata.h>

namespace MXML {

typedef enum {
   malformedError=1,
   ioError,
   notFoundError
} errorType;

class Error: public Falcon::FalconData
{
private:
   int m_code;
   int m_beginLine;
   int m_beginChar;
   int m_line;
   int m_char;

public:

/** Error codes
   This define what kind of error happened while decoding the XML document
*/
enum codes
{
   errNone = 0,
   errIo,
   errNomem,
   errOutChar,
   errInvalidNode,
   errInvalidAtt,
   errMalformedAtt,
   errInvalidChar,
   errUnclosed,
   errUnclosedEntity,
   errWrongEntity,
   errChildNotFound,
   errAttrNotFound,
   errHyerarcy,
   errCommentInvalid,
   errMultipleXmlDecl
};

protected:
   Error( const codes code, const Element *generator );

public:
   virtual ~Error();
   virtual const errorType type() const = 0;
   int numericCode() const;
   const Falcon::String description() const;
   void toString( Falcon::String &target ) const;
   void describeLine( Falcon::String &target ) const;

   const Falcon::String describeLine() const { Falcon::String s; describeLine(s); return s; }

   virtual void gcMark( Falcon::uint32 mk ) {};
   virtual Falcon::FalconData *clone() const { return 0; }
};


class MalformedError: public Error
{
public:
   MalformedError( const codes code, const Element *generator ):
      Error( code, generator ) {};
   virtual const errorType type() const  { return malformedError; }
};

class IOError: public Error
{
public:
   IOError( const codes code, const Element *generator  ):
      Error( code, generator ) {};
   virtual const errorType type() const { return ioError; }
};

class NotFoundError: public Error
{
public:
   NotFoundError( const codes code, const Element *generator ):
      Error( code, generator ) {};
   virtual const errorType type() const { return notFoundError; }
};

}

#endif