Merge pull request #959 from Exiv2/fix947_FreeBSD_BasicError_typeinfo
fix947_FreeBSD_BasicError_typeinfo
This commit is contained in:
commit
cc000ceb1c
@ -260,43 +260,43 @@ namespace Exiv2 {
|
||||
provided to print errors to a stream.
|
||||
*/
|
||||
template<typename charT>
|
||||
class BasicError : public AnyError {
|
||||
class EXIV2API BasicError : public AnyError {
|
||||
public:
|
||||
//! @name Creators
|
||||
//@{
|
||||
//! Constructor taking only an error code
|
||||
explicit BasicError(ErrorCode code);
|
||||
explicit inline BasicError(ErrorCode code);
|
||||
|
||||
//! Constructor taking an error code and one argument
|
||||
template<typename A>
|
||||
BasicError(ErrorCode code, const A& arg1);
|
||||
inline BasicError(ErrorCode code, const A& arg1);
|
||||
|
||||
//! Constructor taking an error code and two arguments
|
||||
template<typename A, typename B>
|
||||
BasicError(ErrorCode code, const A& arg1, const B& arg2);
|
||||
inline BasicError(ErrorCode code, const A& arg1, const B& arg2);
|
||||
|
||||
//! Constructor taking an error code and three arguments
|
||||
template<typename A, typename B, typename C>
|
||||
BasicError(ErrorCode code, const A& arg1, const B& arg2, const C& arg3);
|
||||
inline BasicError(ErrorCode code, const A& arg1, const B& arg2, const C& arg3);
|
||||
|
||||
//! Virtual destructor. (Needed because of throw())
|
||||
virtual ~BasicError() throw();
|
||||
virtual inline ~BasicError() throw();
|
||||
//@}
|
||||
|
||||
//! @name Accessors
|
||||
//@{
|
||||
virtual int code() const throw();
|
||||
virtual inline int code() const throw();
|
||||
/*!
|
||||
@brief Return the error message as a C-string. The pointer returned by what()
|
||||
is valid only as long as the BasicError object exists.
|
||||
*/
|
||||
virtual const char* what() const throw();
|
||||
virtual inline const char* what() const throw();
|
||||
#ifdef EXV_UNICODE_PATH
|
||||
/*!
|
||||
@brief Return the error message as a wchar_t-string. The pointer returned by
|
||||
wwhat() is valid only as long as the BasicError object exists.
|
||||
*/
|
||||
virtual const wchar_t* wwhat() const throw();
|
||||
virtual inline const wchar_t* wwhat() const throw();
|
||||
#endif
|
||||
//@}
|
||||
|
||||
@ -304,7 +304,7 @@ namespace Exiv2 {
|
||||
//! @name Manipulators
|
||||
//@{
|
||||
//! Assemble the error message from the arguments
|
||||
EXIV2API void setMsg();
|
||||
void setMsg();
|
||||
//@}
|
||||
|
||||
// DATA
|
||||
|
||||
@ -145,10 +145,9 @@ endif()
|
||||
|
||||
set_target_properties( exiv2lib_int PROPERTIES
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
COMPILE_DEFINITIONS exiv2lib_STATIC
|
||||
COMPILE_DEFINITIONS exiv2lib_EXPORTS
|
||||
)
|
||||
|
||||
|
||||
target_include_directories(exiv2lib_int PRIVATE ${ZLIB_INCLUDE_DIR})
|
||||
target_include_directories(exiv2lib PRIVATE ${ZLIB_INCLUDE_DIR})
|
||||
|
||||
|
||||
@ -225,7 +225,7 @@ namespace Exiv2 {
|
||||
}
|
||||
|
||||
template<>
|
||||
void BasicError<char>::setMsg()
|
||||
void EXIV2API BasicError<char>::setMsg()
|
||||
{
|
||||
std::string msg = _(errMsg(code_));
|
||||
std::string::size_type pos;
|
||||
@ -262,7 +262,7 @@ namespace Exiv2 {
|
||||
|
||||
#ifdef EXV_UNICODE_PATH
|
||||
template<>
|
||||
void BasicError<wchar_t>::setMsg()
|
||||
void EXIV2API BasicError<wchar_t>::setMsg()
|
||||
{
|
||||
std::string s = _(errMsg(code_));
|
||||
std::wstring wmsg(s.begin(), s.end());
|
||||
|
||||
@ -1,5 +1,22 @@
|
||||
find_package(GTest REQUIRED)
|
||||
|
||||
get_target_property(exiv2lib_SOURCES exiv2lib SOURCES)
|
||||
get_target_property(exiv2lib_int_SOURCES exiv2lib_int SOURCES)
|
||||
get_target_property(exiv2lib_COMPILE_DEFINITIONS exiv2lib COMPILE_DEFINITIONS)
|
||||
get_target_property(exiv2lib_INCLUDE_DIRECTORIES exiv2lib INCLUDE_DIRECTORIES)
|
||||
get_target_property(exiv2lib_LINK_LIBRARIES exiv2lib LINK_LIBRARIES)
|
||||
|
||||
set(unit_tests_exiv2lib_SOURCES)
|
||||
foreach(source IN LISTS exiv2lib_SOURCES exiv2lib_int_SOURCES)
|
||||
if(source MATCHES "\.(c|cpp|h|hpp)$")
|
||||
if(source MATCHES ".*/.*")
|
||||
list(APPEND unit_tests_exiv2lib_SOURCES "${source}")
|
||||
else()
|
||||
list(APPEND unit_tests_exiv2lib_SOURCES "../src/${source}")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
add_executable(unit_tests mainTestRunner.cpp
|
||||
gtestwrapper.h
|
||||
test_types.cpp
|
||||
@ -14,13 +31,24 @@ add_executable(unit_tests mainTestRunner.cpp
|
||||
test_helper_functions.cpp
|
||||
test_slice.cpp
|
||||
test_image_int.cpp
|
||||
$<TARGET_OBJECTS:exiv2lib_int>
|
||||
${unit_tests_exiv2lib_SOURCES}
|
||||
)
|
||||
|
||||
target_compile_definitions(unit_tests PRIVATE exiv2lib_STATIC)
|
||||
|
||||
if (exiv2lib_COMPILE_DEFINITIONS)
|
||||
target_compile_definitions(unit_tests PRIVATE ${exiv2lib_COMPILE_DEFINITIONS})
|
||||
endif ()
|
||||
|
||||
target_include_directories(unit_tests
|
||||
PRIVATE
|
||||
${exiv2lib_INCLUDE_DIRECTORIES}
|
||||
)
|
||||
|
||||
#TODO Use GTest::GTest once we upgrade the minimum CMake version required
|
||||
target_link_libraries(unit_tests
|
||||
PRIVATE
|
||||
exiv2lib
|
||||
${exiv2lib_LINK_LIBRARIES}
|
||||
${GTEST_BOTH_LIBRARIES}
|
||||
)
|
||||
|
||||
@ -50,4 +78,4 @@ endif()
|
||||
|
||||
if (MSVC)
|
||||
set_target_properties(unit_tests PROPERTIES LINK_FLAGS "/ignore:4099")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user