Author: carnold
Date: Mon Sep 24 22:36:39 2007
New Revision: 579076

URL: http://svn.apache.org/viewvc?rev=579076&view=rev
Log:
LOGCXX-18: Restoring << operator (wchar_t pass)

Modified:
    logging/log4cxx/trunk/src/apr-util/apr-util-1.2.8/xml/expat/lib/xmlparse.c
    logging/log4cxx/trunk/src/examples/cpp/trivial.cpp
    logging/log4cxx/trunk/src/main/cpp/messagebuffer.cpp
    logging/log4cxx/trunk/src/main/include/log4cxx/helpers/messagebuffer.h
    logging/log4cxx/trunk/src/test/cpp/streamtestcase.cpp

Modified: 
logging/log4cxx/trunk/src/apr-util/apr-util-1.2.8/xml/expat/lib/xmlparse.c
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/apr-util/apr-util-1.2.8/xml/expat/lib/xmlparse.c?rev=579076&r1=579075&r2=579076&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/apr-util/apr-util-1.2.8/xml/expat/lib/xmlparse.c 
(original)
+++ logging/log4cxx/trunk/src/apr-util/apr-util-1.2.8/xml/expat/lib/xmlparse.c 
Mon Sep 24 22:36:39 2007
@@ -1331,16 +1331,16 @@
 
 const XML_LChar *
 XML_ExpatVersion(void) {
-  return VERSION;
+  return "expat_1.95.1";
 }
 
 XML_Expat_Version
 XML_ExpatVersionInfo(void) {
   XML_Expat_Version version;
 
-  version.major = XML_MAJOR_VERSION;
-  version.minor = XML_MINOR_VERSION;
-  version.micro = XML_MICRO_VERSION;
+  version.major = 1;
+  version.minor = 95;
+  version.micro = 1;
 
   return version;
 }

Modified: logging/log4cxx/trunk/src/examples/cpp/trivial.cpp
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/examples/cpp/trivial.cpp?rev=579076&r1=579075&r2=579076&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/examples/cpp/trivial.cpp (original)
+++ logging/log4cxx/trunk/src/examples/cpp/trivial.cpp Mon Sep 24 22:36:39 2007
@@ -1,53 +1,60 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <log4cxx/logstring.h>
-#include <stdlib.h>
+#include <iostream>
+#include <pthread.h>
+#include <sstream>
 #include <log4cxx/logger.h>
-#include <log4cxx/basicconfigurator.h>
+#include <log4cxx/propertyconfigurator.h>
 #include <log4cxx/helpers/exception.h>
-#include <log4cxx/ndc.h>
-#include <locale.h>
 
-using namespace log4cxx;
-using namespace log4cxx::helpers;
+struct Data
+{
+    int count;
+};
 
-int main()
+void* LogThread(void* args)
 {
-    setlocale(LC_ALL, "");
-    int result = EXIT_SUCCESS;
-    try
+    Data* d = (Data*)args;
+
+    // Build Logger Name
+    std::ostringstream temp;
+    temp << "TestLogger" << d->count;
+    std::string loggerName(temp.str());
+    std::cout << "getting logger = " << loggerName << std::endl;
+
+    log4cxx::LoggerPtr logger(log4cxx::Logger::getLogger(loggerName));
+
+    while(1)
     {
-                BasicConfigurator::configure();
-                LoggerPtr rootLogger = Logger::getRootLogger();
+        logger->debug(loggerName);
+        logger->debug("This is a test of the emergency broadcast system.  This 
is only a test");
+        logger->debug("This is a test of the emergency broadcast system. This 
is only a test");
+        logger->debug("This is a test of the emergency broadcast system.  This 
is only a test");
+        logger->debug("This is a test of the emergency broadcast system.  This 
is only a test");
+        logger->debug("This is a test of the emergency broadcast system.  This 
is only a test");
+        logger->debug("This is a test of the emergency broadcast system.  This 
is only a test");
+        logger->debug("This is a test of the emergency broadcast system.  This 
is only a test");
 
-                NDC::push("trivial context");
+        usleep(5);
+    }
+
+    return 0;
+}
+
+int main(void)
+{
+    log4cxx::LoggerPtr logger(log4cxx::Logger::getRootLogger());
+    for(int count = 0; count < 10; count++)
+    {
+        Data* d = new Data();
+        d->count = count;
 
-                LOG4CXX_DEBUG(rootLogger, "debug message");
-                LOG4CXX_INFO(rootLogger, "info message");
-                LOG4CXX_WARN(rootLogger, "warn message");
-                LOG4CXX_ERROR(rootLogger, "error message");
-                LOG4CXX_FATAL(rootLogger, "fatal message");
-
-                NDC::pop();
-        }
-        catch(std::exception&)
-        {
-                result = EXIT_FAILURE;
-        }
+        pthread_t newThread;
+        pthread_create(&newThread, NULL, &LogThread, d);
+        sleep(1);
+    }
+
+    std::string input;
+    std::cout << "Waiting for input to exit" << std::endl;
+    std::cin >> input;
 
-    return result;
+    return 0;
 }

Modified: logging/log4cxx/trunk/src/main/cpp/messagebuffer.cpp
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/messagebuffer.cpp?rev=579076&r1=579075&r2=579076&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/messagebuffer.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/messagebuffer.cpp Mon Sep 24 22:36:39 
2007
@@ -87,7 +87,7 @@
    
 WideMessageBuffer& MessageBuffer::operator+(const wchar_t* msg) {
    if (0 == msg) {
-       wbuf = new WideMessageBuffer(L"null"):
+       wbuf = new WideMessageBuffer(L"null");
    } else {
        wbuf = new WideMessageBuffer(msg);
    }
@@ -113,7 +113,11 @@
 WideMessageBuffer::WideMessageBuffer(const wchar_t* msg) : buf(msg), stream(0) 
{
 }
 
-WideMessageBuffer::WideMessageBuffer(const std::wstream& msg) : buf(msg), 
stream(0) {
+WideMessageBuffer::WideMessageBuffer(const std::wstring& msg) : buf(msg), 
stream(0) {
+}
+
+WideMessageBuffer::~WideMessageBuffer()  {
+    delete stream;
 }
 
 const std::wstring& WideMessageBuffer::str(const WideMessageBuffer&) const {

Modified: logging/log4cxx/trunk/src/main/include/log4cxx/helpers/messagebuffer.h
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/include/log4cxx/helpers/messagebuffer.h?rev=579076&r1=579075&r2=579076&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/include/log4cxx/helpers/messagebuffer.h 
(original)
+++ logging/log4cxx/trunk/src/main/include/log4cxx/helpers/messagebuffer.h Mon 
Sep 24 22:36:39 2007
@@ -85,8 +85,8 @@
         WideMessageBuffer& operator+(const wchar_t* msg);
         WideMessageBuffer& operator+(const wchar_t msg);
 
-        static std::wstring str(const WideMessageBuffer&);
-        static std::wstring str(const std::wostring&);
+        const std::wstring& str(const WideMessageBuffer&) const;
+        std::wstring str(const std::wostream&) const;
 #endif
 
    private:

Modified: logging/log4cxx/trunk/src/test/cpp/streamtestcase.cpp
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/streamtestcase.cpp?rev=579076&r1=579075&r2=579076&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/test/cpp/streamtestcase.cpp (original)
+++ logging/log4cxx/trunk/src/test/cpp/streamtestcase.cpp Mon Sep 24 22:36:39 
2007
@@ -62,7 +62,7 @@
 #if LOG4CXX_HAS_WCHAR_T
                 CPPUNIT_TEST(testWide);
                 CPPUNIT_TEST(testWideAppend);
-                CPPUNIT_TEST(testWideScientific);
+                CPPUNIT_TEST(testWideWidth);
 #endif
         CPPUNIT_TEST_SUITE_END();
 


Reply via email to