submitted 1.2.0

This commit is contained in:
Guenter Obiltschnig
2006-08-29 07:10:35 +00:00
parent f476bd6b32
commit 2d4078f392
1428 changed files with 25715 additions and 12456 deletions

View File

@@ -1,7 +1,7 @@
//
// ASCIIEncoding.cpp
//
// $Id: //poco/1.1.0/Foundation/src/ASCIIEncoding.cpp#2 $
// $Id: //poco/1.2/Foundation/src/ASCIIEncoding.cpp#1 $
//
// Library: Foundation
// Package: Text
@@ -34,10 +34,10 @@
//
#include "Foundation/ASCIIEncoding.h"
#include "Poco/ASCIIEncoding.h"
Foundation_BEGIN
namespace Poco {
const TextEncoding::CharacterMap ASCIIEncoding::_charMap =
@@ -94,4 +94,4 @@ int ASCIIEncoding::convert(int ch, unsigned char* bytes, int length) const
}
Foundation_END
} // namespace Poco

View File

@@ -0,0 +1,133 @@
//
// ActiveDispatcher.cpp
//
// $Id: //poco/1.2/Foundation/src/ActiveDispatcher.cpp#1 $
//
// Library: Foundation
// Package: Threading
// Module: ActiveObjects
//
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#include "Poco/ActiveDispatcher.h"
#include "Poco/Notification.h"
#include "Poco/AutoPtr.h"
namespace Poco {
namespace
{
class MethodNotification: public Notification
{
public:
MethodNotification(Runnable* pRunnable):
_pRunnable(pRunnable)
{
}
Runnable* runnable() const
{
return _pRunnable;
}
private:
Runnable* _pRunnable;
};
class StopNotification: public Notification
{
};
}
ActiveDispatcher::ActiveDispatcher()
{
_thread.start(*this);
}
ActiveDispatcher::ActiveDispatcher(Thread::Priority prio)
{
_thread.setPriority(prio);
_thread.start(*this);
}
ActiveDispatcher::~ActiveDispatcher()
{
try
{
stop();
}
catch (...)
{
}
}
void ActiveDispatcher::start(Runnable* pRunnable)
{
poco_check_ptr (pRunnable);
_queue.enqueueNotification(new MethodNotification(pRunnable));
}
void ActiveDispatcher::cancel()
{
_queue.clear();
}
void ActiveDispatcher::run()
{
AutoPtr<Notification> pNf = _queue.waitDequeueNotification();
while (pNf && !dynamic_cast<StopNotification*>(pNf.get()))
{
MethodNotification* pMethodNf = dynamic_cast<MethodNotification*>(pNf.get());
poco_check_ptr (pMethodNf);
Runnable* pRunnable = pMethodNf->runnable();
poco_check_ptr (pRunnable);
pRunnable->run();
pNf = _queue.waitDequeueNotification();
}
}
void ActiveDispatcher::stop()
{
_queue.clear();
_queue.wakeUpAll();
_queue.enqueueNotification(new StopNotification);
_thread.join();
}
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// ArchiveStrategy.cpp
//
// $Id: //poco/1.1.0/Foundation/src/ArchiveStrategy.cpp#2 $
// $Id: //poco/1.2/Foundation/src/ArchiveStrategy.cpp#1 $
//
// Library: Foundation
// Package: Logging
@@ -34,17 +34,63 @@
//
#include "Foundation/ArchiveStrategy.h"
#include "Foundation/NumberFormatter.h"
#include "Foundation/File.h"
#include "Foundation/Path.h"
#include "Foundation/DeflatingStream.h"
#include "Foundation/StreamCopier.h"
#include "Foundation/Exception.h"
#include "Poco/ArchiveStrategy.h"
#include "Poco/NumberFormatter.h"
#include "Poco/File.h"
#include "Poco/Path.h"
#include "Poco/DeflatingStream.h"
#include "Poco/StreamCopier.h"
#include "Poco/Exception.h"
#include "Poco/ActiveDispatcher.h"
#include "Poco/ActiveMethod.h"
#include "Poco/Void.h"
#include <fstream>
Foundation_BEGIN
namespace Poco {
//
// ArchiveCompressor
//
class ArchiveCompressor: public ActiveDispatcher
{
public:
ArchiveCompressor():
compress(this, &ArchiveCompressor::compressImpl)
{
}
~ArchiveCompressor()
{
}
ActiveMethod<Void, std::string, ArchiveCompressor, ActiveStarter<ActiveDispatcher> > compress;
protected:
Void compressImpl(const std::string& path)
{
std::string gzPath(path);
gzPath.append(".gz");
std::ifstream istr(path.c_str(), std::ios::binary | std::ios::in);
if (!istr.good()) throw OpenFileException(path);
std::ofstream ostr(gzPath.c_str(), std::ios::binary | std::ios::out);
if (ostr.good())
{
DeflatingOutputStream deflater(ostr, DeflatingStreamBuf::STREAM_GZIP);
StreamCopier::copyStream(istr, deflater);
deflater.close();
ostr.close();
istr.close();
File f(path);
f.remove();
}
else throw CreateFileException(gzPath);
return Void();
}
};
//
@@ -52,13 +98,16 @@ Foundation_BEGIN
//
ArchiveStrategy::ArchiveStrategy(): _compress(false)
ArchiveStrategy::ArchiveStrategy():
_compress(false),
_pCompressor(0)
{
}
ArchiveStrategy::~ArchiveStrategy()
{
delete _pCompressor;
}
@@ -87,19 +136,9 @@ void ArchiveStrategy::moveFile(const std::string& oldPath, const std::string& ne
}
else
{
std::ifstream istr(f.path().c_str(), std::ios::binary | std::ios::in);
if (!istr.good()) throw OpenFileException(oldPath);
std::ofstream ostr(mvPath.c_str(), std::ios::binary | std::ios::out);
if (ostr.good())
{
DeflatingOutputStream deflater(ostr, DeflatingStreamBuf::STREAM_GZIP);
StreamCopier::copyStream(istr, deflater);
deflater.close();
ostr.close();
istr.close();
f.remove();
}
else throw CreateFileException(mvPath);
f.renameTo(newPath);
if (!_pCompressor) _pCompressor = new ArchiveCompressor;
_pCompressor->compress(newPath);
}
}
@@ -169,4 +208,4 @@ LogFile* ArchiveByNumberStrategy::archive(LogFile* pFile)
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// AsyncChannel.cpp
//
// $Id: //poco/1.1.0/Foundation/src/AsyncChannel.cpp#2 $
// $Id: //poco/1.2/Foundation/src/AsyncChannel.cpp#1 $
//
// Library: Foundation
// Package: Logging
@@ -34,15 +34,15 @@
//
#include "Foundation/AsyncChannel.h"
#include "Foundation/Notification.h"
#include "Foundation/Message.h"
#include "Foundation/Formatter.h"
#include "Foundation/AutoPtr.h"
#include "Foundation/LoggingRegistry.h"
#include "Poco/AsyncChannel.h"
#include "Poco/Notification.h"
#include "Poco/Message.h"
#include "Poco/Formatter.h"
#include "Poco/AutoPtr.h"
#include "Poco/LoggingRegistry.h"
Foundation_BEGIN
namespace Poco {
class MessageNotification: public Notification
@@ -144,4 +144,4 @@ void AsyncChannel::run()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// Base64Decoder.cpp
//
// $Id: //poco/1.1.0/Foundation/src/Base64Decoder.cpp#2 $
// $Id: //poco/1.2/Foundation/src/Base64Decoder.cpp#1 $
//
// Library: Foundation
// Package: Streams
@@ -34,13 +34,13 @@
//
#include "Foundation/Base64Decoder.h"
#include "Foundation/Base64Encoder.h"
#include "Foundation/Exception.h"
#include "Foundation/Mutex.h"
#include "Poco/Base64Decoder.h"
#include "Poco/Base64Encoder.h"
#include "Poco/Exception.h"
#include "Poco/Mutex.h"
Foundation_BEGIN
namespace Poco {
unsigned char Base64DecoderBuf::IN_ENCODING[256];
@@ -56,11 +56,11 @@ Base64DecoderBuf::Base64DecoderBuf(std::istream& istr):
FastMutex::ScopedLock lock(mutex);
if (!IN_ENCODING_INIT)
{
for (int i = 0; i < sizeof(IN_ENCODING); i++)
for (unsigned i = 0; i < sizeof(IN_ENCODING); i++)
{
IN_ENCODING[i] = 0xFF;
}
for (int i = 0; i < sizeof(Base64EncoderBuf::OUT_ENCODING); i++)
for (unsigned i = 0; i < sizeof(Base64EncoderBuf::OUT_ENCODING); i++)
{
IN_ENCODING[Base64EncoderBuf::OUT_ENCODING[i]] = i;
}
@@ -150,4 +150,4 @@ Base64Decoder::~Base64Decoder()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// Base64Encoder.cpp
//
// $Id: //poco/1.1.0/Foundation/src/Base64Encoder.cpp#2 $
// $Id: //poco/1.2/Foundation/src/Base64Encoder.cpp#1 $
//
// Library: Foundation
// Package: Streams
@@ -34,10 +34,10 @@
//
#include "Foundation/Base64Encoder.h"
#include "Poco/Base64Encoder.h"
Foundation_BEGIN
namespace Poco {
const unsigned char Base64EncoderBuf::OUT_ENCODING[64] =
@@ -178,4 +178,4 @@ Base64Encoder::~Base64Encoder()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// BinaryReader.cpp
//
// $Id: //poco/1.1.0/Foundation/src/BinaryReader.cpp#2 $
// $Id: //poco/1.2/Foundation/src/BinaryReader.cpp#1 $
//
// Library: Foundation
// Package: Streams
@@ -34,11 +34,11 @@
//
#include "Foundation/BinaryReader.h"
#include "Foundation/ByteOrder.h"
#include "Poco/BinaryReader.h"
#include "Poco/ByteOrder.h"
Foundation_BEGIN
namespace Poco {
BinaryReader::BinaryReader(std::istream& istr, StreamByteOrder byteOrder):
@@ -147,7 +147,7 @@ BinaryReader& BinaryReader::operator >> (float& value)
{
char* ptr = (char*) &value;
ptr += sizeof(value);
for (int i = 0; i < sizeof(value); ++i)
for (unsigned i = 0; i < sizeof(value); ++i)
_istr.read(--ptr, 1);
}
else
@@ -164,7 +164,7 @@ BinaryReader& BinaryReader::operator >> (double& value)
{
char* ptr = (char*) &value;
ptr += sizeof(value);
for (int i = 0; i < sizeof(value); ++i)
for (unsigned i = 0; i < sizeof(value); ++i)
_istr.read(--ptr, 1);
}
else
@@ -270,10 +270,10 @@ void BinaryReader::readRaw(int length, std::string& value)
void BinaryReader::readBOM()
{
UInt32 bom;
UInt16 bom;
_istr.read((char*) &bom, sizeof(bom));
_flipBytes = bom != 0xFEFF;
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// BinaryWriter.cpp
//
// $Id: //poco/1.1.0/Foundation/src/BinaryWriter.cpp#2 $
// $Id: //poco/1.2/Foundation/src/BinaryWriter.cpp#1 $
//
// Library: Foundation
// Package: Streams
@@ -34,12 +34,12 @@
//
#include "Foundation/BinaryWriter.h"
#include "Foundation/ByteOrder.h"
#include "Poco/BinaryWriter.h"
#include "Poco/ByteOrder.h"
#include <string.h>
Foundation_BEGIN
namespace Poco {
BinaryWriter::BinaryWriter(std::ostream& ostr, StreamByteOrder byteOrder):
@@ -190,7 +190,7 @@ BinaryWriter& BinaryWriter::operator << (float value)
{
const char* ptr = (const char*) &value;
ptr += sizeof(value);
for (int i = 0; i < sizeof(value); ++i)
for (unsigned i = 0; i < sizeof(value); ++i)
_ostr.write(--ptr, 1);
}
else
@@ -207,7 +207,7 @@ BinaryWriter& BinaryWriter::operator << (double value)
{
const char* ptr = (const char*) &value;
ptr += sizeof(value);
for (int i = 0; i < sizeof(value); ++i)
for (unsigned i = 0; i < sizeof(value); ++i)
_ostr.write(--ptr, 1);
}
else
@@ -313,7 +313,7 @@ void BinaryWriter::writeRaw(const std::string& rawData)
void BinaryWriter::writeBOM()
{
UInt32 value = 0xFEFF;
UInt16 value = 0xFEFF;
if (_flipBytes) value = ByteOrder::flipBytes(value);
_ostr.write((const char*) &value, sizeof(value));
}
@@ -325,4 +325,4 @@ void BinaryWriter::flush()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// Bugcheck.cpp
//
// $Id: //poco/1.1.0/Foundation/src/Bugcheck.cpp#2 $
// $Id: //poco/1.2/Foundation/src/Bugcheck.cpp#1 $
//
// Library: Foundation
// Package: Core
@@ -34,13 +34,13 @@
//
#include "Foundation/Bugcheck.h"
#include "Foundation/Debugger.h"
#include "Foundation/Exception.h"
#include "Poco/Bugcheck.h"
#include "Poco/Debugger.h"
#include "Poco/Exception.h"
#include <sstream>
Foundation_BEGIN
namespace Poco {
void Bugcheck::assertion(const char* cond, const char* file, int line)
@@ -100,4 +100,4 @@ std::string Bugcheck::what(const char* msg, const char* file, int line)
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// ByteOrder.cpp
//
// $Id: //poco/1.1.0/Foundation/src/ByteOrder.cpp#2 $
// $Id: //poco/1.2/Foundation/src/ByteOrder.cpp#1 $
//
// Library: Foundation
// Package: Core
@@ -34,4 +34,4 @@
//
#include "Foundation/ByteOrder.h"
#include "Poco/ByteOrder.h"

View File

@@ -1,7 +1,7 @@
//
// Channel.cpp
//
// $Id: //poco/1.1.0/Foundation/src/Channel.cpp#2 $
// $Id: //poco/1.2/Foundation/src/Channel.cpp#1 $
//
// Library: Foundation
// Package: Logging
@@ -34,10 +34,10 @@
//
#include "Foundation/Channel.h"
#include "Poco/Channel.h"
Foundation_BEGIN
namespace Poco {
Channel::Channel()
@@ -72,4 +72,4 @@ std::string Channel::getProperty(const std::string& name) const
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// Configurable.cpp
//
// $Id: //poco/1.1.0/Foundation/src/Configurable.cpp#2 $
// $Id: //poco/1.2/Foundation/src/Configurable.cpp#1 $
//
// Library: Foundation
// Package: Logging
@@ -34,10 +34,10 @@
//
#include "Foundation/Configurable.h"
#include "Poco/Configurable.h"
Foundation_BEGIN
namespace Poco {
Configurable::Configurable()
@@ -50,4 +50,4 @@ Configurable::~Configurable()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// ConsoleChannel.cpp
//
// $Id: //poco/1.1.0/Foundation/src/ConsoleChannel.cpp#2 $
// $Id: //poco/1.2/Foundation/src/ConsoleChannel.cpp#1 $
//
// Library: Foundation
// Package: Logging
@@ -34,12 +34,12 @@
//
#include "Foundation/ConsoleChannel.h"
#include "Foundation/Message.h"
#include "Poco/ConsoleChannel.h"
#include "Poco/Message.h"
#include <iostream>
Foundation_BEGIN
namespace Poco {
FastMutex ConsoleChannel::_mutex;
@@ -68,4 +68,4 @@ void ConsoleChannel::log(const Message& msg)
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// CountingStream.cpp
//
// $Id: //poco/1.1.0/Foundation/src/CountingStream.cpp#2 $
// $Id: //poco/1.2/Foundation/src/CountingStream.cpp#1 $
//
// Library: Foundation
// Package: Streams
@@ -34,10 +34,10 @@
//
#include "Foundation/CountingStream.h"
#include "Poco/CountingStream.h"
Foundation_BEGIN
namespace Poco {
CountingStreamBuf::CountingStreamBuf():
@@ -182,4 +182,4 @@ CountingOutputStream::~CountingOutputStream()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// DateTime.cpp
//
// $Id: //poco/1.1.0/Foundation/src/DateTime.cpp#2 $
// $Id: //poco/1.2/Foundation/src/DateTime.cpp#1 $
//
// Library: Foundation
// Package: DateTime
@@ -34,12 +34,12 @@
//
#include "Foundation/DateTime.h"
#include "Poco/DateTime.h"
#include <algorithm>
#include <math.h>
Foundation_BEGIN
namespace Poco {
inline double DateTime::toJulianDay(Timestamp::UtcTimeVal utcTime)
@@ -59,16 +59,16 @@ DateTime::DateTime()
{
Timestamp now;
_utcTime = now.utcTime();
_julianDay = toJulianDay(_utcTime);
computeGregorian();
computeGregorian(julianDay());
computeDaytime();
}
DateTime::DateTime(const Timestamp& timestamp):
_utcTime(timestamp.utcTime()),
_julianDay(toJulianDay(_utcTime))
_utcTime(timestamp.utcTime())
{
computeGregorian();
computeGregorian(julianDay());
computeDaytime();
}
@@ -91,30 +91,27 @@ DateTime::DateTime(int year, int month, int day, int hour, int minute, int secon
poco_assert (millisecond >= 0 && millisecond <= 999);
poco_assert (microsecond >= 0 && microsecond <= 999);
_julianDay = toJulianDay(year, month, day, hour, minute, second, millisecond, microsecond);
_utcTime = toUtcTime(_julianDay);
_utcTime = toUtcTime(toJulianDay(year, month, day)) + 10*(hour*Timespan::HOURS + minute*Timespan::MINUTES + second*Timespan::SECONDS + millisecond*Timespan::MILLISECONDS + microsecond);
}
DateTime::DateTime(double julianDay):
_utcTime(toUtcTime(julianDay)),
_julianDay(julianDay)
_utcTime(toUtcTime(julianDay))
{
computeGregorian();
computeGregorian(julianDay);
}
DateTime::DateTime(Timestamp::UtcTimeVal utcTime, Timestamp::TimeDiff diff):
_utcTime(utcTime + diff*10),
_julianDay(toJulianDay(_utcTime))
_utcTime(utcTime + diff*10)
{
computeGregorian();
computeGregorian(julianDay());
computeDaytime();
}
DateTime::DateTime(const DateTime& dateTime):
_utcTime(dateTime._utcTime),
_julianDay(dateTime._julianDay),
_year(dateTime._year),
_month(dateTime._month),
_day(dateTime._day),
@@ -137,7 +134,6 @@ DateTime& DateTime::operator = (const DateTime& dateTime)
if (&dateTime != this)
{
_utcTime = dateTime._utcTime;
_julianDay = dateTime._julianDay;
_year = dateTime._year;
_month = dateTime._month;
_day = dateTime._day;
@@ -153,18 +149,17 @@ DateTime& DateTime::operator = (const DateTime& dateTime)
DateTime& DateTime::operator = (const Timestamp& timestamp)
{
_utcTime = timestamp.utcTime();
_julianDay = toJulianDay(_utcTime);
computeGregorian();
_utcTime = timestamp.utcTime();
computeGregorian(julianDay());
computeDaytime();
return *this;
}
DateTime& DateTime::operator = (double julianDay)
{
_julianDay = julianDay;
_utcTime = toUtcTime(julianDay);
computeGregorian();
_utcTime = toUtcTime(julianDay);
computeGregorian(julianDay);
return *this;
}
@@ -180,8 +175,7 @@ DateTime& DateTime::assign(int year, int month, int day, int hour, int minute, i
poco_assert (millisecond >= 0 && millisecond <= 999);
poco_assert (microsecond >= 0 && microsecond <= 999);
_julianDay = toJulianDay(year, month, day, hour, minute, second, millisecond, microsecond);
_utcTime = toUtcTime(_julianDay);
_utcTime = toUtcTime(toJulianDay(year, month, day)) + 10*(hour*Timespan::HOURS + minute*Timespan::MINUTES + second*Timespan::SECONDS + millisecond*Timespan::MILLISECONDS + microsecond);
_year = year;
_month = month;
_day = day;
@@ -198,7 +192,6 @@ DateTime& DateTime::assign(int year, int month, int day, int hour, int minute, i
void DateTime::swap(DateTime& dateTime)
{
std::swap(_utcTime, dateTime._utcTime);
std::swap(_julianDay, dateTime._julianDay);
std::swap(_year, dateTime._year);
std::swap(_month, dateTime._month);
std::swap(_day, dateTime._day);
@@ -212,7 +205,7 @@ void DateTime::swap(DateTime& dateTime)
int DateTime::dayOfWeek() const
{
return int((floor(_julianDay + 1.5))) % 7;
return int((floor(julianDay() + 1.5))) % 7;
}
@@ -239,6 +232,20 @@ int DateTime::daysOfMonth(int year, int month)
}
bool DateTime::isValid(int year, int month, int day, int hour, int minute, int second, int millisecond, int microsecond)
{
return
(year >= 0 && year <= 9999) &&
(month >= 1 && month <= 12) &&
(day >= 1 && day <= daysOfMonth(year, month)) &&
(hour >= 0 && hour <= 23) &&
(minute >= 0 && minute <= 59) &&
(second >= 0 && second <= 59) &&
(millisecond >= 0 && millisecond <= 999) &&
(microsecond >= 0 && microsecond <= 999);
}
int DateTime::week(int firstDayOfWeek) const
{
poco_assert (firstDayOfWeek >= 0 && firstDayOfWeek <= 6);
@@ -256,6 +263,12 @@ int DateTime::week(int firstDayOfWeek) const
}
double DateTime::julianDay() const
{
return toJulianDay(_utcTime);
}
DateTime DateTime::operator + (const Timespan& span) const
{
return DateTime(_utcTime, span.totalMicroseconds());
@@ -277,8 +290,8 @@ Timespan DateTime::operator - (const DateTime& dateTime) const
DateTime& DateTime::operator += (const Timespan& span)
{
_utcTime += span.totalMicroseconds()*10;
_julianDay = toJulianDay(_utcTime);
computeGregorian();
computeGregorian(julianDay());
computeDaytime();
return *this;
}
@@ -286,8 +299,8 @@ DateTime& DateTime::operator += (const Timespan& span)
DateTime& DateTime::operator -= (const Timespan& span)
{
_utcTime -= span.totalMicroseconds()*10;
_julianDay = toJulianDay(_utcTime);
computeGregorian();
computeGregorian(julianDay());
computeDaytime();
return *this;
}
@@ -339,10 +352,10 @@ void DateTime::normalize()
}
void DateTime::computeGregorian()
void DateTime::computeGregorian(double julianDay)
{
double z = floor(_julianDay - 1721118.5);
double r = _julianDay - 1721118.5 - z;
double z = floor(julianDay - 1721118.5);
double r = julianDay - 1721118.5 - z;
double g = z - 0.25;
double a = floor(g / 36524.25);
double b = a - floor(a/4);
@@ -380,8 +393,18 @@ void DateTime::computeGregorian()
poco_assert_dbg (_second >= 0 && _second <= 59);
poco_assert_dbg (_millisecond >= 0 && _millisecond <= 999);
poco_assert_dbg (_microsecond >= 0 && _microsecond <= 999);
}
Foundation_END
void DateTime::computeDaytime()
{
Timespan span(_utcTime/10);
_hour = span.hours();
_minute = span.minutes();
_second = span.seconds();
_millisecond = span.milliseconds();
_microsecond = span.microseconds();
}
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// DateTimeFormat.cpp
//
// $Id: //poco/1.1.0/Foundation/src/DateTimeFormat.cpp#2 $
// $Id: //poco/1.2/Foundation/src/DateTimeFormat.cpp#1 $
//
// Library: Foundation
// Package: DateTime
@@ -34,10 +34,10 @@
//
#include "Foundation/DateTimeFormat.h"
#include "Poco/DateTimeFormat.h"
Foundation_BEGIN
namespace Poco {
const std::string DateTimeFormat::ISO8601_FORMAT = "%Y-%m-%dT%H:%M:%S%z";
@@ -79,4 +79,4 @@ const std::string DateTimeFormat::MONTH_NAMES[] =
};
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// DateTimeFormatter.cpp
//
// $Id: //poco/1.1.0/Foundation/src/DateTimeFormatter.cpp#2 $
// $Id: //poco/1.2/Foundation/src/DateTimeFormatter.cpp#1 $
//
// Library: Foundation
// Package: DateTime
@@ -34,15 +34,15 @@
//
#include "Foundation/DateTimeFormatter.h"
#include "Foundation/DateTimeFormat.h"
#include "Foundation/DateTime.h"
#include "Foundation/LocalDateTime.h"
#include "Foundation/Timestamp.h"
#include "Foundation/NumberFormatter.h"
#include "Poco/DateTimeFormatter.h"
#include "Poco/DateTimeFormat.h"
#include "Poco/DateTime.h"
#include "Poco/LocalDateTime.h"
#include "Poco/Timestamp.h"
#include "Poco/NumberFormatter.h"
Foundation_BEGIN
namespace Poco {
std::string DateTimeFormatter::format(const Timestamp& timestamp, const std::string& fmt, int timeZoneDifferential)
@@ -185,4 +185,4 @@ std::string DateTimeFormatter::tzdRFC(int timeZoneDifferential)
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// DateTimeParser.cpp
//
// $Id: //poco/1.1.0/Foundation/src/DateTimeParser.cpp#2 $
// $Id: //poco/1.2/Foundation/src/DateTimeParser.cpp#1 $
//
// Library: Foundation
// Package: DateTime
@@ -34,14 +34,14 @@
//
#include "Foundation/DateTimeParser.h"
#include "Foundation/DateTimeFormat.h"
#include "Foundation/DateTime.h"
#include "Foundation/Exception.h"
#include "Poco/DateTimeParser.h"
#include "Poco/DateTimeFormat.h"
#include "Poco/DateTime.h"
#include "Poco/Exception.h"
#include <ctype.h>
Foundation_BEGIN
namespace Poco {
#define SKIP_JUNK() \
@@ -275,7 +275,7 @@ int DateTimeParser::parseTZD(std::string::const_iterator& it, const std::string:
if (it != end && isalpha(*it)) designator += *it++;
if (it != end && isalpha(*it)) designator += *it++;
if (it != end && isalpha(*it)) designator += *it++;
for (int i = 0; i < sizeof(zones)/sizeof(Zone); ++i)
for (unsigned i = 0; i < sizeof(zones)/sizeof(Zone); ++i)
{
if (designator == zones[i].designator)
return zones[i].timeZoneDifferential;
@@ -366,4 +366,4 @@ int DateTimeParser::parseAMPM(std::string::const_iterator& it, const std::string
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// Debugger.cpp
//
// $Id: //poco/1.1.0/Foundation/src/Debugger.cpp#2 $
// $Id: //poco/1.2/Foundation/src/Debugger.cpp#1 $
//
// Library: Foundation
// Package: Core
@@ -34,7 +34,7 @@
//
#include "Foundation/Debugger.h"
#include "Poco/Debugger.h"
#include <sstream>
#include <stdlib.h>
#include <stdio.h>
@@ -47,6 +47,9 @@
#include <lib$routines.h>
#include <ssdef.h>
#endif
#if defined(POCO_WIN32_UTF8)
#include "Poco/UnicodeConverter.h"
#endif
// NOTE: In this module, we use the C library functions (fputs) for,
@@ -54,7 +57,7 @@
// might not have been initialized yet.
Foundation_BEGIN
namespace Poco {
bool Debugger::isAvailable()
@@ -82,8 +85,15 @@ void Debugger::message(const std::string& msg)
#if defined(POCO_OS_FAMILY_WINDOWS)
if (IsDebuggerPresent())
{
#if defined(POCO_WIN32_UTF8)
std::wstring umsg;
UnicodeConverter::toUTF16(msg, umsg);
umsg += '\n';
OutputDebugStringW(umsg.c_str());
#else
OutputDebugString(msg.c_str());
OutputDebugString("\n");
#endif
}
#elif defined(POCO_OS_FAMILY_UNIX)
#elif defined(POCO_OS_FAMILY_VMS)
@@ -152,4 +162,4 @@ void Debugger::enter(const char* file, int line)
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// DeflatingStream.cpp
//
// $Id: //poco/1.1.0/Foundation/src/DeflatingStream.cpp#2 $
// $Id: //poco/1.2/Foundation/src/DeflatingStream.cpp#1 $
//
// Library: Foundation
// Package: Streams
@@ -34,11 +34,11 @@
//
#include "Foundation/DeflatingStream.h"
#include "Foundation/Exception.h"
#include "Poco/DeflatingStream.h"
#include "Poco/Exception.h"
Foundation_BEGIN
namespace Poco {
DeflatingStreamBuf::DeflatingStreamBuf(std::istream& istr, StreamType type, int level):
@@ -136,7 +136,7 @@ int DeflatingStreamBuf::close()
int DeflatingStreamBuf::readFromDevice(char* buffer, std::streamsize length)
{
if (!_pIstr) return 0;
if (!_zstr.next_in && !_eof)
if (_zstr.avail_in == 0 && !_eof)
{
int n = 0;
if (_pIstr->good())
@@ -155,14 +155,9 @@ int DeflatingStreamBuf::readFromDevice(char* buffer, std::streamsize length)
_zstr.avail_in = 0;
_eof = true;
}
_zstr.next_out = (unsigned char*) buffer;
_zstr.avail_out = length;
}
else if (_zstr.avail_out == 0)
{
_zstr.next_out = (unsigned char*) buffer;
_zstr.avail_out = length;
}
_zstr.next_out = (unsigned char*) buffer;
_zstr.avail_out = length;
for (;;)
{
int rc = deflate(&_zstr, _eof ? Z_FINISH : Z_NO_FLUSH);
@@ -289,4 +284,4 @@ DeflatingInputStream::~DeflatingInputStream()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// DigestEngine.cpp
//
// $Id: //poco/1.1.0/Foundation/src/DigestEngine.cpp#2 $
// $Id: //poco/1.2/Foundation/src/DigestEngine.cpp#1 $
//
// Library: Foundation
// Package: Crypt
@@ -34,10 +34,10 @@
//
#include "Foundation/DigestEngine.h"
#include "Poco/DigestEngine.h"
Foundation_BEGIN
namespace Poco {
DigestEngine::DigestEngine()
@@ -65,4 +65,4 @@ std::string DigestEngine::digestToHex(const Digest& bytes)
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// DigestStream.cpp
//
// $Id: //poco/1.1.0/Foundation/src/DigestStream.cpp#2 $
// $Id: //poco/1.2/Foundation/src/DigestStream.cpp#1 $
//
// Library: Foundation
// Package: Crypt
@@ -34,10 +34,10 @@
//
#include "Foundation/DigestStream.h"
#include "Poco/DigestStream.h"
Foundation_BEGIN
namespace Poco {
const int DigestBuf::BUFFER_SIZE = 256;
@@ -46,8 +46,8 @@ const int DigestBuf::BUFFER_SIZE = 256;
DigestBuf::DigestBuf(DigestEngine& eng):
BufferedStreamBuf(BUFFER_SIZE, std::ios::out),
_eng(eng),
_pOstr(0),
_pIstr(0)
_pIstr(0),
_pOstr(0)
{
}
@@ -169,4 +169,4 @@ void DigestOutputStream::close()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// DirectoryIterator.cpp
//
// $Id: //poco/1.1.0/Foundation/src/DirectoryIterator.cpp#2 $
// $Id: //poco/1.2/Foundation/src/DirectoryIterator.cpp#1 $
//
// Library: Foundation
// Package: Filesystem
@@ -34,7 +34,7 @@
//
#include "Foundation/DirectoryIterator.h"
#include "Poco/DirectoryIterator.h"
#if defined(POCO_OS_FAMILY_WINDOWS) && defined(POCO_WIN32_UTF8)
@@ -48,7 +48,7 @@
#endif
Foundation_BEGIN
namespace Poco {
DirectoryIterator::DirectoryIterator(): _pImpl(0)
@@ -168,4 +168,4 @@ DirectoryIterator DirectoryIterator::operator ++ (int dummy)
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// DirectoryIterator_UNIX.cpp
//
// $Id: //poco/1.1.0/Foundation/src/DirectoryIterator_UNIX.cpp#2 $
// $Id: //poco/1.2/Foundation/src/DirectoryIterator_UNIX.cpp#1 $
//
// Library: Foundation
// Package: Filesystem
@@ -34,12 +34,12 @@
//
#include "Foundation/DirectoryIterator_UNIX.h"
#include "Foundation/File_UNIX.h"
#include "Foundation/Path.h"
#include "Poco/DirectoryIterator_UNIX.h"
#include "Poco/File_UNIX.h"
#include "Poco/Path.h"
Foundation_BEGIN
namespace Poco {
DirectoryIteratorImpl::DirectoryIteratorImpl(const std::string& path): _pDir(0), _rc(1)
@@ -75,4 +75,4 @@ const std::string& DirectoryIteratorImpl::next()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// DirectoryIterator_VMS.cpp
//
// $Id: //poco/1.1.0/Foundation/src/DirectoryIterator_VMS.cpp#2 $
// $Id: //poco/1.2/Foundation/src/DirectoryIterator_VMS.cpp#1 $
//
// Library: Foundation
// Package: Filesystem
@@ -34,16 +34,16 @@
//
#include "Foundation/DirectoryIterator_VMS.h"
#include "Foundation/Path.h"
#include "Foundation/Exception.h"
#include "Poco/DirectoryIterator_VMS.h"
#include "Poco/Path.h"
#include "Poco/Exception.h"
#include <iodef.h>
#include <atrdef.h>
#include <fibdef.h>
#include <starlet.h>
Foundation_BEGIN
namespace Poco {
DirectoryIteratorImpl::DirectoryIteratorImpl(const std::string& path): _rc(1)
@@ -84,4 +84,4 @@ const std::string& DirectoryIteratorImpl::next()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// DirectoryIterator_WIN32.cpp
//
// $Id: //poco/1.1.0/Foundation/src/DirectoryIterator_WIN32.cpp#2 $
// $Id: //poco/1.2/Foundation/src/DirectoryIterator_WIN32.cpp#1 $
//
// Library: Foundation
// Package: Filesystem
@@ -34,12 +34,12 @@
//
#include "Foundation/DirectoryIterator_WIN32.h"
#include "Foundation/File_WIN32.h"
#include "Foundation/Path.h"
#include "Poco/DirectoryIterator_WIN32.h"
#include "Poco/File_WIN32.h"
#include "Poco/Path.h"
Foundation_BEGIN
namespace Poco {
DirectoryIteratorImpl::DirectoryIteratorImpl(const std::string& path): _fh(INVALID_HANDLE_VALUE), _rc(1)
@@ -82,4 +82,4 @@ const std::string& DirectoryIteratorImpl::next()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// DirectoryIterator_WIN32U.cpp
//
// $Id: //poco/1.1.0/Foundation/src/DirectoryIterator_WIN32U.cpp#2 $
// $Id: //poco/1.2/Foundation/src/DirectoryIterator_WIN32U.cpp#1 $
//
// Library: Foundation
// Package: Filesystem
@@ -34,14 +34,14 @@
//
#include "Foundation/DirectoryIterator_WIN32U.h"
#include "Foundation/File_WIN32U.h"
#include "Foundation/Path.h"
#include "Foundation/UnicodeConverter.h"
#include "Poco/DirectoryIterator_WIN32U.h"
#include "Poco/File_WIN32U.h"
#include "Poco/Path.h"
#include "Poco/UnicodeConverter.h"
#include <string.h>
Foundation_BEGIN
namespace Poco {
DirectoryIteratorImpl::DirectoryIteratorImpl(const std::string& path): _fh(INVALID_HANDLE_VALUE), _rc(1)
@@ -87,4 +87,4 @@ const std::string& DirectoryIteratorImpl::next()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// Environment.cpp
//
// $Id: //poco/1.1.0/Foundation/src/Environment.cpp#2 $
// $Id: //poco/1.2/Foundation/src/Environment.cpp#1 $
//
// Library: Foundation
// Package: Core
@@ -34,7 +34,7 @@
//
#include "Foundation/Environment.h"
#include "Poco/Environment.h"
#if defined(POCO_OS_FAMILY_VMS)
@@ -48,7 +48,7 @@
#endif
Foundation_BEGIN
namespace Poco {
std::string Environment::get(const std::string& name)
@@ -93,4 +93,4 @@ std::string Environment::nodeName()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// Environment_UNIX.cpp
//
// $Id: //poco/1.1.0/Foundation/src/Environment_UNIX.cpp#2 $
// $Id: //poco/1.2/Foundation/src/Environment_UNIX.cpp#1 $
//
// Library: Foundation
// Package: Core
@@ -34,14 +34,14 @@
//
#include "Foundation/Environment_UNIX.h"
#include "Foundation/Exception.h"
#include "Poco/Environment_UNIX.h"
#include "Poco/Exception.h"
#include <unistd.h>
#include <stdlib.h>
#include <sys/utsname.h>
Foundation_BEGIN
namespace Poco {
EnvironmentImpl::StringMap EnvironmentImpl::_map;
@@ -117,4 +117,4 @@ std::string EnvironmentImpl::nodeNameImpl()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// Environment_VMS.cpp
//
// $Id: //poco/1.1.0/Foundation/src/Environment_VMS.cpp#2 $
// $Id: //poco/1.2/Foundation/src/Environment_VMS.cpp#1 $
//
// Library: Foundation
// Package: Core
@@ -34,8 +34,8 @@
//
#include "Foundation/Environment_VMS.h"
#include "Foundation/Exception.h"
#include "Poco/Environment_VMS.h"
#include "Poco/Exception.h"
#include <stdlib.h>
#include <starlet.h>
#include <descrip.h>
@@ -45,7 +45,7 @@
#include <lnmdef.h>
Foundation_BEGIN
namespace Poco {
FastMutex EnvironmentImpl::_mutex;
@@ -168,4 +168,4 @@ std::string EnvironmentImpl::trnlnm(const std::string& name)
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// Environment_WIN32.cpp
//
// $Id: //poco/1.1.0/Foundation/src/Environment_WIN32.cpp#2 $
// $Id: //poco/1.2/Foundation/src/Environment_WIN32.cpp#1 $
//
// Library: Foundation
// Package: Core
@@ -34,13 +34,13 @@
//
#include "Foundation/Environment_WIN32.h"
#include "Foundation/Exception.h"
#include "Poco/Environment_WIN32.h"
#include "Poco/Exception.h"
#include <sstream>
#include <windows.h>
Foundation_BEGIN
namespace Poco {
std::string EnvironmentImpl::getImpl(const std::string& name)
@@ -144,4 +144,4 @@ std::string EnvironmentImpl::nodeNameImpl()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// Environment_WIN32U.cpp
//
// $Id: //poco/1.1.0/Foundation/src/Environment_WIN32U.cpp#2 $
// $Id: //poco/1.2/Foundation/src/Environment_WIN32U.cpp#1 $
//
// Library: Foundation
// Package: Core
@@ -34,16 +34,16 @@
//
#include "Foundation/Environment_WIN32U.h"
#include "Foundation/Exception.h"
#include "Foundation/UnicodeConverter.h"
#include "Foundation/Buffer.h"
#include "Poco/Environment_WIN32U.h"
#include "Poco/Exception.h"
#include "Poco/UnicodeConverter.h"
#include "Poco/Buffer.h"
#include <sstream>
#include <string.h>
#include <windows.h>
Foundation_BEGIN
namespace Poco {
std::string EnvironmentImpl::getImpl(const std::string& name)
@@ -110,7 +110,9 @@ std::string EnvironmentImpl::osVersionImpl()
if (GetVersionEx(&vi) == 0) throw SystemException("Cannot get OS version information");
std::ostringstream str;
str << vi.dwMajorVersion << "." << vi.dwMinorVersion << " (Build " << (vi.dwBuildNumber & 0xFFFF);
if (vi.szCSDVersion[0]) str << ": " << vi.szCSDVersion;
std::string version;
UnicodeConverter::toUTF8(vi.szCSDVersion, version);
if (!version.empty()) str << ": " << version;
str << ")";
return str.str();
}
@@ -157,4 +159,4 @@ std::string EnvironmentImpl::nodeNameImpl()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// ErrorHandler.cpp
//
// $Id: //poco/1.1.0/Foundation/src/ErrorHandler.cpp#2 $
// $Id: //poco/1.2/Foundation/src/ErrorHandler.cpp#1 $
//
// Library: Foundation
// Package: Threading
@@ -34,11 +34,11 @@
//
#include "Foundation/ErrorHandler.h"
#include "Foundation/SingletonHolder.h"
#include "Poco/ErrorHandler.h"
#include "Poco/SingletonHolder.h"
Foundation_BEGIN
namespace Poco {
ErrorHandler* ErrorHandler::_pHandler = ErrorHandler::defaultHandler();
@@ -130,4 +130,4 @@ ErrorHandler* ErrorHandler::defaultHandler()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// Event.cpp
//
// $Id: //poco/1.1.0/Foundation/src/Event.cpp#2 $
// $Id: //poco/1.2/Foundation/src/Event.cpp#1 $
//
// Library: Foundation
// Package: Threading
@@ -34,7 +34,7 @@
//
#include "Foundation/Event.h"
#include "Poco/Event.h"
#if defined(POCO_OS_FAMILY_WINDOWS)
@@ -44,7 +44,7 @@
#endif
Foundation_BEGIN
namespace Poco {
Event::Event(bool autoReset): EventImpl(autoReset)
@@ -57,4 +57,4 @@ Event::~Event()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// EventArgs.cpp
//
// $Id: //poco/1.1.0/Foundation/src/EventArgs.cpp#2 $
// $Id: //poco/1.2/Foundation/src/EventArgs.cpp#1 $
//
// Library: Foundation
// Package: Events
@@ -36,10 +36,10 @@
//
#include "Foundation/EventArgs.h"
#include "Poco/EventArgs.h"
Foundation_BEGIN
namespace Poco {
EventArgs::EventArgs()
@@ -52,4 +52,4 @@ EventArgs::~EventArgs()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// EventLogChannel.cpp
//
// $Id: //poco/1.1.0/Foundation/src/EventLogChannel.cpp#2 $
// $Id: //poco/1.2/Foundation/src/EventLogChannel.cpp#1 $
//
// Library: Foundation
// Package: Logging
@@ -34,12 +34,15 @@
//
#include "Foundation/EventLogChannel.h"
#include "Foundation/Message.h"
#include "Poco/EventLogChannel.h"
#include "Poco/Message.h"
#include "pocomsg.h"
#if defined(POCO_WIN32_UTF8)
#include "Poco/UnicodeConverter.h"
#endif
Foundation_BEGIN
namespace Poco {
const std::string EventLogChannel::PROP_NAME = "name";
@@ -51,6 +54,18 @@ EventLogChannel::EventLogChannel():
_logFile("Application"),
_h(0)
{
#if defined(POCO_WIN32_UTF8)
wchar_t name[256];
int n = GetModuleFileNameW(NULL, name, sizeof(name));
if (n > 0)
{
wchar_t* end = name + n - 1;
while (end > name && *end != '\\') --end;
if (*end == '\\') ++end;
std::wstring uname(end);
UnicodeConverter::toUTF8(uname, _name);
}
#else
char name[256];
int n = GetModuleFileName(NULL, name, sizeof(name));
if (n > 0)
@@ -60,6 +75,7 @@ EventLogChannel::EventLogChannel():
if (*end == '\\') ++end;
_name = end;
}
#endif
}
@@ -89,7 +105,15 @@ EventLogChannel::~EventLogChannel()
void EventLogChannel::open()
{
setUpRegistry();
#if defined(POCO_WIN32_UTF8)
std::wstring uhost;
UnicodeConverter::toUTF16(_host, uhost);
std::wstring uname;
UnicodeConverter::toUTF16(_name, uname);
_h = RegisterEventSourceW(uhost.empty() ? NULL : uhost.c_str(), uname.c_str());
#else
_h = RegisterEventSource(_host.empty() ? NULL : _host.c_str(), _name.c_str());
#endif
if (!_h) throw SystemException("cannot register event source");
}
@@ -104,8 +128,15 @@ void EventLogChannel::close()
void EventLogChannel::log(const Message& msg)
{
if (!_h) open();
#if defined(POCO_WIN32_UTF8)
std::wstring utext;
UnicodeConverter::toUTF16(msg.getText(), utext);
const wchar_t* pMsg = utext.c_str();
ReportEventW(_h, getType(msg), getCategory(msg), POCO_MSG_LOG, NULL, 1, 0, &pMsg, NULL);
#else
const char* pMsg = msg.getText().c_str();
ReportEvent(_h, getType(msg), getCategory(msg), POCO_MSG_LOG, NULL, 1, 0, &pMsg, NULL);
#endif
}
@@ -186,13 +217,31 @@ void EventLogChannel::setUpRegistry() const
key.append(_name);
HKEY hKey;
DWORD disp;
#if defined(POCO_WIN32_UTF8)
std::wstring ukey;
UnicodeConverter::toUTF16(key, ukey);
DWORD rc = RegCreateKeyExW(HKEY_LOCAL_MACHINE, ukey.c_str(), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &disp);
#else
DWORD rc = RegCreateKeyEx(HKEY_LOCAL_MACHINE, key.c_str(), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &disp);
#endif
if (rc != ERROR_SUCCESS) return;
if (disp == REG_CREATED_NEW_KEY)
{
#if defined(POCO_WIN32_UTF8)
std::wstring path;
#if defined(POCO_DLL)
#if defined(_DEBUG)
path = findLibrary(L"PocoFoundationd.dll");
#else
path = findLibrary(L"PocoFoundation.dll");
#endif
#endif
if (path.empty())
path = findLibrary(L"PocoMsg.dll");
#else
std::string path;
#if defined(POCO_DLL)
#if defined(_DEBUG)
path = findLibrary("PocoFoundationd.dll");
@@ -203,21 +252,44 @@ void EventLogChannel::setUpRegistry() const
if (path.empty())
path = findLibrary("PocoMsg.dll");
#endif
if (!path.empty())
{
DWORD count = 8;
DWORD types = 7;
#if defined(POCO_WIN32_UTF8)
RegSetValueExW(hKey, L"CategoryMessageFile", 0, REG_SZ, (const BYTE*) path.c_str(), (DWORD) path.size() + 1);
RegSetValueExW(hKey, L"EventMessageFile", 0, REG_SZ, (const BYTE*) path.c_str(), (DWORD) path.size() + 1);
RegSetValueExW(hKey, L"CategoryCount", 0, REG_DWORD, (const BYTE*) &count, (DWORD) sizeof(count));
RegSetValueExW(hKey, L"TypesSupported", 0, REG_DWORD, (const BYTE*) &types, (DWORD) sizeof(types));
#else
RegSetValueEx(hKey, "CategoryMessageFile", 0, REG_SZ, (const BYTE*) path.c_str(), (DWORD) path.size() + 1);
RegSetValueEx(hKey, "EventMessageFile", 0, REG_SZ, (const BYTE*) path.c_str(), (DWORD) path.size() + 1);
RegSetValueEx(hKey, "CategoryCount", 0, REG_DWORD, (const BYTE*) &count, (DWORD) sizeof(count));
RegSetValueEx(hKey, "TypesSupported", 0, REG_DWORD, (const BYTE*) &types, (DWORD) sizeof(types));
#endif
}
}
RegCloseKey(hKey);
}
#if defined(POCO_WIN32_UTF8)
std::wstring EventLogChannel::findLibrary(const wchar_t* name)
{
std::wstring path;
HMODULE dll = LoadLibraryW(name);
if (dll)
{
wchar_t name[MAX_PATH + 1];
int n = GetModuleFileNameW(dll, name, sizeof(name));
if (n > 0) path = name;
FreeLibrary(dll);
}
return path;
}
#else
std::string EventLogChannel::findLibrary(const char* name)
{
std::string path;
@@ -231,6 +303,7 @@ std::string EventLogChannel::findLibrary(const char* name)
}
return path;
}
#endif
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// Event_POSIX.cpp
//
// $Id: //poco/1.1.0/Foundation/src/Event_POSIX.cpp#2 $
// $Id: //poco/1.2/Foundation/src/Event_POSIX.cpp#1 $
//
// Library: Foundation
// Package: Threading
@@ -34,11 +34,11 @@
//
#include "Foundation/Event_POSIX.h"
#include "Poco/Event_POSIX.h"
#include <sys/time.h>
Foundation_BEGIN
namespace Poco {
EventImpl::EventImpl(bool autoReset): _auto(autoReset), _state(false)
@@ -114,4 +114,4 @@ bool EventImpl::waitImpl(long milliseconds)
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// Event_WIN32.cpp
//
// $Id: //poco/1.1.0/Foundation/src/Event_WIN32.cpp#2 $
// $Id: //poco/1.2/Foundation/src/Event_WIN32.cpp#1 $
//
// Library: Foundation
// Package: Threading
@@ -34,10 +34,10 @@
//
#include "Foundation/Event_WIN32.h"
#include "Poco/Event_WIN32.h"
Foundation_BEGIN
namespace Poco {
EventImpl::EventImpl(bool autoReset)
@@ -80,4 +80,4 @@ bool EventImpl::waitImpl(long milliseconds)
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// Exception.cpp
//
// $Id: //poco/1.1.0/Foundation/src/Exception.cpp#2 $
// $Id: //poco/1.2/Foundation/src/Exception.cpp#1 $
//
// Library: Foundation
// Package: Core
@@ -34,11 +34,11 @@
//
#include "Foundation/Exception.h"
#include "Poco/Exception.h"
#include <typeinfo>
Foundation_BEGIN
namespace Poco {
Exception::Exception(): _pNested(0)
@@ -66,7 +66,7 @@ Exception::Exception(const std::string& msg, const Exception& nested): _msg(msg)
}
Exception::Exception(const Exception& exc)
Exception::Exception(const Exception& exc): std::exception(exc)
{
_msg = exc._msg;
_pNested = exc._pNested ? exc._pNested->clone() : 0;
@@ -109,18 +109,6 @@ const char* Exception::what() const throw()
}
const Exception* Exception::nested() const
{
return _pNested;
}
const std::string& Exception::message() const
{
return _msg;
}
std::string Exception::displayText() const
{
std::string txt = name();
@@ -139,6 +127,12 @@ Exception* Exception::clone() const
}
void Exception::rethrow() const
{
throw *this;
}
POCO_IMPLEMENT_EXCEPTION(LogicException, Exception, "Logic exception")
POCO_IMPLEMENT_EXCEPTION(AssertionViolationException, LogicException, "Assertion violation")
POCO_IMPLEMENT_EXCEPTION(NullPointerException, LogicException, "Null pointer")
@@ -149,6 +143,7 @@ POCO_IMPLEMENT_EXCEPTION(RangeException, LogicException, "Out of range")
POCO_IMPLEMENT_EXCEPTION(IllegalStateException, LogicException, "Illegal state")
POCO_IMPLEMENT_EXCEPTION(InvalidAccessException, LogicException, "Invalid access")
POCO_IMPLEMENT_EXCEPTION(SignalException, LogicException, "Signal received")
POCO_IMPLEMENT_EXCEPTION(UnhandledException, LogicException, "Signal received")
POCO_IMPLEMENT_EXCEPTION(RuntimeException, Exception, "Runtime exception")
POCO_IMPLEMENT_EXCEPTION(NotFoundException, RuntimeException, "Not found")
@@ -186,4 +181,4 @@ POCO_IMPLEMENT_EXCEPTION(UnknownURISchemeException, RuntimeException, "Unknown U
POCO_IMPLEMENT_EXCEPTION(ApplicationException, Exception, "Application exception")
POCO_IMPLEMENT_EXCEPTION(BadCastException, RuntimeException, "Bad cast exception")
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// FPEnvironment.cpp
//
// $Id: //poco/1.1.0/Foundation/src/FPEnvironment.cpp#2 $
// $Id: //poco/1.2/Foundation/src/FPEnvironment.cpp#1 $
//
// Library: Foundation
// Package: Core
@@ -35,15 +35,15 @@
// pull in platform identification macros needed below
#include "Foundation/Platform.h"
#include "Poco/Platform.h"
#if defined(__osf__) || defined(__VMS)
#if defined(POCO_NO_FPENVIRONMENT)
#include "FPEnvironment_DUMMY.cpp"
#elif defined(__osf__) || defined(__VMS)
#include "FPEnvironment_DEC.cpp"
#elif defined(sun) || defined(__sun)
#include "FPEnvironment_SUN.cpp"
#elif defined(__CYGWIN__) || (defined(__GNUC__) && __GNUC__ < 3)
#include "FPEnvironment_DUMMY.cpp"
#elif defined(POCO_OS_FAMILY_UNIX)
#include "FPEnvironment_C99.cpp"
#elif defined(POCO_OS_FAMILY_WINDOWS)
@@ -55,10 +55,10 @@
// header file must be included after platform-specific part
// due to _XOPEN_SOURCE conflict on Tru64 (see FPEnvironment_DEC.cpp)
#include "Foundation/FPEnvironment.h"
#include "Poco/FPEnvironment.h"
Foundation_BEGIN
namespace Poco {
FPEnvironment::FPEnvironment()
@@ -104,4 +104,4 @@ void FPEnvironment::clearFlags()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// FPEnvironment_C99.cpp
//
// $Id: //poco/1.1.0/Foundation/src/FPEnvironment_C99.cpp#2 $
// $Id: //poco/1.2/Foundation/src/FPEnvironment_C99.cpp#1 $
//
// Library: Foundation
// Package: Core
@@ -34,10 +34,10 @@
//
#include "Foundation/FPEnvironment_C99.h"
#include "Poco/FPEnvironment_C99.h"
Foundation_BEGIN
namespace Poco {
FPEnvironmentImpl::FPEnvironmentImpl()
@@ -101,4 +101,4 @@ long double FPEnvironmentImpl::copySignImpl(long double target, long double sour
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// FPEnvironment_DEC.cpp
//
// $Id: //poco/1.1.0/Foundation/src/FPEnvironment_DEC.cpp#2 $
// $Id: //poco/1.2/Foundation/src/FPEnvironment_DEC.cpp#1 $
//
// Library: Foundation
// Package: Core
@@ -47,10 +47,10 @@
#if defined(__VMS)
#include <starlet.h>
#endif
#include "Foundation/FPEnvironment_DEC.h"
#include "Poco/FPEnvironment_DEC.h"
Foundation_BEGIN
namespace Poco {
FPEnvironmentImpl::FPEnvironmentImpl()
@@ -214,4 +214,4 @@ FPEnvironmentImpl::RoundingModeImpl FPEnvironmentImpl::getRoundingModeImpl()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// FPEnvironment_C99.cpp
//
// $Id: //poco/1.1.0/Foundation/src/FPEnvironment_DUMMY.cpp#2 $
// $Id: //poco/1.2/Foundation/src/FPEnvironment_DUMMY.cpp#1 $
//
// Library: Foundation
// Package: Core
@@ -34,10 +34,10 @@
//
#include "Foundation/FPEnvironment_DUMMY.h"
#include "Poco/FPEnvironment_DUMMY.h"
Foundation_BEGIN
namespace Poco {
FPEnvironmentImpl::RoundingModeImpl FPEnvironmentImpl::_roundingMode;
@@ -98,4 +98,4 @@ long double FPEnvironmentImpl::copySignImpl(long double target, long double sour
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// FPEnvironment_SUN.cpp
//
// $Id: //poco/1.1.0/Foundation/src/FPEnvironment_SUN.cpp#2 $
// $Id: //poco/1.2/Foundation/src/FPEnvironment_SUN.cpp#1 $
//
// Library: Foundation
// Package: Core
@@ -35,10 +35,10 @@
#include <math.h>
#include "Foundation/FPEnvironment_SUN.h"
#include "Poco/FPEnvironment_SUN.h"
Foundation_BEGIN
namespace Poco {
FPEnvironmentImpl::FPEnvironmentImpl()
@@ -158,4 +158,4 @@ FPEnvironmentImpl::RoundingModeImpl FPEnvironmentImpl::getRoundingModeImpl()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// FPEnvironment_WIN32.cpp
//
// $Id: //poco/1.1.0/Foundation/src/FPEnvironment_WIN32.cpp#2 $
// $Id: //poco/1.2/Foundation/src/FPEnvironment_WIN32.cpp#1 $
//
// Library: Foundation
// Package: Core
@@ -34,10 +34,10 @@
//
#include "Foundation/FPEnvironment_WIN32.h"
#include "Poco/FPEnvironment_WIN32.h"
Foundation_BEGIN
namespace Poco {
FPEnvironmentImpl::FPEnvironmentImpl()
@@ -95,4 +95,4 @@ FPEnvironmentImpl::RoundingModeImpl FPEnvironmentImpl::getRoundingModeImpl()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// File.cpp
//
// $Id: //poco/1.1.0/Foundation/src/File.cpp#2 $
// $Id: //poco/1.2/Foundation/src/File.cpp#1 $
//
// Library: Foundation
// Package: Filesystem
@@ -34,9 +34,9 @@
//
#include "Foundation/File.h"
#include "Foundation/Path.h"
#include "Foundation/DirectoryIterator.h"
#include "Poco/File.h"
#include "Poco/Path.h"
#include "Poco/DirectoryIterator.h"
#if defined(POCO_OS_FAMILY_WINDOWS) && defined(POCO_WIN32_UTF8)
@@ -50,7 +50,7 @@
#endif
Foundation_BEGIN
namespace Poco {
File::File()
@@ -148,6 +148,12 @@ bool File::isDirectory() const
}
bool File::isLink() const
{
return isLinkImpl();
}
Timestamp File::created() const
{
return createdImpl();
@@ -224,7 +230,7 @@ void File::renameTo(const std::string& path)
void File::remove(bool recursive)
{
if (recursive && isDirectory())
if (recursive && !isLink() && isDirectory())
{
std::vector<File> files;
list(files);
@@ -292,4 +298,4 @@ void File::list(std::vector<File>& files) const
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// FileChannel.cpp
//
// $Id: //poco/1.1.0/Foundation/src/FileChannel.cpp#2 $
// $Id: //poco/1.2/Foundation/src/FileChannel.cpp#1 $
//
// Library: Foundation
// Package: Logging
@@ -34,22 +34,22 @@
//
#include "Foundation/FileChannel.h"
#include "Foundation/ArchiveStrategy.h"
#include "Foundation/RotateStrategy.h"
#include "Foundation/PurgeStrategy.h"
#include "Foundation/Message.h"
#include "Foundation/NumberParser.h"
#include "Foundation/DateTimeFormatter.h"
#include "Foundation/DateTime.h"
#include "Foundation/LocalDateTime.h"
#include "Foundation/String.h"
#include "Foundation/Timespan.h"
#include "Foundation/Exception.h"
#include "Poco/FileChannel.h"
#include "Poco/ArchiveStrategy.h"
#include "Poco/RotateStrategy.h"
#include "Poco/PurgeStrategy.h"
#include "Poco/Message.h"
#include "Poco/NumberParser.h"
#include "Poco/DateTimeFormatter.h"
#include "Poco/DateTime.h"
#include "Poco/LocalDateTime.h"
#include "Poco/String.h"
#include "Poco/Timespan.h"
#include "Poco/Exception.h"
#include <ctype.h>
Foundation_BEGIN
namespace Poco {
const std::string FileChannel::PROP_PATH = "path";
@@ -73,9 +73,9 @@ FileChannel::FileChannel():
FileChannel::FileChannel(const std::string& path):
_path(path),
_times("utc"),
_compress(false),
_path(path),
_pFile(0),
_pRotateStrategy(0),
_pArchiveStrategy(new ArchiveByNumberStrategy),
@@ -315,7 +315,7 @@ void FileChannel::setPurgeAge(const std::string& age)
else if (unit == "weeks")
factor = 7*Timespan::DAYS;
else if (unit == "months")
factor *= 30*Timespan::DAYS;
factor = 30*Timespan::DAYS;
else if (unit != "seconds")
throw InvalidArgumentException("purgeAge", age);
@@ -355,4 +355,4 @@ void FileChannel::purge()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// FileStreamFactory.cpp
//
// $Id: //poco/1.1.0/Foundation/src/FileStreamFactory.cpp#2 $
// $Id: //poco/1.2/Foundation/src/FileStreamFactory.cpp#1 $
//
// Library: Foundation
// Package: URI
@@ -34,15 +34,15 @@
//
#include "Foundation/FileStreamFactory.h"
#include "Foundation/URI.h"
#include "Foundation/Path.h"
#include "Foundation/File.h"
#include "Foundation/Exception.h"
#include "Poco/FileStreamFactory.h"
#include "Poco/URI.h"
#include "Poco/Path.h"
#include "Poco/File.h"
#include "Poco/Exception.h"
#include <fstream>
Foundation_BEGIN
namespace Poco {
FileStreamFactory::FileStreamFactory()
@@ -83,4 +83,4 @@ std::istream* FileStreamFactory::open(const Path& path)
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// File_UNIX.cpp
//
// $Id: //poco/1.1.0/Foundation/src/File_UNIX.cpp#2 $
// $Id: //poco/1.2/Foundation/src/File_UNIX.cpp#1 $
//
// Library: Foundation
// Package: Filesystem
@@ -34,9 +34,9 @@
//
#include "Foundation/File_UNIX.h"
#include "Foundation/Buffer.h"
#include "Foundation/Exception.h"
#include "Poco/File_UNIX.h"
#include "Poco/Buffer.h"
#include "Poco/Exception.h"
#include <algorithm>
#include <sys/stat.h>
#include <sys/types.h>
@@ -48,7 +48,7 @@
#include <string.h>
Foundation_BEGIN
namespace Poco {
FileImpl::FileImpl()
@@ -154,6 +154,19 @@ bool FileImpl::isDirectoryImpl() const
}
bool FileImpl::isLinkImpl() const
{
poco_assert (!_path.empty());
struct stat st;
if (lstat(_path.c_str(), &st) == 0)
return S_ISLNK(st.st_mode);
else
handleError(_path);
return false;
}
Timestamp FileImpl::createdImpl() const
{
poco_assert (!_path.empty());
@@ -300,7 +313,7 @@ void FileImpl::removeImpl()
poco_assert (!_path.empty());
int rc;
if (isDirectoryImpl())
if (!isLinkImpl() && isDirectoryImpl())
rc = rmdir(_path.c_str());
else
rc = unlink(_path.c_str());
@@ -372,4 +385,4 @@ void FileImpl::handleError(const std::string& path)
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// File_VMS.cpp
//
// $Id: //poco/1.1.0/Foundation/src/File_VMS.cpp#2 $
// $Id: //poco/1.2/Foundation/src/File_VMS.cpp#1 $
//
// Library: Foundation
// Package: Filesystem
@@ -34,9 +34,9 @@
//
#include "Foundation/File_VMS.h"
#include "Foundation/Exception.h"
#include "Foundation/Path.h"
#include "Poco/File_VMS.h"
#include "Poco/Exception.h"
#include "Poco/Path.h"
#include <stdio.h>
#include <unistd.h>
#include <unixio.h>
@@ -52,7 +52,7 @@
#include <descrip.h>
Foundation_BEGIN
namespace Poco {
FileImpl::FileImpl()
@@ -160,6 +160,12 @@ bool FileImpl::isDirectoryImpl() const
}
bool FileImpl::isLinkImpl() const
{
return false;
}
Timestamp FileImpl::createdImpl() const
{
poco_assert (!_path.empty());
@@ -372,4 +378,4 @@ void FileImpl::handleError(const std::string& path)
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// File_WIN32.cpp
//
// $Id: //poco/1.1.0/Foundation/src/File_WIN32.cpp#2 $
// $Id: //poco/1.2/Foundation/src/File_WIN32.cpp#1 $
//
// Library: Foundation
// Package: Filesystem
@@ -34,12 +34,12 @@
//
#include "Foundation/File_WIN32.h"
#include "Foundation/Exception.h"
#include "Poco/File_WIN32.h"
#include "Poco/Exception.h"
#include <windows.h>
Foundation_BEGIN
namespace Poco {
class FileHandle
@@ -170,6 +170,12 @@ bool FileImpl::isDirectoryImpl() const
}
bool FileImpl::isLinkImpl() const
{
return false;
}
Timestamp FileImpl::createdImpl() const
{
poco_assert (!_path.empty());
@@ -350,4 +356,4 @@ void FileImpl::handleError(const std::string& path)
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// File_WIN32U.cpp
//
// $Id: //poco/1.1.0/Foundation/src/File_WIN32U.cpp#2 $
// $Id: //poco/1.2/Foundation/src/File_WIN32U.cpp#1 $
//
// Library: Foundation
// Package: Filesystem
@@ -34,13 +34,13 @@
//
#include "Foundation/File_WIN32U.h"
#include "Foundation/Exception.h"
#include "Foundation/UnicodeConverter.h"
#include "Poco/File_WIN32U.h"
#include "Poco/Exception.h"
#include "Poco/UnicodeConverter.h"
#include <windows.h>
Foundation_BEGIN
namespace Poco {
class FileHandle
@@ -174,6 +174,12 @@ bool FileImpl::isDirectoryImpl() const
}
bool FileImpl::isLinkImpl() const
{
return false;
}
Timestamp FileImpl::createdImpl() const
{
poco_assert (!_path.empty());
@@ -358,4 +364,4 @@ void FileImpl::handleError(const std::string& path)
}
Foundation_END
} // namespace Poco

334
Foundation/src/Format.cpp Normal file
View File

@@ -0,0 +1,334 @@
//
// Format.cpp
//
// $Id: //poco/1.2/Foundation/src/Format.cpp#1 $
//
// Library: Foundation
// Package: Core
// Module: Format
//
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Redistributions in any form must be accompanied by information on
// how to obtain complete source code for this software and any
// accompanying software that uses this software. The source code
// must either be included in the distribution or be available for no
// more than the cost of distribution plus a nominal fee, and must be
// freely redistributable under reasonable conditions. For an
// executable file, complete source code means the source code for all
// modules it contains. It does not include source code for modules or
// files that typically accompany the major components of the operating
// system on which the executable file runs.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
#include "Poco/Format.h"
#include "Poco/Exception.h"
#include <sstream>
#include <ctype.h>
namespace Poco {
namespace
{
void parseFlags(std::ostream& str, std::string::const_iterator& itFmt, const std::string::const_iterator& endFmt)
{
bool isFlag = true;
while (isFlag && itFmt != endFmt)
{
switch (*itFmt)
{
case '-': str.setf(std::ios_base::left); ++itFmt; break;
case '+': str.setf(std::ios_base::showpos); ++itFmt; break;
case '0': str.fill('0'); ++itFmt; break;
case '#': str.setf(std::ios_base::showpoint | std::ios_base::showbase); ++itFmt; break;
default: isFlag = false; break;
}
}
}
void parseWidth(std::ostream& str, std::string::const_iterator& itFmt, const std::string::const_iterator& endFmt)
{
int width = 0;
while (itFmt != endFmt && isdigit(*itFmt))
{
width = 10*width + *itFmt - '0';
++itFmt;
}
if (width != 0) str.width(width);
}
void parsePrec(std::ostream& str, std::string::const_iterator& itFmt, const std::string::const_iterator& endFmt)
{
if (itFmt != endFmt && *itFmt == '.')
{
++itFmt;
int prec = 0;
while (itFmt != endFmt && isdigit(*itFmt))
{
prec = 10*prec + *itFmt - '0';
++itFmt;
}
if (prec != 0) str.precision(prec);
}
}
char parseMod(std::string::const_iterator& itFmt, const std::string::const_iterator& endFmt)
{
char mod = 0;
if (itFmt != endFmt)
{
switch (*itFmt)
{
case 'l':
case 'h':
case 'L': mod = *itFmt++; break;
}
}
return mod;
}
void prepareFormat(std::ostream& str, char type)
{
switch (type)
{
case 'd':
case 'i': str << std::dec; break;
case 'o': str << std::oct; break;
case 'x': str << std::hex; break;
case 'X': str << std::hex << std::uppercase; break;
case 'e': str << std::scientific; break;
case 'E': str << std::scientific << std::uppercase; break;
case 'f': str << std::fixed; break;
}
}
void formatOne(std::string& result, std::string::const_iterator& itFmt, const std::string::const_iterator& endFmt, std::vector<Any>::const_iterator& itVal)
{
std::ostringstream str;
parseFlags(str, itFmt, endFmt);
parseWidth(str, itFmt, endFmt);
parsePrec(str, itFmt, endFmt);
char mod = parseMod(itFmt, endFmt);
if (itFmt != endFmt)
{
char type = *itFmt++;
prepareFormat(str, type);
switch (type)
{
case 'c':
str << AnyCast<char>(*itVal++);
break;
case 'd':
case 'i':
switch (mod)
{
case 'l': str << AnyCast<long>(*itVal++); break;
case 'L': str << AnyCast<Int64>(*itVal++); break;
case 'h': str << AnyCast<short>(*itVal++); break;
default: str << AnyCast<int>(*itVal++); break;
}
break;
case 'o':
case 'u':
case 'x':
case 'X':
switch (mod)
{
case 'l': str << AnyCast<unsigned long>(*itVal++); break;
case 'L': str << AnyCast<UInt64>(*itVal++); break;
case 'h': str << AnyCast<unsigned short>(*itVal++); break;
default: str << AnyCast<unsigned>(*itVal++); break;
}
break;
case 'e':
case 'E':
case 'f':
switch (mod)
{
case 'l': str << AnyCast<long double>(*itVal++); break;
case 'L': str << AnyCast<long double>(*itVal++); break;
case 'h': str << AnyCast<float>(*itVal++); break;
default: str << AnyCast<double>(*itVal++); break;
}
break;
case 's':
str << RefAnyCast<std::string>(*itVal++);
break;
default:
str << type;
}
}
result.append(str.str());
}
}
std::string format(const std::string& fmt, const Any& value)
{
std::string result;
format(result, fmt, value);
return result;
}
std::string format(const std::string& fmt, const Any& value1, const Any& value2)
{
std::string result;
format(result, fmt, value1, value2);
return result;
}
std::string format(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3)
{
std::string result;
format(result, fmt, value1, value2, value3);
return result;
}
std::string format(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4)
{
std::string result;
format(result, fmt, value1, value2, value3, value4);
return result;
}
std::string format(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5)
{
std::string result;
format(result, fmt, value1, value2, value3, value4, value5);
return result;
}
std::string format(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6)
{
std::string result;
format(result, fmt, value1, value2, value3, value4, value5, value6);
return result;
}
void format(std::string& result, const std::string& fmt, const Any& value)
{
std::vector<Any> args;
args.push_back(value);
format(result, fmt, args);
}
void format(std::string& result, const std::string& fmt, const Any& value1, const Any& value2)
{
std::vector<Any> args;
args.push_back(value1);
args.push_back(value2);
format(result, fmt, args);
}
void format(std::string& result, const std::string& fmt, const Any& value1, const Any& value2, const Any& value3)
{
std::vector<Any> args;
args.push_back(value1);
args.push_back(value2);
args.push_back(value3);
format(result, fmt, args);
}
void format(std::string& result, const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4)
{
std::vector<Any> args;
args.push_back(value1);
args.push_back(value2);
args.push_back(value3);
args.push_back(value4);
format(result, fmt, args);
}
void format(std::string& result, const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5)
{
std::vector<Any> args;
args.push_back(value1);
args.push_back(value2);
args.push_back(value3);
args.push_back(value4);
args.push_back(value5);
format(result, fmt, args);
}
void format(std::string& result, const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6)
{
std::vector<Any> args;
args.push_back(value1);
args.push_back(value2);
args.push_back(value3);
args.push_back(value4);
args.push_back(value5);
args.push_back(value6);
format(result, fmt, args);
}
void format(std::string& result, const std::string& fmt, const std::vector<Any>& values)
{
std::string::const_iterator itFmt = fmt.begin();
std::string::const_iterator endFmt = fmt.end();
std::vector<Any>::const_iterator itVal = values.begin();
std::vector<Any>::const_iterator endVal = values.end();
while (itFmt != endFmt)
{
switch (*itFmt)
{
case '%':
++itFmt;
if (itFmt != endFmt && itVal != endVal)
formatOne(result, itFmt, endFmt, itVal);
else
result += *itFmt;
break;
default:
result += *itFmt;
++itFmt;
}
}
}
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// Formatter.cpp
//
// $Id: //poco/1.1.0/Foundation/src/Formatter.cpp#2 $
// $Id: //poco/1.2/Foundation/src/Formatter.cpp#1 $
//
// Library: Foundation
// Package: Logging
@@ -34,11 +34,11 @@
//
#include "Foundation/Formatter.h"
#include "Foundation/Exception.h"
#include "Poco/Formatter.h"
#include "Poco/Exception.h"
Foundation_BEGIN
namespace Poco {
Formatter::Formatter()
@@ -63,4 +63,4 @@ std::string Formatter::getProperty(const std::string& name) const
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// FormattingChannel.cpp
//
// $Id: //poco/1.1.0/Foundation/src/FormattingChannel.cpp#2 $
// $Id: //poco/1.2/Foundation/src/FormattingChannel.cpp#1 $
//
// Library: Foundation
// Package: Logging
@@ -34,13 +34,13 @@
//
#include "Foundation/FormattingChannel.h"
#include "Foundation/Formatter.h"
#include "Foundation/Message.h"
#include "Foundation/LoggingRegistry.h"
#include "Poco/FormattingChannel.h"
#include "Poco/Formatter.h"
#include "Poco/Message.h"
#include "Poco/LoggingRegistry.h"
Foundation_BEGIN
namespace Poco {
FormattingChannel::FormattingChannel():
@@ -145,4 +145,4 @@ void FormattingChannel::close()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// Glob.cpp
//
// $Id: //poco/1.1.0/Foundation/src/Glob.cpp#2 $
// $Id: //poco/1.2/Foundation/src/Glob.cpp#1 $
//
// Library: Foundation
// Package: Filesystem
@@ -34,14 +34,14 @@
//
#include "Foundation/Glob.h"
#include "Foundation/Path.h"
#include "Foundation/Exception.h"
#include "Foundation/DirectoryIterator.h"
#include "Foundation/File.h"
#include "Poco/Glob.h"
#include "Poco/Path.h"
#include "Poco/Exception.h"
#include "Poco/DirectoryIterator.h"
#include "Poco/File.h"
Foundation_BEGIN
namespace Poco {
Glob::Glob(const std::string& pattern, int options):
@@ -239,4 +239,4 @@ void Glob::collect(const Path& pathPattern, const Path& base, const Path& curren
}
Foundation_END
} // namespace Poco

View File

@@ -0,0 +1,86 @@
//
// HashStatistic.cpp
//
// $Id: //poco/1.2/Foundation/src/HashStatistic.cpp#1 $
//
// Library: Foundation
// Package: Core
// Module: HashStatistic
//
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#include "Poco/HashStatistic.h"
#include <sstream>
namespace Poco {
HashStatistic::HashStatistic(
UInt32 tableSize,
UInt32 numEntries,
UInt32 numZeroEntries,
UInt32 maxEntry,
std::vector<UInt32> details):
_sizeOfTable(tableSize),
_numberOfEntries(numEntries),
_numZeroEntries(numZeroEntries),
_maxEntriesPerHash(maxEntry),
_detailedEntriesPerHash(details)
{
}
HashStatistic::~HashStatistic()
{
}
std::string HashStatistic::toString() const
{
std::ostringstream str;
str << "HashTable of size " << _sizeOfTable << " containing " << _numberOfEntries << " entries:\n";
str << " NumberOfZeroEntries: " << _numZeroEntries << "\n";
str << " MaxEntry: " << _maxEntriesPerHash << "\n";
str << " AvgEntry: " << avgEntriesPerHash() << ", excl Zero slots: " << avgEntriesPerHashExclZeroEntries() << "\n";
str << " DetailedStatistics: \n";
for (int i = 0; i < _detailedEntriesPerHash.size(); ++i)
{
// 10 entries per line
if (i % 10 == 0)
{
str << "\n " << i << ":";
}
str << " " << _detailedEntriesPerHash[i];
}
str << "\n";
str.flush();
return str.str();
}
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// HexBinaryDecoder.cpp
//
// $Id: //poco/1.1.0/Foundation/src/HexBinaryDecoder.cpp#2 $
// $Id: //poco/1.2/Foundation/src/HexBinaryDecoder.cpp#1 $
//
// Library: Foundation
// Package: Streams
@@ -34,11 +34,11 @@
//
#include "Foundation/HexBinaryDecoder.h"
#include "Foundation/Exception.h"
#include "Poco/HexBinaryDecoder.h"
#include "Poco/Exception.h"
Foundation_BEGIN
namespace Poco {
HexBinaryDecoderBuf::HexBinaryDecoderBuf(std::istream& istr): _istr(istr)
@@ -112,4 +112,4 @@ HexBinaryDecoder::~HexBinaryDecoder()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// HexBinaryEncoder.cpp
//
// $Id: //poco/1.1.0/Foundation/src/HexBinaryEncoder.cpp#2 $
// $Id: //poco/1.2/Foundation/src/HexBinaryEncoder.cpp#1 $
//
// Library: Foundation
// Package: Streams
@@ -34,10 +34,10 @@
//
#include "Foundation/HexBinaryEncoder.h"
#include "Poco/HexBinaryEncoder.h"
Foundation_BEGIN
namespace Poco {
HexBinaryEncoderBuf::HexBinaryEncoderBuf(std::ostream& ostr):
@@ -137,4 +137,4 @@ HexBinaryEncoder::~HexBinaryEncoder()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// InflatingStream.cpp
//
// $Id: //poco/1.1.0/Foundation/src/InflatingStream.cpp#2 $
// $Id: //poco/1.2/Foundation/src/InflatingStream.cpp#1 $
//
// Library: Foundation
// Package: Streams
@@ -34,11 +34,11 @@
//
#include "Foundation/InflatingStream.h"
#include "Foundation/Exception.h"
#include "Poco/InflatingStream.h"
#include "Poco/Exception.h"
Foundation_BEGIN
namespace Poco {
InflatingStreamBuf::InflatingStreamBuf(std::istream& istr, StreamType type):
@@ -114,7 +114,7 @@ int InflatingStreamBuf::readFromDevice(char* buffer, std::streamsize length)
{
if (_eof || !_pIstr) return 0;
if (!_zstr.next_in)
if (_zstr.avail_in == 0)
{
int n = 0;
if (_pIstr->good())
@@ -125,14 +125,9 @@ int InflatingStreamBuf::readFromDevice(char* buffer, std::streamsize length)
if (n == 0) return 0;
_zstr.next_in = (unsigned char*) _buffer;
_zstr.avail_in = n;
_zstr.next_out = (unsigned char*) buffer;
_zstr.avail_out = length;
}
else if (_zstr.avail_out == 0)
{
_zstr.next_out = (unsigned char*) buffer;
_zstr.avail_out = length;
}
_zstr.next_out = (unsigned char*) buffer;
_zstr.avail_out = length;
for (;;)
{
int rc = inflate(&_zstr, Z_NO_FLUSH);
@@ -255,4 +250,4 @@ InflatingInputStream::~InflatingInputStream()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// Latin1Encoding.cpp
//
// $Id: //poco/1.1.0/Foundation/src/Latin1Encoding.cpp#2 $
// $Id: //poco/1.2/Foundation/src/Latin1Encoding.cpp#1 $
//
// Library: Foundation
// Package: Text
@@ -34,10 +34,10 @@
//
#include "Foundation/Latin1Encoding.h"
#include "Poco/Latin1Encoding.h"
Foundation_BEGIN
namespace Poco {
const TextEncoding::CharacterMap Latin1Encoding::_charMap =
@@ -94,4 +94,4 @@ int Latin1Encoding::convert(int ch, unsigned char* bytes, int length) const
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// Latin9Encoding.cpp
//
// $Id: //poco/1.1.0/Foundation/src/Latin9Encoding.cpp#2 $
// $Id: //poco/1.2/Foundation/src/Latin9Encoding.cpp#1 $
//
// Library: Foundation
// Package: Text
@@ -34,10 +34,10 @@
//
#include "Foundation/Latin9Encoding.h"
#include "Poco/Latin9Encoding.h"
Foundation_BEGIN
namespace Poco {
const TextEncoding::CharacterMap Latin9Encoding::_charMap =
@@ -105,4 +105,4 @@ int Latin9Encoding::convert(int ch, unsigned char* bytes, int length) const
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// LineEndingConverter.cpp
//
// $Id: //poco/1.1.0/Foundation/src/LineEndingConverter.cpp#2 $
// $Id: //poco/1.2/Foundation/src/LineEndingConverter.cpp#1 $
//
// Library: Foundation
// Package: Streams
@@ -34,10 +34,10 @@
//
#include "Foundation/LineEndingConverter.h"
#include "Poco/LineEndingConverter.h"
Foundation_BEGIN
namespace Poco {
#if defined(_WIN32)
@@ -201,4 +201,4 @@ OutputLineEndingConverter::~OutputLineEndingConverter()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// LocalDateTime.cpp
//
// $Id: //poco/1.1.0/Foundation/src/LocalDateTime.cpp#2 $
// $Id: //poco/1.2/Foundation/src/LocalDateTime.cpp#1 $
//
// Library: Foundation
// Package: DateTime
@@ -34,13 +34,13 @@
//
#include "Foundation/LocalDateTime.h"
#include "Foundation/Timezone.h"
#include "Foundation/Timespan.h"
#include "Poco/LocalDateTime.h"
#include "Poco/Timezone.h"
#include "Poco/Timespan.h"
#include <algorithm>
Foundation_BEGIN
namespace Poco {
LocalDateTime::LocalDateTime():
@@ -184,8 +184,6 @@ DateTime LocalDateTime::utc() const
bool LocalDateTime::operator == (const LocalDateTime& dateTime) const
{
Timestamp::UtcTimeVal t1 = utcTime();
Timestamp::UtcTimeVal t2 = dateTime.utcTime();
return utcTime() == dateTime.utcTime();
}
@@ -252,4 +250,4 @@ LocalDateTime& LocalDateTime::operator -= (const Timespan& span)
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// LogFile.cpp
//
// $Id: //poco/1.1.0/Foundation/src/LogFile.cpp#2 $
// $Id: //poco/1.2/Foundation/src/LogFile.cpp#1 $
//
// Library: Foundation
// Package: Logging
@@ -34,10 +34,12 @@
//
#include "Foundation/LogFile.h"
#include "Poco/LogFile.h"
#if defined(POCO_OS_FAMILY_WINDOWS)
#if defined(POCO_OS_FAMILY_WINDOWS) && defined(POCO_WIN32_UTF8)
#include "LogFile_WIN32U.cpp"
#elif defined(POCO_OS_FAMILY_WINDOWS)
#include "LogFile_WIN32.cpp"
#elif defined(POCO_OS_FAMILY_VMS)
#include "LogFile_VMS.cpp"
@@ -46,7 +48,7 @@
#endif
Foundation_BEGIN
namespace Poco {
LogFile::LogFile(const std::string& path): LogFileImpl(path)
@@ -59,4 +61,4 @@ LogFile::~LogFile()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// LogFile_STD.cpp
//
// $Id: //poco/1.1.0/Foundation/src/LogFile_STD.cpp#2 $
// $Id: //poco/1.2/Foundation/src/LogFile_STD.cpp#1 $
//
// Library: Foundation
// Package: Logging
@@ -34,17 +34,17 @@
//
#include "Foundation/LogFile_STD.h"
#include "Foundation/File.h"
#include "Foundation/Exception.h"
#include "Poco/LogFile_STD.h"
#include "Poco/File.h"
#include "Poco/Exception.h"
Foundation_BEGIN
namespace Poco {
LogFileImpl::LogFileImpl(const std::string& path): _path(path)
{
_str.open(path.c_str(), std::ios::ate);
_str.open(path.c_str(), std::ios::app | std::ios::ate);
if (!_str.good()) throw OpenFileException(path);
if (sizeImpl() == 0)
_creationDate = File(path).getLastModified();
@@ -83,4 +83,4 @@ const std::string& LogFileImpl::pathImpl() const
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// LogFile_VMS.cpp
//
// $Id: //poco/1.1.0/Foundation/src/LogFile_VMS.cpp#2 $
// $Id: //poco/1.2/Foundation/src/LogFile_VMS.cpp#1 $
//
// Library: Foundation
// Package: Logging
@@ -34,12 +34,12 @@
//
#include "Foundation/LogFile_VMS.h"
#include "Foundation/File.h"
#include "Foundation/Exception.h"
#include "Poco/LogFile_VMS.h"
#include "Poco/File.h"
#include "Poco/Exception.h"
Foundation_BEGIN
namespace Poco {
LogFileImpl::LogFileImpl(const std::string& path): _path(path)
@@ -88,4 +88,4 @@ const std::string& LogFileImpl::pathImpl() const
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// LogFile_WIN32.cpp
//
// $Id: //poco/1.1.0/Foundation/src/LogFile_WIN32.cpp#2 $
// $Id: //poco/1.2/Foundation/src/LogFile_WIN32.cpp#1 $
//
// Library: Foundation
// Package: Logging
@@ -34,12 +34,12 @@
//
#include "Foundation/LogFile_WIN32.h"
#include "Foundation/File.h"
#include "Foundation/Exception.h"
#include "Poco/LogFile_WIN32.h"
#include "Poco/File.h"
#include "Poco/Exception.h"
Foundation_BEGIN
namespace Poco {
LogFileImpl::LogFileImpl(const std::string& path): _path(path)
@@ -106,4 +106,4 @@ const std::string& LogFileImpl::pathImpl() const
}
Foundation_END
} // namespace Poco

View File

@@ -0,0 +1,112 @@
//
// LogFile_WIN32U.cpp
//
// $Id: //poco/1.2/Foundation/src/LogFile_WIN32U.cpp#1 $
//
// Library: Foundation
// Package: Logging
// Module: LogFile
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#include "Poco/LogFile_WIN32U.h"
#include "Poco/File.h"
#include "Poco/Exception.h"
#include "Poco/UnicodeConverter.h"
namespace Poco {
LogFileImpl::LogFileImpl(const std::string& path): _path(path)
{
std::wstring upath;
UnicodeConverter::toUTF16(path, upath);
_hFile = CreateFileW(upath.c_str(), GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (_hFile == INVALID_HANDLE_VALUE) throw OpenFileException(path);
SetFilePointer(_hFile, 0, 0, FILE_END);
// There seems to be a strange "optimization" in the Windows NTFS
// filesystem that causes it to reuse directory entries of deleted
// files. Example:
// 1. create a file named "test.dat"
// note the file's creation date
// 2. delete the file "test.dat"
// 3. wait a few seconds
// 4. create a file named "test.dat"
// the new file will have the same creation
// date as the old one.
// We work around this bug by taking the file's
// modification date as a reference when the
// file is empty.
if (sizeImpl() == 0)
_creationDate = File(path).getLastModified();
else
_creationDate = File(path).created();
}
LogFileImpl::~LogFileImpl()
{
CloseHandle(_hFile);
}
void LogFileImpl::writeImpl(const std::string& text)
{
DWORD bytesWritten;
BOOL res = WriteFile(_hFile, text.data(), (DWORD) text.size(), &bytesWritten, NULL);
if (!res) throw WriteFileException(_path);
res = WriteFile(_hFile, "\r\n", 2, &bytesWritten, NULL);
if (!res) throw WriteFileException(_path);
res = FlushFileBuffers(_hFile);
if (!res) throw WriteFileException(_path);
}
UInt64 LogFileImpl::sizeImpl() const
{
LARGE_INTEGER li;
li.HighPart = 0;
li.LowPart = SetFilePointer(_hFile, 0, &li.HighPart, FILE_CURRENT);
return li.QuadPart;
}
Timestamp LogFileImpl::creationDateImpl() const
{
return _creationDate;
}
const std::string& LogFileImpl::pathImpl() const
{
return _path;
}
} // namespace Poco

View File

@@ -0,0 +1,181 @@
//
// LogStream.cpp
//
// $Id: //poco/1.2/Foundation/src/LogStream.cpp#1 $
//
// Library: Foundation
// Package: Logging
// Module: LogStream
//
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#include "Poco/LogStream.h"
namespace Poco {
//
// LogStreamBuf
//
LogStreamBuf::LogStreamBuf(Logger& logger, Message::Priority priority):
_logger(logger),
_priority(priority)
{
}
LogStreamBuf::~LogStreamBuf()
{
}
void LogStreamBuf::setPriority(Message::Priority priority)
{
_priority = priority;
}
int LogStreamBuf::writeToDevice(char c)
{
if (c == '\n' || c == '\r')
{
Message msg(_logger.name(), _message, _priority);
_message.clear();
_logger.log(msg);
}
else _message += c;
return c;
}
//
// LogIOS
//
LogIOS::LogIOS(Logger& logger, Message::Priority priority):
_buf(logger, priority)
{
poco_ios_init(&_buf);
}
LogIOS::~LogIOS()
{
}
LogStreamBuf* LogIOS::rdbuf()
{
return &_buf;
}
//
// LogStream
//
LogStream::LogStream(Logger& logger, Message::Priority priority):
LogIOS(logger, priority),
std::ostream(&_buf)
{
}
LogStream::LogStream(const std::string& loggerName, Message::Priority priority):
LogIOS(Logger::get(loggerName), priority),
std::ostream(&_buf)
{
}
LogStream::~LogStream()
{
}
LogStream& LogStream::fatal()
{
return priority(Message::PRIO_FATAL);
}
LogStream& LogStream::critical()
{
return priority(Message::PRIO_CRITICAL);
}
LogStream& LogStream::error()
{
return priority(Message::PRIO_ERROR);
}
LogStream& LogStream::warning()
{
return priority(Message::PRIO_WARNING);
}
LogStream& LogStream::notice()
{
return priority(Message::PRIO_NOTICE);
}
LogStream& LogStream::information()
{
return priority(Message::PRIO_INFORMATION);
}
LogStream& LogStream::debug()
{
return priority(Message::PRIO_DEBUG);
}
LogStream& LogStream::trace()
{
return priority(Message::PRIO_TRACE);
}
LogStream& LogStream::priority(Message::Priority priority)
{
_buf.setPriority(priority);
return *this;
}
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// Logger.cpp
//
// $Id: //poco/1.1.0/Foundation/src/Logger.cpp#2 $
// $Id: //poco/1.2/Foundation/src/Logger.cpp#1 $
//
// Library: Foundation
// Package: Logging
@@ -34,14 +34,14 @@
//
#include "Foundation/Logger.h"
#include "Foundation/Formatter.h"
#include "Foundation/LoggingRegistry.h"
#include "Foundation/Exception.h"
#include "Foundation/NumberFormatter.h"
#include "Poco/Logger.h"
#include "Poco/Formatter.h"
#include "Poco/LoggingRegistry.h"
#include "Poco/Exception.h"
#include "Poco/NumberFormatter.h"
Foundation_BEGIN
namespace Poco {
Logger::LoggerMap* Logger::_pLoggerMap = 0;
@@ -371,6 +371,21 @@ void Logger::destroy(const std::string& name)
}
void Logger::names(std::vector<std::string>& names)
{
Mutex::ScopedLock lock(_mapMtx);
names.clear();
if (_pLoggerMap)
{
for (LoggerMap::const_iterator it = _pLoggerMap->begin(); it != _pLoggerMap->end(); ++it)
{
names.push_back(it->first);
}
}
}
Logger& Logger::parent(const std::string& name)
{
std::string::size_type pos = name.rfind('.');
@@ -413,4 +428,4 @@ void Logger::add(Logger* pLogger)
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// LoggingFactory.cpp
//
// $Id: //poco/1.1.0/Foundation/src/LoggingFactory.cpp#2 $
// $Id: //poco/1.2/Foundation/src/LoggingFactory.cpp#1 $
//
// Library: Foundation
// Package: Logging
@@ -34,27 +34,27 @@
//
#include "Foundation/LoggingFactory.h"
#include "Foundation/SingletonHolder.h"
#include "Foundation/AsyncChannel.h"
#include "Foundation/ConsoleChannel.h"
#include "Foundation/FileChannel.h"
#include "Foundation/FormattingChannel.h"
#include "Foundation/SplitterChannel.h"
#include "Foundation/NullChannel.h"
#include "Poco/LoggingFactory.h"
#include "Poco/SingletonHolder.h"
#include "Poco/AsyncChannel.h"
#include "Poco/ConsoleChannel.h"
#include "Poco/FileChannel.h"
#include "Poco/FormattingChannel.h"
#include "Poco/SplitterChannel.h"
#include "Poco/NullChannel.h"
#if defined(POCO_OS_FAMILY_UNIX)
#include "Foundation/SyslogChannel.h"
#include "Poco/SyslogChannel.h"
#endif
#if defined(POCO_OS_FAMILY_VMS)
#include "Foundation/OpcomChannel.h"
#include "Poco/OpcomChannel.h"
#endif
#if defined(POCO_OS_FAMILY_WINDOWS)
#include "Foundation/EventLogChannel.h"
#include "Poco/EventLogChannel.h"
#endif
#include "Foundation/PatternFormatter.h"
#include "Poco/PatternFormatter.h"
Foundation_BEGIN
namespace Poco {
LoggingFactory::LoggingFactory()
@@ -122,4 +122,4 @@ void LoggingFactory::registerBuiltins()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// LoggingRegistry.cpp
//
// $Id: //poco/1.1.0/Foundation/src/LoggingRegistry.cpp#2 $
// $Id: //poco/1.2/Foundation/src/LoggingRegistry.cpp#1 $
//
// Library: Foundation
// Package: Logging
@@ -34,11 +34,11 @@
//
#include "Foundation/LoggingRegistry.h"
#include "Foundation/SingletonHolder.h"
#include "Poco/LoggingRegistry.h"
#include "Poco/SingletonHolder.h"
Foundation_BEGIN
namespace Poco {
LoggingRegistry::LoggingRegistry()
@@ -131,4 +131,4 @@ LoggingRegistry& LoggingRegistry::defaultRegistry()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// MD2Engine.cpp
//
// $Id: //poco/1.1.0/Foundation/src/MD2Engine.cpp#2 $
// $Id: //poco/1.2/Foundation/src/MD2Engine.cpp#1 $
//
// Library: Foundation
// Package: Crypt
@@ -53,11 +53,11 @@
//
#include "Foundation/MD2Engine.h"
#include "Poco/MD2Engine.h"
#include <string.h>
Foundation_BEGIN
namespace Poco {
MD2Engine::MD2Engine()
@@ -213,4 +213,4 @@ void MD2Engine::transform(unsigned char state[16], unsigned char checksum[16], c
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// MD4Engine.cpp
//
// $Id: //poco/1.1.0/Foundation/src/MD4Engine.cpp#2 $
// $Id: //poco/1.2/Foundation/src/MD4Engine.cpp#1 $
//
// Library: Foundation
// Package: Crypt
@@ -57,11 +57,11 @@
//
#include "Foundation/MD4Engine.h"
#include "Poco/MD4Engine.h"
#include <string.h>
Foundation_BEGIN
namespace Poco {
MD4Engine::MD4Engine()
@@ -297,4 +297,4 @@ void MD4Engine::decode(UInt32* output, const unsigned char* input, unsigned int
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// MD5Engine.cpp
//
// $Id: //poco/1.1.0/Foundation/src/MD5Engine.cpp#2 $
// $Id: //poco/1.2/Foundation/src/MD5Engine.cpp#1 $
//
// Library: Foundation
// Package: Crypt
@@ -57,11 +57,11 @@
//
#include "Foundation/MD5Engine.h"
#include "Poco/MD5Engine.h"
#include <string.h>
Foundation_BEGIN
namespace Poco {
MD5Engine::MD5Engine()
@@ -328,4 +328,4 @@ void MD5Engine::decode(UInt32* output, const unsigned char* input, unsigned int
}
Foundation_END
} // namespace Poco

Binary file not shown.

View File

@@ -1,7 +1,7 @@
//
// Manifest.cpp
//
// $Id: //poco/1.1.0/Foundation/src/Manifest.cpp#2 $
// $Id: //poco/1.2/Foundation/src/Manifest.cpp#1 $
//
// Library: Foundation
// Package: SharedLibrary
@@ -34,10 +34,10 @@
//
#include "Foundation/Manifest.h"
#include "Poco/Manifest.h"
Foundation_BEGIN
namespace Poco {
ManifestBase::ManifestBase()
@@ -50,4 +50,4 @@ ManifestBase::~ManifestBase()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// MemoryPool.cpp
//
// $Id: //poco/1.1.0/Foundation/src/MemoryPool.cpp#2 $
// $Id: //poco/1.2/Foundation/src/MemoryPool.cpp#1 $
//
// Library: Foundation
// Package: Core
@@ -34,11 +34,11 @@
//
#include "Foundation/MemoryPool.h"
#include "Foundation/Exception.h"
#include "Poco/MemoryPool.h"
#include "Poco/Exception.h"
Foundation_BEGIN
namespace Poco {
MemoryPool::MemoryPool(size_t blockSize, int preAlloc, int maxAlloc):
@@ -100,4 +100,4 @@ void MemoryPool::release(void* ptr)
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// Message.cpp
//
// $Id: //poco/1.1.0/Foundation/src/Message.cpp#2 $
// $Id: //poco/1.2/Foundation/src/Message.cpp#1 $
//
// Library: Foundation
// Package: Logging
@@ -34,20 +34,20 @@
//
#include "Foundation/Message.h"
#include "Foundation/Exception.h"
#include "Foundation/Process.h"
#include "Foundation/Thread.h"
#include "Poco/Message.h"
#include "Poco/Exception.h"
#include "Poco/Process.h"
#include "Poco/Thread.h"
Foundation_BEGIN
namespace Poco {
Message::Message():
_prio(PRIO_FATAL),
_pMap(0),
_tid(0),
_pid(0)
_pid(0),
_pMap(0)
{
init();
}
@@ -57,9 +57,9 @@ Message::Message(const std::string& source, const std::string& text, Priority pr
_source(source),
_text(text),
_prio(prio),
_pMap(0),
_tid(0),
_pid(0)
_pid(0),
_pMap(0)
{
init();
}
@@ -199,4 +199,4 @@ std::string& Message::operator [] (const std::string& param)
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// Mutex.cpp
//
// $Id: //poco/1.1.0/Foundation/src/Mutex.cpp#2 $
// $Id: //poco/1.2/Foundation/src/Mutex.cpp#1 $
//
// Library: Foundation
// Package: Threading
@@ -34,7 +34,7 @@
//
#include "Foundation/Mutex.h"
#include "Poco/Mutex.h"
#if defined(POCO_OS_FAMILY_WINDOWS)
@@ -44,7 +44,7 @@
#endif
Foundation_BEGIN
namespace Poco {
Mutex::Mutex()
@@ -67,4 +67,4 @@ FastMutex::~FastMutex()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// Mutex_POSIX.cpp
//
// $Id: //poco/1.1.0/Foundation/src/Mutex_POSIX.cpp#2 $
// $Id: //poco/1.2/Foundation/src/Mutex_POSIX.cpp#1 $
//
// Library: Foundation
// Package: Threading
@@ -34,10 +34,10 @@
//
#include "Foundation/Mutex_POSIX.h"
#include "Poco/Mutex_POSIX.h"
Foundation_BEGIN
namespace Poco {
MutexImpl::MutexImpl()
@@ -92,4 +92,4 @@ FastMutexImpl::~FastMutexImpl()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// Mutex_WIN32.cpp
//
// $Id: //poco/1.1.0/Foundation/src/Mutex_WIN32.cpp#2 $
// $Id: //poco/1.2/Foundation/src/Mutex_WIN32.cpp#1 $
//
// Library: Foundation
// Package: Threading
@@ -34,10 +34,10 @@
//
#include "Foundation/Mutex_WIN32.h"
#include "Poco/Mutex_WIN32.h"
Foundation_BEGIN
namespace Poco {
MutexImpl::MutexImpl()
@@ -53,4 +53,4 @@ MutexImpl::~MutexImpl()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// NamedEvent.cpp
//
// $Id: //poco/1.1.0/Foundation/src/NamedEvent.cpp#2 $
// $Id: //poco/1.2/Foundation/src/NamedEvent.cpp#1 $
//
// Library: Foundation
// Package: Processes
@@ -34,7 +34,7 @@
//
#include "Foundation/NamedEvent.h"
#include "Poco/NamedEvent.h"
#if defined(POCO_OS_FAMILY_WINDOWS) && defined(POCO_WIN32_UTF8)
@@ -48,7 +48,7 @@
#endif
Foundation_BEGIN
namespace Poco {
NamedEvent::NamedEvent(const std::string& name):
@@ -62,4 +62,4 @@ NamedEvent::~NamedEvent()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// NamedEvent_UNIX.cpp
//
// $Id: //poco/1.1.0/Foundation/src/NamedEvent_UNIX.cpp#2 $
// $Id: //poco/1.2/Foundation/src/NamedEvent_UNIX.cpp#1 $
//
// Library: Foundation
// Package: Processes
@@ -34,8 +34,8 @@
//
#include "Foundation/NamedEvent_UNIX.h"
#include "Foundation/Exception.h"
#include "Poco/NamedEvent_UNIX.h"
#include "Poco/Exception.h"
#include <fcntl.h>
#include <sys/stat.h>
#if defined(sun) || defined(__APPLE__) || defined(__osf__) || defined(__QNX__)
@@ -49,7 +49,7 @@
#endif
Foundation_BEGIN
namespace Poco {
#if defined(linux) || defined(__CYGWIN__)
@@ -156,4 +156,4 @@ std::string NamedEventImpl::getFileName()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// NamedEvent_VMS.cpp
//
// $Id: //poco/1.1.0/Foundation/src/NamedEvent_VMS.cpp#2 $
// $Id: //poco/1.2/Foundation/src/NamedEvent_VMS.cpp#1 $
//
// Library: Foundation
// Package: Processes
@@ -34,14 +34,14 @@
//
#include "Foundation/NamedEvent_VMS.h"
#include "Poco/NamedEvent_VMS.h"
#include <lib$routines.h>
#include <starlet.h>
#include <descrip.h>
#include <iodef.h>
Foundation_BEGIN
namespace Poco {
NamedEventImpl::NamedEventImpl(const std::string& name):
@@ -82,4 +82,4 @@ void NamedEventImpl::waitImpl()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// NamedEvent_WIN32.cpp
//
// $Id: //poco/1.1.0/Foundation/src/NamedEvent_WIN32.cpp#2 $
// $Id: //poco/1.2/Foundation/src/NamedEvent_WIN32.cpp#1 $
//
// Library: Foundation
// Package: Processes
@@ -34,11 +34,11 @@
//
#include "Foundation/NamedEvent_WIN32.h"
#include "Foundation/Exception.h"
#include "Poco/NamedEvent_WIN32.h"
#include "Poco/Exception.h"
Foundation_BEGIN
namespace Poco {
NamedEventImpl::NamedEventImpl(const std::string& name):
@@ -75,4 +75,4 @@ void NamedEventImpl::waitImpl()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// NamedEvent_WIN32.cpp
//
// $Id: //poco/1.1.0/Foundation/src/NamedEvent_WIN32U.cpp#2 $
// $Id: //poco/1.2/Foundation/src/NamedEvent_WIN32U.cpp#1 $
//
// Library: Foundation
// Package: Processes
@@ -34,12 +34,12 @@
//
#include "Foundation/NamedEvent_WIN32U.h"
#include "Foundation/Exception.h"
#include "Foundation/UnicodeConverter.h"
#include "Poco/NamedEvent_WIN32U.h"
#include "Poco/Exception.h"
#include "Poco/UnicodeConverter.h"
Foundation_BEGIN
namespace Poco {
NamedEventImpl::NamedEventImpl(const std::string& name):
@@ -77,4 +77,4 @@ void NamedEventImpl::waitImpl()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// NamedMutex.cpp
//
// $Id: //poco/1.1.0/Foundation/src/NamedMutex.cpp#2 $
// $Id: //poco/1.2/Foundation/src/NamedMutex.cpp#1 $
//
// Library: Foundation
// Package: Processes
@@ -34,7 +34,7 @@
//
#include "Foundation/NamedMutex.h"
#include "Poco/NamedMutex.h"
#if defined(POCO_OS_FAMILY_WINDOWS) && defined(POCO_WIN32_UTF8)
@@ -48,7 +48,7 @@
#endif
Foundation_BEGIN
namespace Poco {
NamedMutex::NamedMutex(const std::string& name):
@@ -62,4 +62,4 @@ NamedMutex::~NamedMutex()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// NamedMutex_UNIX.cpp
//
// $Id: //poco/1.1.0/Foundation/src/NamedMutex_UNIX.cpp#2 $
// $Id: //poco/1.2/Foundation/src/NamedMutex_UNIX.cpp#1 $
//
// Library: Foundation
// Package: Processes
@@ -34,8 +34,8 @@
//
#include "Foundation/NamedMutex_UNIX.h"
#include "Foundation/Exception.h"
#include "Poco/NamedMutex_UNIX.h"
#include "Poco/Exception.h"
#include <fcntl.h>
#include <sys/stat.h>
#if defined(sun) || defined(__APPLE__) || defined(__osf__)
@@ -49,7 +49,7 @@
#endif
Foundation_BEGIN
namespace Poco {
#if defined(linux) || defined(__CYGWIN__)
@@ -170,4 +170,4 @@ std::string NamedMutexImpl::getFileName()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// NamedMutex_VMS.cpp
//
// $Id: //poco/1.1.0/Foundation/src/NamedMutex_VMS.cpp#2 $
// $Id: //poco/1.2/Foundation/src/NamedMutex_VMS.cpp#1 $
//
// Library: Foundation
// Package: Processes
@@ -34,12 +34,12 @@
//
#include "Foundation/NamedMutex_VMS.h"
#include "Poco/NamedMutex_VMS.h"
#include <starlet.h>
#include <iodef.h>
Foundation_BEGIN
namespace Poco {
NamedMutexImpl::NamedMutexImpl(const std::string& name):
@@ -84,4 +84,4 @@ void NamedMutexImpl::unlockImpl()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// NamedMutex_WIN32.cpp
//
// $Id: //poco/1.1.0/Foundation/src/NamedMutex_WIN32.cpp#2 $
// $Id: //poco/1.2/Foundation/src/NamedMutex_WIN32.cpp#1 $
//
// Library: Foundation
// Package: Processes
@@ -34,11 +34,11 @@
//
#include "Foundation/NamedMutex_WIN32.h"
#include "Foundation/Exception.h"
#include "Poco/NamedMutex_WIN32.h"
#include "Poco/Exception.h"
Foundation_BEGIN
namespace Poco {
NamedMutexImpl::NamedMutexImpl(const std::string& name):
@@ -92,4 +92,4 @@ void NamedMutexImpl::unlockImpl()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// NamedMutex_WIN32.cpp
//
// $Id: //poco/1.1.0/Foundation/src/NamedMutex_WIN32U.cpp#2 $
// $Id: //poco/1.2/Foundation/src/NamedMutex_WIN32U.cpp#1 $
//
// Library: Foundation
// Package: Processes
@@ -34,12 +34,12 @@
//
#include "Foundation/NamedMutex_WIN32U.h"
#include "Foundation/Exception.h"
#include "Foundation/UnicodeConverter.h"
#include "Poco/NamedMutex_WIN32U.h"
#include "Poco/Exception.h"
#include "Poco/UnicodeConverter.h"
Foundation_BEGIN
namespace Poco {
NamedMutexImpl::NamedMutexImpl(const std::string& name):
@@ -94,4 +94,4 @@ void NamedMutexImpl::unlockImpl()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// NestedDiagnosticContext.cpp
//
// $Id: //poco/1.1.0/Foundation/src/NestedDiagnosticContext.cpp#2 $
// $Id: //poco/1.2/Foundation/src/NestedDiagnosticContext.cpp#1 $
//
// Library: Foundation
// Package: Core
@@ -34,12 +34,12 @@
//
#include "Foundation/NestedDiagnosticContext.h"
#include "Foundation/SingletonHolder.h"
#include "Foundation/ThreadLocal.h"
#include "Poco/NestedDiagnosticContext.h"
#include "Poco/SingletonHolder.h"
#include "Poco/ThreadLocal.h"
Foundation_BEGIN
namespace Poco {
NestedDiagnosticContext::NestedDiagnosticContext()
@@ -143,4 +143,4 @@ NestedDiagnosticContext& NestedDiagnosticContext::current()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// Notification.cpp
//
// $Id: //poco/1.1.0/Foundation/src/Notification.cpp#2 $
// $Id: //poco/1.2/Foundation/src/Notification.cpp#1 $
//
// Library: Foundation
// Package: Notifications
@@ -34,11 +34,11 @@
//
#include "Foundation/Notification.h"
#include "Poco/Notification.h"
#include <typeinfo>
Foundation_BEGIN
namespace Poco {
Notification::Notification()
@@ -57,4 +57,4 @@ std::string Notification::name() const
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// NotificationCenter.cpp
//
// $Id: //poco/1.1.0/Foundation/src/NotificationCenter.cpp#2 $
// $Id: //poco/1.2/Foundation/src/NotificationCenter.cpp#1 $
//
// Library: Foundation
// Package: Notifications
@@ -34,14 +34,14 @@
//
#include "Foundation/NotificationCenter.h"
#include "Foundation/Notification.h"
#include "Foundation/Observer.h"
#include "Foundation/AutoPtr.h"
#include "Foundation/SingletonHolder.h"
#include "Poco/NotificationCenter.h"
#include "Poco/Notification.h"
#include "Poco/Observer.h"
#include "Poco/AutoPtr.h"
#include "Poco/SingletonHolder.h"
Foundation_BEGIN
namespace Poco {
NotificationCenter::NotificationCenter()
@@ -116,4 +116,4 @@ NotificationCenter& NotificationCenter::defaultCenter()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// NotificationQueue.cpp
//
// $Id: //poco/1.1.0/Foundation/src/NotificationQueue.cpp#2 $
// $Id: //poco/1.2/Foundation/src/NotificationQueue.cpp#1 $
//
// Library: Foundation
// Package: Notifications
@@ -34,13 +34,13 @@
//
#include "Foundation/NotificationQueue.h"
#include "Foundation/NotificationCenter.h"
#include "Foundation/Notification.h"
#include "Foundation/SingletonHolder.h"
#include "Poco/NotificationQueue.h"
#include "Poco/NotificationCenter.h"
#include "Poco/Notification.h"
#include "Poco/SingletonHolder.h"
Foundation_BEGIN
namespace Poco {
NotificationQueue::NotificationQueue()
@@ -224,4 +224,4 @@ NotificationQueue& NotificationQueue::defaultQueue()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// NullChannel.cpp
//
// $Id: //poco/1.1.0/Foundation/src/NullChannel.cpp#2 $
// $Id: //poco/1.2/Foundation/src/NullChannel.cpp#1 $
//
// Library: Foundation
// Package: Logging
@@ -34,10 +34,10 @@
//
#include "Foundation/NullChannel.h"
#include "Poco/NullChannel.h"
Foundation_BEGIN
namespace Poco {
NullChannel::NullChannel()
@@ -60,4 +60,4 @@ void NullChannel::setProperty(const std::string&, const std::string&)
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// NullStream.cpp
//
// $Id: //poco/1.1.0/Foundation/src/NullStream.cpp#2 $
// $Id: //poco/1.2/Foundation/src/NullStream.cpp#1 $
//
// Library: Foundation
// Package: Streams
@@ -34,10 +34,10 @@
//
#include "Foundation/NullStream.h"
#include "Poco/NullStream.h"
Foundation_BEGIN
namespace Poco {
NullStreamBuf::NullStreamBuf()
@@ -93,4 +93,4 @@ NullOutputStream::~NullOutputStream()
}
Foundation_END
} // namespace Poco

View File

@@ -1,7 +1,7 @@
//
// NumberFormatter.cpp
//
// $Id: //poco/1.1.0/Foundation/src/NumberFormatter.cpp#2 $
// $Id: //poco/1.2/Foundation/src/NumberFormatter.cpp#1 $
//
// Library: Foundation
// Package: Core
@@ -34,7 +34,7 @@
//
#include "Foundation/NumberFormatter.h"
#include "Poco/NumberFormatter.h"
#include <stdio.h>
#include <ctype.h>
@@ -48,7 +48,7 @@
#endif
Foundation_BEGIN
namespace Poco {
std::string NumberFormatter::format(int value)
@@ -381,4 +381,4 @@ std::string NumberFormatter::format(const void* ptr)
}
Foundation_END
} // namespace Poco

Some files were not shown because too many files have changed in this diff Show More