diff --git a/src/audio-sdlmixer.h b/src/audio-sdlmixer.h index ee33ef2c..5ff4530b 100644 --- a/src/audio-sdlmixer.h +++ b/src/audio-sdlmixer.h @@ -40,7 +40,7 @@ class ExceptionSDLmixer : public ExceptionAudio { explicit ExceptionSDLmixer(const std::string &description); virtual ~ExceptionSDLmixer() {} - virtual std::string get_platform() const { return "SDL_mixer"; } + virtual const std::string get_platform() const { return "SDL_mixer"; } }; class AudioSDL : public Audio, public Audio::VolumeController { diff --git a/src/audio.cc b/src/audio.cc index b746b741..2a03d0bb 100644 --- a/src/audio.cc +++ b/src/audio.cc @@ -33,7 +33,7 @@ ExceptionAudio::ExceptionAudio(const std::string &description) : ExceptionAudio::~ExceptionAudio() { } -std::string +const std::string ExceptionAudio::get_description() const { return "[" + get_system() + ":" + get_platform() + "] " + description.c_str(); } diff --git a/src/audio.h b/src/audio.h index 1f059326..850e94ba 100644 --- a/src/audio.h +++ b/src/audio.h @@ -34,9 +34,9 @@ class ExceptionAudio : public ExceptionFreeserf { explicit ExceptionAudio(const std::string &description); virtual ~ExceptionAudio(); - virtual std::string get_description() const; - virtual std::string get_platform() const { return "Abstract"; } - virtual std::string get_system() const { return "audio"; } + virtual const std::string get_description() const; + virtual const std::string get_platform() const { return "Abstract"; } + virtual const std::string get_system() const { return "audio"; } }; class Audio { diff --git a/src/debug.cc b/src/debug.cc index cf74f287..577642f8 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -21,8 +21,8 @@ #include "src/debug.h" -ExceptionFreeserf::ExceptionFreeserf(const std::string &description_) throw() - : description(description_) { +ExceptionFreeserf::ExceptionFreeserf(const std::string &description_) throw() { + description = "[" + get_system() + "] " + description_; } ExceptionFreeserf::~ExceptionFreeserf() { @@ -30,10 +30,10 @@ ExceptionFreeserf::~ExceptionFreeserf() { const char* ExceptionFreeserf::what() const throw() { - return get_description().c_str(); + return description.c_str(); } -std::string +const std::string ExceptionFreeserf::get_description() const { - return "[" + get_system() + "] " + description; + return description; } diff --git a/src/debug.h b/src/debug.h index 23c63b43..00d16bfd 100644 --- a/src/debug.h +++ b/src/debug.h @@ -35,8 +35,8 @@ class ExceptionFreeserf : public std::exception { virtual ~ExceptionFreeserf(); virtual const char* what() const throw(); - virtual std::string get_description() const; - virtual std::string get_system() const { return "Unspecified"; } + virtual const std::string get_description() const; + virtual const std::string get_system() const { return "Unspecified"; } }; #ifndef NDEBUG diff --git a/src/gfx.h b/src/gfx.h index 267267ff..188dd1bd 100644 --- a/src/gfx.h +++ b/src/gfx.h @@ -35,7 +35,7 @@ class ExceptionGFX : public ExceptionFreeserf { explicit ExceptionGFX(const std::string &description); virtual ~ExceptionGFX(); - virtual std::string get_system() const { return "graphics"; } + virtual const std::string get_system() const { return "graphics"; } }; class Color { diff --git a/src/video-sdl.h b/src/video-sdl.h index 98cb71e2..f3b85673 100644 --- a/src/video-sdl.h +++ b/src/video-sdl.h @@ -53,7 +53,7 @@ class ExceptionSDL : public ExceptionVideo { explicit ExceptionSDL(const std::string &description) throw(); virtual ~ExceptionSDL() {} - virtual std::string get_platform() const { return "SDL"; } + virtual const std::string get_platform() const { return "SDL"; } }; class VideoSDL : public Video { diff --git a/src/video.cc b/src/video.cc index f654af6d..cf270adc 100644 --- a/src/video.cc +++ b/src/video.cc @@ -30,7 +30,7 @@ ExceptionVideo::ExceptionVideo(const std::string &description) : ExceptionVideo::~ExceptionVideo() { } -std::string +const std::string ExceptionVideo::get_description() const { return "[" + get_system() + ":" + get_platform() + "] " + description.c_str(); } diff --git a/src/video.h b/src/video.h index ba2396f8..98b3e378 100644 --- a/src/video.h +++ b/src/video.h @@ -32,9 +32,9 @@ class ExceptionVideo : public ExceptionFreeserf { explicit ExceptionVideo(const std::string &description); virtual ~ExceptionVideo(); - virtual std::string get_description() const; - virtual std::string get_platform() const { return "Abstract"; } - virtual std::string get_system() const { return "video"; } + virtual const std::string get_description() const; + virtual const std::string get_platform() const { return "Abstract"; } + virtual const std::string get_system() const { return "video"; } }; class Video {