blob: 5b6484a3f1899b6619a184e7c1918ae46f6a8195 (
plain)
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
104
105
106
107
108
109
110
111
|
/***************************************************************************
mymoneyexception.h - description
-------------------
begin : Sun Apr 28 2002
copyright : (C) 2000-2002 by Michael Edwardes
email : mte@users.sourceforge.net
Javier Campos Morales <javi_c@users.sourceforge.net>
Felix Rodriguez <frodriguez@users.sourceforge.net>
John C <thetacoturtle@users.sourceforge.net>
Thomas Baumgart <ipwizard@users.sourceforge.net>
Kevin Tambascio <ktambascio@users.sourceforge.net>
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef MYMONEYEXCEPTION_H
#define MYMONEYEXCEPTION_H
// ----------------------------------------------------------------------------
// TQt Includes
#include <tqstring.h>
#include <kmymoney/export.h>
/**
* @file
* @author Thomas Baumgart
*/
/**
* This class describes an exception that is thrown by the engine
* in case of a failure.
*/
class KMYMONEY_EXPORT MyMoneyException {
public:
/**
* @def MYMONEYEXCEPTION(text)
* This is the preferred constructor to create a new exception
* object. It automatically inserts the filename and the source
* code line into the object upon creation.
*
* It is equivilant to MyMoneyException(text, __FILE__, __LINE__)
*/
#define MYMONEYEXCEPTION(a) MyMoneyException(a, __FILE__, __LINE__)
/**
* The constructor to create a new MyMoneyException object.
*
* @param msg reference to TQString containing the message
* @param file reference to TQString containing the name of the sourcefile where
* the exception was thrown
* @param line unsigned long containing the line number of the line where
* the exception was thrown in the file.
*
* An easier way to use this constructor is to use the macro
* MYMONEYEXCEPTION(text) instead. It automatically assigns the file
* and line parameter to the correct values.
*/
MyMoneyException(const TQString& msg, const TQString& file, const unsigned long line);
~MyMoneyException();
/**
* This method is used to return the message that was passed
* during the creation of the exception object.
*
* @return reference to TQString containing the message
*/
const TQString& what(void) const { return m_msg; };
/**
* This method is used to return the filename that was passed
* during the creation of the exception object.
*
* @return reference to TQString containing the filename
*/
const TQString& file(void) const { return m_file; };
/**
* This method is used to return the linenumber that was passed
* during the creation of the exception object.
*
* @return long integer containing the line number
*/
unsigned long line(void) const { return m_line; };
private:
/**
* This member variable holds the message
*/
TQString m_msg;
/**
* This member variable holds the filename
*/
TQString m_file;
/**
* This member variable holds the line number
*/
unsigned long m_line;
};
#endif
|