~ubuntu-branches/ubuntu/wily/opencollada/wily-proposed

« back to all changes in this revision

Viewing changes to Externals/MathMLSolver/include/MathMLError.h

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2015-05-14 17:23:27 UTC
  • Revision ID: package-import@ubuntu.com-20150514172327-f862u8envms01fra
Tags: upstream-0.1.0~20140703.ddf8f47+dfsg1
ImportĀ upstreamĀ versionĀ 0.1.0~20140703.ddf8f47+dfsg1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/******************************************************************************
 
2
Copyright (c) 2007 netAllied GmbH, Tettnang
 
3
 
 
4
Permission is hereby granted, free of charge, to any person
 
5
obtaining a copy of this software and associated documentation
 
6
files (the "Software"), to deal in the Software without
 
7
restriction, including without limitation the rights to use,
 
8
copy, modify, merge, publish, distribute, sublicense, and/or sell
 
9
copies of the Software, and to permit persons to whom the
 
10
Software is furnished to do so, subject to the following
 
11
conditions:
 
12
 
 
13
The above copyright notice and this permission notice shall be
 
14
included in all copies or substantial portions of the Software.
 
15
 
 
16
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 
17
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 
18
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 
19
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 
20
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 
21
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 
22
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 
23
OTHER DEALINGS IN THE SOFTWARE.
 
24
******************************************************************************/
 
25
 
 
26
#ifndef __MATHML_SOLVER_ERROR_H__
 
27
#define __MATHML_SOLVER_ERROR_H__
 
28
 
 
29
#include "MathMLSolverPrerequisites.h"
 
30
#include "MathMLString.h"
 
31
 
 
32
namespace MathML
 
33
{
 
34
 
 
35
    /**
 
36
     * This class describes an error related to MathML.
 
37
     */
 
38
    class _MATHML_SOLVER_EXPORT Error
 
39
    {
 
40
    public:
 
41
        enum ErrorCode
 
42
        {
 
43
            ERR_INVALIDPARAMS,
 
44
            ERR_ITEM_NOT_FOUND,
 
45
            ERR_INTERNAL_ERROR,
 
46
        };
 
47
 
 
48
    private:
 
49
        /** Error code. */
 
50
        ErrorCode mErrorCode;
 
51
        /** Error message. */
 
52
        String mMsg;
 
53
 
 
54
    public:
 
55
        /** Constructor. */
 
56
        Error( ErrorCode errorCode, const String& errorMessage )
 
57
            : mErrorCode( errorCode )
 
58
            , mMsg( errorMessage )
 
59
        {}
 
60
 
 
61
        /** Destructor. */
 
62
        virtual ~Error(){}
 
63
 
 
64
        /** Returns the error code. */
 
65
        ErrorCode getErrorCode() const { return mErrorCode; }
 
66
 
 
67
        /** Returns the error message. */
 
68
        const String& getErrorMessage() const { return mMsg; }
 
69
 
 
70
    };
 
71
 
 
72
    /**
 
73
     * Handles errors. Users of the library may implement this to be notified when errors occur.
 
74
     */
 
75
    class _MATHML_SOLVER_EXPORT ErrorHandler
 
76
    {
 
77
    public:
 
78
        /** Constructor. */
 
79
        ErrorHandler(){}
 
80
 
 
81
        /** Destructor. */
 
82
        virtual ~ErrorHandler(){}
 
83
 
 
84
        /** This method is used to pass errors to implementors.
 
85
        @param error An error that occurred.
 
86
        @return true if caller should continue, false for cancel.
 
87
        */
 
88
        virtual bool handleError( const Error* error ) = 0;
 
89
 
 
90
    };
 
91
 
 
92
} // namespace MathML
 
93
 
 
94
#endif // __MATHML_SOLVER_ERROR_H__