carnold 2004/12/18 00:28:28
Modified: . build.xml
examples delayedloop.cpp
include/log4cxx/helpers pool.h stringhelper.h
src Makefile.am pool.cpp stringhelper.cpp
tests/src testchar.h
Log:
LOG4CXX-10: Linux iteration
Revision Changes Path
1.12 +1 -0 logging-log4cxx/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/logging-log4cxx/build.xml,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- build.xml 16 Dec 2004 06:41:15 -0000 1.11
+++ build.xml 18 Dec 2004 08:28:28 -0000 1.12
@@ -171,6 +171,7 @@
</exec>
<exec executable="sh">
<arg value="./configure"/>
+ <arg value="--with-apr=${apr.dir}"/>
</exec>
</target>
1.7 +2 -1 logging-log4cxx/examples/delayedloop.cpp
Index: delayedloop.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/examples/delayedloop.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- delayedloop.cpp 15 Dec 2004 08:10:37 -0000 1.6
+++ delayedloop.cpp 18 Dec 2004 08:28:28 -0000 1.7
@@ -21,6 +21,7 @@
#include <apr_time.h>
#include <iostream>
#include <log4cxx/stream.h>
+#include <exception>
using namespace log4cxx;
using namespace log4cxx::helpers;
@@ -84,7 +85,7 @@
{
apr_sleep(1000000);
}
- catch(Exception& e)
+ catch(std::exception& e)
{
}
}
1.6 +11 -11 logging-log4cxx/include/log4cxx/helpers/pool.h
Index: pool.h
===================================================================
RCS file: /home/cvs/logging-log4cxx/include/log4cxx/helpers/pool.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- pool.h 18 Dec 2004 07:53:04 -0000 1.5
+++ pool.h 18 Dec 2004 08:28:28 -0000 1.6
@@ -18,18 +18,18 @@
#define _LOG4CXX_HELPERS_POOL_H
#include <log4cxx/portability.h>
-
-#if defined(_MSC_VER)
-#if defined(_WIN32) && !defined(WIN32)
-#define WIN32
-#endif
-
-#include <apr_pools.h>
-#else
+
+#if defined(_MSC_VER)
+#if defined(_WIN32) && !defined(WIN32)
+#define WIN32
+#endif
+
+#include <apr_pools.h>
+#else
extern "C" {
struct apr_pool_t;
-}
-#endif
+}
+#endif
namespace log4cxx
{
@@ -41,7 +41,7 @@
Pool();
~Pool();
- inline operator apr_pool_t*() { return pool; }
+ inline operator apr_pool_t*() const { return pool; }
protected:
apr_pool_t* pool;
1.15 +17 -17 logging-log4cxx/include/log4cxx/helpers/stringhelper.h
Index: stringhelper.h
===================================================================
RCS file: /home/cvs/logging-log4cxx/include/log4cxx/helpers/stringhelper.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- stringhelper.h 18 Dec 2004 07:53:04 -0000 1.14
+++ stringhelper.h 18 Dec 2004 08:28:28 -0000 1.15
@@ -20,40 +20,40 @@
#include <log4cxx/portability.h>
#include <log4cxx/logstring.h>
#include <stdarg.h>
-
+
+extern "C" {
+struct apr_pool_t;
+}
namespace log4cxx
{
namespace helpers
{
- /**
- String manipulation routines
- */
+ class Pool;
+ /**
+ String manipulation routines
+ */
class LOG4CXX_EXPORT StringHelper
{
public:
static std::string trim(const std::string& s);
static std::wstring trim(const std::wstring& s);
- static bool startsWith(const std::string& s, const std::string&
suffix);
- static bool startsWith(const std::wstring& s, const
std::wstring& suffix);
+ static bool startsWith(const std::string& s, const std::string&
suffix);
+ static bool startsWith(const std::wstring& s, const
std::wstring& suffix);
static bool endsWith(const std::string& s, const std::string&
suffix);
static bool endsWith(const std::wstring& s, const std::wstring&
suffix);
- static bool equalsIgnoreCase(const std::string& s1, const char*
upper, const char* lower);
- static bool equalsIgnoreCase(const std::wstring& s1, const
wchar_t* upper, const wchar_t* lower);
+ static bool equalsIgnoreCase(const std::string& s1,
+ const char* upper, const char* lower);
+ static bool equalsIgnoreCase(const std::wstring& s1,
+ const wchar_t* upper, const wchar_t* lower);
static int toInt(const std::string& s);
static int toInt(const std::wstring& s);
static log4cxx_int64_t toInt64(const std::string& s);
static log4cxx_int64_t toInt64(const std::wstring& s);
-
-#if defined(_MSC_VER)
- //
- // TODO: would fail to link with VC6 if apr_pool_t* was used
- //
- static LogString toString(int s, void* pool);
-#else
- static LogString toString(int s, apr_pool_t* pool);
-#endif
+
+ static LogString toString(int s, const log4cxx::helpers::Pool&
pool);
+ static LogString toString(int s, apr_pool_t* pool);
static LogString toString(int s);
static std::string toLowerCase(const std::string& s);
1.23 +2 -1 logging-log4cxx/src/Makefile.am
Index: Makefile.am
===================================================================
RCS file: /home/cvs/logging-log4cxx/src/Makefile.am,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- Makefile.am 16 Dec 2004 00:21:46 -0000 1.22
+++ Makefile.am 18 Dec 2004 08:28:28 -0000 1.23
@@ -46,6 +46,7 @@
ndc.cpp \
nteventlogappender.cpp \
objectimpl.cpp \
+ objectptr.cpp \
odbcappender.cpp \
onlyonceerrorhandler.cpp \
optionconverter.cpp \
@@ -67,7 +68,7 @@
smtpappender.cpp \
socket.cpp \
socketappender.cpp \
- socketappenderskeleton.cpp \
+ socketappenderskeleton.cpp \
sockethubappender.cpp \
socketimpl.cpp \
socketinputstream.cpp \
1.3 +17 -17 logging-log4cxx/src/pool.cpp
Index: pool.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/src/pool.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- pool.cpp 18 Dec 2004 07:53:05 -0000 1.2
+++ pool.cpp 18 Dec 2004 08:28:28 -0000 1.3
@@ -1,36 +1,36 @@
/*
* Copyright 2003,2004 The Apache Software Foundation.
- *
+ *
* Licensed 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/helpers/pool.h>
-#include <log4cxx/helpers/exception.h>
+
+#include <log4cxx/helpers/pool.h>
+#include <log4cxx/helpers/exception.h>
#include <log4cxx/helpers/aprinitializer.h>
-#include <apr_pools.h>
+#include <apr_pools.h>
using namespace log4cxx::helpers;
using namespace log4cxx;
-
-Pool::Pool() : pool(0) {
+
+Pool::Pool() : pool(0) {
apr_status_t stat = apr_pool_create(&pool,
APRInitializer::getRootPool());
- if (stat != APR_SUCCESS) {
- throw PoolException(stat);
- }
-}
-
-Pool::~Pool() {
- apr_pool_destroy(pool);
+ if (stat != APR_SUCCESS) {
+ throw PoolException(stat);
+ }
}
-
+
+Pool::~Pool() {
+ apr_pool_destroy(pool);
+}
+
1.7 +48 -48 logging-log4cxx/src/stringhelper.cpp
Index: stringhelper.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/src/stringhelper.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- stringhelper.cpp 18 Dec 2004 07:53:05 -0000 1.6
+++ stringhelper.cpp 18 Dec 2004 08:28:28 -0000 1.7
@@ -27,37 +27,37 @@
std::string StringHelper::toLowerCase(const std::string& s)
{
- std::string d;
- std::transform(s.begin(), s.end(),
- std::insert_iterator<std::string>(d, d.begin()), tolower);
- return d;
+ std::string d;
+ std::transform(s.begin(), s.end(),
+ std::insert_iterator<std::string>(d, d.begin()), tolower);
+ return d;
}
std::wstring StringHelper::toLowerCase(const std::wstring& s)
{
- std::wstring d;
-#if defined(_MSC_VER)
- std::transform(s.begin(), s.end(),
- std::insert_iterator<std::wstring>(d, d.begin()),
- towlower);
-#else
+ std::wstring d;
+#if defined(_MSC_VER)
std::transform(s.begin(), s.end(),
std::insert_iterator<std::wstring>(d, d.begin()),
- std::tolower<wchar_t>);
-#endif
+ towlower);
+#else
+ std::transform(s.begin(), s.end(),
+ std::insert_iterator<std::wstring>(d, d.begin()),
+ (int(*)(int)) std::tolower);
+#endif
return d;
}
std::string StringHelper::trim(const std::string& s)
{
- std::string::size_type pos = s.find_first_not_of(' ');
- if (pos == std::string::npos)
- {
- return std::string();
- }
+ std::string::size_type pos = s.find_first_not_of(' ');
+ if (pos == std::string::npos)
+ {
+ return std::string();
+ }
- std::string::size_type n = s.find_last_not_of(' ') - pos + 1;
- return s.substr(pos, n);
+ std::string::size_type n = s.find_last_not_of(' ') - pos + 1;
+ return s.substr(pos, n);
}
std::wstring StringHelper::trim(const std::wstring& s)
@@ -71,28 +71,28 @@
std::wstring::size_type n = s.find_last_not_of(L' ') - pos + 1;
return s.substr(pos, n);
}
-
-
-bool StringHelper::startsWith(const std::wstring& teststr, const
std::wstring& substr)
- {
- bool val = false;
- if(teststr.length() > substr.length()) {
- val = teststr.substr(0, substr.length()) == substr;
- }
-
- return val;
-}
-
-bool StringHelper::startsWith(const std::string& teststr, const std::string&
substr)
- {
- bool val = false;
- if(teststr.length() > substr.length()) {
- val = teststr.substr(0, substr.length()) == substr;
- }
-
- return val;
-}
-
+
+
+bool StringHelper::startsWith(const std::wstring& teststr, const
std::wstring& substr)
+ {
+ bool val = false;
+ if(teststr.length() > substr.length()) {
+ val = teststr.substr(0, substr.length()) == substr;
+ }
+
+ return val;
+}
+
+bool StringHelper::startsWith(const std::string& teststr, const std::string&
substr)
+ {
+ bool val = false;
+ if(teststr.length() > substr.length()) {
+ val = teststr.substr(0, substr.length()) == substr;
+ }
+
+ return val;
+}
+
bool StringHelper::endsWith(const std::string& s, const std::string& suffix)
{
@@ -179,13 +179,13 @@
LOG4CXX_ENCODE_CHAR(charstr, logstr);
return apr_atoi64(charstr.c_str());
}
-
-#if defined(_MSC_VER)
-LogString StringHelper::toString(int s, void* pool) {
-#else
-LogString StringHelper::toString(int s, apr_pool_t* pool) {
-#endif
- char* fmt = apr_itoa((apr_pool_t*) pool, s);
+
+LogString StringHelper::toString(int s, const Pool& pool) {
+ return toString(s, (apr_pool_t*) pool);
+}
+
+LogString StringHelper::toString(int s, apr_pool_t* pool) {
+ char* fmt = apr_itoa(pool, s);
LogString str;
log4cxx::helpers::Transcoder::decode(fmt, strlen(fmt), str);
return str;
1.3 +3 -3 logging-log4cxx/tests/src/testchar.h
Index: testchar.h
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/testchar.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- testchar.h 18 Dec 2004 07:53:06 -0000 1.2
+++ testchar.h 18 Dec 2004 08:28:28 -0000 1.3
@@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
#if !defined(_LOG4CXX_TESTCHAR_H)
-#define _LOG4CXX_TESTCHAR_H
+#define _LOG4CXX_TESTCHAR_H
//
// This macro and typedef lets many tests
@@ -29,4 +29,4 @@
typedef char testchar;
#endif
-#endif
\ No newline at end of file
+#endif