Refactor MyMoneyException class
MyMoneyException changes in following way:
- Untranslated exceptions, as normal user doesn't need to understand
exceptions, only developers do,
- Tidied up catching phrase, so it's always catched by const reference,
- no d-pointer (there should be no cascade header inclusion) and
reduced implementation to only what() method,
- we use code from standard library, which implements what() method, so
we have less to compile,
- MyMoneyException constructor is inlined, but it should be short,
because of the use of POD types only,
- two defines to throw an exception (explanation below).
mymoneyexception.h contains header for std::runtime_error and two
defines for customizing exception messages.
First define, MYMONEYEXCEPTION constructs the message roughly in the
- construct QString from LINE, which is int,
- construct QString from FILE, which is const char *,
- take exception message, only QStrings allowed,
- construct QString from the three strings above,
- construct const char * from QString, for which std::runtime_error has
As one can see, there is lot of effort to throw an exception, so there
MYMONEYEXCEPTION_CSTRING has been introduced, to avoid all above
mentioned memory allocations.
Differential Revision: https://phabricator.kde.org/D12808