~ubuntu-branches/ubuntu/utopic/psi/utopic

« back to all changes in this revision

Viewing changes to third-party/cppunit/cppunit/include/cppunit/Exception.h

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2009-09-25 17:49:51 UTC
  • mfrom: (6.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20090925174951-lvm7kdap82o8xhn3
Tags: 0.13-1
* Updated to upstream version 0.13
* Set Standards-Version to 3.8.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef CPPUNIT_EXCEPTION_H
2
 
#define CPPUNIT_EXCEPTION_H
3
 
 
4
 
#include <cppunit/Portability.h>
5
 
#include <cppunit/Message.h>
6
 
#include <cppunit/SourceLine.h>
7
 
#include <exception>
8
 
 
9
 
 
10
 
CPPUNIT_NS_BEGIN
11
 
 
12
 
 
13
 
/*! \brief Exceptions thrown by failed assertions.
14
 
 * \ingroup BrowsingCollectedTestResult
15
 
 *
16
 
 * Exception is an exception that serves
17
 
 * descriptive strings through its what() method
18
 
 */
19
 
class CPPUNIT_API Exception : public std::exception
20
 
{
21
 
public:
22
 
  /*! \brief Constructs the exception with the specified message and source location.
23
 
   * \param message Message associated to the exception.
24
 
   * \param sourceLine Source location related to the exception.
25
 
   */
26
 
  Exception( const Message &message = Message(), 
27
 
             const SourceLine &sourceLine = SourceLine() );
28
 
 
29
 
#ifdef CPPUNIT_ENABLE_SOURCELINE_DEPRECATED
30
 
  /*!
31
 
   * \deprecated Use other constructor instead.
32
 
   */
33
 
  Exception( std::string  message, 
34
 
             long lineNumber, 
35
 
             std::string fileName );
36
 
#endif
37
 
 
38
 
  /*! \brief Constructs a copy of an exception.
39
 
   * \param other Exception to copy.
40
 
   */
41
 
  Exception( const Exception &other );
42
 
 
43
 
  /// Destructs the exception
44
 
  virtual ~Exception() throw();
45
 
 
46
 
  /// Performs an assignment
47
 
  Exception &operator =( const Exception &other );
48
 
 
49
 
  /// Returns descriptive message
50
 
  const char *what() const throw();
51
 
 
52
 
  /// Location where the error occured
53
 
  SourceLine sourceLine() const;
54
 
 
55
 
  /// Message related to the exception.
56
 
  Message message() const;
57
 
 
58
 
  /// Set the message.
59
 
  void setMessage( const Message &message );
60
 
 
61
 
#ifdef CPPUNIT_ENABLE_SOURCELINE_DEPRECATED
62
 
  /// The line on which the error occurred
63
 
  long lineNumber() const;
64
 
 
65
 
  /// The file in which the error occurred
66
 
  std::string fileName() const;
67
 
 
68
 
  static const std::string UNKNOWNFILENAME;
69
 
  static const long UNKNOWNLINENUMBER;
70
 
#endif
71
 
 
72
 
  /// Clones the exception.
73
 
  virtual Exception *clone() const;
74
 
 
75
 
protected:
76
 
  // VC++ does not recognize call to parent class when prefixed
77
 
  // with a namespace. This is a workaround.
78
 
  typedef std::exception SuperClass;
79
 
 
80
 
  Message m_message;
81
 
  SourceLine m_sourceLine;
82
 
  std::string m_whatMessage;
83
 
};
84
 
 
85
 
 
86
 
CPPUNIT_NS_END
87
 
 
88
 
 
89
 
#endif // CPPUNIT_EXCEPTION_H
90