/trunk/log4cxx/src/main/cpp/charsetencoder.cpp |
---|
491,7 → 491,11 |
} else if (StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("UTF-16LE"), LOG4CXX_STR("utf-16le"))) { |
return new UTF16LECharsetEncoder(); |
} |
#if APR_HAS_XLATE || !defined(_WIN32) |
#ifdef LOG4CXX_QT |
//RM5248 not sure what this should be |
return new UTF8CharsetEncoder(); |
#elif APR_HAS_XLATE || !defined(_WIN32) |
return new APRCharsetEncoder(charset); |
#else |
throw IllegalArgumentException(charset); |
/trunk/log4cxx/src/main/cpp/domconfigurator.cpp |
---|
40,11 → 40,14 |
#include <log4cxx/helpers/transcoder.h> |
#include <log4cxx/rolling/rollingfileappender.h> |
#include <log4cxx/rolling/filterbasedtriggeringpolicy.h> |
#include <apr_xml.h> |
#include <log4cxx/helpers/bytebuffer.h> |
#include <log4cxx/helpers/charsetdecoder.h> |
#include <log4cxx/net/smtpappender.h> |
#ifndef LOG4CXX_QT |
#include <apr_xml.h> |
#endif |
using namespace log4cxx; |
using namespace log4cxx::xml; |
using namespace log4cxx::helpers; |
/trunk/log4cxx/src/main/cpp/date.cpp |
---|
22,16 → 22,24 |
#define INT64_C(x) x ## LL |
#endif |
#ifndef LOG4CXX_QT |
#include <apr_time.h> |
#else |
#include <QDateTime> |
#endif |
#include <apr_time.h> |
using namespace log4cxx; |
using namespace log4cxx::helpers; |
IMPLEMENT_LOG4CXX_OBJECT(Date) |
#ifndef LOG4CXX_QT |
Date::Date() : time(apr_time_now()) { |
} |
#else |
Date::Date() : time( QDateTime::currentMSecsSinceEpoch() / 1000 ) { |
} |
#endif |
Date::Date(log4cxx_time_t t) : time(t) { |
} |
40,14 → 48,26 |
} |
log4cxx_time_t Date::getMicrosecondsPerDay() { |
#ifdef LOG4CXX_QT |
return 86400000000; |
#else |
return APR_INT64_C(86400000000); |
#endif |
} |
log4cxx_time_t Date::getMicrosecondsPerSecond() { |
#ifdef LOG4CXX_QT |
return 1000000; |
#else |
return APR_USEC_PER_SEC; |
#endif |
} |
log4cxx_time_t Date::getNextSecond() const { |
#ifdef LOG4CXX_QT |
return ((time / getMicrosecondsPerSecond()) + 1) * getMicrosecondsPerSecond(); |
#else |
return ((time / APR_USEC_PER_SEC) + 1) * APR_USEC_PER_SEC; |
#endif |
} |
/trunk/log4cxx/src/main/cpp/datagramsocket.cpp |
---|
20,8 → 20,13 |
#include <log4cxx/helpers/loglog.h> |
#include <log4cxx/helpers/transcoder.h> |
#ifndef LOG4CXX_QT |
#include "apr_network_io.h" |
#include "apr_lib.h" |
#else |
#include <QHostAddress> |
#include <QByteArray> |
#endif |
using namespace log4cxx::helpers; |
67,6 → 72,7 |
// Create server socket address (including port number) |
LOG4CXX_ENCODE_CHAR(hostAddr, localAddress1->getHostAddress()); |
#ifndef LOG4CXX_QT |
apr_sockaddr_t *server_addr; |
apr_status_t status = |
apr_sockaddr_info_get(&server_addr, hostAddr.c_str(), APR_INET, |
80,6 → 86,13 |
if (status != APR_SUCCESS) { |
throw BindException(status); |
} |
#else |
QHostAddress localHost( localAddress1->getHostAddress().c_str() ); |
bool status = socket->bind( localHost, localPort1 ); |
if( !status ){ |
throw BindException( status ); |
} |
#endif |
this->localPort = localPort1; |
this->localAddress = localAddress1; |
88,6 → 101,7 |
/** Close the socket.*/ |
void DatagramSocket::close() |
{ |
#ifndef LOG4CXX_QT |
if (socket != 0) { |
apr_status_t status = apr_socket_close(socket); |
if (status != APR_SUCCESS) { |
97,6 → 111,11 |
socket = 0; |
localPort = 0; |
} |
#else |
if( socket->isOpen() ){ |
socket->close(); |
} |
#endif |
} |
void DatagramSocket::connect(InetAddressPtr address1, int port1) |
109,6 → 128,7 |
// create socket address |
LOG4CXX_ENCODE_CHAR(hostAddr, address1->getHostAddress()); |
#ifndef LOG4CXX_QT |
apr_sockaddr_t *client_addr; |
apr_status_t status = |
apr_sockaddr_info_get(&client_addr, hostAddr.c_str(), APR_INET, |
122,11 → 142,15 |
if (status != APR_SUCCESS) { |
throw ConnectException(status); |
} |
#else |
socket->connectToHost( address1->getHostAddress().c_str(), port1 ); |
#endif |
} |
/** Creates a datagram socket.*/ |
void DatagramSocket::create() |
{ |
#ifndef LOG4CXX_QT |
apr_socket_t* newSocket; |
apr_status_t status = |
apr_socket_create(&newSocket, APR_INET, SOCK_DGRAM, |
135,6 → 159,9 |
if (status != APR_SUCCESS) { |
throw SocketException(status); |
} |
#else |
socket = new QUdpSocket(); |
#endif |
} |
/** Receive the datagram packet.*/ |
144,6 → 171,7 |
// Create the address from which to receive the datagram packet |
LOG4CXX_ENCODE_CHAR(hostAddr, p->getAddress()->getHostAddress()); |
#ifndef LOG4CXX_QT |
apr_sockaddr_t *addr; |
apr_status_t status = |
apr_sockaddr_info_get(&addr, hostAddr.c_str(), APR_INET, |
159,6 → 187,13 |
if (status != APR_SUCCESS) { |
throw IOException(status); |
} |
#else |
int length = p->getLength(); |
int status = socket->read( (char*)p->getData(), length ); |
if( status == -1 ){ |
throw IOException( status ); |
} |
#endif |
} |
/** Sends a datagram packet.*/ |
168,6 → 203,7 |
// create the adress to which to send the datagram packet |
LOG4CXX_ENCODE_CHAR(hostAddr, p->getAddress()->getHostAddress()); |
#ifndef LOG4CXX_QT |
apr_sockaddr_t *addr; |
apr_status_t status = |
apr_sockaddr_info_get(&addr, hostAddr.c_str(), APR_INET, p->getPort(), |
183,4 → 219,11 |
if (status != APR_SUCCESS) { |
throw IOException(status); |
} |
#else |
int len = p->getLength(); |
int status = socket->write( (const char*)p->getData(), len ); |
if( status < 0 ){ |
throw IOException( status ); |
} |
#endif |
} |
/trunk/log4cxx/src/main/cpp/charsetdecoder.cpp |
---|
482,7 → 482,11 |
StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("ISO-LATIN-1"), LOG4CXX_STR("iso-latin-1"))) { |
return new ISOLatinCharsetDecoder(); |
} |
#if APR_HAS_XLATE || !defined(_WIN32) |
#ifdef LOG4CXX_QT |
//RM5248 not sure what this should be |
return new UTF8CharsetDecoder(); |
#elif APR_HAS_XLATE || !defined(_WIN32) |
return new APRCharsetDecoder(charset); |
#else |
throw IllegalArgumentException(charset); |
/trunk/log4cxx/src/main/cpp/bytearrayinputstream.cpp |
---|
20,6 → 20,7 |
#include <log4cxx/helpers/bytebuffer.h> |
#include <log4cxx/helpers/transcoder.h> |
#include <algorithm> |
#include <string.h> |
using namespace log4cxx; |
using namespace log4cxx::helpers; |
/trunk/log4cxx/src/main/include/log4cxx/log4cxx.h.in |
---|
34,6 → 34,8 |
#define LOG4CXX_UNICHAR_API @UNICHAR_API@ |
#define LOG4CXX_CFSTRING_API @CFSTRING_API@ |
#define LOG4CXX_SUCCESS 0 |
#define LOG4CXX_BADARG 2000 |
typedef long long log4cxx_int64_t; |
#define LOG4CXX_USE_GLOBAL_SCOPE_TEMPLATE 0 |
/trunk/log4cxx/src/main/include/log4cxx/helpers/datagramsocket.h |
---|
24,7 → 24,11 |
#include <log4cxx/helpers/pool.h> |
#include <log4cxx/helpers/datagrampacket.h> |
#ifdef LOG4CXX_QT |
#include <QUdpSocket> |
#else |
extern "C" { struct apr_socket_t; } |
#endif |
namespace log4cxx |
{ |
105,8 → 109,12 |
private: |
DatagramSocket(const DatagramSocket&); |
DatagramSocket& operator=(const DatagramSocket&); |
#ifdef LOG4CXX_QT |
QUdpSocket* socket; |
#else |
/** The APR socket */ |
apr_socket_t *socket; |
#endif |
/** The memory pool for the socket */ |
Pool socketPool; |
/trunk/log4cxx/log4cxx-qt.pro |
---|
5,6 → 5,8 |
#------------------------------------------------- |
QT -= gui |
QT += network |
CONFIG += no_keywords |
TARGET = log4cxx-qt |
TEMPLATE = lib |