View difference between Paste ID: iRLQbzuc and
SHOW:
|
|
- or go back to the newest paste.
1 | - | |
1 | + | // File indented manually |
2 | ||
3 | #include <iostream> | |
4 | #include <sstream> | |
5 | ||
6 | #include "Exception.h" | |
7 | #include "Error.h" | |
8 | ||
9 | namespace Package | |
10 | { | |
11 | // Constructor | |
12 | Exception::Exception( | |
13 | const std::string& _who, | |
14 | const std::string& _message, | |
15 | const TErrorCode& _errorCode) | |
16 | : who(_who) | |
17 | , message(_message) | |
18 | , errorCode(_errorCode) | |
19 | { | |
20 | // Do nothing | |
21 | } | |
22 | ||
23 | // Destructor | |
24 | Exception::~Exception() throw() | |
25 | { | |
26 | // Do nothing | |
27 | } | |
28 | ||
29 | // what | |
30 | const char* Exception::what() const throw() | |
31 | { | |
32 | std::ostringstream ossResult; | |
33 | ossResult << who << ": " << message; | |
34 | return ossResult.str().c_str(); | |
35 | } | |
36 | ||
37 | // GetErrorCode | |
38 | TErrorCode Exception::GetErrorCode() const throw() | |
39 | { | |
40 | return errorCode; | |
41 | } | |
42 | } | |
43 | ||
44 | ||
45 | ||
46 | ////////// | |
47 | ////////// | |
48 | ////////// | |
49 | ||
50 | ||
51 | ||
52 | // File indented with gg=G | |
53 | ||
54 | #include <iostream> | |
55 | #include <sstream> | |
56 | ||
57 | #include "Exception.h" | |
58 | #include "Error.h" | |
59 | ||
60 | namespace Package | |
61 | { | |
62 | // Constructor | |
63 | Exception::Exception( | |
64 | const std::string& _who, | |
65 | const std::string& _message, | |
66 | const TErrorCode& _errorCode) | |
67 | : who(_who) | |
68 | , message(_message) | |
69 | , errorCode(_errorCode) | |
70 | { | |
71 | // Do nothing | |
72 | } | |
73 | ||
74 | // Destructor | |
75 | Exception::~Exception() throw() | |
76 | { | |
77 | // Do nothing | |
78 | } | |
79 | ||
80 | // what | |
81 | const char* Exception::what() const throw() | |
82 | { | |
83 | std::ostringstream ossResult; | |
84 | ossResult << who << ": " << message; | |
85 | return ossResult.str().c_str(); | |
86 | } | |
87 | ||
88 | // GetErrorCode | |
89 | TError Exception::GetErrorCode() const throw() | |
90 | { | |
91 | return errorCode; | |
92 | } | |
93 | } |