From 18690f4c54b5abfe115805e30362b03f957ae2c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Fri, 14 Sep 2018 10:35:39 +0200 Subject: [PATCH] Provide default and copy constructor for AnyError --- include/exiv2/error.hpp | 19 +++++++------------ samples/conntest.cpp | 2 +- src/error.cpp | 10 ++++++++++ 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/include/exiv2/error.hpp b/include/exiv2/error.hpp index a40a037a..0be812af 100644 --- a/include/exiv2/error.hpp +++ b/include/exiv2/error.hpp @@ -171,20 +171,15 @@ namespace Exiv2 { easier for library users (they have the option of catching most things via std::exception). */ - class AnyError : public std::exception { + class EXIV2API AnyError : public std::exception { public: - //! @name Creators - //@{ - //! Virtual destructor. - virtual ~AnyError() throw(); - //@} + AnyError(); + AnyError(const AnyError& o); - //! @name Accessors - //@{ - //! Return the error code. + virtual ~AnyError() throw(); + ///@brief Return the error code. virtual int code() const throw() =0; - //@} - }; // AnyError + }; //! %AnyError output operator inline std::ostream& operator<<(std::ostream& os, const AnyError& error) @@ -309,7 +304,7 @@ namespace Exiv2 { //! @name Manipulators //@{ //! Assemble the error message from the arguments - void setMsg(); + EXIV2API void setMsg(); //@} // DATA diff --git a/samples/conntest.cpp b/samples/conntest.cpp index 6ea3eef2..22fce2c3 100644 --- a/samples/conntest.cpp +++ b/samples/conntest.cpp @@ -144,7 +144,7 @@ int main(int argc,const char** argv) httpcon(url, useHttp1_0); isOk = true; } - } catch (Exiv2::AnyError& e) { + } catch (const Exiv2::AnyError& e) { std::cout << "Error: '" << e << "'" << std::endl; return -1; } diff --git a/src/error.cpp b/src/error.cpp index e160a3dc..6d3a24bd 100644 --- a/src/error.cpp +++ b/src/error.cpp @@ -210,6 +210,16 @@ namespace Exiv2 { std::cerr << s; } + AnyError::AnyError(): std::exception() + { + + } + + AnyError::AnyError(const AnyError &o): std::exception(o) + { + + } + AnyError::~AnyError() throw() { }