Author: carnold
Date: Fri Feb  1 14:14:52 2008
New Revision: 617676

URL: http://svn.apache.org/viewvc?rev=617676&view=rev
Log:
LOGCXX-219: std::set not DLL exportable in VC 7

Modified:
    logging/log4cxx/trunk/src/main/cpp/file.cpp
    logging/log4cxx/trunk/src/main/cpp/fileinputstream.cpp
    logging/log4cxx/trunk/src/main/cpp/fileoutputstream.cpp
    logging/log4cxx/trunk/src/main/cpp/loggingevent.cpp
    logging/log4cxx/trunk/src/main/cpp/propertiespatternconverter.cpp
    logging/log4cxx/trunk/src/main/include/log4cxx/file.h
    logging/log4cxx/trunk/src/main/include/log4cxx/helpers/fileinputstream.h
    logging/log4cxx/trunk/src/main/include/log4cxx/helpers/fileoutputstream.h
    logging/log4cxx/trunk/src/main/include/log4cxx/log4cxx.h.in
    logging/log4cxx/trunk/src/main/include/log4cxx/log4cxx.hw
    logging/log4cxx/trunk/src/main/include/log4cxx/spi/loggingevent.h
    logging/log4cxx/trunk/src/test/cpp/helpers/charsetencodertestcase.cpp

Modified: logging/log4cxx/trunk/src/main/cpp/file.cpp
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/file.cpp?rev=617676&r1=617675&r2=617676&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/file.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/file.cpp Fri Feb  1 14:14:52 2008
@@ -30,25 +30,48 @@
 File::File() {
 }
 
+template<class S> 
+static LogString decodeLS(const S& src) {
+    LogString dst;
+    Transcoder::decode(src, dst);
+    return dst;
+}
+
+template<class S> 
+static std::string decodeOS(const S& src) {
+    LogString ls;
+    std::string os;
+    Transcoder::decode(src, ls);
+    Transcoder::encode(ls, os);
+    return os;
+}
+
+
 File::File(const std::string& name1)
-  : name(), osName() {
-  Transcoder::decode(name1, this->name);
-  Transcoder::encode(this->name, osName);
+  : name(decodeLS(name1)), osName(decodeOS(name1)) {
+}
+
+File::File(const char* name1)
+  : name(decodeLS(name1)), osName(decodeOS(name1)) {
 }
 
 #if LOG4CXX_WCHAR_T_API
 File::File(const std::wstring& name1)
-   : name(), osName() {
-  Transcoder::decode(name1, this->name);
-  Transcoder::encode(this->name, osName);
+   : name(decodeLS(name1)), osName(decodeOS(name1)) {
+}
+
+File::File(const wchar_t* name1)
+   : name(decodeLS(name1)), osName(decodeOS(name1)) {
 }
 #endif
 
 #if LOG4CXX_UNICHAR_API
 File::File(const std::basic_string<UniChar>& name1)
-   : name(), osName() {
-  Transcoder::decode(name1, this->name);
-  Transcoder::encode(this->name, osName);
+   : name(decodeLS(name1)), osName(decodeOS(name1)) {
+}
+
+File::File(const UniChar* name1)
+   : name(decodeLS(name1)), osName(decodeOS(name1)) {
 }
 #endif
 

Modified: logging/log4cxx/trunk/src/main/cpp/fileinputstream.cpp
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/fileinputstream.cpp?rev=617676&r1=617675&r2=617676&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/fileinputstream.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/fileinputstream.cpp Fri Feb  1 14:14:52 
2008
@@ -32,6 +32,16 @@
 IMPLEMENT_LOG4CXX_OBJECT(FileInputStream)
 
 FileInputStream::FileInputStream(const LogString& filename) {
+    open(filename);
+}
+
+FileInputStream::FileInputStream(const logchar* filename) {
+    LogString fn(filename);
+    open(fn);
+}
+
+
+void FileInputStream::open(const LogString& filename) {
     apr_fileperms_t perm = APR_OS_DEFAULT;
     apr_int32_t flags = APR_READ;
     apr_status_t stat = File().setName(filename).open(&fileptr, flags, perm, 
pool);

Modified: logging/log4cxx/trunk/src/main/cpp/fileoutputstream.cpp
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/fileoutputstream.cpp?rev=617676&r1=617675&r2=617676&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/fileoutputstream.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/fileoutputstream.cpp Fri Feb  1 14:14:52 
2008
@@ -33,6 +33,17 @@
 
 FileOutputStream::FileOutputStream(const LogString& filename,
     bool append) {
+    open(filename, append);
+}
+
+FileOutputStream::FileOutputStream(const logchar* filename,
+    bool append) {
+    LogString fn(filename);
+    open(fn, append);
+}
+
+void FileOutputStream::open(const LogString& filename,
+    bool append) {
     apr_fileperms_t perm = APR_OS_DEFAULT;
     apr_int32_t flags = APR_WRITE | APR_CREATE;
     if (append) {

Modified: logging/log4cxx/trunk/src/main/cpp/loggingevent.cpp
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/loggingevent.cpp?rev=617676&r1=617675&r2=617676&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/loggingevent.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/loggingevent.cpp Fri Feb  1 14:14:52 2008
@@ -138,7 +138,7 @@
                 MDC::Map::const_iterator it;
                 for (it = mdcCopy->begin(); it != mdcCopy->end(); it++)
                 {
-                        set.insert(it->first);
+                        set.push_back(it->first);
 
                 }
         }
@@ -149,7 +149,7 @@
                 MDC::Map::const_iterator it;
                 for (it = m.begin(); it != m.end(); it++)
                 {
-                        set.insert(it->first);
+                        set.push_back(it->first);
                 }
         }
 
@@ -193,7 +193,7 @@
                 std::map<LogString, LogString>::const_iterator it;
                 for (it = properties->begin(); it != properties->end(); it++)
                 {
-                        set.insert(it->first);
+                        set.push_back(it->first);
                 }
         }
 

Modified: logging/log4cxx/trunk/src/main/cpp/propertiespatternconverter.cpp
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/propertiespatternconverter.cpp?rev=617676&r1=617675&r2=617676&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/propertiespatternconverter.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/propertiespatternconverter.cpp Fri Feb  
1 14:14:52 2008
@@ -60,9 +60,9 @@
     if (option.length() == 0) {
       toAppendTo.append(1, (logchar) 0x7B /* '{' */);
 
-      std::set<LogString> keySet(event->getMDCKeySet());
+      LoggingEvent::KeySet keySet(event->getMDCKeySet());
 
-      for(std::set<LogString>::const_iterator iter = keySet.begin();
+      for(LoggingEvent::KeySet::const_iterator iter = keySet.begin();
           iter != keySet.end();
           iter++) {
           toAppendTo.append(1, (logchar) 0x7B /* '{' */);

Modified: logging/log4cxx/trunk/src/main/include/log4cxx/file.h
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/include/log4cxx/file.h?rev=617676&r1=617675&r2=617676&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/include/log4cxx/file.h (original)
+++ logging/log4cxx/trunk/src/main/include/log4cxx/file.h Fri Feb  1 14:14:52 
2008
@@ -40,11 +40,14 @@
                 {
                 public:
                     File();
+                    File(const char* name);
                     File(const std::string& name);
 #if LOG4CXX_WCHAR_T_API
+                    File(const wchar_t* name);
                     File(const std::wstring& name);
 #endif
 #if LOG4CXX_UNICHAR_API
+                    File(const UniChar* name);
                     File(const std::basic_string<UniChar>& name);
 #endif
 #if LOG4CXX_CFSTRING_API

Modified: 
logging/log4cxx/trunk/src/main/include/log4cxx/helpers/fileinputstream.h
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/include/log4cxx/helpers/fileinputstream.h?rev=617676&r1=617675&r2=617676&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/include/log4cxx/helpers/fileinputstream.h 
(original)
+++ logging/log4cxx/trunk/src/main/include/log4cxx/helpers/fileinputstream.h 
Fri Feb  1 14:14:52 2008
@@ -52,6 +52,7 @@
                    * @param filename The system-dependent file name.
                    */
                   FileInputStream(const LogString& filename);
+                  FileInputStream(const logchar* filename);
 
                   /**
                    * Creates a FileInputStream by opening a connection to an 
actual 
@@ -83,6 +84,7 @@
                   FileInputStream(const FileInputStream&);
 
                   FileInputStream& operator=(const FileInputStream&);
+                  void open(const LogString&);
 
           };
 

Modified: 
logging/log4cxx/trunk/src/main/include/log4cxx/helpers/fileoutputstream.h
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/include/log4cxx/helpers/fileoutputstream.h?rev=617676&r1=617675&r2=617676&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/include/log4cxx/helpers/fileoutputstream.h 
(original)
+++ logging/log4cxx/trunk/src/main/include/log4cxx/helpers/fileoutputstream.h 
Fri Feb  1 14:14:52 2008
@@ -45,6 +45,7 @@
                   END_LOG4CXX_CAST_MAP()
 
                   FileOutputStream(const LogString& filename, bool append = 
false);
+                  FileOutputStream(const logchar* filename, bool append = 
false);
                   virtual ~FileOutputStream();
 
                   virtual void close(Pool& p);
@@ -54,6 +55,7 @@
           private:
                   FileOutputStream(const FileOutputStream&);
                   FileOutputStream& operator=(const FileOutputStream&);
+                  void open(const LogString& fn, bool append);
           };
 
           LOG4CXX_PTR_DEF(FileOutputStream);

Modified: logging/log4cxx/trunk/src/main/include/log4cxx/log4cxx.h.in
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/include/log4cxx/log4cxx.h.in?rev=617676&r1=617675&r2=617676&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/include/log4cxx/log4cxx.h.in (original)
+++ logging/log4cxx/trunk/src/main/include/log4cxx/log4cxx.h.in Fri Feb  1 
14:14:52 2008
@@ -46,7 +46,6 @@
 #define LOG4CXX_EXPORT
 #define LOG4CXX_PTR_DEF(T) typedef log4cxx::helpers::ObjectPtrT<T> T##Ptr;
 #define LOG4CXX_LIST_DEF(N, T) typedef std::vector<T> N;
-#define LOG4CXX_SET_DEF(N, T) typedef std::set<T> N;
 
 
 #endif

Modified: logging/log4cxx/trunk/src/main/include/log4cxx/log4cxx.hw
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/include/log4cxx/log4cxx.hw?rev=617676&r1=617675&r2=617676&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/include/log4cxx/log4cxx.hw (original)
+++ logging/log4cxx/trunk/src/main/include/log4cxx/log4cxx.hw Fri Feb  1 
14:14:52 2008
@@ -55,7 +55,6 @@
 #define LOG4CXX_EXPORT
 #define LOG4CXX_PTR_DEF(T) typedef log4cxx::helpers::ObjectPtrT<T> T##Ptr;
 #define LOG4CXX_LIST_DEF(N, T) typedef std::vector<T> N;
-#define LOG4CXX_SET_DEF(N, T) typedef std::set<T> N;
 
 //   definitions used when building DLL
 #elif defined(LOG4CXX)
@@ -69,10 +68,6 @@
 template class LOG4CXX_EXPORT std::vector<T>; \
 typedef std::vector<T> N;
 
-#define LOG4CXX_SET_DEF(N, T) \
-template class LOG4CXX_EXPORT std::allocator<T>; \
-template class LOG4CXX_EXPORT std::set<T>; \
-typedef std::set<T> N;
 
 #else
 //    definitions used when using DLL
@@ -86,10 +81,6 @@
 extern template class LOG4CXX_EXPORT std::vector<T>; \
 typedef std::vector<T> N;
 
-#define LOG4CXX_SET_DEF(N, T) \
-extern template class LOG4CXX_EXPORT std::allocator<T>; \
-extern template class LOG4CXX_EXPORT std::set<T>; \
-typedef std::set<T> N;
 
 #endif
 

Modified: logging/log4cxx/trunk/src/main/include/log4cxx/spi/loggingevent.h
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/include/log4cxx/spi/loggingevent.h?rev=617676&r1=617675&r2=617676&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/include/log4cxx/spi/loggingevent.h (original)
+++ logging/log4cxx/trunk/src/main/include/log4cxx/spi/loggingevent.h Fri Feb  
1 14:14:52 2008
@@ -30,7 +30,6 @@
 #include <time.h>
 #include <log4cxx/logger.h>
 #include <log4cxx/mdc.h>
-#include <set>
 #include <log4cxx/spi/location/locationinfo.h>
 #include <vector>
 
@@ -158,7 +157,7 @@
                         */
                         bool getMDC(const LogString& key, LogString& dest) 
const;
 
-                        LOG4CXX_SET_DEF(KeySet, LogString)
+                        LOG4CXX_LIST_DEF(KeySet, LogString)
                         /**
                         * Returns the set of of the key values in the MDC for 
the event.
                         * The returned set is unmodifiable by the caller.

Modified: logging/log4cxx/trunk/src/test/cpp/helpers/charsetencodertestcase.cpp
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/helpers/charsetencodertestcase.cpp?rev=617676&r1=617675&r2=617676&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/test/cpp/helpers/charsetencodertestcase.cpp 
(original)
+++ logging/log4cxx/trunk/src/test/cpp/helpers/charsetencodertestcase.cpp Fri 
Feb  1 14:14:52 2008
@@ -34,13 +34,13 @@
 LOGUNIT_CLASS(CharsetEncoderTestCase)
 {
         LOGUNIT_TEST_SUITE(CharsetEncoderTestCase);
-#if APR_HAS_THREADS        
-                LOGUNIT_TEST(thread1);
-#endif                
                 LOGUNIT_TEST(encode1);
                 LOGUNIT_TEST(encode2);
                 LOGUNIT_TEST(encode3);
                 LOGUNIT_TEST(encode4);
+#if APR_HAS_THREADS        
+                LOGUNIT_TEST(thread1);
+#endif                
         LOGUNIT_TEST_SUITE_END();
 
         enum { BUFSIZE = 256 };


Reply via email to