summaryrefslogtreecommitdiff
path: root/lib/common
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2015-09-02 21:05:35 +0100
committerChris Wilson <chris+github@qwirx.com>2015-09-02 21:05:35 +0100
commit9dec71921ebc777cc9e29e6e0aee60593cb2600e (patch)
treeb73eca0e0efa3d07b7d8330bd8976572698936e3 /lib/common
parent152dc613483672b8535c9095e24bf0d18104ec45 (diff)
Really fix makeexception.pl.in this time
Diffstat (limited to 'lib/common')
-rwxr-xr-xlib/common/makeexception.pl.in58
1 files changed, 3 insertions, 55 deletions
diff --git a/lib/common/makeexception.pl.in b/lib/common/makeexception.pl.in
index 498c81b8..bddaa94a 100755
--- a/lib/common/makeexception.pl.in
+++ b/lib/common/makeexception.pl.in
@@ -73,12 +73,13 @@ class ${class}Exception : public BoxException
public:
${class}Exception(unsigned int SubType,
const std::string& rMessage = "")
- : mSubType(SubType), mMessage(rMessage)
+ : mSubType(SubType), mMessage(rMessage),
+ mWhat(GetMessage(SubType) + std::string(rMessage.empty() ? "" : ": ") + rMessage)
{
}
${class}Exception(const ${class}Exception &rToCopy)
- : mSubType(rToCopy.mSubType), mMessage(rToCopy.mMessage)
+ : mSubType(rToCopy.mSubType), mMessage(rToCopy.mMessage), mWhat(rToCopy.mWhat)
{
}
@@ -134,51 +135,6 @@ print CPP <<__E;
#include "MemLeakFindOn.h"
-#ifdef EXCEPTION_CODENAMES_EXTENDED
- #ifdef EXCEPTION_CODENAMES_EXTENDED_WITH_DESCRIPTION
-static const char *whats[] = {
-__E
-
-my $last_seen = -1;
-for(my $e = 0; $e <= $#exception; $e++)
-{
- if($exception[$e] ne '')
- {
- for(my $s = $last_seen + 1; $s < $e; $s++)
- {
- print CPP "\t\"UNUSED\",\n"
- }
- my $ext = ($exception_desc[$e] ne '')?" ($exception_desc[$e])":'';
- print CPP "\t\"${class} ".$exception[$e].$ext.'"'.(($e==$#exception)?'':',')."\n";
- $last_seen = $e;
- }
-}
-
-print CPP <<__E;
-};
- #else
-static const char *whats[] = {
-__E
-
-$last_seen = -1;
-for(my $e = 0; $e <= $#exception; $e++)
-{
- if($exception[$e] ne '')
- {
- for(my $s = $last_seen + 1; $s < $e; $s++)
- {
- print CPP "\t\"UNUSED\",\n"
- }
- print CPP "\t\"${class} ".$exception[$e].'"'.(($e==$#exception)?'':',')."\n";
- $last_seen = $e;
- }
-}
-
-print CPP <<__E;
-};
- #endif
-#endif
-
unsigned int ${class}Exception::GetType() const throw()
{
return ${class}Exception::ExceptionType;
@@ -191,14 +147,6 @@ unsigned int ${class}Exception::GetSubType() const throw()
const char * ${class}Exception::what() const throw()
{
- // We need to use a string that will persist after this function exits.
- mWhat = GetMessage(mSubType);
-
- if(mMessage != "")
- {
- mWhat += ": " + mMessage;
- }
-
return mWhat.c_str();
}