From: Sergey POKHODENKO Date: Thu, 28 May 2015 07:53:52 +0000 (+0300) Subject: Replace char* myDescription to std::string myDescription in Events_Error X-Git-Tag: V_1.2.0~38 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1e2e22b2b252398b996013458bdeddd78b0cff42;p=modules%2Fshaper.git Replace char* myDescription to std::string myDescription in Events_Error --- diff --git a/src/Events/Events_Error.cpp b/src/Events/Events_Error.cpp index 2f606b7f9..4b7670e8e 100644 --- a/src/Events/Events_Error.cpp +++ b/src/Events/Events_Error.cpp @@ -10,7 +10,7 @@ #include #include -Events_Error::Events_Error(char* theDescription, const void* theSender) +Events_Error::Events_Error(const std::string& theDescription, const void* theSender) : Events_Message(Events_Error::errorID(), theSender) { myDescription = theDescription; @@ -26,19 +26,14 @@ Events_ID Events_Error::errorID() return aLoop->eventByName("ApplicationError"); } -char* Events_Error::description() const +const char* Events_Error::description() const { - return myDescription; + return myDescription.c_str(); } -void Events_Error::send(char* theDescription, const void* theSender) +void Events_Error::send(const std::string& theDescription, const void* theSender) { std::shared_ptr aNewOne = std::shared_ptr(new Events_Error(theDescription, theSender)); Events_Loop::loop()->send(aNewOne); } - -void Events_Error::send(std::string theDescription, const void* theSender) -{ - Events_Error::send((char*) theDescription.c_str(), theSender); -} diff --git a/src/Events/Events_Error.h b/src/Events/Events_Error.h index 561c987ce..e5e611ab2 100644 --- a/src/Events/Events_Error.h +++ b/src/Events/Events_Error.h @@ -24,7 +24,7 @@ */ class EVENTS_EXPORT Events_Error : public Events_Message { - char* myDescription; ///< pointer to the description of the error + std::string myDescription; ///< the description of the error public: /// default destructor @@ -33,15 +33,13 @@ public: /// Identifier of this event (one for all errors) static Events_ID errorID(); /// Specific error string - char* description() const; + const char* description() const; /// Allows to send an error quickly: it creates and sends the error object automatically - static void send(char* theDescription, const void* theSender = 0); - /// Allows to send an error quickly: it creates and sends the error object automatically - static void send(std::string theDescription, const void* theSender = 0); + static void send(const std::string& theDescription, const void* theSender = 0); protected: /// Default constructor. Use "send" message for generation an error. - Events_Error(char* theDescription, const void* theSender = 0); + Events_Error(const std::string& theDescription, const void* theSender = 0); }; #endif /* EVENTS_ERROR_H_ */