Move implementation to .cpp files. Fix more issues related to visibility settings

v0.27.3
Luis Díaz Más 7 years ago
parent e3f975137c
commit b9f913d5af

@ -94,15 +94,16 @@ namespace Exiv2 {
//! @name Creators
//@{
//! Constructor, takes the log message type as an argument
explicit LogMsg(Level msgType) : msgType_(msgType) {}
explicit LogMsg(Level msgType);
//! Destructor, passes the log message to the message handler depending on the log level
~LogMsg() { if (msgType_ >= level_ && handler_) handler_(msgType_, os_.str().c_str()); }
~LogMsg();
//@}
//! @name Manipulators
//@{
//! Return a reference to the ostringstream which holds the log message
std::ostringstream& os() { return os_; }
std::ostringstream& os();
//@}
/*!
@ -111,17 +112,17 @@ namespace Exiv2 {
log level is \c warn. To suppress all log messages, set the log
level to \c mute (or set the log message handler to 0).
*/
static void setLevel(Level level) { level_ = level; }
static void setLevel(Level level);
/*!
@brief Set the log message handler. The default handler writes log
messages to standard error. To suppress all log messages, set
the log message handler to 0 (or set the log level to \c mute).
*/
static void setHandler(Handler handler) { handler_ = handler; }
static void setHandler(Handler handler);
//! Return the current log level
static Level level() { return level_; }
static Level level();
//! Return the current log message handler
static Handler handler() { return handler_; }
static Handler handler();
//! The default log handler. Sends the log message to standard error.
static void defaultHandler(int level, const char* s);
@ -170,7 +171,7 @@ namespace Exiv2 {
easier for library users (they have the option of catching most
things via std::exception).
*/
class EXIV2API AnyError : public std::exception {
class AnyError : public std::exception {
public:
//! @name Creators
//@{
@ -334,10 +335,9 @@ namespace Exiv2 {
// free functions, template and inline definitions
//! Return the error message for the error with code \em code.
EXIV2API const char* errMsg(int code);
const char* errMsg(int code);
template<typename charT>
//! BasicError constructor
BasicError<charT>::BasicError(ErrorCode code)
: code_(code), count_(0)
{
@ -345,7 +345,6 @@ namespace Exiv2 {
}
template<typename charT> template<typename A>
//! BasicError constructor
BasicError<charT>::BasicError(ErrorCode code, const A& arg1)
: code_(code), count_(1), arg1_(toBasicString<charT>(arg1))
{
@ -353,7 +352,6 @@ namespace Exiv2 {
}
template<typename charT> template<typename A, typename B>
//! BasicError constructor
BasicError<charT>::BasicError(ErrorCode code, const A& arg1, const B& arg2)
: code_(code), count_(2),
arg1_(toBasicString<charT>(arg1)),
@ -363,7 +361,6 @@ namespace Exiv2 {
}
template<typename charT> template<typename A, typename B, typename C>
//! BasicError constructor
BasicError<charT>::BasicError(ErrorCode code, const A& arg1, const B& arg2, const C& arg3)
: code_(code), count_(3),
arg1_(toBasicString<charT>(arg1)),

@ -209,9 +209,9 @@ namespace Exiv2 {
//! @name Creators
//@{
//! Default constructor
DataBuf() : pData_(0), size_(0) {}
DataBuf();
//! Constructor with an initial buffer size
explicit DataBuf(long size) : pData_(new byte[size]()), size_(size) {}
explicit DataBuf(long size);
//! Constructor, copies an existing buffer
DataBuf(const byte* pData, long size);
/*!
@ -221,7 +221,7 @@ namespace Exiv2 {
*/
DataBuf(DataBuf& rhs);
//! Destructor, deletes the allocated buffer
~DataBuf() { delete[] pData_; }
~DataBuf();
//@}
//! @name Manipulators
@ -262,9 +262,9 @@ namespace Exiv2 {
See http://www.josuttis.com/libbook/auto_ptr.html for a discussion.
*/
//@{
DataBuf(DataBufRef rhs) : pData_(rhs.p.first), size_(rhs.p.second) {}
DataBuf& operator=(DataBufRef rhs) { reset(rhs.p); return *this; }
operator DataBufRef() { return DataBufRef(release()); }
DataBuf(DataBufRef rhs);
DataBuf& operator=(DataBufRef rhs);
operator DataBufRef();
//@}
// DATA

@ -266,17 +266,13 @@ namespace Exiv2 {
//! Shortcut for a %DataValue auto pointer.
typedef std::auto_ptr<DataValue> AutoPtr;
//! @name Creators
//@{
//! Default constructor.
explicit DataValue(TypeId typeId =undefined);
//! Constructor
DataValue(const byte* buf,
long len, ByteOrder byteOrder =invalidByteOrder,
TypeId typeId =undefined);
//! Virtual destructor.
virtual ~DataValue();
//@}
//! @name Manipulators
//@{

@ -30,10 +30,6 @@
// *****************************************************************************
// included header files
#include "tiffimage_int.hpp"
#include "types.hpp"
// + standard includes
#include <string>
// *****************************************************************************
// namespace extensions
@ -43,9 +39,7 @@ namespace Exiv2 {
// *****************************************************************************
// class definitions
/*!
@brief Canon CR2 header structure.
*/
/// @brief Canon CR2 header structure.
class Cr2Header : public TiffHeaderBase {
public:
//! @name Creators

@ -29,10 +29,8 @@
// *****************************************************************************
// included header files
#include "types.hpp"
#include "tags_int.hpp"
#include "image.hpp"
#include "basicio.hpp"
// + standard includes
#include <iosfwd>

@ -179,6 +179,25 @@ namespace Exiv2 {
LogMsg::Level LogMsg::level_ = LogMsg::warn; // Default output level
LogMsg::Handler LogMsg::handler_ = LogMsg::defaultHandler;
LogMsg::LogMsg(LogMsg::Level msgType) : msgType_(msgType)
{}
LogMsg::~LogMsg()
{
if (msgType_ >= level_ && handler_)
handler_(msgType_, os_.str().c_str());
}
std::ostringstream &LogMsg::os() { return os_; }
void LogMsg::setLevel(LogMsg::Level level) { level_ = level; }
void LogMsg::setHandler(LogMsg::Handler handler) { handler_ = handler; }
LogMsg::Level LogMsg::level() { return level_; }
LogMsg::Handler LogMsg::handler() { return handler_; }
void LogMsg::defaultHandler(int level, const char* s)
{
switch (static_cast<LogMsg::Level>(level)) {

@ -41,10 +41,6 @@
#include <sys/stat.h>
#include <string.h>
#ifdef _MSC_VER
#pragma message("Using exiv2 http support")
#endif
#define SLEEP 1000
#define SNOOZE 0

@ -130,6 +130,15 @@ namespace Exiv2 {
UNUSED(ret);
}
DataBuf::~DataBuf()
{ delete[] pData_; }
DataBuf::DataBuf() : pData_(0), size_(0)
{}
DataBuf::DataBuf(long size) : pData_(new byte[size]()), size_(size)
{}
DataBuf::DataBuf(const byte* pData, long size)
: pData_(0), size_(0)
{
@ -182,6 +191,12 @@ namespace Exiv2 {
size_ = p.second;
}
DataBuf::DataBuf(DataBufRef rhs) : pData_(rhs.p.first), size_(rhs.p.second) {}
DataBuf &DataBuf::operator=(DataBufRef rhs) { reset(rhs.p); return *this; }
Exiv2::DataBuf::operator DataBufRef() { return DataBufRef(release()); }
// *************************************************************************
// free functions

@ -10,6 +10,7 @@ add_executable(unit_tests mainTestRunner.cpp
test_TimeValue.cpp
test_cr2header_int.cpp
test_helper_functions.cpp
$<TARGET_OBJECTS:exiv2lib_int>
)
#TODO Use GTest::GTest once we upgrade the minimum CMake version required
@ -19,6 +20,11 @@ target_link_libraries(unit_tests
${GTEST_BOTH_LIBRARIES}
)
# ZLIB is used in exiv2lib_int.
if( EXIV2_ENABLE_PNG )
target_link_libraries(unit_tests PRIVATE ${ZLIB_LIBRARIES} )
endif()
target_include_directories(unit_tests
PRIVATE
${GTEST_INCLUDE_DIRS}

Loading…
Cancel
Save