Prevent MSVC 'needs to have a dll interface' warnings (#117)
diff --git a/.gitignore b/.gitignore
index dfc659d..e05c5f7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,7 +6,6 @@
*.swp
ar-lib
-config**
!configuration-samples.md
depcomp
install-sh
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bee6dcc..4791abe 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -73,10 +73,12 @@
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/src/main/include/log4cxx
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING PATTERN "*.h"
+ PATTERN "Private" EXCLUDE
)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/main/include/log4cxx
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING PATTERN "*.h"
+ PATTERN "Private" EXCLUDE
)
install(TARGETS log4cxx EXPORT log4cxxTargets
diff --git a/src/main/cpp/fileappender.cpp b/src/main/cpp/fileappender.cpp
index 59073e4..991fe32 100644
--- a/src/main/cpp/fileappender.cpp
+++ b/src/main/cpp/fileappender.cpp
@@ -40,52 +40,42 @@
FileAppender::FileAppender() :
WriterAppender (std::make_unique<FileAppenderPriv>())
{
- _priv->fileAppend = true;
- _priv->bufferedIO = false;
- _priv->bufferSize = 8 * 1024;
}
-FileAppender::FileAppender(const LayoutPtr& layout1, const LogString& fileName1,
- bool append1, bool bufferedIO1, int bufferSize1)
- : WriterAppender(std::make_unique<FileAppenderPriv>(layout1))
+FileAppender::FileAppender
+ ( const LayoutPtr& layout1
+ , const LogString& fileName1
+ , bool append1
+ , bool bufferedIO1
+ , int bufferSize1
+ )
+ : WriterAppender(std::make_unique<FileAppenderPriv>(layout1, fileName1, append1, bufferedIO1, bufferSize1))
{
- _priv->fileAppend = append1;
- _priv->fileName = fileName1;
- _priv->bufferedIO = bufferedIO1;
- _priv->bufferSize = bufferSize1;
Pool p;
activateOptions(p);
}
-FileAppender::FileAppender(const LayoutPtr& layout1, const LogString& fileName1,
- bool append1)
- : WriterAppender(std::make_unique<FileAppenderPriv>(layout1))
+FileAppender::FileAppender
+ ( const LayoutPtr& layout1
+ , const LogString& fileName1
+ , bool append1
+ )
+ : WriterAppender(std::make_unique<FileAppenderPriv>(layout1, fileName1, append1, false))
{
- _priv->fileAppend = append1;
- _priv->fileName = fileName1;
- _priv->bufferedIO = false;
- _priv->bufferSize = 8 * 1024;
Pool p;
activateOptions(p);
}
FileAppender::FileAppender(const LayoutPtr& layout1, const LogString& fileName1)
- : WriterAppender(std::make_unique<FileAppenderPriv>(layout1))
+ : WriterAppender(std::make_unique<FileAppenderPriv>(layout1, fileName1))
{
- _priv->fileAppend = true;
- _priv->fileName = fileName1;
- _priv->bufferedIO = false;
- _priv->bufferSize = 8 * 1024;
Pool p;
activateOptions(p);
}
-FileAppender::FileAppender(std::unique_ptr<FileAppenderPriv> priv) :
- WriterAppender (std::move(priv))
+FileAppender::FileAppender(std::unique_ptr<FileAppenderPriv> priv)
+ : WriterAppender (std::move(priv))
{
- _priv->fileAppend = true;
- _priv->bufferedIO = false;
- _priv->bufferSize = 8 * 1024;
}
FileAppender::~FileAppender()
diff --git a/src/main/cpp/objectoutputstream.cpp b/src/main/cpp/objectoutputstream.cpp
index 6beb1a2..ab9a85b 100644
--- a/src/main/cpp/objectoutputstream.cpp
+++ b/src/main/cpp/objectoutputstream.cpp
@@ -29,46 +29,60 @@
IMPLEMENT_LOG4CXX_OBJECT(ObjectOutputStream)
+typedef std::map<std::string, unsigned int> ClassDescriptionMap;
+
+struct ObjectOutputStream::ObjectOutputStreamPriv
+{
+
+ OutputStreamPtr os;
+ log4cxx::helpers::CharsetEncoderPtr utf8Encoder;
+ const unsigned int objectHandleDefault;
+ unsigned int objectHandle;
+ ClassDescriptionMap classDescriptions;
+
+ ObjectOutputStreamPriv(OutputStreamPtr outputStream, Pool& p)
+ : os(outputStream)
+ , utf8Encoder(CharsetEncoder::getUTF8Encoder())
+ , objectHandleDefault(0x7E0000)
+ , objectHandle(objectHandleDefault)
+ {}
+};
+
ObjectOutputStream::ObjectOutputStream(OutputStreamPtr outputStream, Pool& p)
- : os(outputStream),
- utf8Encoder(CharsetEncoder::getUTF8Encoder()),
- objectHandleDefault(0x7E0000),
- objectHandle(objectHandleDefault),
- classDescriptions(new ClassDescriptionMap())
+ : m_priv(std::make_unique<ObjectOutputStreamPriv>(outputStream, p))
{
unsigned char start[] = { 0xAC, 0xED, 0x00, 0x05 };
ByteBuffer buf((char*) start, sizeof(start));
- os->write(buf, p);
+ m_priv->os->write(buf, p);
}
ObjectOutputStream::~ObjectOutputStream()
{
- delete classDescriptions;
}
void ObjectOutputStream::close(Pool& p)
{
- os->close(p);
+ m_priv->os->close(p);
}
void ObjectOutputStream::flush(Pool& p)
{
- os->flush(p);
+ m_priv->os->flush(p);
}
void ObjectOutputStream::reset(Pool& p)
{
- os->flush(p);
+ m_priv->os->flush(p);
writeByte(TC_RESET, p);
- os->flush(p);
+ m_priv->os->flush(p);
- objectHandle = objectHandleDefault;
- classDescriptions->clear();
+ m_priv->objectHandle = m_priv->objectHandleDefault;
+ m_priv->classDescriptions.clear();
}
void ObjectOutputStream::writeObject(const LogString& val, Pool& p)
{
- objectHandle++;
+ m_priv->objectHandle++;
writeByte(TC_STRING, p);
char bytes[2];
#if LOG4CXX_LOGCHAR_IS_UTF8
@@ -79,7 +93,7 @@
char* data = p.pstralloc(maxSize);
ByteBuffer dataBuf(data, maxSize);
LogString::const_iterator iter(val.begin());
- utf8Encoder->encode(val, iter, dataBuf);
+ m_priv->utf8Encoder->encode(val, iter, dataBuf);
dataBuf.flip();
size_t len = dataBuf.limit();
#endif
@@ -87,8 +101,8 @@
bytes[0] = (char) ((len >> 8) & 0xFF);
ByteBuffer lenBuf(bytes, sizeof(bytes));
- os->write(lenBuf, p);
- os->write(dataBuf, p);
+ m_priv->os->write(lenBuf, p);
+ m_priv->os->write(dataBuf, p);
}
void ObjectOutputStream::writeObject(const MDC::Map& val, Pool& p)
@@ -114,7 +128,7 @@
TC_BLOCKDATA, 0x08, 0x00, 0x00, 0x00, 0x07
};
ByteBuffer dataBuf(data, sizeof(data));
- os->write(dataBuf, p);
+ m_priv->os->write(dataBuf, p);
char size[4];
size_t sz = val.size();
@@ -125,7 +139,7 @@
size[0] = (char) ((sz >> 24) & 0xFF);
ByteBuffer sizeBuf(size, sizeof(size));
- os->write(sizeBuf, p);
+ m_priv->os->write(sizeBuf, p);
for (MDC::Map::const_iterator iter = val.begin();
iter != val.end();
@@ -143,21 +157,21 @@
char bytes[3];
size_t len = val.size();
ByteBuffer dataBuf(const_cast<char*>(val.data()), val.size());
- objectHandle++;
+ m_priv->objectHandle++;
bytes[0] = 0x74;
bytes[1] = (char) ((len >> 8) & 0xFF);
bytes[2] = (char) (len & 0xFF);
ByteBuffer lenBuf(bytes, sizeof(bytes));
- os->write(lenBuf, p);
- os->write(dataBuf, p);
+ m_priv->os->write(lenBuf, p);
+ m_priv->os->write(dataBuf, p);
}
void ObjectOutputStream::writeByte(char val, Pool& p)
{
ByteBuffer buf(&val, 1);
- os->write(buf, p);
+ m_priv->os->write(buf, p);
}
void ObjectOutputStream::writeInt(int val, Pool& p)
@@ -170,7 +184,7 @@
bytes[0] = (char) ((val >> 24) & 0xFF);
ByteBuffer buf(bytes, sizeof(bytes));
- os->write(buf, p);
+ m_priv->os->write(buf, p);
}
void ObjectOutputStream::writeLong(log4cxx_time_t val, Pool& p)
@@ -187,13 +201,13 @@
bytes[0] = (char) ((val >> 56) & 0xFF);
ByteBuffer buf(bytes, sizeof(bytes));
- os->write(buf, p);
+ m_priv->os->write(buf, p);
}
void ObjectOutputStream::writeBytes(const char* bytes, size_t len, Pool& p)
{
ByteBuffer buf(const_cast<char*>(bytes), len);
- os->write(buf, p);
+ m_priv->os->write(buf, p);
}
void ObjectOutputStream::writeNull(Pool& p)
@@ -207,9 +221,9 @@
size_t len,
Pool& p)
{
- ClassDescriptionMap::const_iterator match = classDescriptions->find(className);
+ ClassDescriptionMap::const_iterator match = m_priv->classDescriptions.find(className);
- if (match != classDescriptions->end())
+ if (match != m_priv->classDescriptions.end())
{
char bytes[6];
@@ -221,18 +235,18 @@
bytes[5] = (char) (match->second & 0xFF);
ByteBuffer buf(bytes, sizeof(bytes));
- os->write(buf, p);
+ m_priv->os->write(buf, p);
- objectHandle++;
+ m_priv->objectHandle++;
}
else
{
- classDescriptions->insert(ClassDescriptionMap::value_type(className, objectHandle));
+ m_priv->classDescriptions.insert(ClassDescriptionMap::value_type(className, m_priv->objectHandle));
writeByte(TC_OBJECT, p);
ByteBuffer buf(classDesc, len);
- os->write(buf, p);
+ m_priv->os->write(buf, p);
- objectHandle += (classDescIncrement + 1);
+ m_priv->objectHandle += (classDescIncrement + 1);
}
}
diff --git a/src/main/cpp/socketappenderskeleton.cpp b/src/main/cpp/socketappenderskeleton.cpp
index 03d87cc..544d033 100644
--- a/src/main/cpp/socketappenderskeleton.cpp
+++ b/src/main/cpp/socketappenderskeleton.cpp
@@ -37,6 +37,21 @@
#define _priv static_cast<SocketAppenderSkeletonPriv*>(m_priv.get())
+SocketAppenderSkeleton::SocketAppenderSkeleton(int defaultPort, int reconnectionDelay)
+ : AppenderSkeleton(std::make_unique<SocketAppenderSkeletonPriv>(defaultPort, reconnectionDelay))
+{
+}
+
+SocketAppenderSkeleton::SocketAppenderSkeleton(helpers::InetAddressPtr address, int port, int reconnectionDelay)
+ : AppenderSkeleton(std::make_unique<SocketAppenderSkeletonPriv>(address, port, reconnectionDelay))
+{
+}
+
+SocketAppenderSkeleton::SocketAppenderSkeleton(const LogString& host, int port, int reconnectionDelay)
+ : AppenderSkeleton(std::make_unique<SocketAppenderSkeletonPriv>(host, port, reconnectionDelay))
+{
+}
+
SocketAppenderSkeleton::SocketAppenderSkeleton(std::unique_ptr<SocketAppenderSkeletonPriv> priv)
: AppenderSkeleton (std::move(priv))
{
diff --git a/src/main/cpp/sockethubappender.cpp b/src/main/cpp/sockethubappender.cpp
index ca84f16..62e5ea7 100644
--- a/src/main/cpp/sockethubappender.cpp
+++ b/src/main/cpp/sockethubappender.cpp
@@ -34,16 +34,19 @@
#include <log4cxx/private/appenderskeleton_priv.h>
#include <mutex>
-using namespace log4cxx;
-using namespace log4cxx::helpers;
-using namespace log4cxx::net;
-using namespace log4cxx::spi;
+namespace log4cxx
+{
+using namespace helpers;
+using namespace spi;
+
+namespace net
+{
IMPLEMENT_LOG4CXX_OBJECT(SocketHubAppender)
int SocketHubAppender::DEFAULT_PORT = 4560;
-struct SocketHubAppender::SocketHubAppenderPriv : public AppenderSkeletonPrivate
+struct SocketHubAppender::SocketHubAppenderPriv : public AppenderSkeleton::AppenderSkeletonPrivate
{
SocketHubAppenderPriv(int port) :
AppenderSkeletonPrivate(),
@@ -286,3 +289,8 @@
{
return _priv->locationInfo;
}
+
+
+} // namespace net
+
+} //namespace log4cxx
diff --git a/src/main/include/log4cxx/appenderskeleton.h b/src/main/include/log4cxx/appenderskeleton.h
index 709cdea..c52110e 100644
--- a/src/main/include/log4cxx/appenderskeleton.h
+++ b/src/main/include/log4cxx/appenderskeleton.h
@@ -18,12 +18,6 @@
#ifndef _LOG4CXX_APPENDER_SKELETON_H
#define _LOG4CXX_APPENDER_SKELETON_H
-#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
-#endif
-
-
#include <log4cxx/appender.h>
#include <log4cxx/layout.h>
#include <log4cxx/spi/errorhandler.h>
@@ -46,8 +40,8 @@
public virtual helpers::Object
{
protected:
- struct AppenderSkeletonPrivate;
- AppenderSkeleton( std::unique_ptr<AppenderSkeletonPrivate> priv );
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(AppenderSkeletonPrivate, m_priv)
+ AppenderSkeleton(LOG4CXX_PRIVATE_PTR(AppenderSkeletonPrivate) priv);
/**
Subclasses of <code>AppenderSkeleton</code> should implement this
@@ -173,15 +167,7 @@
*/
void setThreshold(const LevelPtr& threshold);
- protected:
- std::unique_ptr<AppenderSkeletonPrivate> m_priv;
-
}; // class AppenderSkeleton
} // namespace log4cxx
-#if defined(_MSC_VER)
- #pragma warning ( pop )
-#endif
-
-
#endif //_LOG4CXX_APPENDER_SKELETON_H
diff --git a/src/main/include/log4cxx/config/propertysetter.h b/src/main/include/log4cxx/config/propertysetter.h
index 3c70fb2..58b6f27 100644
--- a/src/main/include/log4cxx/config/propertysetter.h
+++ b/src/main/include/log4cxx/config/propertysetter.h
@@ -26,7 +26,9 @@
namespace helpers
{
class Object;
-typedef std::shared_ptr<Object> ObjectPtr;
+// Instantiate template pointer type passed as parameter
+LOG4CXX_INSTANTIATE_EXPORTED_PTR(Object);
+LOG4CXX_PTR_DEF(Object);
class Properties;
class Pool;
diff --git a/src/main/include/log4cxx/fileappender.h b/src/main/include/log4cxx/fileappender.h
index 19a4ea9..51a5852 100644
--- a/src/main/include/log4cxx/fileappender.h
+++ b/src/main/include/log4cxx/fileappender.h
@@ -24,11 +24,6 @@
#include <log4cxx/file.h>
#include <log4cxx/helpers/pool.h>
-#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4251 )
-#endif
-
namespace log4cxx
{
namespace helpers
@@ -216,8 +211,4 @@
} // namespace log4cxx
-#if defined(_MSC_VER)
- #pragma warning (pop)
-#endif
-
#endif
diff --git a/src/main/include/log4cxx/helpers/appenderattachableimpl.h b/src/main/include/log4cxx/helpers/appenderattachableimpl.h
index f8aa46b..b2e39b0 100644
--- a/src/main/include/log4cxx/helpers/appenderattachableimpl.h
+++ b/src/main/include/log4cxx/helpers/appenderattachableimpl.h
@@ -18,11 +18,6 @@
#ifndef _LOG4CXX_HELPERS_APPENDER_ATTACHABLE_IMPL_H
#define _LOG4CXX_HELPERS_APPENDER_ATTACHABLE_IMPL_H
-#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
-#endif
-
#include <log4cxx/spi/appenderattachable.h>
#include <log4cxx/helpers/object.h>
@@ -110,8 +105,7 @@
std::mutex& getMutex();
private:
- struct priv_data;
- std::unique_ptr<priv_data> m_priv;
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(priv_data, m_priv)
AppenderAttachableImpl(const AppenderAttachableImpl&);
AppenderAttachableImpl& operator=(const AppenderAttachableImpl&);
@@ -122,8 +116,5 @@
}
}
-#if defined(_MSC_VER)
- #pragma warning ( pop )
-#endif
#endif //_LOG4CXX_HELPERS_APPENDER_ATTACHABLE_IMPL_H
diff --git a/src/main/include/log4cxx/helpers/bufferedwriter.h b/src/main/include/log4cxx/helpers/bufferedwriter.h
index 685c3d7..49a01d3 100644
--- a/src/main/include/log4cxx/helpers/bufferedwriter.h
+++ b/src/main/include/log4cxx/helpers/bufferedwriter.h
@@ -20,11 +20,6 @@
#include <log4cxx/helpers/writer.h>
-#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4251 )
-#endif
-
namespace log4cxx
{
@@ -38,8 +33,7 @@
class LOG4CXX_EXPORT BufferedWriter : public Writer
{
private:
- struct BufferedWriterPriv;
- std::unique_ptr<BufferedWriterPriv> m_priv;
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(BufferedWriterPriv, m_priv)
public:
DECLARE_ABSTRACT_LOG4CXX_OBJECT(BufferedWriter)
@@ -65,8 +59,4 @@
} //namespace log4cxx
-#if defined(_MSC_VER)
- #pragma warning (pop)
-#endif
-
#endif //_LOG4CXX_HELPERS_BUFFEREDWRITER_H
diff --git a/src/main/include/log4cxx/helpers/bytearrayinputstream.h b/src/main/include/log4cxx/helpers/bytearrayinputstream.h
index a5df60a..ecacece 100644
--- a/src/main/include/log4cxx/helpers/bytearrayinputstream.h
+++ b/src/main/include/log4cxx/helpers/bytearrayinputstream.h
@@ -18,12 +18,6 @@
#ifndef _LOG4CXX_HELPERS_BYTEARRAYINPUTSTREAM_H
#define _LOG4CXX_HELPERS_BYTEARRAYINPUTSTREAM_H
-#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
-#endif
-
-
#include <vector>
#include <log4cxx/helpers/inputstream.h>
@@ -41,8 +35,7 @@
class LOG4CXX_EXPORT ByteArrayInputStream : public InputStream
{
private:
- struct ByteArrayInputStreamPriv;
- std::unique_ptr<ByteArrayInputStreamPriv> m_priv;
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(ByteArrayInputStreamPriv, m_priv)
public:
DECLARE_ABSTRACT_LOG4CXX_OBJECT(ByteArrayInputStream)
@@ -88,8 +81,5 @@
} //namespace log4cxx
-#if defined(_MSC_VER)
- #pragma warning ( pop )
-#endif
#endif //_LOG4CXX_HELPERS_BYTEARRAYINPUTSTREAM_H
diff --git a/src/main/include/log4cxx/helpers/bytearrayoutputstream.h b/src/main/include/log4cxx/helpers/bytearrayoutputstream.h
index f4f96c2..56f0c8b 100644
--- a/src/main/include/log4cxx/helpers/bytearrayoutputstream.h
+++ b/src/main/include/log4cxx/helpers/bytearrayoutputstream.h
@@ -18,17 +18,9 @@
#ifndef _LOG4CXX_HELPERS_BYTEARRAYOUTPUTSTREAM_H
#define _LOG4CXX_HELPERS_BYTEARRAYOUTPUTSTREAM_H
-#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
-#endif
-
-
-
#include <log4cxx/helpers/outputstream.h>
#include <vector>
-
namespace log4cxx
{
@@ -44,8 +36,7 @@
class LOG4CXX_EXPORT ByteArrayOutputStream : public OutputStream
{
private:
- struct ByteArrayOutputStreamPriv;
- std::unique_ptr<ByteArrayOutputStreamPriv> m_priv;
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(ByteArrayOutputStreamPriv, m_priv)
public:
DECLARE_ABSTRACT_LOG4CXX_OBJECT(ByteArrayOutputStream)
@@ -72,9 +63,4 @@
} //namespace log4cxx
-#if defined(_MSC_VER)
- #pragma warning ( pop )
-#endif
-
-
#endif //_LOG4CXX_HELPERS_BYTEARRAYOUTPUTSTREAM_H
diff --git a/src/main/include/log4cxx/helpers/bytebuffer.h b/src/main/include/log4cxx/helpers/bytebuffer.h
index 21f8916..926ba14 100644
--- a/src/main/include/log4cxx/helpers/bytebuffer.h
+++ b/src/main/include/log4cxx/helpers/bytebuffer.h
@@ -33,8 +33,7 @@
class LOG4CXX_EXPORT ByteBuffer
{
private:
- struct ByteBufferPriv;
- std::unique_ptr<ByteBufferPriv> m_priv;
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(ByteBufferPriv, m_priv)
public:
ByteBuffer(char* data, size_t capacity);
@@ -60,7 +59,6 @@
ByteBuffer(const ByteBuffer&);
ByteBuffer& operator=(const ByteBuffer&);
};
-
} // namespace helpers
} //namespace log4cxx
diff --git a/src/main/include/log4cxx/helpers/cacheddateformat.h b/src/main/include/log4cxx/helpers/cacheddateformat.h
index 94c543d..1cff634 100644
--- a/src/main/include/log4cxx/helpers/cacheddateformat.h
+++ b/src/main/include/log4cxx/helpers/cacheddateformat.h
@@ -20,11 +20,6 @@
#include <log4cxx/helpers/dateformat.h>
-#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4251 )
-#endif
-
namespace log4cxx
{
namespace pattern
@@ -87,8 +82,7 @@
*/
static const logchar zeroString[];
- struct CachedDateFormatPriv;
- std::unique_ptr<CachedDateFormatPriv> m_priv;
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(CachedDateFormatPriv, m_priv)
public:
/**
@@ -197,8 +191,4 @@
} // namespace helpers
} // namespace log4cxx
-#if defined(_MSC_VER)
- #pragma warning (pop)
-#endif
-
#endif // _LOG4CXX_HELPERS_SIMPLE_DATE_FORMAT_H
diff --git a/src/main/include/log4cxx/helpers/cyclicbuffer.h b/src/main/include/log4cxx/helpers/cyclicbuffer.h
index 10b9679..d6d7647 100644
--- a/src/main/include/log4cxx/helpers/cyclicbuffer.h
+++ b/src/main/include/log4cxx/helpers/cyclicbuffer.h
@@ -35,8 +35,7 @@
class LOG4CXX_EXPORT CyclicBuffer
{
private:
- struct CyclicBufferPriv;
- std::unique_ptr<CyclicBufferPriv> m_priv;
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(CyclicBufferPriv, m_priv)
public:
/**
diff --git a/src/main/include/log4cxx/helpers/datagrampacket.h b/src/main/include/log4cxx/helpers/datagrampacket.h
index f4e9e60..46497a4 100644
--- a/src/main/include/log4cxx/helpers/datagrampacket.h
+++ b/src/main/include/log4cxx/helpers/datagrampacket.h
@@ -36,8 +36,7 @@
class LOG4CXX_EXPORT DatagramPacket : public helpers::Object
{
private:
- struct DatagramPacketPriv;
- std::unique_ptr<DatagramPacketPriv> m_priv;
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(DatagramPacketPriv, m_priv)
public:
DECLARE_ABSTRACT_LOG4CXX_OBJECT(DatagramPacket)
diff --git a/src/main/include/log4cxx/helpers/datagramsocket.h b/src/main/include/log4cxx/helpers/datagramsocket.h
index cbfd29d..64188ad 100644
--- a/src/main/include/log4cxx/helpers/datagramsocket.h
+++ b/src/main/include/log4cxx/helpers/datagramsocket.h
@@ -37,10 +37,8 @@
class LOG4CXX_EXPORT DatagramSocket : public helpers::Object
{
protected:
- struct DatagramSocketPriv;
- std::unique_ptr<DatagramSocketPriv> m_priv;
-
- DatagramSocket(std::unique_ptr<DatagramSocketPriv> priv);
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(DatagramSocketPriv, m_priv)
+ DatagramSocket(LOG4CXX_PRIVATE_PTR(DatagramSocketPriv) priv);
public:
DECLARE_ABSTRACT_LOG4CXX_OBJECT(DatagramSocket)
@@ -103,7 +101,6 @@
private:
DatagramSocket(const DatagramSocket&);
DatagramSocket& operator=(const DatagramSocket&);
-
};
} // namespace helpers
diff --git a/src/main/include/log4cxx/helpers/fileinputstream.h b/src/main/include/log4cxx/helpers/fileinputstream.h
index d088c4e..ab907c8 100644
--- a/src/main/include/log4cxx/helpers/fileinputstream.h
+++ b/src/main/include/log4cxx/helpers/fileinputstream.h
@@ -36,8 +36,7 @@
class LOG4CXX_EXPORT FileInputStream : public InputStream
{
private:
- struct FileInputStreamPrivate;
- std::unique_ptr<FileInputStreamPrivate> m_priv;
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(FileInputStreamPrivate, m_priv)
public:
DECLARE_ABSTRACT_LOG4CXX_OBJECT(FileInputStream)
diff --git a/src/main/include/log4cxx/helpers/fileoutputstream.h b/src/main/include/log4cxx/helpers/fileoutputstream.h
index ddade3e..322d8a7 100644
--- a/src/main/include/log4cxx/helpers/fileoutputstream.h
+++ b/src/main/include/log4cxx/helpers/fileoutputstream.h
@@ -35,8 +35,7 @@
class LOG4CXX_EXPORT FileOutputStream : public OutputStream
{
private:
- struct FileOutputStreamPrivate;
- std::unique_ptr<FileOutputStreamPrivate> m_priv;
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(FileOutputStreamPrivate, m_priv)
public:
DECLARE_ABSTRACT_LOG4CXX_OBJECT(FileOutputStream)
diff --git a/src/main/include/log4cxx/helpers/filewatchdog.h b/src/main/include/log4cxx/helpers/filewatchdog.h
index 7565ef9..51398a3 100644
--- a/src/main/include/log4cxx/helpers/filewatchdog.h
+++ b/src/main/include/log4cxx/helpers/filewatchdog.h
@@ -66,8 +66,7 @@
FileWatchdog(const FileWatchdog&);
FileWatchdog& operator=(const FileWatchdog&);
- struct FileWatchdogPrivate;
- std::unique_ptr<FileWatchdogPrivate> m_priv;
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(FileWatchdogPrivate, m_priv)
};
} // namespace helpers
} // namespace log4cxx
diff --git a/src/main/include/log4cxx/helpers/inputstreamreader.h b/src/main/include/log4cxx/helpers/inputstreamreader.h
index f51d75d..bdd1d5d 100644
--- a/src/main/include/log4cxx/helpers/inputstreamreader.h
+++ b/src/main/include/log4cxx/helpers/inputstreamreader.h
@@ -28,6 +28,10 @@
namespace helpers
{
+// Instantiate template pointer types passed as parameters
+LOG4CXX_INSTANTIATE_EXPORTED_PTR(InputStream);
+LOG4CXX_INSTANTIATE_EXPORTED_PTR(CharsetDecoder);
+
/**
* Class for reading from character streams.
* Decorates a byte based InputStream and provides appropriate
diff --git a/src/main/include/log4cxx/helpers/locale.h b/src/main/include/log4cxx/helpers/locale.h
index 9dfd55d..71589b3 100644
--- a/src/main/include/log4cxx/helpers/locale.h
+++ b/src/main/include/log4cxx/helpers/locale.h
@@ -21,11 +21,6 @@
#include <log4cxx/logstring.h>
#include <memory>
-#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4251 )
-#endif
-
namespace log4cxx
{
namespace helpers
@@ -46,14 +41,10 @@
protected:
Locale(const Locale&);
Locale& operator=(const Locale&);
- struct LocalePrivate;
- std::unique_ptr<LocalePrivate> m_priv;
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(LocalePrivate, m_priv)
}; // class Locale
} // namespace helpers
} // namespace log4cxx
-#if defined(_MSC_VER)
- #pragma warning (pop)
-#endif
#endif // _LOG4CXX_HELPERS_LOCALE_H
diff --git a/src/main/include/log4cxx/helpers/loglog.h b/src/main/include/log4cxx/helpers/loglog.h
index 49a8d43..4316506 100644
--- a/src/main/include/log4cxx/helpers/loglog.h
+++ b/src/main/include/log4cxx/helpers/loglog.h
@@ -42,8 +42,7 @@
class LOG4CXX_EXPORT LogLog
{
private:
- struct LogLogPrivate;
- std::unique_ptr<LogLogPrivate> m_priv;
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(LogLogPrivate, m_priv)
LogLog();
LogLog(const LogLog&);
diff --git a/src/main/include/log4cxx/helpers/messagebuffer.h b/src/main/include/log4cxx/helpers/messagebuffer.h
index 80506a9..b4b65d8 100644
--- a/src/main/include/log4cxx/helpers/messagebuffer.h
+++ b/src/main/include/log4cxx/helpers/messagebuffer.h
@@ -185,8 +185,7 @@
*/
CharMessageBuffer& operator=(const CharMessageBuffer&);
- struct CharMessageBufferPrivate;
- std::unique_ptr<CharMessageBufferPrivate> m_priv;
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(CharMessageBufferPrivate, m_priv)
};
template<class V>
@@ -356,8 +355,7 @@
*/
UniCharMessageBuffer& operator=(const UniCharMessageBuffer&);
- struct UniCharMessageBufferPrivate;
- std::unique_ptr<UniCharMessageBufferPrivate> m_priv;
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(UniCharMessageBufferPrivate, m_priv)
};
template<class V>
@@ -516,8 +514,7 @@
*/
WideMessageBuffer& operator=(const WideMessageBuffer&);
- struct WideMessageBufferPrivate;
- std::unique_ptr<WideMessageBufferPrivate> m_priv;
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(WideMessageBufferPrivate, m_priv)
};
template<class V>
@@ -782,8 +779,7 @@
*/
MessageBuffer& operator=(const MessageBuffer&);
- struct MessageBufferPrivate;
- std::unique_ptr<MessageBufferPrivate> m_priv;
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(MessageBufferPrivate, m_priv)
};
template<class V>
diff --git a/src/main/include/log4cxx/helpers/objectoutputstream.h b/src/main/include/log4cxx/helpers/objectoutputstream.h
index 7763770..3d09bf9 100644
--- a/src/main/include/log4cxx/helpers/objectoutputstream.h
+++ b/src/main/include/log4cxx/helpers/objectoutputstream.h
@@ -84,13 +84,7 @@
private:
ObjectOutputStream(const ObjectOutputStream&);
ObjectOutputStream& operator=(const ObjectOutputStream&);
-
- OutputStreamPtr os;
- log4cxx::helpers::CharsetEncoderPtr utf8Encoder;
- const unsigned int objectHandleDefault;
- unsigned int objectHandle;
- typedef std::map<std::string, unsigned int> ClassDescriptionMap;
- ClassDescriptionMap* classDescriptions;
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(ObjectOutputStreamPriv, m_priv)
};
LOG4CXX_PTR_DEF(ObjectOutputStream);
diff --git a/src/main/include/log4cxx/helpers/resourcebundle.h b/src/main/include/log4cxx/helpers/resourcebundle.h
index aed5ece..81fa0ff 100644
--- a/src/main/include/log4cxx/helpers/resourcebundle.h
+++ b/src/main/include/log4cxx/helpers/resourcebundle.h
@@ -81,7 +81,15 @@
The parent bundle is searched by #getString when this bundle does
not contain a particular resource.
*/
+
+#if defined(_MSC_VER)
+ #pragma warning ( push )
+ #pragma warning ( disable: 4251 )
+#endif
ResourceBundlePtr parent;
+#if defined(_MSC_VER)
+ #pragma warning (pop)
+#endif
}; // class ResourceBundle
} // namespace helpers
} // namespace log4cxx
diff --git a/src/main/include/log4cxx/helpers/serversocket.h b/src/main/include/log4cxx/helpers/serversocket.h
index c1847a7..276a856 100644
--- a/src/main/include/log4cxx/helpers/serversocket.h
+++ b/src/main/include/log4cxx/helpers/serversocket.h
@@ -33,8 +33,8 @@
class LOG4CXX_EXPORT ServerSocket
{
protected:
- struct ServerSocketPrivate;
- ServerSocket(std::unique_ptr<ServerSocketPrivate> priv);
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(ServerSocketPrivate, m_priv)
+ ServerSocket(LOG4CXX_PRIVATE_PTR(ServerSocketPrivate) priv);
public:
@@ -59,9 +59,6 @@
static ServerSocketUniquePtr create(int port);
- protected:
- std::unique_ptr<ServerSocketPrivate> m_priv;
-
};
} // namespace helpers
} // namespace log4cxx
diff --git a/src/main/include/log4cxx/helpers/socket.h b/src/main/include/log4cxx/helpers/socket.h
index fd7cadd..9d6595c 100644
--- a/src/main/include/log4cxx/helpers/socket.h
+++ b/src/main/include/log4cxx/helpers/socket.h
@@ -43,9 +43,8 @@
class LOG4CXX_EXPORT Socket : public helpers::Object
{
protected:
- struct SocketPrivate;
-
- Socket(std::unique_ptr<SocketPrivate>);
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(SocketPrivate, m_priv)
+ Socket(LOG4CXX_PRIVATE_PTR(SocketPrivate) priv);
public:
DECLARE_ABSTRACT_LOG4CXX_OBJECT(Socket)
@@ -72,8 +71,6 @@
Socket(const Socket&);
Socket& operator=(const Socket&);
- protected:
- std::unique_ptr<SocketPrivate> m_priv;
};
} // namespace helpers
diff --git a/src/main/include/log4cxx/helpers/socketoutputstream.h b/src/main/include/log4cxx/helpers/socketoutputstream.h
index 90000df..b275086 100644
--- a/src/main/include/log4cxx/helpers/socketoutputstream.h
+++ b/src/main/include/log4cxx/helpers/socketoutputstream.h
@@ -18,12 +18,6 @@
#ifndef _LOG4CXX_HELPERS_SOCKET_OUTPUT_STREAM_H
#define _LOG4CXX_HELPERS_SOCKET_OUTPUT_STREAM_H
-#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
-#endif
-
-
#include <log4cxx/logstring.h>
#include <log4cxx/helpers/outputstream.h>
#include <log4cxx/helpers/socket.h>
@@ -51,8 +45,7 @@
virtual void write(ByteBuffer& buf, Pool& p);
private:
- struct SocketOutputStreamPrivate;
- std::unique_ptr<SocketOutputStreamPrivate> m_priv;
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(SocketOutputStreamPrivate, m_priv)
//
// prevent copy and assignment statements
SocketOutputStream(const SocketOutputStream&);
@@ -65,10 +58,5 @@
} // namespace helpers
} // namespace log4cxx
-#if defined(_MSC_VER)
- #pragma warning ( pop )
-#endif
-
-
#endif // _LOG4CXX_HELPERS_SOCKET_OUTPUT_STREAM_H
diff --git a/src/main/include/log4cxx/helpers/stringtokenizer.h b/src/main/include/log4cxx/helpers/stringtokenizer.h
index c915420..e9defb9 100644
--- a/src/main/include/log4cxx/helpers/stringtokenizer.h
+++ b/src/main/include/log4cxx/helpers/stringtokenizer.h
@@ -21,11 +21,6 @@
#include <log4cxx/logstring.h>
#include <log4cxx/helpers/exception.h>
-#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4251 )
-#endif
-
namespace log4cxx
{
namespace helpers
@@ -43,14 +38,9 @@
StringTokenizer(const StringTokenizer&);
StringTokenizer& operator=(const StringTokenizer&);
- struct StringTokenizerPrivate;
- std::unique_ptr<StringTokenizerPrivate> m_priv;
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(StringTokenizerPrivate, m_priv)
}; // class StringTokenizer
} // namespace helpers;
} // namespace log4cxx;
-#if defined(_MSC_VER)
- #pragma warning (pop)
-#endif
-
#endif //_LOG4CXX_HELPERS_STRING_TOKENIZER_H
diff --git a/src/main/include/log4cxx/helpers/syslogwriter.h b/src/main/include/log4cxx/helpers/syslogwriter.h
index 547459b..b594525 100644
--- a/src/main/include/log4cxx/helpers/syslogwriter.h
+++ b/src/main/include/log4cxx/helpers/syslogwriter.h
@@ -18,16 +18,10 @@
#ifndef _LOG4CXX_SYSLOG_WRITER_H
#define _LOG4CXX_SYSLOG_WRITER_H
-
#include <log4cxx/helpers/object.h>
#include <log4cxx/helpers/inetaddress.h>
#include <log4cxx/helpers/datagramsocket.h>
-#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4251 )
-#endif
-
namespace log4cxx
{
namespace helpers
@@ -45,14 +39,9 @@
void write(const LogString& string);
private:
- struct SyslogWriterPrivate;
- std::unique_ptr<SyslogWriterPrivate> m_priv;
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(SyslogWriterPrivate, m_priv)
};
} // namespace helpers
} // namespace log4cxx
-#if defined(_MSC_VER)
- #pragma warning (pop)
-#endif
-
#endif
diff --git a/src/main/include/log4cxx/helpers/threadspecificdata.h b/src/main/include/log4cxx/helpers/threadspecificdata.h
index e1bb2d8..461797d 100644
--- a/src/main/include/log4cxx/helpers/threadspecificdata.h
+++ b/src/main/include/log4cxx/helpers/threadspecificdata.h
@@ -21,11 +21,6 @@
#include <log4cxx/ndc.h>
#include <log4cxx/mdc.h>
-#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4251 )
-#endif
-
namespace log4cxx
{
namespace helpers
@@ -61,15 +56,11 @@
private:
static ThreadSpecificData& getDataNoThreads();
static ThreadSpecificData* createCurrentData();
- struct ThreadSpecificDataPrivate;
- std::unique_ptr<ThreadSpecificDataPrivate> m_priv;
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(ThreadSpecificDataPrivate, m_priv)
};
} // namespace helpers
} // namespace log4cxx
-#if defined(_MSC_VER)
- #pragma warning (pop)
-#endif
#endif
diff --git a/src/main/include/log4cxx/helpers/threadutility.h b/src/main/include/log4cxx/helpers/threadutility.h
index e9b1d82..498bcba 100644
--- a/src/main/include/log4cxx/helpers/threadutility.h
+++ b/src/main/include/log4cxx/helpers/threadutility.h
@@ -75,8 +75,7 @@
log4cxx::helpers::ThreadStarted threadStartedFunction();
log4cxx::helpers::ThreadStartPost postStartFunction();
- struct priv_data;
- std::unique_ptr<priv_data> m_priv;
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(priv_data, m_priv)
public:
~ThreadUtility();
diff --git a/src/main/include/log4cxx/hierarchy.h b/src/main/include/log4cxx/hierarchy.h
index 72120bd..96aa3ca 100644
--- a/src/main/include/log4cxx/hierarchy.h
+++ b/src/main/include/log4cxx/hierarchy.h
@@ -18,10 +18,6 @@
#ifndef _LOG4CXX_HIERARCHY_H
#define _LOG4CXX_HIERARCHY_H
-#if defined(_MSC_VER)
- #pragma warning (push)
- #pragma warning ( disable: 4231 4251 4275 4786 )
-#endif
#include <log4cxx/spi/loggerrepository.h>
#include <log4cxx/spi/loggerfactory.h>
@@ -62,8 +58,7 @@
public std::enable_shared_from_this<Hierarchy>
{
private:
- struct HierarchyPrivate;
- std::unique_ptr<HierarchyPrivate> m_priv;
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(HierarchyPrivate, m_priv)
public:
DECLARE_ABSTRACT_LOG4CXX_OBJECT(Hierarchy)
@@ -273,9 +268,4 @@
} //namespace log4cxx
-
-#if defined(_MSC_VER)
- #pragma warning (pop)
-#endif
-
#endif //_LOG4CXX_HIERARCHY_H
diff --git a/src/main/include/log4cxx/htmllayout.h b/src/main/include/log4cxx/htmllayout.h
index c0bf1ac..eb1e878 100644
--- a/src/main/include/log4cxx/htmllayout.h
+++ b/src/main/include/log4cxx/htmllayout.h
@@ -18,12 +18,6 @@
#ifndef _LOG4CXX_HTML_LAYOUT_H
#define _LOG4CXX_HTML_LAYOUT_H
-#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
-#endif
-
-
#include <log4cxx/layout.h>
#include <log4cxx/helpers/iso8601dateformat.h>
@@ -37,8 +31,7 @@
class LOG4CXX_EXPORT HTMLLayout : public Layout
{
private:
- struct HTMLLayoutPrivate;
- std::unique_ptr<HTMLLayoutPrivate> m_priv;
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(HTMLLayoutPrivate, m_priv)
public:
DECLARE_LOG4CXX_OBJECT(HTMLLayout)
@@ -117,9 +110,4 @@
LOG4CXX_PTR_DEF(HTMLLayout);
} // namespace log4cxx
-#if defined(_MSC_VER)
- #pragma warning ( pop )
-#endif
-
-
#endif // _LOG4CXX_HTML_LAYOUT_H
diff --git a/src/main/include/log4cxx/log4cxx.h.in b/src/main/include/log4cxx/log4cxx.h.in
index e350d83..663157a 100644
--- a/src/main/include/log4cxx/log4cxx.h.in
+++ b/src/main/include/log4cxx/log4cxx.h.in
@@ -64,8 +64,15 @@
typedef std::weak_ptr<T> T##WeakPtr
#define LOG4CXX_UNIQUE_PTR_DEF(T) typedef std::unique_ptr<T> T##UniquePtr;
#define LOG4CXX_LIST_DEF(N, T) typedef std::vector<T> N
+#define LOG4CXX_PRIVATE_PTR(T) std::unique_ptr<T>
#if _WIN32
+#define LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(T, V) \
+__pragma( warning( push ) ) \
+__pragma( warning( disable : 4251 ) ) \
+ struct T; LOG4CXX_PRIVATE_PTR(T) V; \
+__pragma( warning( pop ) )
+
// definitions used when using static library
#if defined(LOG4CXX_STATIC)
#define LOG4CXX_EXPORT
@@ -76,8 +83,11 @@
// definitions used when using DLL
#define LOG4CXX_EXPORT __declspec(dllimport)
#endif
+#define LOG4CXX_INSTANTIATE_EXPORTED_PTR(T) template class LOG4CXX_EXPORT std::shared_ptr<T>
#else
#define LOG4CXX_EXPORT
+#define LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(T, V) struct T; LOG4CXX_PRIVATE_PTR(T) V;
+#define LOG4CXX_INSTANTIATE_EXPORTED_PTR(T)
#endif /* WIN32 */
namespace log4cxx {
diff --git a/src/main/include/log4cxx/logger.h b/src/main/include/log4cxx/logger.h
index e8b40c3..2f56de1 100644
--- a/src/main/include/log4cxx/logger.h
+++ b/src/main/include/log4cxx/logger.h
@@ -18,15 +18,6 @@
#ifndef _LOG4CXX_LOGGER_H
#define _LOG4CXX_LOGGER_H
-#if defined(_MSC_VER) && (_MSC_VER < 1900)
- #pragma warning ( push )
- #pragma warning ( disable: 4127 )
-#endif
-#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
-#endif
-
#include <log4cxx/helpers/appenderattachableimpl.h>
#include <log4cxx/level.h>
#include <log4cxx/helpers/pool.h>
@@ -72,8 +63,7 @@
END_LOG4CXX_CAST_MAP()
private:
- struct LoggerPrivate;
- std::unique_ptr<LoggerPrivate> m_priv;
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(LoggerPrivate, m_priv)
protected:
friend class DefaultLoggerFactory;
@@ -1984,10 +1974,6 @@
/**@}*/
-#if defined(_MSC_VER)
- #pragma warning ( pop )
-#endif
-
#include <log4cxx/spi/loggerrepository.h>
#endif //_LOG4CXX_LOGGER_H
diff --git a/src/main/include/log4cxx/net/socketappenderskeleton.h b/src/main/include/log4cxx/net/socketappenderskeleton.h
index 95991dc..4878019 100644
--- a/src/main/include/log4cxx/net/socketappenderskeleton.h
+++ b/src/main/include/log4cxx/net/socketappenderskeleton.h
@@ -24,11 +24,6 @@
#include <thread>
#include <condition_variable>
-#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4251 )
-#endif
-
namespace log4cxx
{
@@ -44,10 +39,20 @@
struct SocketAppenderSkeletonPriv;
public:
- SocketAppenderSkeleton(std::unique_ptr<SocketAppenderSkeletonPriv> priv);
+ SocketAppenderSkeleton(int defaultPort, int reconnectionDelay);
~SocketAppenderSkeleton();
/**
+ Connects to remote server at <code>address</code> and <code>port</code>.
+ */
+ SocketAppenderSkeleton(helpers::InetAddressPtr address, int port, int reconnectionDelay);
+
+ /**
+ Connects to remote server at <code>host</code> and <code>port</code>.
+ */
+ SocketAppenderSkeleton(const LogString& host, int port, int reconnectionDelay);
+
+ /**
Connect to the specified <b>RemoteHost</b> and <b>Port</b>.
*/
void activateOptions(log4cxx::helpers::Pool& p);
@@ -122,6 +127,7 @@
const LogString& value);
protected:
+ SocketAppenderSkeleton(std::unique_ptr<SocketAppenderSkeletonPriv> priv);
virtual void setSocket(log4cxx::helpers::SocketPtr& socket, log4cxx::helpers::Pool& p) = 0;
@@ -152,9 +158,5 @@
} // namespace net
} // namespace log4cxx
-#if defined(_MSC_VER)
- #pragma warning (pop)
-#endif
-
#endif // _LOG4CXX_NET_SOCKET_APPENDER_SKELETON_H
diff --git a/src/main/include/log4cxx/pattern/formattinginfo.h b/src/main/include/log4cxx/pattern/formattinginfo.h
index 372bcd7..5fce138 100644
--- a/src/main/include/log4cxx/pattern/formattinginfo.h
+++ b/src/main/include/log4cxx/pattern/formattinginfo.h
@@ -42,8 +42,7 @@
*/
class LOG4CXX_EXPORT FormattingInfo : public virtual log4cxx::helpers::Object
{
- struct FormattingInfoPrivate;
- std::unique_ptr<FormattingInfoPrivate> m_priv;
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(FormattingInfoPrivate, m_priv)
public:
DECLARE_ABSTRACT_LOG4CXX_OBJECT(FormattingInfo)
diff --git a/src/main/include/log4cxx/pattern/patternconverter.h b/src/main/include/log4cxx/pattern/patternconverter.h
index af04162..05916f4 100644
--- a/src/main/include/log4cxx/pattern/patternconverter.h
+++ b/src/main/include/log4cxx/pattern/patternconverter.h
@@ -23,11 +23,6 @@
#include <log4cxx/logstring.h>
#include <vector>
-#ifdef _MSC_VER
- // disable identifier too wide for debugging warning
- #pragma warning ( disable: 4231 4251 4275 4786 )
-#endif
-
#define DECLARE_LOG4CXX_PATTERN(cls) DECLARE_ABSTRACT_LOG4CXX_OBJECT(cls)
namespace log4cxx
@@ -50,14 +45,8 @@
class LOG4CXX_EXPORT PatternConverter : public virtual log4cxx::helpers::Object
{
protected:
- struct PatternConverterPrivate;
- std::unique_ptr<PatternConverterPrivate> m_priv;
-
- /**
- * Use this constructor when you have a subclass that has its own private data
- * @param priv
- */
- PatternConverter(std::unique_ptr<PatternConverterPrivate> priv);
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(PatternConverterPrivate, m_priv)
+ PatternConverter(LOG4CXX_PRIVATE_PTR(PatternConverterPrivate) priv);
/**
* Create a new pattern converter. Use this constructor when you have a subclass
diff --git a/src/main/include/log4cxx/patternlayout.h b/src/main/include/log4cxx/patternlayout.h
index 3f8106c..fb055e6 100644
--- a/src/main/include/log4cxx/patternlayout.h
+++ b/src/main/include/log4cxx/patternlayout.h
@@ -18,11 +18,6 @@
#ifndef _LOG4CXX_PATTERN_LAYOUT_H
#define _LOG4CXX_PATTERN_LAYOUT_H
-#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
-#endif
-
#include <log4cxx/layout.h>
#include <log4cxx/pattern/loggingeventpatternconverter.h>
#include <log4cxx/pattern/formattinginfo.h>
@@ -362,8 +357,7 @@
*/
class LOG4CXX_EXPORT PatternLayout : public Layout
{
- struct PatternLayoutPrivate;
- std::unique_ptr<PatternLayoutPrivate> m_priv;
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(PatternLayoutPrivate, m_priv)
public:
DECLARE_LOG4CXX_OBJECT(PatternLayout)
@@ -427,8 +421,4 @@
LOG4CXX_PTR_DEF(PatternLayout);
} // namespace log4cxx
-#if defined(_MSC_VER)
- #pragma warning ( pop )
-#endif
-
#endif //_LOG4CXX_PATTERN_LAYOUT_H
diff --git a/src/main/include/log4cxx/private/fileappender_priv.h b/src/main/include/log4cxx/private/fileappender_priv.h
index e035e6a..58918c7 100644
--- a/src/main/include/log4cxx/private/fileappender_priv.h
+++ b/src/main/include/log4cxx/private/fileappender_priv.h
@@ -26,9 +26,19 @@
struct FileAppender::FileAppenderPriv : public WriterAppender::WriterAppenderPriv
{
- FileAppenderPriv() : WriterAppenderPriv() {}
-
- FileAppenderPriv(LayoutPtr layout) : WriterAppenderPriv(layout) {}
+ FileAppenderPriv
+ ( LayoutPtr _layout = LayoutPtr()
+ , const LogString& _fileName = LogString()
+ , bool _fileAppend = true
+ , bool _bufferedIO = false
+ , int _bufferSize = 8 * 1024
+ )
+ : WriterAppenderPriv(_layout)
+ , fileAppend(_fileAppend)
+ , fileName(_fileName)
+ , bufferedIO(_bufferedIO)
+ , bufferSize(_bufferSize)
+ {}
/** Append to or truncate the file? The default value for this
variable is <code>true</code>, meaning that by default a
diff --git a/src/main/include/log4cxx/rolling/action.h b/src/main/include/log4cxx/rolling/action.h
index a69f326..8b9d9ea 100644
--- a/src/main/include/log4cxx/rolling/action.h
+++ b/src/main/include/log4cxx/rolling/action.h
@@ -39,15 +39,14 @@
LOG4CXX_CAST_ENTRY(Action)
END_LOG4CXX_CAST_MAP()
- struct ActionPrivate;
- std::unique_ptr<ActionPrivate> m_priv;
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(ActionPrivate, m_priv)
protected:
/**
* Constructor.
*/
Action();
- Action( std::unique_ptr<ActionPrivate> priv );
+ Action(LOG4CXX_PRIVATE_PTR(ActionPrivate) priv);
virtual ~Action();
public:
diff --git a/src/main/include/log4cxx/rolling/filterbasedtriggeringpolicy.h b/src/main/include/log4cxx/rolling/filterbasedtriggeringpolicy.h
index 1b910ec..3cb6a42 100644
--- a/src/main/include/log4cxx/rolling/filterbasedtriggeringpolicy.h
+++ b/src/main/include/log4cxx/rolling/filterbasedtriggeringpolicy.h
@@ -35,6 +35,8 @@
namespace rolling
{
+// Instantiate template pointer types passed as parameters
+LOG4CXX_INSTANTIATE_EXPORTED_PTR(log4cxx::spi::Filter);
/**
* FilterBasedTriggeringPolicy determines if rolling should be triggered
diff --git a/src/main/include/log4cxx/rolling/rollingpolicybase.h b/src/main/include/log4cxx/rolling/rollingpolicybase.h
index 205ab6d..d6d7318 100644
--- a/src/main/include/log4cxx/rolling/rollingpolicybase.h
+++ b/src/main/include/log4cxx/rolling/rollingpolicybase.h
@@ -18,12 +18,6 @@
#if !defined(_LOG4CXX_ROLLING_ROLLING_POLICY_BASE_H)
#define _LOG4CXX_ROLLING_ROLLING_POLICY_BASE_H
-#if defined(_MSC_VER)
- #pragma warning ( push )
- #pragma warning ( disable: 4231 4251 4275 4786 )
-#endif
-
-
#include <log4cxx/helpers/object.h>
#include <log4cxx/logger.h>
#include <log4cxx/logmanager.h>
@@ -57,13 +51,10 @@
LOG4CXX_CAST_ENTRY(spi::OptionHandler)
END_LOG4CXX_CAST_MAP()
-
- struct RollingPolicyBasePrivate;
- std::unique_ptr<RollingPolicyBasePrivate> m_priv;
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(RollingPolicyBasePrivate, m_priv)
public:
RollingPolicyBase();
- RollingPolicyBase( std::unique_ptr<RollingPolicyBasePrivate> priv );
virtual ~RollingPolicyBase();
virtual void activateOptions(log4cxx::helpers::Pool& p) = 0;
virtual log4cxx::pattern::PatternMap getFormatSpecifiers() const = 0;
@@ -94,6 +85,7 @@
}
#endif
protected:
+ RollingPolicyBase(LOG4CXX_PRIVATE_PTR(RollingPolicyBasePrivate) priv);
/**
* Parse file name pattern.
*/
@@ -115,9 +107,4 @@
}
}
-
-#if defined(_MSC_VER)
- #pragma warning ( pop )
-#endif
-
#endif
diff --git a/src/main/include/log4cxx/spi/defaultrepositoryselector.h b/src/main/include/log4cxx/spi/defaultrepositoryselector.h
index 1e22fed..8059f4d 100644
--- a/src/main/include/log4cxx/spi/defaultrepositoryselector.h
+++ b/src/main/include/log4cxx/spi/defaultrepositoryselector.h
@@ -42,8 +42,7 @@
virtual LoggerRepositoryPtr getLoggerRepository();
private:
- struct DefaultRepositorySelectorPrivate;
- std::unique_ptr<DefaultRepositorySelectorPrivate> m_priv;
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(DefaultRepositorySelectorPrivate, m_priv)
};
} // namespace spi
} // namespace log4cxx
diff --git a/src/main/include/log4cxx/spi/filter.h b/src/main/include/log4cxx/spi/filter.h
index 6130526..6c2dfe5 100644
--- a/src/main/include/log4cxx/spi/filter.h
+++ b/src/main/include/log4cxx/spi/filter.h
@@ -69,8 +69,7 @@
public virtual helpers::Object
{
protected:
- struct FilterPrivate;
- std::unique_ptr<FilterPrivate> m_priv;
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(FilterPrivate, m_priv)
public:
Filter();
diff --git a/src/main/include/log4cxx/spi/loggingevent.h b/src/main/include/log4cxx/spi/loggingevent.h
index d3fded3..d036f40 100644
--- a/src/main/include/log4cxx/spi/loggingevent.h
+++ b/src/main/include/log4cxx/spi/loggingevent.h
@@ -18,11 +18,6 @@
#ifndef _LOG4CXX_SPI_LOGGING_EVENT_H
#define _LOG4CXX_SPI_LOGGING_EVENT_H
-#if defined(_MSC_VER)
- #pragma warning (push)
- #pragma warning ( disable: 4231 4251 4275 4786 )
-#endif
-
#include <log4cxx/logstring.h>
#include <time.h>
#include <log4cxx/logger.h>
@@ -180,8 +175,7 @@
void setProperty(const LogString& key, const LogString& value);
private:
- struct LoggingEventPrivate;
- std::unique_ptr<LoggingEventPrivate> m_priv;
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(LoggingEventPrivate, m_priv)
//
// prevent copy and assignment
@@ -198,9 +192,4 @@
}
}
-#if defined(_MSC_VER)
- #pragma warning (pop)
-#endif
-
-
#endif //_LOG4CXX_SPI_LOGGING_EVENT_H
diff --git a/src/main/include/log4cxx/varia/fallbackerrorhandler.h b/src/main/include/log4cxx/varia/fallbackerrorhandler.h
index 42395c3..e49e638 100644
--- a/src/main/include/log4cxx/varia/fallbackerrorhandler.h
+++ b/src/main/include/log4cxx/varia/fallbackerrorhandler.h
@@ -42,8 +42,7 @@
public virtual helpers::Object
{
private:
- struct FallbackErrorHandlerPrivate;
- std::unique_ptr<FallbackErrorHandlerPrivate> m_priv;
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(FallbackErrorHandlerPrivate, m_priv)
public:
DECLARE_LOG4CXX_OBJECT(FallbackErrorHandler)
diff --git a/src/main/include/log4cxx/xml/domconfigurator.h b/src/main/include/log4cxx/xml/domconfigurator.h
index 0c4d6d1..5c19079 100644
--- a/src/main/include/log4cxx/xml/domconfigurator.h
+++ b/src/main/include/log4cxx/xml/domconfigurator.h
@@ -18,13 +18,6 @@
#ifndef _LOG4CXX_XML_DOM_CONFIGURATOR_H
#define _LOG4CXX_XML_DOM_CONFIGURATOR_H
-#if defined(_MSC_VER)
- #pragma warning (push)
- #pragma warning ( disable: 4231 4251 4275 4786 )
-#endif
-
-
-
#include <log4cxx/logstring.h>
#include <map>
#include <log4cxx/appender.h>
@@ -301,15 +294,10 @@
DOMConfigurator& operator=(const DOMConfigurator&);
static XMLWatchdog* xdog;
- struct DOMConfiguratorPrivate;
- std::unique_ptr<DOMConfiguratorPrivate> m_priv;
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(DOMConfiguratorPrivate, m_priv)
};
LOG4CXX_PTR_DEF(DOMConfigurator);
} // namespace xml
} // namespace log4cxx
-#if defined(_MSC_VER)
- #pragma warning (pop)
-#endif
-
#endif // _LOG4CXX_XML_DOM_CONFIGURATOR_H
diff --git a/src/main/include/log4cxx/xml/xmllayout.h b/src/main/include/log4cxx/xml/xmllayout.h
index ffe0a13..90eda79 100644
--- a/src/main/include/log4cxx/xml/xmllayout.h
+++ b/src/main/include/log4cxx/xml/xmllayout.h
@@ -53,8 +53,7 @@
class LOG4CXX_EXPORT XMLLayout : public Layout
{
private:
- struct XMLLayoutPrivate;
- std::unique_ptr<XMLLayoutPrivate> m_priv;
+ LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(XMLLayoutPrivate, m_priv)
public:
DECLARE_LOG4CXX_OBJECT(XMLLayout)