ArchiveStrategy.h | ArchiveStrategy.h | |||
---|---|---|---|---|
// | // | |||
// ArchiveStrategy.h | // ArchiveStrategy.h | |||
// | // | |||
// $Id: //poco/1.3/Foundation/include/Poco/ArchiveStrategy.h#4 $ | // $Id: //poco/1.3/Foundation/include/Poco/ArchiveStrategy.h#5 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Logging | // Package: Logging | |||
// Module: FileChannel | // Module: FileChannel | |||
// | // | |||
// Definition of the ArchiveStrategy class and subclasses. | // Definition of the ArchiveStrategy class and subclasses. | |||
// | // | |||
// Copyright (c) 2004-2008, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2008, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 116 | skipping to change at line 116 | |||
LogFile* archive(LogFile* pFile) | LogFile* archive(LogFile* pFile) | |||
/// Archives the file by appending the current timestamp to the | /// Archives the file by appending the current timestamp to the | |||
/// file name. If the new file name exists, additionally a m onotonic | /// file name. If the new file name exists, additionally a m onotonic | |||
/// increasing number is appended to the log file name. | /// increasing number is appended to the log file name. | |||
{ | { | |||
std::string path = pFile->path(); | std::string path = pFile->path(); | |||
delete pFile; | delete pFile; | |||
std::string archPath = path; | std::string archPath = path; | |||
archPath.append("."); | archPath.append("."); | |||
archPath.append(DateTimeFormatter::format(DT().timestamp(), "%Y%m%d%H%M%S%i")); | DateTimeFormatter::append(archPath, DT().timestamp(), "%Y%m% d%H%M%S%i"); | |||
if (exists(archPath)) archiveByNumber(archPath); | if (exists(archPath)) archiveByNumber(archPath); | |||
else moveFile(path, archPath); | else moveFile(path, archPath); | |||
return new LogFile(path); | return new LogFile(path); | |||
} | } | |||
private: | private: | |||
void archiveByNumber(const std::string& basePath) | void archiveByNumber(const std::string& basePath) | |||
/// A monotonic increasing number is appended to the | /// A monotonic increasing number is appended to the | |||
/// log file name. The most recent archived file | /// log file name. The most recent archived file | |||
/// always has the number zero. | /// always has the number zero. | |||
{ | { | |||
int n = -1; | int n = -1; | |||
std::string path; | std::string path; | |||
do | do | |||
{ | { | |||
path = basePath; | path = basePath; | |||
path.append("."); | path.append("."); | |||
path.append(NumberFormatter::format(++n)); | NumberFormatter::append(path, ++n); | |||
} | } | |||
while (exists(path)); | while (exists(path)); | |||
while (n >= 0) | while (n >= 0) | |||
{ | { | |||
std::string oldPath = basePath; | std::string oldPath = basePath; | |||
if (n > 0) | if (n > 0) | |||
{ | { | |||
oldPath.append("."); | oldPath.append("."); | |||
oldPath.append(NumberFormatter::format(n - 1 )); | NumberFormatter::append(oldPath, n - 1); | |||
} | } | |||
std::string newPath = basePath; | std::string newPath = basePath; | |||
newPath.append("."); | newPath.append("."); | |||
newPath.append(NumberFormatter::format(n)); | NumberFormatter::append(newPath, n); | |||
moveFile(oldPath, newPath); | moveFile(oldPath, newPath); | |||
--n; | --n; | |||
} | } | |||
} | } | |||
}; | }; | |||
} // namespace Poco | } // namespace Poco | |||
#endif // Foundation_ArchiveStrategy_INCLUDED | #endif // Foundation_ArchiveStrategy_INCLUDED | |||
End of changes. 5 change blocks. | ||||
5 lines changed or deleted | 5 lines changed or added | |||
Bugcheck.h | Bugcheck.h | |||
---|---|---|---|---|
// | // | |||
// Bugcheck.h | // Bugcheck.h | |||
// | // | |||
// $Id: //poco/1.3/Foundation/include/Poco/Bugcheck.h#2 $ | // $Id: //poco/1.3/Foundation/include/Poco/Bugcheck.h#3 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: Bugcheck | // Module: Bugcheck | |||
// | // | |||
// Definition of the Bugcheck class and the self-testing macros. | // Definition of the Bugcheck class and the self-testing macros. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 43 | skipping to change at line 43 | |||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Foundation_Bugcheck_INCLUDED | #ifndef Foundation_Bugcheck_INCLUDED | |||
#define Foundation_Bugcheck_INCLUDED | #define Foundation_Bugcheck_INCLUDED | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
#include <string> | #include <string> | |||
#if defined(_DEBUG) | ||||
# include <iostream> | ||||
#endif | ||||
namespace Poco { | namespace Poco { | |||
class Foundation_API Bugcheck | class Foundation_API Bugcheck | |||
/// This class provides some static methods that are | /// This class provides some static methods that are | |||
/// used by the | /// used by the | |||
/// poco_assert_dbg(), poco_assert(), poco_check_ptr() | /// poco_assert_dbg(), poco_assert(), poco_check_ptr() | |||
/// and poco_bugcheck() macros. | /// and poco_bugcheck() macros. | |||
/// You should not invoke these methods | /// You should not invoke these methods | |||
/// directly. Use the macros instead, as they | /// directly. Use the macros instead, as they | |||
skipping to change at line 114 | skipping to change at line 117 | |||
#define poco_bugcheck_msg(msg) \ | #define poco_bugcheck_msg(msg) \ | |||
Poco::Bugcheck::bugcheck(msg, __FILE__, __LINE__) | Poco::Bugcheck::bugcheck(msg, __FILE__, __LINE__) | |||
#define poco_debugger() \ | #define poco_debugger() \ | |||
Poco::Bugcheck::debugger(__FILE__, __LINE__) | Poco::Bugcheck::debugger(__FILE__, __LINE__) | |||
#define poco_debugger_msg(msg) \ | #define poco_debugger_msg(msg) \ | |||
Poco::Bugcheck::debugger(msg, __FILE__, __LINE__) | Poco::Bugcheck::debugger(msg, __FILE__, __LINE__) | |||
#if defined(_DEBUG) | ||||
# define poco_stdout_dbg(outstr) \ | ||||
std::cout << __FILE__ << '(' << std::dec << __LINE__ << "):" << outs | ||||
tr << std::endl; | ||||
#else | ||||
# define poco_stdout_dbg(outstr) | ||||
#endif | ||||
#if defined(_DEBUG) | ||||
# define poco_stderr_dbg(outstr) \ | ||||
std::cerr << __FILE__ << '(' << std::dec << __LINE__ << "):" | ||||
<< outstr << std::endl; | ||||
#else | ||||
# define poco_stderr_dbg(outstr) | ||||
#endif | ||||
// | // | |||
// poco_static_assert | // poco_static_assert | |||
// | // | |||
// The following was ported from <boost/static_assert.hpp> | // The following was ported from <boost/static_assert.hpp> | |||
// | // | |||
template <bool x> | template <bool x> | |||
struct POCO_STATIC_ASSERTION_FAILURE; | struct POCO_STATIC_ASSERTION_FAILURE; | |||
template <> | template <> | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 20 lines changed or added | |||
Config.h | Config.h | |||
---|---|---|---|---|
// | // | |||
// Config.h | // Config.h | |||
// | // | |||
// $Id: //poco/1.3/Foundation/include/Poco/Config.h#8 $ | // $Id: //poco/1.3/Foundation/include/Poco/Config.h#9 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: Foundation | // Module: Foundation | |||
// | // | |||
// Feature configuration for the POCO libraries. | // Feature configuration for the POCO libraries. | |||
// | // | |||
// Copyright (c) 2006-2008, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2006-2009, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
// Permission is hereby granted, free of charge, to any person or organizat ion | // Permission is hereby granted, free of charge, to any person or organizat ion | |||
// obtaining a copy of the software and accompanying documentation covered by | // obtaining a copy of the software and accompanying documentation covered by | |||
// this license (the "Software") to use, reproduce, display, distribute, | // this license (the "Software") to use, reproduce, display, distribute, | |||
// execute, and transmit the Software, and to prepare derivative works of t he | // execute, and transmit the Software, and to prepare derivative works of t he | |||
// Software, and to permit third-parties to whom the Software is furnished to | // Software, and to permit third-parties to whom the Software is furnished to | |||
// do so, all subject to the following: | // do so, all subject to the following: | |||
// | // | |||
// The copyright notices in the Software and this entire statement, includi ng | // The copyright notices in the Software and this entire statement, includi ng | |||
skipping to change at line 60 | skipping to change at line 60 | |||
// Define if std::wstring is not available | // Define if std::wstring is not available | |||
// #define POCO_NO_WSTRING | // #define POCO_NO_WSTRING | |||
// Define to disable shared memory | // Define to disable shared memory | |||
// #define POCO_NO_SHAREDMEMORY | // #define POCO_NO_SHAREDMEMORY | |||
// Define to desired default thread stack size | // Define to desired default thread stack size | |||
// Zero means OS default | // Zero means OS default | |||
#define POCO_THREAD_STACK_SIZE 0 | #define POCO_THREAD_STACK_SIZE 0 | |||
// Following are options to remove certain features | ||||
// to reduce library/executable size for smaller | ||||
// embedded platforms. By enabling these options, | ||||
// the size of a statically executable can be | ||||
// reduced by a few 100 Kbytes. | ||||
// No automatic registration of FileChannel in | ||||
// LoggingFactory - avoids FileChannel and friends | ||||
// being linked to executable. | ||||
// #define POCO_NO_FILECHANNEL | ||||
// No automatic registration of SplitterChannel in | ||||
// LoggingFactory - avoids SplitterChannel being | ||||
// linked to executable. | ||||
// #define POCO_NO_SPLITTERCHANNEL | ||||
// No automatic registration of SyslogChannel in | ||||
// LoggingFactory - avoids SyslogChannel being | ||||
// linked to executable on Unix/Linux systems. | ||||
// #define POCO_NO_SYSLOGCHANNEL | ||||
// No support for INI file configurations in | ||||
// Poco::Util::Application. | ||||
// #define POCO_UTIL_NO_INIFILECONFIGURATION | ||||
// No support for XML configuration in | ||||
// Poco::Util::Application. Avoids linking of XML | ||||
// library and saves a few 100 Kbytes. | ||||
// #define POCO_UTIL_NO_XMLCONFIGURATION | ||||
#endif // Foundation_Config_INCLUDED | #endif // Foundation_Config_INCLUDED | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 32 lines changed or added | |||
DNS.h | DNS.h | |||
---|---|---|---|---|
// | // | |||
// DNS.h | // DNS.h | |||
// | // | |||
// $Id: //poco/1.3/Net/include/Poco/Net/DNS.h#1 $ | // $Id: //poco/1.3/Net/include/Poco/Net/DNS.h#2 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: NetCore | // Package: NetCore | |||
// Module: DNS | // Module: DNS | |||
// | // | |||
// Definition of the DNS class. | // Definition of the DNS class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 118 | skipping to change at line 118 | |||
/// Throws a NoAddressFoundException if no address can be | /// Throws a NoAddressFoundException if no address can be | |||
/// found for this host. | /// found for this host. | |||
/// | /// | |||
/// Throws a DNSException in case of a general DNS error. | /// Throws a DNSException in case of a general DNS error. | |||
/// | /// | |||
/// Throws an IOException in case of any other error. | /// Throws an IOException in case of any other error. | |||
static void flushCache(); | static void flushCache(); | |||
/// Flushes the internal DNS cache. | /// Flushes the internal DNS cache. | |||
static std::string hostName(); | ||||
/// Returns the host name of this host. | ||||
protected: | protected: | |||
static int lastError(); | static int lastError(); | |||
/// Returns the code of the last error. | /// Returns the code of the last error. | |||
static void error(int code, const std::string& arg); | static void error(int code, const std::string& arg); | |||
/// Throws an exception according to the error code. | /// Throws an exception according to the error code. | |||
private: | private: | |||
typedef std::map<std::string, HostEntry> DNSCache; | typedef std::map<std::string, HostEntry> DNSCache; | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 4 lines changed or added | |||
DatagramSocket.h | DatagramSocket.h | |||
---|---|---|---|---|
// | // | |||
// DatagramSocket.h | // DatagramSocket.h | |||
// | // | |||
// $Id: //poco/1.3/Net/include/Poco/Net/DatagramSocket.h#1 $ | // $Id: //poco/1.3/Net/include/Poco/Net/DatagramSocket.h#2 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: Sockets | // Package: Sockets | |||
// Module: DatagramSocket | // Module: DatagramSocket | |||
// | // | |||
// Definition of the DatagramSocket class. | // Definition of the DatagramSocket class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 55 | skipping to change at line 55 | |||
namespace Net { | namespace Net { | |||
class Net_API DatagramSocket: public Socket | class Net_API DatagramSocket: public Socket | |||
/// This class provides an interface to an | /// This class provides an interface to an | |||
/// UDP stream socket. | /// UDP stream socket. | |||
{ | { | |||
public: | public: | |||
DatagramSocket(); | DatagramSocket(); | |||
/// Creates an unconnected IPv4 datagram socket. | /// Creates an unconnected IPv4 datagram socket. | |||
DatagramSocket(IPAddress::Family family); | explicit DatagramSocket(IPAddress::Family family); | |||
/// Creates an unconnected datagram socket. | /// Creates an unconnected datagram socket. | |||
/// | /// | |||
/// The socket will be created for the | /// The socket will be created for the | |||
/// given address family. | /// given address family. | |||
DatagramSocket(const SocketAddress& address, bool reuseAddress = fal se); | DatagramSocket(const SocketAddress& address, bool reuseAddress = fal se); | |||
/// Creates a datagram socket and binds it | /// Creates a datagram socket and binds it | |||
/// to the given address. | /// to the given address. | |||
/// | /// | |||
/// Depending on the address family, the socket | /// Depending on the address family, the socket | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
DatagramSocketImpl.h | DatagramSocketImpl.h | |||
---|---|---|---|---|
// | // | |||
// DatagramSocketImpl.h | // DatagramSocketImpl.h | |||
// | // | |||
// $Id: //poco/1.3/Net/include/Poco/Net/DatagramSocketImpl.h#1 $ | // $Id: //poco/1.3/Net/include/Poco/Net/DatagramSocketImpl.h#2 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: Sockets | // Package: Sockets | |||
// Module: DatagramSocketImpl | // Module: DatagramSocketImpl | |||
// | // | |||
// Definition of the DatagramSocketImpl class. | // Definition of the DatagramSocketImpl class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 58 | skipping to change at line 58 | |||
/// This class implements an UDP socket. | /// This class implements an UDP socket. | |||
{ | { | |||
public: | public: | |||
DatagramSocketImpl(); | DatagramSocketImpl(); | |||
/// Creates a StreamSocketImpl. | /// Creates a StreamSocketImpl. | |||
/// | /// | |||
/// If the system supports IPv6, the socket will | /// If the system supports IPv6, the socket will | |||
/// be an IPv6 socket. Otherwise, it will be | /// be an IPv6 socket. Otherwise, it will be | |||
/// an IPv4 socket. | /// an IPv4 socket. | |||
DatagramSocketImpl(IPAddress::Family family); | explicit DatagramSocketImpl(IPAddress::Family family); | |||
/// Creates an unconnected datagram socket. | /// Creates an unconnected datagram socket. | |||
/// | /// | |||
/// The socket will be created for the | /// The socket will be created for the | |||
/// given address family. | /// given address family. | |||
DatagramSocketImpl(poco_socket_t sockfd); | DatagramSocketImpl(poco_socket_t sockfd); | |||
/// Creates a StreamSocketImpl using the given native socket . | /// Creates a StreamSocketImpl using the given native socket . | |||
protected: | protected: | |||
void init(int af); | void init(int af); | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
DateTimeFormatter.h | DateTimeFormatter.h | |||
---|---|---|---|---|
// | // | |||
// DateTimeFormatter.h | // DateTimeFormatter.h | |||
// | // | |||
// $Id: //poco/1.3/Foundation/include/Poco/DateTimeFormatter.h#1 $ | // $Id: //poco/1.3/Foundation/include/Poco/DateTimeFormatter.h#4 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: DateTime | // Package: DateTime | |||
// Module: DateTimeFormatter | // Module: DateTimeFormatter | |||
// | // | |||
// Definition of the DateTimeFormatter class. | // Definition of the DateTimeFormatter class. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 42 | skipping to change at line 42 | |||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | |||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Foundation_DateTimeFormatter_INCLUDED | #ifndef Foundation_DateTimeFormatter_INCLUDED | |||
#define Foundation_DateTimeFormatter_INCLUDED | #define Foundation_DateTimeFormatter_INCLUDED | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
#include "Poco/DateTime.h" | ||||
#include "Poco/LocalDateTime.h" | ||||
namespace Poco { | namespace Poco { | |||
class DateTime; | ||||
class LocalDateTime; | ||||
class Timestamp; | class Timestamp; | |||
class Timespan; | class Timespan; | |||
class Foundation_API DateTimeFormatter | class Foundation_API DateTimeFormatter | |||
/// This class converts dates and times into strings, supporting a | /// This class converts dates and times into strings, supporting a | |||
/// variety of standard and custom formats. | /// variety of standard and custom formats. | |||
/// | ||||
/// There are two kind of static member functions: | ||||
/// * format* functions return a std::string containing | ||||
/// the formatted value. | ||||
/// * append* functions append the formatted value to | ||||
/// an existing string. | ||||
{ | { | |||
public: | public: | |||
enum | enum | |||
{ | { | |||
UTC = 0xFFFF /// Special value for timeZoneDifferential deno ting UTC. | UTC = 0xFFFF /// Special value for timeZoneDifferential deno ting UTC. | |||
}; | }; | |||
static std::string format(const Timestamp& timestamp, const std::str ing& fmt, int timeZoneDifferential = UTC); | static std::string format(const Timestamp& timestamp, const std::str ing& fmt, int timeZoneDifferential = UTC); | |||
/// Formats the given timestamp according to the given forma t. | /// Formats the given timestamp according to the given forma t. | |||
/// The format string is used as a template to format the da te and | /// The format string is used as a template to format the da te and | |||
skipping to change at line 86 | skipping to change at line 92 | |||
/// * %y - year without century (70) | /// * %y - year without century (70) | |||
/// * %Y - year with century (1970) | /// * %Y - year with century (1970) | |||
/// * %H - hour (00 .. 23) | /// * %H - hour (00 .. 23) | |||
/// * %h - hour (00 .. 12) | /// * %h - hour (00 .. 12) | |||
/// * %a - am/pm | /// * %a - am/pm | |||
/// * %A - AM/PM | /// * %A - AM/PM | |||
/// * %M - minute (00 .. 59) | /// * %M - minute (00 .. 59) | |||
/// * %S - second (00 .. 59) | /// * %S - second (00 .. 59) | |||
/// * %i - millisecond (000 .. 999) | /// * %i - millisecond (000 .. 999) | |||
/// * %c - centisecond (0 .. 9) | /// * %c - centisecond (0 .. 9) | |||
/// * %F - fractional seconds/microseconds (000000 - 99999 9) | ||||
/// * %z - time zone differential in ISO 8601 format (Z or +NN.NN). | /// * %z - time zone differential in ISO 8601 format (Z or +NN.NN). | |||
/// * %Z - time zone differential in RFC format (GMT or +N NNN) | /// * %Z - time zone differential in RFC format (GMT or +N NNN) | |||
/// * %% - percent sign | /// * %% - percent sign | |||
/// | /// | |||
/// Class DateTimeFormat defines format strings for various standard date/time formats. | /// Class DateTimeFormat defines format strings for various standard date/time formats. | |||
static std::string format(const DateTime& dateTime, const std::strin g& fmt, int timeZoneDifferential = UTC); | static std::string format(const DateTime& dateTime, const std::strin g& fmt, int timeZoneDifferential = UTC); | |||
/// Formats the given date and time according to the given f ormat. | /// Formats the given date and time according to the given f ormat. | |||
/// See format(const Timestamp&, const std::string&, int) fo r more information. | /// See format(const Timestamp&, const std::string&, int) fo r more information. | |||
skipping to change at line 115 | skipping to change at line 122 | |||
/// | /// | |||
/// * %d - days | /// * %d - days | |||
/// * %H - hours (00 .. 23) | /// * %H - hours (00 .. 23) | |||
/// * %h - total hours (0 .. n) | /// * %h - total hours (0 .. n) | |||
/// * %M - minutes (00 .. 59) | /// * %M - minutes (00 .. 59) | |||
/// * %m - total minutes (0 .. n) | /// * %m - total minutes (0 .. n) | |||
/// * %S - seconds (00 .. 59) | /// * %S - seconds (00 .. 59) | |||
/// * %s - total seconds (0 .. n) | /// * %s - total seconds (0 .. n) | |||
/// * %i - milliseconds (000 .. 999) | /// * %i - milliseconds (000 .. 999) | |||
/// * %c - centisecond (0 .. 9) | /// * %c - centisecond (0 .. 9) | |||
/// * %F - fractional seconds/microseconds (000000 - 99999 9) | ||||
/// * %% - percent sign | /// * %% - percent sign | |||
static void append(std::string& str, const Timestamp& timestamp, con | ||||
st std::string& fmt, int timeZoneDifferential = UTC); | ||||
/// Formats the given timestamp according to the given forma | ||||
t and appends it to str. | ||||
/// | ||||
/// See format() for documentation of the formatting string. | ||||
static void append(std::string& str, const DateTime& dateTime, const | ||||
std::string& fmt, int timeZoneDifferential = UTC); | ||||
/// Formats the given date and time according to the given f | ||||
ormat and appends it to str. | ||||
/// | ||||
/// See format() for documentation of the formatting string. | ||||
static void append(std::string& str, const LocalDateTime& dateTime, | ||||
const std::string& fmt); | ||||
/// Formats the given local date and time according to the g | ||||
iven format and appends it to str. | ||||
/// | ||||
/// See format() for documentation of the formatting string. | ||||
static void append(std::string& str, const Timespan& timespan, const | ||||
std::string& fmt = "%dd %H:%M:%S.%i"); | ||||
/// Formats the given timespan according to the given format | ||||
and appends it to str. | ||||
/// | ||||
/// See format() for documentation of the formatting string. | ||||
static std::string tzdISO(int timeZoneDifferential); | static std::string tzdISO(int timeZoneDifferential); | |||
/// Formats the given timezone differential in ISO format. | /// Formats the given timezone differential in ISO format. | |||
/// If timeZoneDifferential is UTC, "Z" is returned, | /// If timeZoneDifferential is UTC, "Z" is returned, | |||
/// otherwise, +HH.MM (or -HH.MM) is returned. | /// otherwise, +HH.MM (or -HH.MM) is returned. | |||
static std::string tzdRFC(int timeZoneDifferential); | static std::string tzdRFC(int timeZoneDifferential); | |||
/// Formats the given timezone differential in RFC format. | /// Formats the given timezone differential in RFC format. | |||
/// If timeZoneDifferential is UTC, "GMT" is returned, | /// If timeZoneDifferential is UTC, "GMT" is returned, | |||
/// otherwise ++HHMM (or -HHMM) is returned. | /// otherwise ++HHMM (or -HHMM) is returned. | |||
static void tzdISO(std::string& str, int timeZoneDifferential); | ||||
/// Formats the given timezone differential in ISO format | ||||
/// and appends it to the given string. | ||||
/// If timeZoneDifferential is UTC, "Z" is returned, | ||||
/// otherwise, +HH.MM (or -HH.MM) is returned. | ||||
static void tzdRFC(std::string& str, int timeZoneDifferential); | ||||
/// Formats the given timezone differential in RFC format | ||||
/// and appends it to the given string. | ||||
/// If timeZoneDifferential is UTC, "GMT" is returned, | ||||
/// otherwise ++HHMM (or -HHMM) is returned. | ||||
}; | }; | |||
// | ||||
// inlines | ||||
// | ||||
inline std::string DateTimeFormatter::format(const Timestamp& timestamp, co | ||||
nst std::string& fmt, int timeZoneDifferential) | ||||
{ | ||||
DateTime dateTime(timestamp); | ||||
return format(dateTime, fmt, timeZoneDifferential); | ||||
} | ||||
inline std::string DateTimeFormatter::format(const DateTime& dateTime, cons | ||||
t std::string& fmt, int timeZoneDifferential) | ||||
{ | ||||
std::string result; | ||||
result.reserve(64); | ||||
append(result, dateTime, fmt, timeZoneDifferential); | ||||
return result; | ||||
} | ||||
inline std::string DateTimeFormatter::format(const LocalDateTime& dateTime, | ||||
const std::string& fmt) | ||||
{ | ||||
return format(dateTime._dateTime, fmt, dateTime._tzd); | ||||
} | ||||
inline std::string DateTimeFormatter::format(const Timespan& timespan, cons | ||||
t std::string& fmt) | ||||
{ | ||||
std::string result; | ||||
result.reserve(32); | ||||
append(result, timespan, fmt); | ||||
return result; | ||||
} | ||||
inline void DateTimeFormatter::append(std::string& str, const Timestamp& ti | ||||
mestamp, const std::string& fmt, int timeZoneDifferential) | ||||
{ | ||||
DateTime dateTime(timestamp); | ||||
append(str, dateTime, fmt, timeZoneDifferential); | ||||
} | ||||
inline std::string DateTimeFormatter::tzdISO(int timeZoneDifferential) | ||||
{ | ||||
std::string result; | ||||
result.reserve(8); | ||||
tzdISO(result, timeZoneDifferential); | ||||
return result; | ||||
} | ||||
inline std::string DateTimeFormatter::tzdRFC(int timeZoneDifferential) | ||||
{ | ||||
std::string result; | ||||
result.reserve(8); | ||||
tzdRFC(result, timeZoneDifferential); | ||||
return result; | ||||
} | ||||
} // namespace Poco | } // namespace Poco | |||
#endif // Foundation_DateTimeFormatter_INCLUDED | #endif // Foundation_DateTimeFormatter_INCLUDED | |||
End of changes. 9 change blocks. | ||||
3 lines changed or deleted | 108 lines changed or added | |||
DialogSocket.h | DialogSocket.h | |||
---|---|---|---|---|
// | // | |||
// DialogSocket.h | // DialogSocket.h | |||
// | // | |||
// $Id: //poco/1.3/Net/include/Poco/Net/DialogSocket.h#1 $ | // $Id: //poco/1.3/Net/include/Poco/Net/DialogSocket.h#2 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: Sockets | // Package: Sockets | |||
// Module: DialogSocket | // Module: DialogSocket | |||
// | // | |||
// Definition of the DialogSocket class. | // Definition of the DialogSocket class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 69 | skipping to change at line 69 | |||
/// Limited support for the TELNET protocol (RFC 854) is | /// Limited support for the TELNET protocol (RFC 854) is | |||
/// available. | /// available. | |||
{ | { | |||
public: | public: | |||
DialogSocket(); | DialogSocket(); | |||
/// Creates an unconnected stream socket. | /// Creates an unconnected stream socket. | |||
/// | /// | |||
/// Before sending or receiving data, the socket | /// Before sending or receiving data, the socket | |||
/// must be connected with a call to connect(). | /// must be connected with a call to connect(). | |||
DialogSocket(const SocketAddress& address); | explicit DialogSocket(const SocketAddress& address); | |||
/// Creates a stream socket and connects it to | /// Creates a stream socket and connects it to | |||
/// the socket specified by address. | /// the socket specified by address. | |||
DialogSocket(const Socket& socket); | DialogSocket(const Socket& socket); | |||
/// Creates the DialogSocket with the SocketImpl | /// Creates the DialogSocket with the SocketImpl | |||
/// from another socket. The SocketImpl must be | /// from another socket. The SocketImpl must be | |||
/// a StreamSocketImpl, otherwise an InvalidArgumentExceptio n | /// a StreamSocketImpl, otherwise an InvalidArgumentExceptio n | |||
/// will be thrown. | /// will be thrown. | |||
~DialogSocket(); | ~DialogSocket(); | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
DynamicAny.h | DynamicAny.h | |||
---|---|---|---|---|
// | // | |||
// DynamicAny.h | // DynamicAny.h | |||
// | // | |||
// $Id: //poco/1.3/Foundation/include/Poco/DynamicAny.h#8 $ | // $Id: //poco/1.3/Foundation/include/Poco/DynamicAny.h#9 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: DynamicAny | // Module: DynamicAny | |||
// | // | |||
// Definition of the DynamicAny class. | // Definition of the DynamicAny class. | |||
// | // | |||
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2007, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
ErrorHandler.h | ErrorHandler.h | |||
---|---|---|---|---|
// | // | |||
// ErrorHandler.h | // ErrorHandler.h | |||
// | // | |||
// $Id: //poco/1.3/Foundation/include/Poco/ErrorHandler.h#1 $ | // $Id: //poco/1.3/Foundation/include/Poco/ErrorHandler.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Threading | // Package: Threading | |||
// Module: ErrorHandler | // Module: ErrorHandler | |||
// | // | |||
// Definition of the ErrorHandler class. | // Definition of the ErrorHandler class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 58 | skipping to change at line 58 | |||
/// This is the base class for thread error handlers. | /// This is the base class for thread error handlers. | |||
/// | /// | |||
/// An unhandled exception that causes a thread to terminate is usua lly | /// An unhandled exception that causes a thread to terminate is usua lly | |||
/// silently ignored, since the class library cannot do anything mea ningful | /// silently ignored, since the class library cannot do anything mea ningful | |||
/// about it. | /// about it. | |||
/// | /// | |||
/// The Thread class provides the possibility to register a | /// The Thread class provides the possibility to register a | |||
/// global ErrorHandler that is invoked whenever a thread has | /// global ErrorHandler that is invoked whenever a thread has | |||
/// been terminated by an unhandled exception. | /// been terminated by an unhandled exception. | |||
/// The ErrorHandler must be derived from this class and can | /// The ErrorHandler must be derived from this class and can | |||
/// provide implementations of all three handleException() overloads . | /// provide implementations of all three exception() overloads. | |||
/// | /// | |||
/// The ErrorHandler is always invoked within the context of | /// The ErrorHandler is always invoked within the context of | |||
/// the offending thread. | /// the offending thread. | |||
{ | { | |||
public: | public: | |||
ErrorHandler(); | ErrorHandler(); | |||
/// Creates the ErrorHandler. | /// Creates the ErrorHandler. | |||
virtual ~ErrorHandler(); | virtual ~ErrorHandler(); | |||
/// Destroys the ErrorHandler. | /// Destroys the ErrorHandler. | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
File.h | File.h | |||
---|---|---|---|---|
// | // | |||
// File.h | // File.h | |||
// | // | |||
// $Id: //poco/1.3/Foundation/include/Poco/File.h#6 $ | // $Id: //poco/1.3/Foundation/include/Poco/File.h#7 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Filesystem | // Package: Filesystem | |||
// Module: File | // Module: File | |||
// | // | |||
// Definition of the File class. | // Definition of the File class. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 127 | skipping to change at line 127 | |||
bool isFile() const; | bool isFile() const; | |||
/// Returns true iff the file is a regular file. | /// Returns true iff the file is a regular file. | |||
bool isLink() const; | bool isLink() const; | |||
/// Returns true iff the file is a symbolic link. | /// Returns true iff the file is a symbolic link. | |||
bool isDirectory() const; | bool isDirectory() const; | |||
/// Returns true iff the file is a directory. | /// Returns true iff the file is a directory. | |||
bool isDevice() const; | ||||
/// Returns true iff the file is a device. | ||||
bool isHidden() const; | bool isHidden() const; | |||
/// Returns true if the file is hidden. | /// Returns true if the file is hidden. | |||
/// | /// | |||
/// On Windows platforms, the file's hidden | /// On Windows platforms, the file's hidden | |||
/// attribute is set for this to be true. | /// attribute is set for this to be true. | |||
/// | /// | |||
/// On Unix platforms, the file name must | /// On Unix platforms, the file name must | |||
/// begin with a period for this to be true. | /// begin with a period for this to be true. | |||
Timestamp created() const; | Timestamp created() const; | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 4 lines changed or added | |||
File_UNIX.h | File_UNIX.h | |||
---|---|---|---|---|
// | // | |||
// File_UNIX.h | // File_UNIX.h | |||
// | // | |||
// $Id: //poco/1.3/Foundation/include/Poco/File_UNIX.h#3 $ | // $Id: //poco/1.3/Foundation/include/Poco/File_UNIX.h#4 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Filesystem | // Package: Filesystem | |||
// Module: File | // Module: File | |||
// | // | |||
// Definition of the FileImpl class for Unix. | // Definition of the FileImpl class for Unix. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 63 | skipping to change at line 63 | |||
void swapImpl(FileImpl& file); | void swapImpl(FileImpl& file); | |||
void setPathImpl(const std::string& path); | void setPathImpl(const std::string& path); | |||
const std::string& getPathImpl() const; | const std::string& getPathImpl() const; | |||
bool existsImpl() const; | bool existsImpl() const; | |||
bool canReadImpl() const; | bool canReadImpl() const; | |||
bool canWriteImpl() const; | bool canWriteImpl() const; | |||
bool canExecuteImpl() const; | bool canExecuteImpl() const; | |||
bool isFileImpl() const; | bool isFileImpl() const; | |||
bool isDirectoryImpl() const; | bool isDirectoryImpl() const; | |||
bool isLinkImpl() const; | bool isLinkImpl() const; | |||
bool isDeviceImpl() const; | ||||
bool isHiddenImpl() const; | bool isHiddenImpl() const; | |||
Timestamp createdImpl() const; | Timestamp createdImpl() const; | |||
Timestamp getLastModifiedImpl() const; | Timestamp getLastModifiedImpl() const; | |||
void setLastModifiedImpl(const Timestamp& ts); | void setLastModifiedImpl(const Timestamp& ts); | |||
FileSizeImpl getSizeImpl() const; | FileSizeImpl getSizeImpl() const; | |||
void setSizeImpl(FileSizeImpl size); | void setSizeImpl(FileSizeImpl size); | |||
void setWriteableImpl(bool flag = true); | void setWriteableImpl(bool flag = true); | |||
void setExecutableImpl(bool flag = true); | void setExecutableImpl(bool flag = true); | |||
void copyToImpl(const std::string& path) const; | void copyToImpl(const std::string& path) const; | |||
void renameToImpl(const std::string& path); | void renameToImpl(const std::string& path); | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 2 lines changed or added | |||
File_VMS.h | File_VMS.h | |||
---|---|---|---|---|
// | // | |||
// File_VMS.h | // File_VMS.h | |||
// | // | |||
// $Id: //poco/1.3/Foundation/include/Poco/File_VMS.h#3 $ | // $Id: //poco/1.3/Foundation/include/Poco/File_VMS.h#4 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Filesystem | // Package: Filesystem | |||
// Module: File | // Module: File | |||
// | // | |||
// Definition of the FileImpl class for OpenVMS. | // Definition of the FileImpl class for OpenVMS. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 64 | skipping to change at line 64 | |||
void swapImpl(FileImpl& file); | void swapImpl(FileImpl& file); | |||
void setPathImpl(const std::string& path); | void setPathImpl(const std::string& path); | |||
const std::string& getPathImpl() const; | const std::string& getPathImpl() const; | |||
bool existsImpl() const; | bool existsImpl() const; | |||
bool canReadImpl() const; | bool canReadImpl() const; | |||
bool canWriteImpl() const; | bool canWriteImpl() const; | |||
bool canExecuteImpl() const; | bool canExecuteImpl() const; | |||
bool isFileImpl() const; | bool isFileImpl() const; | |||
bool isDirectoryImpl() const; | bool isDirectoryImpl() const; | |||
bool isLinkImpl() const; | bool isLinkImpl() const; | |||
bool isDeviceImpl() const; | ||||
bool isHiddenImpl() const; | bool isHiddenImpl() const; | |||
Timestamp createdImpl() const; | Timestamp createdImpl() const; | |||
Timestamp getLastModifiedImpl() const; | Timestamp getLastModifiedImpl() const; | |||
void setLastModifiedImpl(const Timestamp& ts); | void setLastModifiedImpl(const Timestamp& ts); | |||
FileSizeImpl getSizeImpl() const; | FileSizeImpl getSizeImpl() const; | |||
void setSizeImpl(FileSizeImpl size); | void setSizeImpl(FileSizeImpl size); | |||
void setWriteableImpl(bool flag = true); | void setWriteableImpl(bool flag = true); | |||
void setExecutableImpl(bool flag = true); | void setExecutableImpl(bool flag = true); | |||
void copyToImpl(const std::string& path) const; | void copyToImpl(const std::string& path) const; | |||
void renameToImpl(const std::string& path); | void renameToImpl(const std::string& path); | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 2 lines changed or added | |||
File_WIN32.h | File_WIN32.h | |||
---|---|---|---|---|
// | // | |||
// File_WIN32.h | // File_WIN32.h | |||
// | // | |||
// $Id: //poco/1.3/Foundation/include/Poco/File_WIN32.h#3 $ | // $Id: //poco/1.3/Foundation/include/Poco/File_WIN32.h#4 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Filesystem | // Package: Filesystem | |||
// Module: File | // Module: File | |||
// | // | |||
// Definition of the FileImpl class for WIN32. | // Definition of the FileImpl class for WIN32. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 64 | skipping to change at line 64 | |||
void swapImpl(FileImpl& file); | void swapImpl(FileImpl& file); | |||
void setPathImpl(const std::string& path); | void setPathImpl(const std::string& path); | |||
const std::string& getPathImpl() const; | const std::string& getPathImpl() const; | |||
bool existsImpl() const; | bool existsImpl() const; | |||
bool canReadImpl() const; | bool canReadImpl() const; | |||
bool canWriteImpl() const; | bool canWriteImpl() const; | |||
bool canExecuteImpl() const; | bool canExecuteImpl() const; | |||
bool isFileImpl() const; | bool isFileImpl() const; | |||
bool isDirectoryImpl() const; | bool isDirectoryImpl() const; | |||
bool isLinkImpl() const; | bool isLinkImpl() const; | |||
bool isDeviceImpl() const; | ||||
bool isHiddenImpl() const; | bool isHiddenImpl() const; | |||
Timestamp createdImpl() const; | Timestamp createdImpl() const; | |||
Timestamp getLastModifiedImpl() const; | Timestamp getLastModifiedImpl() const; | |||
void setLastModifiedImpl(const Timestamp& ts); | void setLastModifiedImpl(const Timestamp& ts); | |||
FileSizeImpl getSizeImpl() const; | FileSizeImpl getSizeImpl() const; | |||
void setSizeImpl(FileSizeImpl size); | void setSizeImpl(FileSizeImpl size); | |||
void setWriteableImpl(bool flag = true); | void setWriteableImpl(bool flag = true); | |||
void setExecutableImpl(bool flag = true); | void setExecutableImpl(bool flag = true); | |||
void copyToImpl(const std::string& path) const; | void copyToImpl(const std::string& path) const; | |||
void renameToImpl(const std::string& path); | void renameToImpl(const std::string& path); | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 2 lines changed or added | |||
File_WIN32U.h | File_WIN32U.h | |||
---|---|---|---|---|
// | // | |||
// File_WIN32U.h | // File_WIN32U.h | |||
// | // | |||
// $Id: //poco/1.3/Foundation/include/Poco/File_WIN32U.h#3 $ | // $Id: //poco/1.3/Foundation/include/Poco/File_WIN32U.h#4 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Filesystem | // Package: Filesystem | |||
// Module: File | // Module: File | |||
// | // | |||
// Definition of the Unicode FileImpl class for WIN32. | // Definition of the Unicode FileImpl class for WIN32. | |||
// | // | |||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 64 | skipping to change at line 64 | |||
void swapImpl(FileImpl& file); | void swapImpl(FileImpl& file); | |||
void setPathImpl(const std::string& path); | void setPathImpl(const std::string& path); | |||
const std::string& getPathImpl() const; | const std::string& getPathImpl() const; | |||
bool existsImpl() const; | bool existsImpl() const; | |||
bool canReadImpl() const; | bool canReadImpl() const; | |||
bool canWriteImpl() const; | bool canWriteImpl() const; | |||
bool canExecuteImpl() const; | bool canExecuteImpl() const; | |||
bool isFileImpl() const; | bool isFileImpl() const; | |||
bool isDirectoryImpl() const; | bool isDirectoryImpl() const; | |||
bool isLinkImpl() const; | bool isLinkImpl() const; | |||
bool isDeviceImpl() const; | ||||
bool isHiddenImpl() const; | bool isHiddenImpl() const; | |||
Timestamp createdImpl() const; | Timestamp createdImpl() const; | |||
Timestamp getLastModifiedImpl() const; | Timestamp getLastModifiedImpl() const; | |||
void setLastModifiedImpl(const Timestamp& ts); | void setLastModifiedImpl(const Timestamp& ts); | |||
FileSizeImpl getSizeImpl() const; | FileSizeImpl getSizeImpl() const; | |||
void setSizeImpl(FileSizeImpl size); | void setSizeImpl(FileSizeImpl size); | |||
void setWriteableImpl(bool flag = true); | void setWriteableImpl(bool flag = true); | |||
void setExecutableImpl(bool flag = true); | void setExecutableImpl(bool flag = true); | |||
void copyToImpl(const std::string& path) const; | void copyToImpl(const std::string& path) const; | |||
void renameToImpl(const std::string& path); | void renameToImpl(const std::string& path); | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 2 lines changed or added | |||
Glob.h | Glob.h | |||
---|---|---|---|---|
// | // | |||
// Glob.h | // Glob.h | |||
// | // | |||
// $Id: //poco/1.3/Foundation/include/Poco/Glob.h#2 $ | // $Id: //poco/1.3/Foundation/include/Poco/Glob.h#3 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Filesystem | // Package: Filesystem | |||
// Module: Glob | // Module: Glob | |||
// | // | |||
// Definition of the Glob class. | // Definition of the Glob class. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2009, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
// Permission is hereby granted, free of charge, to any person or organizat ion | // Permission is hereby granted, free of charge, to any person or organizat ion | |||
// obtaining a copy of the software and accompanying documentation covered by | // obtaining a copy of the software and accompanying documentation covered by | |||
// this license (the "Software") to use, reproduce, display, distribute, | // this license (the "Software") to use, reproduce, display, distribute, | |||
// execute, and transmit the Software, and to prepare derivative works of t he | // execute, and transmit the Software, and to prepare derivative works of t he | |||
// Software, and to permit third-parties to whom the Software is furnished to | // Software, and to permit third-parties to whom the Software is furnished to | |||
// do so, all subject to the following: | // do so, all subject to the following: | |||
// | // | |||
// The copyright notices in the Software and this entire statement, includi ng | // The copyright notices in the Software and this entire statement, includi ng | |||
skipping to change at line 42 | skipping to change at line 42 | |||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | |||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Foundation_Glob_INCLUDED | #ifndef Foundation_Glob_INCLUDED | |||
#define Foundation_Glob_INCLUDED | #define Foundation_Glob_INCLUDED | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
#include "Poco/TextIterator.h" | ||||
#include <set> | #include <set> | |||
namespace Poco { | namespace Poco { | |||
class Path; | class Path; | |||
class Foundation_API Glob | class Foundation_API Glob | |||
/// This class implements glob-style pattern matching | /// This class implements glob-style pattern matching | |||
/// as known from Unix shells. | /// as known from Unix shells. | |||
/// | /// | |||
skipping to change at line 65 | skipping to change at line 66 | |||
/// specified set. | /// specified set. | |||
/// | /// | |||
/// A set is composed of characters or ranges; a range looks like | /// A set is composed of characters or ranges; a range looks like | |||
/// character hyphen character (as in 0-9 or A-Z). | /// character hyphen character (as in 0-9 or A-Z). | |||
/// [0-9a-zA-Z_] is the set of characters allowed in C identifiers. | /// [0-9a-zA-Z_] is the set of characters allowed in C identifiers. | |||
/// Any other character in the pattern must be matched exactly. | /// Any other character in the pattern must be matched exactly. | |||
/// | /// | |||
/// To suppress the special syntactic significance of any of '[]*?!- \', | /// To suppress the special syntactic significance of any of '[]*?!- \', | |||
/// and match the character exactly, precede it with a backslash. | /// and match the character exactly, precede it with a backslash. | |||
/// | /// | |||
/// UTF-8 encoded strings are not supported. | /// All strings are assumed to be UTF-8 encoded. | |||
{ | { | |||
public: | public: | |||
enum Options | enum Options | |||
/// Flags that modify the matching behavior. | /// Flags that modify the matching behavior. | |||
{ | { | |||
GLOB_DEFAULT = 0x00, /// default behavior | GLOB_DEFAULT = 0x00, /// default behavior | |||
GLOB_DOT_SPECIAL = 0x01, /// '*' and '?' do not match '. ' at beginning of subject | GLOB_DOT_SPECIAL = 0x01, /// '*' and '?' do not match '. ' at beginning of subject | |||
GLOB_FOLLOW_SYMLINKS = 0x02, /// follow symbolic links | GLOB_FOLLOW_SYMLINKS = 0x02, /// follow symbolic links | |||
GLOB_CASELESS = 0x04, /// ignore case when comparing characters | ||||
GLOB_DIRS_ONLY = 0x80 /// only glob for directories ( for internal use only) | GLOB_DIRS_ONLY = 0x80 /// only glob for directories ( for internal use only) | |||
}; | }; | |||
Glob(const std::string& pattern, int options = 0); | Glob(const std::string& pattern, int options = 0); | |||
/// Creates the Glob, using the given pattern. The pattern | /// Creates the Glob, using the given pattern. The pattern | |||
/// must not be an empty string. | /// must not be an empty string. | |||
/// | /// | |||
/// If the GLOB_DOT_SPECIAL option is specified, '*' and '?' do | /// If the GLOB_DOT_SPECIAL option is specified, '*' and '?' do | |||
/// not match '.' at the beginning of a matched subject. Thi s is useful for | /// not match '.' at the beginning of a matched subject. Thi s is useful for | |||
/// making dot-files invisible in good old Unix-style. | /// making dot-files invisible in good old Unix-style. | |||
skipping to change at line 136 | skipping to change at line 138 | |||
/// The pattern may contain wildcard expressions even in int ermediate | /// The pattern may contain wildcard expressions even in int ermediate | |||
/// directory names (e.g. /usr/include/*/*.h). | /// directory names (e.g. /usr/include/*/*.h). | |||
/// | /// | |||
/// Note that, for obvious reasons, escaping characters in a pattern | /// Note that, for obvious reasons, escaping characters in a pattern | |||
/// with a backslash does not work in Windows-style paths. | /// with a backslash does not work in Windows-style paths. | |||
/// | /// | |||
/// Directories that for whatever reason cannot be traversed are | /// Directories that for whatever reason cannot be traversed are | |||
/// ignored. | /// ignored. | |||
protected: | protected: | |||
bool match(std::string::const_iterator& itp, const std::string::cons | bool match(TextIterator& itp, const TextIterator& endp, TextIterator | |||
t_iterator& endp, std::string::const_iterator& its, const std::string::cons | & its, const TextIterator& ends); | |||
t_iterator& ends); | bool matchAfterAsterisk(TextIterator itp, const TextIterator& endp, | |||
bool matchAfterAsterisk(std::string::const_iterator itp, const std:: | TextIterator its, const TextIterator& ends); | |||
string::const_iterator& endp, std::string::const_iterator its, const std::s | bool matchSet(TextIterator& itp, const TextIterator& endp, int c); | |||
tring::const_iterator& ends); | ||||
bool matchSet(std::string::const_iterator& itp, const std::string::c | ||||
onst_iterator& endp, char c); | ||||
static void collect(const Path& pathPattern, const Path& base, const Path& current, const std::string& pattern, std::set<std::string>& files, i nt options); | static void collect(const Path& pathPattern, const Path& base, const Path& current, const std::string& pattern, std::set<std::string>& files, i nt options); | |||
static bool isDirectory(const Path& path, bool followSymlink); | static bool isDirectory(const Path& path, bool followSymlink); | |||
private: | private: | |||
std::string _pattern; | std::string _pattern; | |||
int _options; | int _options; | |||
Glob(); | Glob(); | |||
Glob(const Glob&); | Glob(const Glob&); | |||
Glob& operator = (const Glob&); | Glob& operator = (const Glob&); | |||
End of changes. 6 change blocks. | ||||
11 lines changed or deleted | 10 lines changed or added | |||
HTTPClientSession.h | HTTPClientSession.h | |||
---|---|---|---|---|
// | // | |||
// HTTPClientSession.h | // HTTPClientSession.h | |||
// | // | |||
// $Id: //poco/1.3/Net/include/Poco/Net/HTTPClientSession.h#4 $ | // $Id: //poco/1.3/Net/include/Poco/Net/HTTPClientSession.h#5 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: HTTPClient | // Package: HTTPClient | |||
// Module: HTTPClientSession | // Module: HTTPClientSession | |||
// | // | |||
// Definition of the HTTPClientSession class. | // Definition of the HTTPClientSession class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 167 | skipping to change at line 167 | |||
{ | { | |||
DEFAULT_KEEP_ALIVE_TIMEOUT = 8 | DEFAULT_KEEP_ALIVE_TIMEOUT = 8 | |||
}; | }; | |||
void reconnect(); | void reconnect(); | |||
/// Connects the underlying socket to the HTTP server. | /// Connects the underlying socket to the HTTP server. | |||
int write(const char* buffer, std::streamsize length); | int write(const char* buffer, std::streamsize length); | |||
/// Tries to re-connect if keep-alive is on. | /// Tries to re-connect if keep-alive is on. | |||
virtual std::string getHostInfo() const; | virtual std::string proxyRequestPrefix() const; | |||
/// Returns the target host and port number for proxy reques | /// Returns the prefix prepended to the URI for proxy reques | |||
ts. | ts | |||
/// (e.g., "http://myhost.com"). | ||||
void deleteResponseStream(); | void deleteResponseStream(); | |||
/// Deletes the response stream and sets it to 0. | /// Deletes the response stream and sets it to 0. | |||
void deleteRequestStream(); | void deleteRequestStream(); | |||
/// Deletes the request stream and sets it to 0. | /// Deletes the request stream and sets it to 0. | |||
void setResponseStream(std::istream* pRespStream); | void setResponseStream(std::istream* pRespStream); | |||
/// Sets the response stream iff _pResponseStream is 0. | /// Sets the response stream iff _pResponseStream is 0. | |||
End of changes. 2 change blocks. | ||||
4 lines changed or deleted | 5 lines changed or added | |||
HTTPMessage.h | HTTPMessage.h | |||
---|---|---|---|---|
// | // | |||
// HTTPMessage.h | // HTTPMessage.h | |||
// | // | |||
// $Id: //poco/1.3/Net/include/Poco/Net/HTTPMessage.h#1 $ | // $Id: //poco/1.3/Net/include/Poco/Net/HTTPMessage.h#2 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: HTTP | // Package: HTTP | |||
// Module: HTTPMessage | // Module: HTTPMessage | |||
// | // | |||
// Definition of the HTTPMessage class. | // Definition of the HTTPMessage class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 141 | skipping to change at line 141 | |||
static const std::string UNKNOWN_CONTENT_TYPE; | static const std::string UNKNOWN_CONTENT_TYPE; | |||
static const std::string CONTENT_LENGTH; | static const std::string CONTENT_LENGTH; | |||
static const std::string CONTENT_TYPE; | static const std::string CONTENT_TYPE; | |||
static const std::string TRANSFER_ENCODING; | static const std::string TRANSFER_ENCODING; | |||
static const std::string CONNECTION; | static const std::string CONNECTION; | |||
static const std::string CONNECTION_KEEP_ALIVE; | static const std::string CONNECTION_KEEP_ALIVE; | |||
static const std::string CONNECTION_CLOSE; | static const std::string CONNECTION_CLOSE; | |||
static const std::string EMPTY; | ||||
protected: | protected: | |||
HTTPMessage(); | HTTPMessage(); | |||
/// Creates the HTTPMessage with version HTTP/1.0. | /// Creates the HTTPMessage with version HTTP/1.0. | |||
HTTPMessage(const std::string& version); | HTTPMessage(const std::string& version); | |||
/// Creates the HTTPMessage and sets | /// Creates the HTTPMessage and sets | |||
/// the version. | /// the version. | |||
virtual ~HTTPMessage(); | virtual ~HTTPMessage(); | |||
/// Destroys the HTTPMessage. | /// Destroys the HTTPMessage. | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 3 lines changed or added | |||
HTTPRequestHandlerFactory.h | HTTPRequestHandlerFactory.h | |||
---|---|---|---|---|
// | // | |||
// HTTPRequestHandlerFactory.h | // HTTPRequestHandlerFactory.h | |||
// | // | |||
// $Id: //poco/1.3/Net/include/Poco/Net/HTTPRequestHandlerFactory.h#2 $ | // $Id: //poco/1.3/Net/include/Poco/Net/HTTPRequestHandlerFactory.h#3 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: HTTPServer | // Package: HTTPServer | |||
// Module: HTTPRequestHandlerFactory | // Module: HTTPRequestHandlerFactory | |||
// | // | |||
// Definition of the HTTPRequestHandlerFactory class. | // Definition of the HTTPRequestHandlerFactory class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 42 | skipping to change at line 42 | |||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | |||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Net_HTTPRequestHandlerFactory_INCLUDED | #ifndef Net_HTTPRequestHandlerFactory_INCLUDED | |||
#define Net_HTTPRequestHandlerFactory_INCLUDED | #define Net_HTTPRequestHandlerFactory_INCLUDED | |||
#include "Poco/Net/Net.h" | #include "Poco/Net/Net.h" | |||
#include "Poco/SharedPtr.h" | ||||
namespace Poco { | namespace Poco { | |||
namespace Net { | namespace Net { | |||
class HTTPServerRequest; | class HTTPServerRequest; | |||
class HTTPServerResponse; | class HTTPServerResponse; | |||
class HTTPRequestHandler; | class HTTPRequestHandler; | |||
class Net_API HTTPRequestHandlerFactory | class Net_API HTTPRequestHandlerFactory | |||
/// A factory for HTTPRequestHandler objects. | /// A factory for HTTPRequestHandler objects. | |||
/// Subclasses must override the createRequestHandler() | /// Subclasses must override the createRequestHandler() | |||
/// method. | /// method. | |||
{ | { | |||
public: | public: | |||
typedef Poco::SharedPtr<HTTPRequestHandlerFactory> Ptr; | ||||
HTTPRequestHandlerFactory(); | HTTPRequestHandlerFactory(); | |||
/// Creates the HTTPRequestHandlerFactory. | /// Creates the HTTPRequestHandlerFactory. | |||
virtual ~HTTPRequestHandlerFactory(); | virtual ~HTTPRequestHandlerFactory(); | |||
/// Destroys the HTTPRequestHandlerFactory. | /// Destroys the HTTPRequestHandlerFactory. | |||
virtual HTTPRequestHandler* createRequestHandler(const HTTPServerReq uest& request) = 0; | virtual HTTPRequestHandler* createRequestHandler(const HTTPServerReq uest& request) = 0; | |||
/// Must be overridden by sublasses. | /// Must be overridden by sublasses. | |||
/// | /// | |||
/// Creates a new request handler for the given HTTP request . | /// Creates a new request handler for the given HTTP request . | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 4 lines changed or added | |||
HTTPServer.h | HTTPServer.h | |||
---|---|---|---|---|
// | // | |||
// HTTPServer.h | // HTTPServer.h | |||
// | // | |||
// $Id: //poco/1.3/Net/include/Poco/Net/HTTPServer.h#1 $ | // $Id: //poco/1.3/Net/include/Poco/Net/HTTPServer.h#3 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: HTTPServer | // Package: HTTPServer | |||
// Module: HTTPServer | // Module: HTTPServer | |||
// | // | |||
// Definition of the HTTPServer class. | // Definition of the HTTPServer class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 43 | skipping to change at line 43 | |||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Net_HTTPServer_INCLUDED | #ifndef Net_HTTPServer_INCLUDED | |||
#define Net_HTTPServer_INCLUDED | #define Net_HTTPServer_INCLUDED | |||
#include "Poco/Net/Net.h" | #include "Poco/Net/Net.h" | |||
#include "Poco/Net/TCPServer.h" | #include "Poco/Net/TCPServer.h" | |||
#include "Poco/Net/HTTPRequestHandlerFactory.h" | ||||
#include "Poco/Net/HTTPServerParams.h" | ||||
namespace Poco { | namespace Poco { | |||
namespace Net { | namespace Net { | |||
class HTTPRequestHandlerFactory; | ||||
class HTTPServerParams; | ||||
class Net_API HTTPServer: public TCPServer | class Net_API HTTPServer: public TCPServer | |||
/// A subclass of TCPServer that implements a | /// A subclass of TCPServer that implements a | |||
/// full-featured multithreaded HTTP server. | /// full-featured multithreaded HTTP server. | |||
/// | /// | |||
/// A HTTPRequestHandlerFactory must be supplied. | /// A HTTPRequestHandlerFactory must be supplied. | |||
/// The ServerSocket must be bound and in listening state. | /// The ServerSocket must be bound and in listening state. | |||
/// | /// | |||
/// To configure various aspects of the server, a HTTPServerParams | /// To configure various aspects of the server, a HTTPServerParams | |||
/// object can be passed to the constructor. | /// object can be passed to the constructor. | |||
/// | /// | |||
skipping to change at line 73 | skipping to change at line 72 | |||
/// - automatic decoding/encoding of request/response message bodi es | /// - automatic decoding/encoding of request/response message bodi es | |||
/// using chunked transfer encoding. | /// using chunked transfer encoding. | |||
/// | /// | |||
/// Please see the TCPServer class for information about | /// Please see the TCPServer class for information about | |||
/// connection and thread handling. | /// connection and thread handling. | |||
/// | /// | |||
/// See RFC 2616 <http://www.faqs.org/rfcs/rfc2616.html> for more | /// See RFC 2616 <http://www.faqs.org/rfcs/rfc2616.html> for more | |||
/// information about the HTTP protocol. | /// information about the HTTP protocol. | |||
{ | { | |||
public: | public: | |||
HTTPServer(HTTPRequestHandlerFactory* pFactory, const ServerSocket& socket, HTTPServerParams* pParams); | HTTPServer(HTTPRequestHandlerFactory::Ptr pFactory, const ServerSock et& socket, HTTPServerParams::Ptr pParams); | |||
/// Creates the HTTPServer, using the given ServerSocket. | /// Creates the HTTPServer, using the given ServerSocket. | |||
/// | /// | |||
/// The server takes ownership of the HTTPRequstHandlerFacto ry | /// The server takes ownership of the HTTPRequstHandlerFacto ry | |||
/// and deletes it when it's no longer needed. | /// and deletes it when it's no longer needed. | |||
/// | /// | |||
/// The server also takes ownership of the HTTPServerParams object. | /// The server also takes ownership of the HTTPServerParams object. | |||
/// | /// | |||
/// News threads are taken from the default thread pool. | /// News threads are taken from the default thread pool. | |||
HTTPServer(HTTPRequestHandlerFactory* pFactory, Poco::ThreadPool& th readPool, const ServerSocket& socket, HTTPServerParams* pParams); | HTTPServer(HTTPRequestHandlerFactory::Ptr pFactory, Poco::ThreadPool & threadPool, const ServerSocket& socket, HTTPServerParams::Ptr pParams); | |||
/// Creates the HTTPServer, using the given ServerSocket. | /// Creates the HTTPServer, using the given ServerSocket. | |||
/// | /// | |||
/// The server takes ownership of the HTTPRequstHandlerFacto ry | /// The server takes ownership of the HTTPRequstHandlerFacto ry | |||
/// and deletes it when it's no longer needed. | /// and deletes it when it's no longer needed. | |||
/// | /// | |||
/// The server also takes ownership of the HTTPServerParams object. | /// The server also takes ownership of the HTTPServerParams object. | |||
/// | /// | |||
/// News threads are taken from the given thread pool. | /// News threads are taken from the given thread pool. | |||
~HTTPServer(); | ~HTTPServer(); | |||
End of changes. 5 change blocks. | ||||
6 lines changed or deleted | 5 lines changed or added | |||
HTTPServerConnection.h | HTTPServerConnection.h | |||
---|---|---|---|---|
// | // | |||
// HTTPServerConnection.h | // HTTPServerConnection.h | |||
// | // | |||
// $Id: //poco/1.3/Net/include/Poco/Net/HTTPServerConnection.h#2 $ | // $Id: //poco/1.3/Net/include/Poco/Net/HTTPServerConnection.h#4 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: HTTPServer | // Package: HTTPServer | |||
// Module: HTTPServerConnection | // Module: HTTPServerConnection | |||
// | // | |||
// Definition of the HTTPServerConnection class. | // Definition of the HTTPServerConnection class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 44 | skipping to change at line 44 | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Net_HTTPServerConnection_INCLUDED | #ifndef Net_HTTPServerConnection_INCLUDED | |||
#define Net_HTTPServerConnection_INCLUDED | #define Net_HTTPServerConnection_INCLUDED | |||
#include "Poco/Net/Net.h" | #include "Poco/Net/Net.h" | |||
#include "Poco/Net/TCPServerConnection.h" | #include "Poco/Net/TCPServerConnection.h" | |||
#include "Poco/Net/HTTPResponse.h" | #include "Poco/Net/HTTPResponse.h" | |||
#include "Poco/Net/HTTPRequestHandlerFactory.h" | ||||
#include "Poco/Net/HTTPServerParams.h" | ||||
namespace Poco { | namespace Poco { | |||
namespace Net { | namespace Net { | |||
class HTTPServerParams; | ||||
class HTTPRequestHandlerFactory; | ||||
class HTTPServerSession; | class HTTPServerSession; | |||
class Net_API HTTPServerConnection: public TCPServerConnection | class Net_API HTTPServerConnection: public TCPServerConnection | |||
/// This subclass of TCPServerConnection handles HTTP | /// This subclass of TCPServerConnection handles HTTP | |||
/// connections. | /// connections. | |||
{ | { | |||
public: | public: | |||
HTTPServerConnection(const StreamSocket& socket, HTTPServerParams* p Params, HTTPRequestHandlerFactory* pFactory); | HTTPServerConnection(const StreamSocket& socket, HTTPServerParams::P tr pParams, HTTPRequestHandlerFactory::Ptr pFactory); | |||
/// Creates the HTTPServerConnection. | /// Creates the HTTPServerConnection. | |||
virtual ~HTTPServerConnection(); | virtual ~HTTPServerConnection(); | |||
/// Destroys the HTTPServerConnection. | /// Destroys the HTTPServerConnection. | |||
void run(); | void run(); | |||
/// Handles all HTTP requests coming in. | /// Handles all HTTP requests coming in. | |||
protected: | protected: | |||
void sendErrorResponse(HTTPServerSession& session, HTTPResponse::HTT PStatus status); | void sendErrorResponse(HTTPServerSession& session, HTTPResponse::HTT PStatus status); | |||
private: | private: | |||
HTTPServerParams* _pParams; | HTTPServerParams::Ptr _pParams; | |||
HTTPRequestHandlerFactory* _pFactory; | HTTPRequestHandlerFactory::Ptr _pFactory; | |||
}; | }; | |||
} } // namespace Poco::Net | } } // namespace Poco::Net | |||
#endif // Net_HTTPServerConnection_INCLUDED | #endif // Net_HTTPServerConnection_INCLUDED | |||
End of changes. 5 change blocks. | ||||
6 lines changed or deleted | 6 lines changed or added | |||
HTTPServerConnectionFactory.h | HTTPServerConnectionFactory.h | |||
---|---|---|---|---|
// | // | |||
// HTTPServerConnectionFactory.h | // HTTPServerConnectionFactory.h | |||
// | // | |||
// $Id: //poco/1.3/Net/include/Poco/Net/HTTPServerConnectionFactory.h#1 $ | // $Id: //poco/1.3/Net/include/Poco/Net/HTTPServerConnectionFactory.h#3 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: HTTPServer | // Package: HTTPServer | |||
// Module: HTTPServerConnectionFactory | // Module: HTTPServerConnectionFactory | |||
// | // | |||
// Definition of the HTTPServerConnectionFactory class. | // Definition of the HTTPServerConnectionFactory class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 43 | skipping to change at line 43 | |||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Net_HTTPServerConnectionFactory_INCLUDED | #ifndef Net_HTTPServerConnectionFactory_INCLUDED | |||
#define Net_HTTPServerConnectionFactory_INCLUDED | #define Net_HTTPServerConnectionFactory_INCLUDED | |||
#include "Poco/Net/Net.h" | #include "Poco/Net/Net.h" | |||
#include "Poco/Net/TCPServerConnectionFactory.h" | #include "Poco/Net/TCPServerConnectionFactory.h" | |||
#include "Poco/Net/HTTPRequestHandlerFactory.h" | ||||
#include "Poco/Net/HTTPServerParams.h" | ||||
namespace Poco { | namespace Poco { | |||
namespace Net { | namespace Net { | |||
class HTTPServerParams; | ||||
class HTTPRequestHandlerFactory; | ||||
class Net_API HTTPServerConnectionFactory: public TCPServerConnectionFactor y | class Net_API HTTPServerConnectionFactory: public TCPServerConnectionFactor y | |||
/// This implementation of a TCPServerConnectionFactory | /// This implementation of a TCPServerConnectionFactory | |||
/// is used by HTTPServer to create HTTPServerConnection objects. | /// is used by HTTPServer to create HTTPServerConnection objects. | |||
{ | { | |||
public: | public: | |||
HTTPServerConnectionFactory(HTTPServerParams* pParams, HTTPRequestHa ndlerFactory* pFactory); | HTTPServerConnectionFactory(HTTPServerParams::Ptr pParams, HTTPReque stHandlerFactory::Ptr pFactory); | |||
/// Creates the HTTPServerConnectionFactory. | /// Creates the HTTPServerConnectionFactory. | |||
~HTTPServerConnectionFactory(); | ~HTTPServerConnectionFactory(); | |||
/// Destroys the HTTPServerConnectionFactory. | /// Destroys the HTTPServerConnectionFactory. | |||
TCPServerConnection* createConnection(const StreamSocket& socket); | TCPServerConnection* createConnection(const StreamSocket& socket); | |||
/// Creates an instance of HTTPServerConnection | /// Creates an instance of HTTPServerConnection | |||
/// using the given StreamSocket. | /// using the given StreamSocket. | |||
private: | private: | |||
HTTPServerParams* _pParams; | HTTPServerParams::Ptr _pParams; | |||
HTTPRequestHandlerFactory* _pFactory; | HTTPRequestHandlerFactory::Ptr _pFactory; | |||
}; | }; | |||
} } // namespace Poco::Net | } } // namespace Poco::Net | |||
#endif // Net_HTTPServerConnectionFactory_INCLUDED | #endif // Net_HTTPServerConnectionFactory_INCLUDED | |||
End of changes. 5 change blocks. | ||||
7 lines changed or deleted | 6 lines changed or added | |||
HTTPServerParams.h | HTTPServerParams.h | |||
---|---|---|---|---|
// | // | |||
// HTTPServerParams.h | // HTTPServerParams.h | |||
// | // | |||
// $Id: //poco/1.3/Net/include/Poco/Net/HTTPServerParams.h#1 $ | // $Id: //poco/1.3/Net/include/Poco/Net/HTTPServerParams.h#2 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: HTTPServer | // Package: HTTPServer | |||
// Module: HTTPServerParams | // Module: HTTPServerParams | |||
// | // | |||
// Definition of the HTTPServerParams class. | // Definition of the HTTPServerParams class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 54 | skipping to change at line 54 | |||
namespace Poco { | namespace Poco { | |||
namespace Net { | namespace Net { | |||
class Net_API HTTPServerParams: public TCPServerParams | class Net_API HTTPServerParams: public TCPServerParams | |||
/// This class is used to specify parameters to both the | /// This class is used to specify parameters to both the | |||
/// HTTPServer, as well as to HTTPRequestHandler objects. | /// HTTPServer, as well as to HTTPRequestHandler objects. | |||
/// | /// | |||
/// Subclasses may add new parameters to the class. | /// Subclasses may add new parameters to the class. | |||
{ | { | |||
public: | public: | |||
typedef Poco::AutoPtr<HTTPServerParams> Ptr; | ||||
HTTPServerParams(); | HTTPServerParams(); | |||
/// Creates the HTTPServerParams. | /// Creates the HTTPServerParams. | |||
/// | /// | |||
/// Sets the following default values: | /// Sets the following default values: | |||
/// - timeout: 60 seconds | /// - timeout: 60 seconds | |||
/// - keepAlive: true | /// - keepAlive: true | |||
/// - maxKeepAliveRequests: 0 | /// - maxKeepAliveRequests: 0 | |||
/// - keepAliveTimeout: 10 seconds | /// - keepAliveTimeout: 10 seconds | |||
void setServerName(const std::string& serverName); | void setServerName(const std::string& serverName); | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 3 lines changed or added | |||
HTTPServerRequestImpl.h | HTTPServerRequestImpl.h | |||
---|---|---|---|---|
// | // | |||
// HTTPServerRequestImpl.h | // HTTPServerRequestImpl.h | |||
// | // | |||
// $Id: //poco/1.3/Net/include/Poco/Net/HTTPServerRequestImpl.h#1 $ | // $Id: //poco/1.3/Net/include/Poco/Net/HTTPServerRequestImpl.h#3 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: HTTPServer | // Package: HTTPServer | |||
// Module: HTTPServerRequestImpl | // Module: HTTPServerRequestImpl | |||
// | // | |||
// Definition of the HTTPServerRequestImpl class. | // Definition of the HTTPServerRequestImpl class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 44 | skipping to change at line 44 | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Net_HTTPServerRequestImpl_INCLUDED | #ifndef Net_HTTPServerRequestImpl_INCLUDED | |||
#define Net_HTTPServerRequestImpl_INCLUDED | #define Net_HTTPServerRequestImpl_INCLUDED | |||
#include "Poco/Net/Net.h" | #include "Poco/Net/Net.h" | |||
#include "Poco/Net/HTTPServerRequest.h" | #include "Poco/Net/HTTPServerRequest.h" | |||
#include "Poco/Net/SocketAddress.h" | #include "Poco/Net/SocketAddress.h" | |||
#include "Poco/AutoPtr.h" | ||||
#include <istream> | #include <istream> | |||
namespace Poco { | namespace Poco { | |||
namespace Net { | namespace Net { | |||
class HTTPServerSession; | class HTTPServerSession; | |||
class HTTPServerParams; | class HTTPServerParams; | |||
class Net_API HTTPServerRequestImpl: public HTTPServerRequest | class Net_API HTTPServerRequestImpl: public HTTPServerRequest | |||
/// This subclass of HTTPServerRequest is used for | /// This subclass of HTTPServerRequest is used for | |||
skipping to change at line 90 | skipping to change at line 91 | |||
const SocketAddress& serverAddress() const; | const SocketAddress& serverAddress() const; | |||
/// Returns the server's address. | /// Returns the server's address. | |||
const HTTPServerParams& serverParams() const; | const HTTPServerParams& serverParams() const; | |||
/// Returns a reference to the server parameters. | /// Returns a reference to the server parameters. | |||
HTTPServerResponse& response() const; | HTTPServerResponse& response() const; | |||
/// Returns a reference to the associated response. | /// Returns a reference to the associated response. | |||
protected: | ||||
static const std::string EXPECT; | ||||
private: | private: | |||
HTTPServerResponse& _response; | HTTPServerResponse& _response; | |||
std::istream* _pStream; | std::istream* _pStream; | |||
HTTPServerParams* _pParams; | Poco::AutoPtr<HTTPServerParams> _pParams; | |||
SocketAddress _clientAddress; | SocketAddress _clientAddress; | |||
SocketAddress _serverAddress; | SocketAddress _serverAddress; | |||
}; | }; | |||
// | // | |||
// inlines | // inlines | |||
// | // | |||
inline std::istream& HTTPServerRequestImpl::stream() | inline std::istream& HTTPServerRequestImpl::stream() | |||
{ | { | |||
poco_check_ptr (_pStream); | poco_check_ptr (_pStream); | |||
return *_pStream; | return *_pStream; | |||
End of changes. 4 change blocks. | ||||
6 lines changed or deleted | 10 lines changed or added | |||
HTTPServerSession.h | HTTPServerSession.h | |||
---|---|---|---|---|
// | // | |||
// HTTPServerSession.h | // HTTPServerSession.h | |||
// | // | |||
// $Id: //poco/1.3/Net/include/Poco/Net/HTTPServerSession.h#2 $ | // $Id: //poco/1.3/Net/include/Poco/Net/HTTPServerSession.h#3 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: HTTPServer | // Package: HTTPServer | |||
// Module: HTTPServerSession | // Module: HTTPServerSession | |||
// | // | |||
// Definition of the HTTPServerSession class. | // Definition of the HTTPServerSession class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 44 | skipping to change at line 44 | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Net_HTTPServerSession_INCLUDED | #ifndef Net_HTTPServerSession_INCLUDED | |||
#define Net_HTTPServerSession_INCLUDED | #define Net_HTTPServerSession_INCLUDED | |||
#include "Poco/Net/Net.h" | #include "Poco/Net/Net.h" | |||
#include "Poco/Net/HTTPSession.h" | #include "Poco/Net/HTTPSession.h" | |||
#include "Poco/Net/SocketAddress.h" | #include "Poco/Net/SocketAddress.h" | |||
#include "Poco/Net/HTTPServerSession.h" | ||||
#include "Poco/Net/HTTPServerParams.h" | ||||
#include "Poco/Timespan.h" | #include "Poco/Timespan.h" | |||
namespace Poco { | namespace Poco { | |||
namespace Net { | namespace Net { | |||
class HTTPServerParams; | ||||
class Net_API HTTPServerSession: public HTTPSession | class Net_API HTTPServerSession: public HTTPSession | |||
/// This class handles the server side of a | /// This class handles the server side of a | |||
/// HTTP session. It is used internally by | /// HTTP session. It is used internally by | |||
/// HTTPServer. | /// HTTPServer. | |||
{ | { | |||
public: | public: | |||
HTTPServerSession(const StreamSocket& socket, HTTPServerParams* pPar ams); | HTTPServerSession(const StreamSocket& socket, HTTPServerParams::Ptr pParams); | |||
/// Creates the HTTPServerSession. | /// Creates the HTTPServerSession. | |||
virtual ~HTTPServerSession(); | virtual ~HTTPServerSession(); | |||
/// Destroys the HTTPServerSession. | /// Destroys the HTTPServerSession. | |||
bool hasMoreRequests(); | bool hasMoreRequests(); | |||
/// Returns true if there are requests available. | /// Returns true if there are requests available. | |||
bool canKeepAlive() const; | bool canKeepAlive() const; | |||
/// Returns true if the session can be kept alive. | /// Returns true if the session can be kept alive. | |||
End of changes. 4 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added | |||
HTTPSession.h | HTTPSession.h | |||
---|---|---|---|---|
// | // | |||
// HTTPSession.h | // HTTPSession.h | |||
// | // | |||
// $Id: //poco/1.3/Net/include/Poco/Net/HTTPSession.h#4 $ | // $Id: //poco/1.3/Net/include/Poco/Net/HTTPSession.h#5 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: HTTP | // Package: HTTP | |||
// Module: HTTPSession | // Module: HTTPSession | |||
// | // | |||
// Definition of the HTTPSession class. | // Definition of the HTTPSession class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 96 | skipping to change at line 96 | |||
/// socket connection resulted in an exception, a | /// socket connection resulted in an exception, a | |||
/// pointer to this exception is returned. | /// pointer to this exception is returned. | |||
/// | /// | |||
/// Otherwise, NULL is returned. | /// Otherwise, NULL is returned. | |||
enum | enum | |||
{ | { | |||
HTTP_PORT = 80 | HTTP_PORT = 80 | |||
}; | }; | |||
StreamSocket detachSocket(); | ||||
/// Detaches the socket from the session. | ||||
/// | ||||
/// The socket is returned, and a new, uninitialized socket | ||||
is | ||||
/// attached to the session. | ||||
protected: | protected: | |||
HTTPSession(); | HTTPSession(); | |||
/// Creates a HTTP session using an | /// Creates a HTTP session using an | |||
/// unconnected stream socket. | /// unconnected stream socket. | |||
HTTPSession(const StreamSocket& socket); | HTTPSession(const StreamSocket& socket); | |||
/// Creates a HTTP session using the | /// Creates a HTTP session using the | |||
/// given socket. The session takes ownership | /// given socket. The session takes ownership | |||
/// of the socket and closes it when it's no | /// of the socket and closes it when it's no | |||
/// longer used. | /// longer used. | |||
skipping to change at line 153 | skipping to change at line 159 | |||
StreamSocket& socket(); | StreamSocket& socket(); | |||
/// Returns a reference to the underlying socket. | /// Returns a reference to the underlying socket. | |||
void refill(); | void refill(); | |||
/// Refills the internal buffer. | /// Refills the internal buffer. | |||
virtual void connect(const SocketAddress& address); | virtual void connect(const SocketAddress& address); | |||
/// Connects the underlying socket to the given address | /// Connects the underlying socket to the given address | |||
/// and sets the socket's receive timeout. | /// and sets the socket's receive timeout. | |||
void attachSocket(const StreamSocket& socket); | ||||
/// Attaches a socket to the session, replacing the | ||||
/// previously attached socket. | ||||
void close(); | void close(); | |||
/// Closes the underlying socket. | /// Closes the underlying socket. | |||
void setException(const Poco::Exception& exc); | void setException(const Poco::Exception& exc); | |||
/// Stores a clone of the exception. | /// Stores a clone of the exception. | |||
private: | private: | |||
enum | enum | |||
{ | { | |||
HTTP_DEFAULT_TIMEOUT = 60000000 | HTTP_DEFAULT_TIMEOUT = 60000000 | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 12 lines changed or added | |||
HTTPStreamFactory.h | HTTPStreamFactory.h | |||
---|---|---|---|---|
// | // | |||
// HTTPStreamFactory.h | // HTTPStreamFactory.h | |||
// | // | |||
// $Id: //poco/1.3/Net/include/Poco/Net/HTTPStreamFactory.h#1 $ | // $Id: //poco/1.3/Net/include/Poco/Net/HTTPStreamFactory.h#2 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: HTTP | // Package: HTTP | |||
// Module: HTTPStreamFactory | // Module: HTTPStreamFactory | |||
// | // | |||
// Definition of the HTTPStreamFactory class. | // Definition of the HTTPStreamFactory class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 83 | skipping to change at line 83 | |||
/// via the HTTP protocol. If a redirection to | /// via the HTTP protocol. If a redirection to | |||
/// a non http://... URI is received, a | /// a non http://... URI is received, a | |||
/// UnsupportedRedirectException exception is thrown. | /// UnsupportedRedirectException exception is thrown. | |||
/// The offending URI can then be obtained via the message() | /// The offending URI can then be obtained via the message() | |||
/// method of UnsupportedRedirectException. | /// method of UnsupportedRedirectException. | |||
static void registerFactory(); | static void registerFactory(); | |||
/// Registers the HTTPStreamFactory with the | /// Registers the HTTPStreamFactory with the | |||
/// default URIStreamOpener instance. | /// default URIStreamOpener instance. | |||
static void unregisterFactory(); | ||||
/// Unregisters the HTTPStreamFactory with the | ||||
/// default URIStreamOpener instance. | ||||
private: | private: | |||
enum | enum | |||
{ | { | |||
MAX_REDIRECTS = 10 | MAX_REDIRECTS = 10 | |||
}; | }; | |||
std::string _proxyHost; | std::string _proxyHost; | |||
Poco::UInt16 _proxyPort; | Poco::UInt16 _proxyPort; | |||
}; | }; | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 5 lines changed or added | |||
HelpFormatter.h | HelpFormatter.h | |||
---|---|---|---|---|
// | // | |||
// HelpFormatter.h | // HelpFormatter.h | |||
// | // | |||
// $Id: //poco/1.3/Util/include/Poco/Util/HelpFormatter.h#1 $ | // $Id: //poco/1.3/Util/include/Poco/Util/HelpFormatter.h#2 $ | |||
// | // | |||
// Library: Util | // Library: Util | |||
// Package: Options | // Package: Options | |||
// Module: HelpFormatter | // Module: HelpFormatter | |||
// | // | |||
// Definition of the HelpFormatter class. | // Definition of the HelpFormatter class. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 114 | skipping to change at line 114 | |||
/// Returns the indentation for description continuation lin es. | /// Returns the indentation for description continuation lin es. | |||
void setAutoIndent(); | void setAutoIndent(); | |||
/// Sets the indentation for description continuation lines so that | /// Sets the indentation for description continuation lines so that | |||
/// the description text is left-aligned. | /// the description text is left-aligned. | |||
void setUnixStyle(bool flag); | void setUnixStyle(bool flag); | |||
/// Enables Unix-style options. Both short and long option n ames | /// Enables Unix-style options. Both short and long option n ames | |||
/// are printed if Unix-style is set. Otherwise, only long o ption | /// are printed if Unix-style is set. Otherwise, only long o ption | |||
/// names are printed. | /// names are printed. | |||
/// | ||||
/// After calling setUnixStyle(), setAutoIndent() should be | ||||
called | ||||
/// as well to ensure proper help text formatting. | ||||
bool isUnixStyle() const; | bool isUnixStyle() const; | |||
/// Returns if Unix-style options are set. | /// Returns if Unix-style options are set. | |||
std::string shortPrefix() const; | std::string shortPrefix() const; | |||
/// Returns the platform-specific prefix for short options. | /// Returns the platform-specific prefix for short options. | |||
/// "-" on Unix, "/" on Windows and OpenVMS. | /// "-" on Unix, "/" on Windows and OpenVMS. | |||
std::string longPrefix() const; | std::string longPrefix() const; | |||
/// Returns the platform-specific prefix for long options. | /// Returns the platform-specific prefix for long options. | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 5 lines changed or added | |||
MulticastSocket.h | MulticastSocket.h | |||
---|---|---|---|---|
// | // | |||
// MulticastSocket.h | // MulticastSocket.h | |||
// | // | |||
// $Id: //poco/1.3/Net/include/Poco/Net/MulticastSocket.h#1 $ | // $Id: //poco/1.3/Net/include/Poco/Net/MulticastSocket.h#2 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: Sockets | // Package: Sockets | |||
// Module: MulticastSocket | // Module: MulticastSocket | |||
// | // | |||
// Definition of the MulticastSocket class. | // Definition of the MulticastSocket class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 57 | skipping to change at line 57 | |||
class Net_API MulticastSocket: public DatagramSocket | class Net_API MulticastSocket: public DatagramSocket | |||
/// A MulticastSocket is a special DatagramSocket | /// A MulticastSocket is a special DatagramSocket | |||
/// that can be used to send packets to and receive | /// that can be used to send packets to and receive | |||
/// packets from multicast groups. | /// packets from multicast groups. | |||
{ | { | |||
public: | public: | |||
MulticastSocket(); | MulticastSocket(); | |||
/// Creates the MulticastSocket. | /// Creates the MulticastSocket. | |||
MulticastSocket(IPAddress::Family family); | explicit MulticastSocket(IPAddress::Family family); | |||
/// Creates an unconnected datagram socket. | /// Creates an unconnected datagram socket. | |||
/// | /// | |||
/// The socket will be created for the | /// The socket will be created for the | |||
/// given address family. | /// given address family. | |||
MulticastSocket(const SocketAddress& address, bool reuseAddress = fa lse); | MulticastSocket(const SocketAddress& address, bool reuseAddress = fa lse); | |||
/// Creates a datagram socket and binds it | /// Creates a datagram socket and binds it | |||
/// to the given address. | /// to the given address. | |||
/// | /// | |||
/// Depending on the address family, the socket | /// Depending on the address family, the socket | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
NObserver.h | NObserver.h | |||
---|---|---|---|---|
// | // | |||
// NObserver.h | // NObserver.h | |||
// | // | |||
// $Id: //poco/1.3/Foundation/include/Poco/NObserver.h#1 $ | // $Id: //poco/1.3/Foundation/include/Poco/NObserver.h#3 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Notifications | // Package: Notifications | |||
// Module: NotificationCenter | // Module: NotificationCenter | |||
// | // | |||
// Definition of the NObserver class template. | // Definition of the NObserver class template. | |||
// | // | |||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 43 | skipping to change at line 43 | |||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Foundation_NObserver_INCLUDED | #ifndef Foundation_NObserver_INCLUDED | |||
#define Foundation_NObserver_INCLUDED | #define Foundation_NObserver_INCLUDED | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
#include "Poco/AbstractObserver.h" | #include "Poco/AbstractObserver.h" | |||
#include "Poco/AutoPtr.h" | ||||
namespace Poco { | namespace Poco { | |||
template <class C, class N> | template <class C, class N> | |||
class NObserver: public AbstractObserver | class NObserver: public AbstractObserver | |||
/// This template class implements an adapter that sits between | /// This template class implements an adapter that sits between | |||
/// a NotificationCenter and an object receiving notifications | /// a NotificationCenter and an object receiving notifications | |||
/// from it. It is quite similar in concept to the | /// from it. It is quite similar in concept to the | |||
/// RunnableAdapter, but provides some NotificationCenter | /// RunnableAdapter, but provides some NotificationCenter | |||
/// specific additional methods. | /// specific additional methods. | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 1 lines changed or added | |||
NamedEvent_UNIX.h | NamedEvent_UNIX.h | |||
---|---|---|---|---|
// | // | |||
// NamedEvent_UNIX.h | // NamedEvent_UNIX.h | |||
// | // | |||
// $Id: //poco/1.3/Foundation/include/Poco/NamedEvent_UNIX.h#1 $ | // $Id: //poco/1.3/Foundation/include/Poco/NamedEvent_UNIX.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Processes | // Package: Processes | |||
// Module: NamedEvent | // Module: NamedEvent | |||
// | // | |||
// Definition of the NamedEventImpl class for Unix. | // Definition of the NamedEventImpl class for Unix. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 42 | skipping to change at line 42 | |||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | |||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Foundation_NamedEvent_UNIX_INCLUDED | #ifndef Foundation_NamedEvent_UNIX_INCLUDED | |||
#define Foundation_NamedEvent_UNIX_INCLUDED | #define Foundation_NamedEvent_UNIX_INCLUDED | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
#if defined(sun) || defined(__APPLE__) || defined(__osf__) || defined(__QNX __) | #if defined(sun) || defined(__APPLE__) || defined(__osf__) || defined(__QNX __) || defined(_AIX) | |||
#include <semaphore.h> | #include <semaphore.h> | |||
#endif | #endif | |||
namespace Poco { | namespace Poco { | |||
class Foundation_API NamedEventImpl | class Foundation_API NamedEventImpl | |||
{ | { | |||
protected: | protected: | |||
NamedEventImpl(const std::string& name); | NamedEventImpl(const std::string& name); | |||
~NamedEventImpl(); | ~NamedEventImpl(); | |||
void setImpl(); | void setImpl(); | |||
void waitImpl(); | void waitImpl(); | |||
private: | private: | |||
std::string getFileName(); | std::string getFileName(); | |||
std::string _name; | std::string _name; | |||
#if defined(sun) || defined(__APPLE__) || defined(__osf__) || defined(__QNX __) | #if defined(sun) || defined(__APPLE__) || defined(__osf__) || defined(__QNX __) || defined(_AIX) | |||
sem_t* _sem; | sem_t* _sem; | |||
#else | #else | |||
int _lockfd; // lock file descriptor | int _lockfd; // lock file descriptor | |||
int _semfd; // file used to identify semaphore | int _semfd; // file used to identify semaphore | |||
int _semid; // semaphore id | int _semid; // semaphore id | |||
#endif | #endif | |||
}; | }; | |||
} // namespace Poco | } // namespace Poco | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
NamedMutex_UNIX.h | NamedMutex_UNIX.h | |||
---|---|---|---|---|
// | // | |||
// NamedMutex_UNIX.h | // NamedMutex_UNIX.h | |||
// | // | |||
// $Id: //poco/1.3/Foundation/include/Poco/NamedMutex_UNIX.h#1 $ | // $Id: //poco/1.3/Foundation/include/Poco/NamedMutex_UNIX.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Processes | // Package: Processes | |||
// Module: NamedMutex | // Module: NamedMutex | |||
// | // | |||
// Definition of the NamedMutexImpl class for Unix. | // Definition of the NamedMutexImpl class for Unix. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 44 | skipping to change at line 44 | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Foundation_NamedMutex_UNIX_INCLUDED | #ifndef Foundation_NamedMutex_UNIX_INCLUDED | |||
#define Foundation_NamedMutex_UNIX_INCLUDED | #define Foundation_NamedMutex_UNIX_INCLUDED | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
#include <sys/types.h> | #include <sys/types.h> | |||
#include <sys/stat.h> | #include <sys/stat.h> | |||
#if defined(sun) || defined(__APPLE__) || defined(__osf__) || defined(__QNX __) | #if defined(sun) || defined(__APPLE__) || defined(__osf__) || defined(__QNX __) || defined(_AIX) | |||
#include <semaphore.h> | #include <semaphore.h> | |||
#endif | #endif | |||
namespace Poco { | namespace Poco { | |||
class Foundation_API NamedMutexImpl | class Foundation_API NamedMutexImpl | |||
{ | { | |||
protected: | protected: | |||
NamedMutexImpl(const std::string& name); | NamedMutexImpl(const std::string& name); | |||
~NamedMutexImpl(); | ~NamedMutexImpl(); | |||
void lockImpl(); | void lockImpl(); | |||
bool tryLockImpl(); | bool tryLockImpl(); | |||
void unlockImpl(); | void unlockImpl(); | |||
private: | private: | |||
std::string getFileName(); | std::string getFileName(); | |||
std::string _name; | std::string _name; | |||
#if defined(sun) || defined(__APPLE__) || defined(__osf__) || defined(__QNX __) | #if defined(sun) || defined(__APPLE__) || defined(__osf__) || defined(__QNX __) || defined(_AIX) | |||
sem_t* _sem; | sem_t* _sem; | |||
#else | #else | |||
int _lockfd; // lock file descriptor | int _lockfd; // lock file descriptor | |||
int _semfd; // file used to identify semaphore | int _semfd; // file used to identify semaphore | |||
int _semid; // semaphore id | int _semid; // semaphore id | |||
#endif | #endif | |||
}; | }; | |||
} // namespace Poco | } // namespace Poco | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
NetworkInterface.h | NetworkInterface.h | |||
---|---|---|---|---|
// | // | |||
// NetworkInterface.h | // NetworkInterface.h | |||
// | // | |||
// $Id: //poco/1.3/Net/include/Poco/Net/NetworkInterface.h#6 $ | // $Id: //poco/1.3/Net/include/Poco/Net/NetworkInterface.h#7 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: Sockets | // Package: Sockets | |||
// Module: NetworkInterface | // Module: NetworkInterface | |||
// | // | |||
// Definition of the NetworkInterface class. | // Definition of the NetworkInterface class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 68 | skipping to change at line 68 | |||
public: | public: | |||
typedef std::vector<NetworkInterface> NetworkInterfaceList; | typedef std::vector<NetworkInterface> NetworkInterfaceList; | |||
NetworkInterface(); | NetworkInterface(); | |||
/// Creates a NetworkInterface representing the | /// Creates a NetworkInterface representing the | |||
/// default interface. | /// default interface. | |||
/// | /// | |||
/// The name is empty, the IP address is the wildcard | /// The name is empty, the IP address is the wildcard | |||
/// address and the index is zero. | /// address and the index is zero. | |||
NetworkInterface(const NetworkInterface& interface); | NetworkInterface(const NetworkInterface& interfc); | |||
/// Creates the NetworkInterface by copying another one. | /// Creates the NetworkInterface by copying another one. | |||
~NetworkInterface(); | ~NetworkInterface(); | |||
/// Destroys the NetworkInterface. | /// Destroys the NetworkInterface. | |||
NetworkInterface& operator = (const NetworkInterface& interface); | NetworkInterface& operator = (const NetworkInterface& interfc); | |||
/// Assigns another NetworkInterface. | /// Assigns another NetworkInterface. | |||
void swap(NetworkInterface& other); | void swap(NetworkInterface& other); | |||
/// Swaps the NetworkInterface with another one. | /// Swaps the NetworkInterface with another one. | |||
int index() const; | int index() const; | |||
/// Returns the interface index. | /// Returns the interface index. | |||
/// | /// | |||
/// Only supported if IPv6 is available. | /// Only supported if IPv6 is available. | |||
/// Returns -1 if IPv6 is not available. | /// Returns -1 if IPv6 is not available. | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
Notification.h | Notification.h | |||
---|---|---|---|---|
// | // | |||
// Notification.h | // Notification.h | |||
// | // | |||
// $Id: //poco/1.3/Foundation/include/Poco/Notification.h#1 $ | // $Id: //poco/1.3/Foundation/include/Poco/Notification.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Notifications | // Package: Notifications | |||
// Module: Notification | // Module: Notification | |||
// | // | |||
// Definition of the Notification class. | // Definition of the Notification class. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 44 | skipping to change at line 44 | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Foundation_Notification_INCLUDED | #ifndef Foundation_Notification_INCLUDED | |||
#define Foundation_Notification_INCLUDED | #define Foundation_Notification_INCLUDED | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
#include "Poco/Mutex.h" | #include "Poco/Mutex.h" | |||
#include "Poco/RefCountedObject.h" | #include "Poco/RefCountedObject.h" | |||
#include "Poco/AutoPtr.h" | ||||
namespace Poco { | namespace Poco { | |||
class Foundation_API Notification: public RefCountedObject | class Foundation_API Notification: public RefCountedObject | |||
/// The base class for all notification classes used | /// The base class for all notification classes used | |||
/// with the NotificationCenter and the NotificationQueue | /// with the NotificationCenter and the NotificationQueue | |||
/// classes. | /// classes. | |||
/// The Notification class can be used with the AutoPtr | /// The Notification class can be used with the AutoPtr | |||
/// template class. | /// template class. | |||
{ | { | |||
public: | public: | |||
typedef AutoPtr<Notification> Ptr; | ||||
Notification(); | Notification(); | |||
/// Creates the notification. | /// Creates the notification. | |||
virtual std::string name() const; | virtual std::string name() const; | |||
/// Returns the name of the notification. | /// Returns the name of the notification. | |||
/// The default implementation returns the class name. | /// The default implementation returns the class name. | |||
protected: | protected: | |||
virtual ~Notification(); | virtual ~Notification(); | |||
}; | }; | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 4 lines changed or added | |||
NotificationCenter.h | NotificationCenter.h | |||
---|---|---|---|---|
// | // | |||
// NotificationCenter.h | // NotificationCenter.h | |||
// | // | |||
// $Id: //poco/1.3/Foundation/include/Poco/NotificationCenter.h#1 $ | // $Id: //poco/1.3/Foundation/include/Poco/NotificationCenter.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Notifications | // Package: Notifications | |||
// Module: NotificationCenter | // Module: NotificationCenter | |||
// | // | |||
// Definition of the NotificationCenter class. | // Definition of the NotificationCenter class. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 42 | skipping to change at line 42 | |||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | |||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Foundation_NotificationCenter_INCLUDED | #ifndef Foundation_NotificationCenter_INCLUDED | |||
#define Foundation_NotificationCenter_INCLUDED | #define Foundation_NotificationCenter_INCLUDED | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
#include "Poco/Notification.h" | ||||
#include "Poco/Mutex.h" | #include "Poco/Mutex.h" | |||
#include <list> | #include <list> | |||
namespace Poco { | namespace Poco { | |||
class Notification; | ||||
class AbstractObserver; | class AbstractObserver; | |||
class Foundation_API NotificationCenter | class Foundation_API NotificationCenter | |||
/// A NotificationCenter is essentially a notification dispatcher. | /// A NotificationCenter is essentially a notification dispatcher. | |||
/// It notifies all observers of notifications meeting specific crit eria. | /// It notifies all observers of notifications meeting specific crit eria. | |||
/// This information is encapsulated in Notification objects. | /// This information is encapsulated in Notification objects. | |||
/// Client objects register themselves with the notification center as observers of | /// Client objects register themselves with the notification center as observers of | |||
/// specific notifications posted by other objects. When an event oc curs, an object | /// specific notifications posted by other objects. When an event oc curs, an object | |||
/// posts an appropriate notification to the notification center. Th e notification | /// posts an appropriate notification to the notification center. Th e notification | |||
/// center invokes the registered method on each matching observer, passing the notification | /// center invokes the registered method on each matching observer, passing the notification | |||
skipping to change at line 114 | skipping to change at line 114 | |||
/// Registers an observer with the NotificationCenter. | /// Registers an observer with the NotificationCenter. | |||
/// Usage: | /// Usage: | |||
/// Observer<MyClass, MyNotification> obs(*this, &MyClas s::handleNotification); | /// Observer<MyClass, MyNotification> obs(*this, &MyClas s::handleNotification); | |||
/// notificationCenter.addObserver(obs); | /// notificationCenter.addObserver(obs); | |||
/// | /// | |||
/// Alternatively, the NObserver template class can be used instead of Observer. | /// Alternatively, the NObserver template class can be used instead of Observer. | |||
void removeObserver(const AbstractObserver& observer); | void removeObserver(const AbstractObserver& observer); | |||
/// Unregisters an observer with the NotificationCenter. | /// Unregisters an observer with the NotificationCenter. | |||
void postNotification(Notification* pNotification); | void postNotification(Notification::Ptr pNotification); | |||
/// Posts a notification to the NotificationCenter. | /// Posts a notification to the NotificationCenter. | |||
/// The NotificationCenter then delivers the notification | /// The NotificationCenter then delivers the notification | |||
/// to all interested observers. | /// to all interested observers. | |||
/// If an observer throws an exception, dispatching terminat es | /// If an observer throws an exception, dispatching terminat es | |||
/// and the exception is rethrown to the caller. | /// and the exception is rethrown to the caller. | |||
/// Ownership of the notification object is claimed and the | /// Ownership of the notification object is claimed and the | |||
/// notification is released before returning. Therefore, | /// notification is released before returning. Therefore, | |||
/// a call like | /// a call like | |||
/// notificationCenter.postNotification(new MyNotificatio n); | /// notificationCenter.postNotification(new MyNotificatio n); | |||
/// does not result in a memory leak. | /// does not result in a memory leak. | |||
End of changes. 4 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
NotificationQueue.h | NotificationQueue.h | |||
---|---|---|---|---|
// | // | |||
// NotificationQueue.h | // NotificationQueue.h | |||
// | // | |||
// $Id: //poco/1.3/Foundation/include/Poco/NotificationQueue.h#1 $ | // $Id: //poco/1.3/Foundation/include/Poco/NotificationQueue.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Notifications | // Package: Notifications | |||
// Module: NotificationQueue | // Module: NotificationQueue | |||
// | // | |||
// Definition of the NotificationQueue class. | // Definition of the NotificationQueue class. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 42 | skipping to change at line 42 | |||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | |||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Foundation_NotificationQueue_INCLUDED | #ifndef Foundation_NotificationQueue_INCLUDED | |||
#define Foundation_NotificationQueue_INCLUDED | #define Foundation_NotificationQueue_INCLUDED | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
#include "Poco/Notification.h" | ||||
#include "Poco/Mutex.h" | #include "Poco/Mutex.h" | |||
#include "Poco/Event.h" | #include "Poco/Event.h" | |||
#include <deque> | #include <deque> | |||
namespace Poco { | namespace Poco { | |||
class Notification; | ||||
class NotificationCenter; | class NotificationCenter; | |||
class Foundation_API NotificationQueue | class Foundation_API NotificationQueue | |||
/// A NotificationQueue object provides a way to implement asynchron ous | /// A NotificationQueue object provides a way to implement asynchron ous | |||
/// notifications. This is especially useful for sending notificatio ns | /// notifications. This is especially useful for sending notificatio ns | |||
/// from one thread to another, for example from a background thread to | /// from one thread to another, for example from a background thread to | |||
/// the main (user interface) thread. | /// the main (user interface) thread. | |||
/// | /// | |||
/// The NotificationQueue can also be used to distribute work from | /// The NotificationQueue can also be used to distribute work from | |||
/// a controlling thread to one or more worker threads. Each worker thread | /// a controlling thread to one or more worker threads. Each worker thread | |||
skipping to change at line 75 | skipping to change at line 75 | |||
/// 3. join each worker thread | /// 3. join each worker thread | |||
/// 4. destroy the notification queue. | /// 4. destroy the notification queue. | |||
{ | { | |||
public: | public: | |||
NotificationQueue(); | NotificationQueue(); | |||
/// Creates the NotificationQueue. | /// Creates the NotificationQueue. | |||
~NotificationQueue(); | ~NotificationQueue(); | |||
/// Destroys the NotificationQueue. | /// Destroys the NotificationQueue. | |||
void enqueueNotification(Notification* pNotification); | void enqueueNotification(Notification::Ptr pNotification); | |||
/// Enqueues the given notification by adding it to | /// Enqueues the given notification by adding it to | |||
/// the end of the queue (FIFO). | /// the end of the queue (FIFO). | |||
/// The queue takes ownership of the notification, thus | /// The queue takes ownership of the notification, thus | |||
/// a call like | /// a call like | |||
/// notificationQueue.enqueueNotification(new MyNotifica tion); | /// notificationQueue.enqueueNotification(new MyNotifica tion); | |||
/// does not result in a memory leak. | /// does not result in a memory leak. | |||
void enqueueUrgentNotification(Notification* pNotification); | void enqueueUrgentNotification(Notification::Ptr pNotification); | |||
/// Enqueues the given notification by adding it to | /// Enqueues the given notification by adding it to | |||
/// the front of the queue (LIFO). The event therefore gets processed | /// the front of the queue (LIFO). The event therefore gets processed | |||
/// before all other events already in the queue. | /// before all other events already in the queue. | |||
/// The queue takes ownership of the notification, thus | /// The queue takes ownership of the notification, thus | |||
/// a call like | /// a call like | |||
/// notificationQueue.enqueueUrgentNotification(new MyNo tification); | /// notificationQueue.enqueueUrgentNotification(new MyNo tification); | |||
/// does not result in a memory leak. | /// does not result in a memory leak. | |||
Notification* dequeueNotification(); | Notification* dequeueNotification(); | |||
/// Dequeues the next pending notification. | /// Dequeues the next pending notification. | |||
/// Returns 0 (null) if no notification is available. | /// Returns 0 (null) if no notification is available. | |||
/// The caller gains ownership of the notification and | /// The caller gains ownership of the notification and | |||
/// is expected to release it when done with it. | /// is expected to release it when done with it. | |||
/// | ||||
/// It is highly recommended that the result is immediately | ||||
/// assigned to a Notification::Ptr, to avoid potential | ||||
/// memory management issues. | ||||
Notification* waitDequeueNotification(); | Notification* waitDequeueNotification(); | |||
/// Dequeues the next pending notification. | /// Dequeues the next pending notification. | |||
/// If no notification is available, waits for a notificatio n | /// If no notification is available, waits for a notificatio n | |||
/// to be enqueued. | /// to be enqueued. | |||
/// The caller gains ownership of the notification and | /// The caller gains ownership of the notification and | |||
/// is expected to release it when done with it. | /// is expected to release it when done with it. | |||
/// This method returns 0 (null) if wakeUpWaitingThreads() | /// This method returns 0 (null) if wakeUpWaitingThreads() | |||
/// has been called by another thread. | /// has been called by another thread. | |||
/// | ||||
/// It is highly recommended that the result is immediately | ||||
/// assigned to a Notification::Ptr, to avoid potential | ||||
/// memory management issues. | ||||
Notification* waitDequeueNotification(long milliseconds); | Notification* waitDequeueNotification(long milliseconds); | |||
/// Dequeues the next pending notification. | /// Dequeues the next pending notification. | |||
/// If no notification is available, waits for a notificatio n | /// If no notification is available, waits for a notificatio n | |||
/// to be enqueued up to the specified time. | /// to be enqueued up to the specified time. | |||
/// Returns 0 (null) if no notification is available. | /// Returns 0 (null) if no notification is available. | |||
/// The caller gains ownership of the notification and | /// The caller gains ownership of the notification and | |||
/// is expected to release it when done with it. | /// is expected to release it when done with it. | |||
/// | ||||
/// It is highly recommended that the result is immediately | ||||
/// assigned to a Notification::Ptr, to avoid potential | ||||
/// memory management issues. | ||||
void dispatch(NotificationCenter& notificationCenter); | void dispatch(NotificationCenter& notificationCenter); | |||
/// Dispatches all queued notifications to the given | /// Dispatches all queued notifications to the given | |||
/// notification center. | /// notification center. | |||
void wakeUpAll(); | void wakeUpAll(); | |||
/// Wakes up all threads that wait for a notification. | /// Wakes up all threads that wait for a notification. | |||
bool empty() const; | bool empty() const; | |||
/// Returns true iff the queue is empty. | /// Returns true iff the queue is empty. | |||
skipping to change at line 140 | skipping to change at line 152 | |||
bool hasIdleThreads() const; | bool hasIdleThreads() const; | |||
/// Returns true if the queue has at least one thread waitin g | /// Returns true if the queue has at least one thread waitin g | |||
/// for a notification. | /// for a notification. | |||
static NotificationQueue& defaultQueue(); | static NotificationQueue& defaultQueue(); | |||
/// Returns a reference to the default | /// Returns a reference to the default | |||
/// NotificationQueue. | /// NotificationQueue. | |||
protected: | protected: | |||
Notification* dequeueOne(); | Notification::Ptr dequeueOne(); | |||
private: | private: | |||
typedef std::deque<Notification*> NfQueue; | typedef std::deque<Notification::Ptr> NfQueue; | |||
struct WaitInfo | struct WaitInfo | |||
{ | { | |||
Notification* pNf; | Notification::Ptr pNf; | |||
Event nfAvailable; | Event nfAvailable; | |||
}; | }; | |||
typedef std::deque<WaitInfo*> WaitQueue; | typedef std::deque<WaitInfo*> WaitQueue; | |||
NfQueue _nfQueue; | NfQueue _nfQueue; | |||
WaitQueue _waitQueue; | WaitQueue _waitQueue; | |||
mutable FastMutex _mutex; | mutable FastMutex _mutex; | |||
}; | }; | |||
} // namespace Poco | } // namespace Poco | |||
End of changes. 11 change blocks. | ||||
8 lines changed or deleted | 20 lines changed or added | |||
NumberFormatter.h | NumberFormatter.h | |||
---|---|---|---|---|
// | // | |||
// NumberFormatter.h | // NumberFormatter.h | |||
// | // | |||
// $Id: //poco/1.3/Foundation/include/Poco/NumberFormatter.h#2 $ | // $Id: //poco/1.3/Foundation/include/Poco/NumberFormatter.h#3 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: NumberFormatter | // Module: NumberFormatter | |||
// | // | |||
// Definition of the NumberFormatter class. | // Definition of the NumberFormatter class. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2008, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
// Permission is hereby granted, free of charge, to any person or organizat ion | // Permission is hereby granted, free of charge, to any person or organizat ion | |||
// obtaining a copy of the software and accompanying documentation covered by | // obtaining a copy of the software and accompanying documentation covered by | |||
// this license (the "Software") to use, reproduce, display, distribute, | // this license (the "Software") to use, reproduce, display, distribute, | |||
// execute, and transmit the Software, and to prepare derivative works of t he | // execute, and transmit the Software, and to prepare derivative works of t he | |||
// Software, and to permit third-parties to whom the Software is furnished to | // Software, and to permit third-parties to whom the Software is furnished to | |||
// do so, all subject to the following: | // do so, all subject to the following: | |||
// | // | |||
// The copyright notices in the Software and this entire statement, includi ng | // The copyright notices in the Software and this entire statement, includi ng | |||
skipping to change at line 48 | skipping to change at line 48 | |||
#ifndef Foundation_NumberFormatter_INCLUDED | #ifndef Foundation_NumberFormatter_INCLUDED | |||
#define Foundation_NumberFormatter_INCLUDED | #define Foundation_NumberFormatter_INCLUDED | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
namespace Poco { | namespace Poco { | |||
class Foundation_API NumberFormatter | class Foundation_API NumberFormatter | |||
/// The NumberFormatter class provides static methods | /// The NumberFormatter class provides static methods | |||
/// for formatting numeric values into strings. | /// for formatting numeric values into strings. | |||
/// | ||||
/// There are two kind of static member functions: | ||||
/// * format* functions return a std::string containing | ||||
/// the formatted value. | ||||
/// * append* functions append the formatted value to | ||||
/// an existing string. | ||||
/// | ||||
/// Internally, std::sprintf() is used to do the actual | ||||
/// formatting. | ||||
{ | { | |||
public: | public: | |||
static std::string format(int value); | static std::string format(int value); | |||
/// Formats an integer value in decimal notation. | /// Formats an integer value in decimal notation. | |||
static std::string format(int value, int width); | static std::string format(int value, int width); | |||
/// Formats an integer value in decimal notation, | /// Formats an integer value in decimal notation, | |||
/// right justified in a field having at least | /// right justified in a field having at least | |||
/// the specified width. | /// the specified width. | |||
skipping to change at line 205 | skipping to change at line 214 | |||
static std::string format(double value, int width, int precision); | static std::string format(double value, int width, int precision); | |||
/// Formats a double value in decimal floating-point notatio n, | /// Formats a double value in decimal floating-point notatio n, | |||
/// right justified in a field of the specified width, | /// right justified in a field of the specified width, | |||
/// with the number of fractional digits given in precision. | /// with the number of fractional digits given in precision. | |||
static std::string format(const void* ptr); | static std::string format(const void* ptr); | |||
/// Formats a pointer in an eight (32-bit architectures) or | /// Formats a pointer in an eight (32-bit architectures) or | |||
/// sixteen (64-bit architectures) characters wide | /// sixteen (64-bit architectures) characters wide | |||
/// field in hexadecimal notation. | /// field in hexadecimal notation. | |||
static void append(std::string& str, int value); | ||||
/// Formats an integer value in decimal notation. | ||||
static void append(std::string& str, int value, int width); | ||||
/// Formats an integer value in decimal notation, | ||||
/// right justified in a field having at least | ||||
/// the specified width. | ||||
static void append0(std::string& str, int value, int width); | ||||
/// Formats an integer value in decimal notation, | ||||
/// right justified and zero-padded in a field | ||||
/// having at least the specified width. | ||||
static void appendHex(std::string& str, int value); | ||||
/// Formats an int value in hexadecimal notation. | ||||
/// The value is treated as unsigned. | ||||
static void appendHex(std::string& str, int value, int width); | ||||
/// Formats a int value in hexadecimal notation, | ||||
/// right justified and zero-padded in | ||||
/// a field having at least the specified width. | ||||
/// The value is treated as unsigned. | ||||
static void append(std::string& str, unsigned value); | ||||
/// Formats an unsigned int value in decimal notation. | ||||
static void append(std::string& str, unsigned value, int width); | ||||
/// Formats an unsigned long int in decimal notation, | ||||
/// right justified in a field having at least the | ||||
/// specified width. | ||||
static void append0(std::string& str, unsigned int value, int width) | ||||
; | ||||
/// Formats an unsigned int value in decimal notation, | ||||
/// right justified and zero-padded in a field having at | ||||
/// least the specified width. | ||||
static void appendHex(std::string& str, unsigned value); | ||||
/// Formats an unsigned int value in hexadecimal notation. | ||||
static void appendHex(std::string& str, unsigned value, int width); | ||||
/// Formats a int value in hexadecimal notation, | ||||
/// right justified and zero-padded in | ||||
/// a field having at least the specified width. | ||||
static void append(std::string& str, long value); | ||||
/// Formats a long value in decimal notation. | ||||
static void append(std::string& str, long value, int width); | ||||
/// Formats a long value in decimal notation, | ||||
/// right justified in a field having at least the | ||||
/// specified width. | ||||
static void append0(std::string& str, long value, int width); | ||||
/// Formats a long value in decimal notation, | ||||
/// right justified and zero-padded in a field | ||||
/// having at least the specified width. | ||||
static void appendHex(std::string& str, long value); | ||||
/// Formats an unsigned long value in hexadecimal notation. | ||||
/// The value is treated as unsigned. | ||||
static void appendHex(std::string& str, long value, int width); | ||||
/// Formats an unsigned long value in hexadecimal notation, | ||||
/// right justified and zero-padded in a field having at lea | ||||
st the | ||||
/// specified width. | ||||
/// The value is treated as unsigned. | ||||
static void append(std::string& str, unsigned long value); | ||||
/// Formats an unsigned long value in decimal notation. | ||||
static void append(std::string& str, unsigned long value, int width) | ||||
; | ||||
/// Formats an unsigned long value in decimal notation, | ||||
/// right justified in a field having at least the specified | ||||
/// width. | ||||
static void append0(std::string& str, unsigned long value, int width | ||||
); | ||||
/// Formats an unsigned long value in decimal notation, | ||||
/// right justified and zero-padded | ||||
/// in a field having at least the specified width. | ||||
static void appendHex(std::string& str, unsigned long value); | ||||
/// Formats an unsigned long value in hexadecimal notation. | ||||
static void appendHex(std::string& str, unsigned long value, int wid | ||||
th); | ||||
/// Formats an unsigned long value in hexadecimal notation, | ||||
/// right justified and zero-padded in a field having at lea | ||||
st the | ||||
/// specified width. | ||||
#if defined(POCO_HAVE_INT64) && !defined(POCO_LONG_IS_64_BIT) | ||||
static void append(std::string& str, Int64 value); | ||||
/// Formats a 64-bit integer value in decimal notation. | ||||
static void append(std::string& str, Int64 value, int width); | ||||
/// Formats a 64-bit integer value in decimal notation, | ||||
/// right justified in a field having at least the specified | ||||
width. | ||||
static void append0(std::string& str, Int64 value, int width); | ||||
/// Formats a 64-bit integer value in decimal notation, | ||||
/// right justified and zero-padded in a field having at lea | ||||
st | ||||
/// the specified width. | ||||
static void appendHex(std::string& str, Int64 value); | ||||
/// Formats a 64-bit integer value in hexadecimal notation. | ||||
/// The value is treated as unsigned. | ||||
static void appendHex(std::string& str, Int64 value, int width); | ||||
/// Formats a 64-bit integer value in hexadecimal notation, | ||||
/// right justified and zero-padded in a field having at lea | ||||
st | ||||
/// the specified width. | ||||
/// The value is treated as unsigned. | ||||
static void append(std::string& str, UInt64 value); | ||||
/// Formats an unsigned 64-bit integer value in decimal nota | ||||
tion. | ||||
static void append(std::string& str, UInt64 value, int width); | ||||
/// Formats an unsigned 64-bit integer value in decimal nota | ||||
tion, | ||||
/// right justified in a field having at least the specified | ||||
width. | ||||
static void append0(std::string& str, UInt64 value, int width); | ||||
/// Formats an unsigned 64-bit integer value in decimal nota | ||||
tion, | ||||
/// right justified and zero-padded in a field having at lea | ||||
st the | ||||
/// specified width. | ||||
static void appendHex(std::string& str, UInt64 value); | ||||
/// Formats a 64-bit integer value in hexadecimal notation. | ||||
static void appendHex(std::string& str, UInt64 value, int width); | ||||
/// Formats a 64-bit integer value in hexadecimal notation, | ||||
/// right justified and zero-padded in a field having at lea | ||||
st | ||||
/// the specified width. | ||||
#endif // defined(POCO_HAVE_INT64) && !defined(POCO_LONG_IS_64_BIT) | ||||
static void append(std::string& str, float value); | ||||
/// Formats a float value in decimal floating-point notation | ||||
, | ||||
/// according to std::printf's %g format with a precision of | ||||
8 fractional digits. | ||||
static void append(std::string& str, double value); | ||||
/// Formats a double value in decimal floating-point notatio | ||||
n, | ||||
/// according to std::printf's %g format with a precision of | ||||
16 fractional digits. | ||||
static void append(std::string& str, double value, int precision); | ||||
/// Formats a double value in decimal floating-point notatio | ||||
n, | ||||
/// according to std::printf's %f format with the given prec | ||||
ision. | ||||
static void append(std::string& str, double value, int width, int pr | ||||
ecision); | ||||
/// Formats a double value in decimal floating-point notatio | ||||
n, | ||||
/// right justified in a field of the specified width, | ||||
/// with the number of fractional digits given in precision. | ||||
static void append(std::string& str, const void* ptr); | ||||
/// Formats a pointer in an eight (32-bit architectures) or | ||||
/// sixteen (64-bit architectures) characters wide | ||||
/// field in hexadecimal notation. | ||||
}; | }; | |||
// | ||||
// inlines | ||||
// | ||||
inline std::string NumberFormatter::format(int value) | ||||
{ | ||||
std::string result; | ||||
append(result, value); | ||||
return result; | ||||
} | ||||
inline std::string NumberFormatter::format(int value, int width) | ||||
{ | ||||
std::string result; | ||||
append(result, value, width); | ||||
return result; | ||||
} | ||||
inline std::string NumberFormatter::format0(int value, int width) | ||||
{ | ||||
std::string result; | ||||
append0(result, value, width); | ||||
return result; | ||||
} | ||||
inline std::string NumberFormatter::formatHex(int value) | ||||
{ | ||||
std::string result; | ||||
appendHex(result, value); | ||||
return result; | ||||
} | ||||
inline std::string NumberFormatter::formatHex(int value, int width) | ||||
{ | ||||
std::string result; | ||||
appendHex(result, value, width); | ||||
return result; | ||||
} | ||||
inline std::string NumberFormatter::format(unsigned value) | ||||
{ | ||||
std::string result; | ||||
append(result, value); | ||||
return result; | ||||
} | ||||
inline std::string NumberFormatter::format(unsigned value, int width) | ||||
{ | ||||
std::string result; | ||||
append(result, value, width); | ||||
return result; | ||||
} | ||||
inline std::string NumberFormatter::format0(unsigned int value, int width) | ||||
{ | ||||
std::string result; | ||||
append0(result, value, width); | ||||
return result; | ||||
} | ||||
inline std::string NumberFormatter::formatHex(unsigned value) | ||||
{ | ||||
std::string result; | ||||
appendHex(result, value); | ||||
return result; | ||||
} | ||||
inline std::string NumberFormatter::formatHex(unsigned value, int width) | ||||
{ | ||||
std::string result; | ||||
appendHex(result, value, width); | ||||
return result; | ||||
} | ||||
inline std::string NumberFormatter::format(long value) | ||||
{ | ||||
std::string result; | ||||
append(result, value); | ||||
return result; | ||||
} | ||||
inline std::string NumberFormatter::format(long value, int width) | ||||
{ | ||||
std::string result; | ||||
append(result, value, width); | ||||
return result; | ||||
} | ||||
inline std::string NumberFormatter::format0(long value, int width) | ||||
{ | ||||
std::string result; | ||||
append0(result, value, width); | ||||
return result; | ||||
} | ||||
inline std::string NumberFormatter::formatHex(long value) | ||||
{ | ||||
std::string result; | ||||
appendHex(result, value); | ||||
return result; | ||||
} | ||||
inline std::string NumberFormatter::formatHex(long value, int width) | ||||
{ | ||||
std::string result; | ||||
appendHex(result, value, width); | ||||
return result; | ||||
} | ||||
inline std::string NumberFormatter::format(unsigned long value) | ||||
{ | ||||
std::string result; | ||||
append(result, value); | ||||
return result; | ||||
} | ||||
inline std::string NumberFormatter::format(unsigned long value, int width) | ||||
{ | ||||
std::string result; | ||||
append(result, value, width); | ||||
return result; | ||||
} | ||||
inline std::string NumberFormatter::format0(unsigned long value, int width) | ||||
{ | ||||
std::string result; | ||||
append0(result, value, width); | ||||
return result; | ||||
} | ||||
inline std::string NumberFormatter::formatHex(unsigned long value) | ||||
{ | ||||
std::string result; | ||||
appendHex(result, value); | ||||
return result; | ||||
} | ||||
inline std::string NumberFormatter::formatHex(unsigned long value, int widt | ||||
h) | ||||
{ | ||||
std::string result; | ||||
appendHex(result, value, width); | ||||
return result; | ||||
} | ||||
#if defined(POCO_HAVE_INT64) && !defined(POCO_LONG_IS_64_BIT) | ||||
inline std::string NumberFormatter::format(Int64 value) | ||||
{ | ||||
std::string result; | ||||
append(result, value); | ||||
return result; | ||||
} | ||||
inline std::string NumberFormatter::format(Int64 value, int width) | ||||
{ | ||||
std::string result; | ||||
append(result, value, width); | ||||
return result; | ||||
} | ||||
inline std::string NumberFormatter::format0(Int64 value, int width) | ||||
{ | ||||
std::string result; | ||||
append0(result, value, width); | ||||
return result; | ||||
} | ||||
inline std::string NumberFormatter::formatHex(Int64 value) | ||||
{ | ||||
std::string result; | ||||
appendHex(result, value); | ||||
return result; | ||||
} | ||||
inline std::string NumberFormatter::formatHex(Int64 value, int width) | ||||
{ | ||||
std::string result; | ||||
appendHex(result, value, width); | ||||
return result; | ||||
} | ||||
inline std::string NumberFormatter::format(UInt64 value) | ||||
{ | ||||
std::string result; | ||||
append(result, value); | ||||
return result; | ||||
} | ||||
inline std::string NumberFormatter::format(UInt64 value, int width) | ||||
{ | ||||
std::string result; | ||||
append(result, value, width); | ||||
return result; | ||||
} | ||||
inline std::string NumberFormatter::format0(UInt64 value, int width) | ||||
{ | ||||
std::string result; | ||||
append0(result, value, width); | ||||
return result; | ||||
} | ||||
inline std::string NumberFormatter::formatHex(UInt64 value) | ||||
{ | ||||
std::string result; | ||||
appendHex(result, value); | ||||
return result; | ||||
} | ||||
inline std::string NumberFormatter::formatHex(UInt64 value, int width) | ||||
{ | ||||
std::string result; | ||||
appendHex(result, value, width); | ||||
return result; | ||||
} | ||||
#endif // defined(POCO_HAVE_INT64) && !defined(POCO_LONG_IS_64_BIT) | ||||
inline std::string NumberFormatter::format(float value) | ||||
{ | ||||
std::string result; | ||||
append(result, value); | ||||
return result; | ||||
} | ||||
inline std::string NumberFormatter::format(double value) | ||||
{ | ||||
std::string result; | ||||
append(result, value); | ||||
return result; | ||||
} | ||||
inline std::string NumberFormatter::format(double value, int precision) | ||||
{ | ||||
std::string result; | ||||
append(result, value, precision); | ||||
return result; | ||||
} | ||||
inline std::string NumberFormatter::format(double value, int width, int pre | ||||
cision) | ||||
{ | ||||
std::string result; | ||||
append(result, value, width, precision); | ||||
return result; | ||||
} | ||||
inline std::string NumberFormatter::format(const void* ptr) | ||||
{ | ||||
std::string result; | ||||
append(result, ptr); | ||||
return result; | ||||
} | ||||
} // namespace Poco | } // namespace Poco | |||
#endif // Foundation_NumberFormatter_INCLUDED | #endif // Foundation_NumberFormatter_INCLUDED | |||
End of changes. 5 change blocks. | ||||
2 lines changed or deleted | 444 lines changed or added | |||
POP3ClientSession.h | POP3ClientSession.h | |||
---|---|---|---|---|
// | // | |||
// POP3ClientSession.h | // POP3ClientSession.h | |||
// | // | |||
// $Id: //poco/1.3/Net/include/Poco/Net/POP3ClientSession.h#1 $ | // $Id: //poco/1.3/Net/include/Poco/Net/POP3ClientSession.h#2 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: Mail | // Package: Mail | |||
// Module: POP3ClientSession | // Module: POP3ClientSession | |||
// | // | |||
// Definition of the POP3ClientSession class. | // Definition of the POP3ClientSession class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 74 | skipping to change at line 74 | |||
struct MessageInfo | struct MessageInfo | |||
/// Information returned by listMessages(). | /// Information returned by listMessages(). | |||
{ | { | |||
int id; | int id; | |||
int size; | int size; | |||
}; | }; | |||
typedef std::vector<MessageInfo> MessageInfoVec; | typedef std::vector<MessageInfo> MessageInfoVec; | |||
POP3ClientSession(const StreamSocket& socket); | explicit POP3ClientSession(const StreamSocket& socket); | |||
/// Creates the POP3ClientSession using | /// Creates the POP3ClientSession using | |||
/// the given socket, which must be connected | /// the given socket, which must be connected | |||
/// to a POP3 server. | /// to a POP3 server. | |||
POP3ClientSession(const std::string& host, Poco::UInt16 port = POP3_ PORT); | POP3ClientSession(const std::string& host, Poco::UInt16 port = POP3_ PORT); | |||
/// Creates the POP3ClientSession using a socket connected | /// Creates the POP3ClientSession using a socket connected | |||
/// to the given host and port. | /// to the given host and port. | |||
virtual ~POP3ClientSession(); | virtual ~POP3ClientSession(); | |||
/// Destroys the SMTPClientSession. | /// Destroys the SMTPClientSession. | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
PatternFormatter.h | PatternFormatter.h | |||
---|---|---|---|---|
// | // | |||
// PatternFormatter.h | // PatternFormatter.h | |||
// | // | |||
// $Id: //poco/1.3/Foundation/include/Poco/PatternFormatter.h#2 $ | // $Id: //poco/1.3/Foundation/include/Poco/PatternFormatter.h#3 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Logging | // Package: Logging | |||
// Module: PatternFormatter | // Module: PatternFormatter | |||
// | // | |||
// Definition of the PatternFormatter class. | // Definition of the PatternFormatter class. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 84 | skipping to change at line 84 | |||
/// * %y - message date/time year without century (70) | /// * %y - message date/time year without century (70) | |||
/// * %Y - message date/time year with century (1970) | /// * %Y - message date/time year with century (1970) | |||
/// * %H - message date/time hour (00 .. 23) | /// * %H - message date/time hour (00 .. 23) | |||
/// * %h - message date/time hour (00 .. 12) | /// * %h - message date/time hour (00 .. 12) | |||
/// * %a - message date/time am/pm | /// * %a - message date/time am/pm | |||
/// * %A - message date/time AM/PM | /// * %A - message date/time AM/PM | |||
/// * %M - message date/time minute (00 .. 59) | /// * %M - message date/time minute (00 .. 59) | |||
/// * %S - message date/time second (00 .. 59) | /// * %S - message date/time second (00 .. 59) | |||
/// * %i - message date/time millisecond (000 .. 999) | /// * %i - message date/time millisecond (000 .. 999) | |||
/// * %c - message date/time centisecond (0 .. 9) | /// * %c - message date/time centisecond (0 .. 9) | |||
/// * %F - message date/time fractional seconds/microseconds (0000 00 - 999999) | ||||
/// * %z - time zone differential in ISO 8601 format (Z or +NN.NN) . | /// * %z - time zone differential in ISO 8601 format (Z or +NN.NN) . | |||
/// * %Z - time zone differential in RFC format (GMT or +NNNN) | /// * %Z - time zone differential in RFC format (GMT or +NNNN) | |||
/// * %[name] - the value of the message parameter with the given name | /// * %[name] - the value of the message parameter with the given name | |||
/// * %% - percent sign | /// * %% - percent sign | |||
{ | { | |||
public: | public: | |||
PatternFormatter(); | PatternFormatter(); | |||
/// Creates a PatternFormatter. | /// Creates a PatternFormatter. | |||
/// The format pattern must be specified with | /// The format pattern must be specified with | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 2 lines changed or added | |||
RefCountedObject.h | RefCountedObject.h | |||
---|---|---|---|---|
// | // | |||
// RefCountedObject.h | // RefCountedObject.h | |||
// | // | |||
// $Id: //poco/1.3/Foundation/include/Poco/RefCountedObject.h#1 $ | // $Id: //poco/1.3/Foundation/include/Poco/RefCountedObject.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: RefCountedObject | // Module: RefCountedObject | |||
// | // | |||
// Definition of the RefCountedObject class. | // Definition of the RefCountedObject class. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2009, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
// Permission is hereby granted, free of charge, to any person or organizat ion | // Permission is hereby granted, free of charge, to any person or organizat ion | |||
// obtaining a copy of the software and accompanying documentation covered by | // obtaining a copy of the software and accompanying documentation covered by | |||
// this license (the "Software") to use, reproduce, display, distribute, | // this license (the "Software") to use, reproduce, display, distribute, | |||
// execute, and transmit the Software, and to prepare derivative works of t he | // execute, and transmit the Software, and to prepare derivative works of t he | |||
// Software, and to permit third-parties to whom the Software is furnished to | // Software, and to permit third-parties to whom the Software is furnished to | |||
// do so, all subject to the following: | // do so, all subject to the following: | |||
// | // | |||
// The copyright notices in the Software and this entire statement, includi ng | // The copyright notices in the Software and this entire statement, includi ng | |||
skipping to change at line 42 | skipping to change at line 42 | |||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | |||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Foundation_RefCountedObject_INCLUDED | #ifndef Foundation_RefCountedObject_INCLUDED | |||
#define Foundation_RefCountedObject_INCLUDED | #define Foundation_RefCountedObject_INCLUDED | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
#include "Poco/Mutex.h" | #include "Poco/AtomicCounter.h" | |||
namespace Poco { | namespace Poco { | |||
class Foundation_API RefCountedObject | class Foundation_API RefCountedObject | |||
/// A base class for objects that employ | /// A base class for objects that employ | |||
/// reference counting based garbage collection. | /// reference counting based garbage collection. | |||
/// | /// | |||
/// Reference-counted objects inhibit construction | /// Reference-counted objects inhibit construction | |||
/// by copying and assignment. | /// by copying and assignment. | |||
{ | { | |||
skipping to change at line 77 | skipping to change at line 77 | |||
/// Returns the reference count. | /// Returns the reference count. | |||
protected: | protected: | |||
virtual ~RefCountedObject(); | virtual ~RefCountedObject(); | |||
/// Destroys the RefCountedObject. | /// Destroys the RefCountedObject. | |||
private: | private: | |||
RefCountedObject(const RefCountedObject&); | RefCountedObject(const RefCountedObject&); | |||
RefCountedObject& operator = (const RefCountedObject&); | RefCountedObject& operator = (const RefCountedObject&); | |||
mutable int _rc; | mutable AtomicCounter _counter; | |||
mutable FastMutex _rcMutex; | ||||
}; | }; | |||
// | // | |||
// inlines | // inlines | |||
// | // | |||
inline int RefCountedObject::referenceCount() const | inline int RefCountedObject::referenceCount() const | |||
{ | { | |||
return _rc; | return _counter.value(); | |||
} | ||||
inline void RefCountedObject::duplicate() const | ||||
{ | ||||
++_counter; | ||||
} | ||||
inline void RefCountedObject::release() const | ||||
{ | ||||
if (--_counter == 0) delete this; | ||||
} | } | |||
} // namespace Poco | } // namespace Poco | |||
#endif // Foundation_RefCountedObject_INCLUDED | #endif // Foundation_RefCountedObject_INCLUDED | |||
End of changes. 5 change blocks. | ||||
6 lines changed or deleted | 15 lines changed or added | |||
SMTPClientSession.h | SMTPClientSession.h | |||
---|---|---|---|---|
// | // | |||
// SMTPClientSession.h | // SMTPClientSession.h | |||
// | // | |||
// $Id: //poco/1.3/Net/include/Poco/Net/SMTPClientSession.h#3 $ | // $Id: //poco/1.3/Net/include/Poco/Net/SMTPClientSession.h#4 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: Mail | // Package: Mail | |||
// Module: SMTPClientSession | // Module: SMTPClientSession | |||
// | // | |||
// Definition of the SMTPClientSession class. | // Definition of the SMTPClientSession class. | |||
// | // | |||
// Copyright (c) 2005-2008, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2008, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 68 | skipping to change at line 68 | |||
SMTP_PORT = 25 | SMTP_PORT = 25 | |||
}; | }; | |||
enum LoginMethod | enum LoginMethod | |||
{ | { | |||
AUTH_NONE, | AUTH_NONE, | |||
AUTH_CRAM_MD5, | AUTH_CRAM_MD5, | |||
AUTH_LOGIN, | AUTH_LOGIN, | |||
}; | }; | |||
SMTPClientSession(const StreamSocket& socket); | explicit SMTPClientSession(const StreamSocket& socket); | |||
/// Creates the SMTPClientSession using | /// Creates the SMTPClientSession using | |||
/// the given socket, which must be connected | /// the given socket, which must be connected | |||
/// to a SMTP server. | /// to a SMTP server. | |||
SMTPClientSession(const std::string& host, Poco::UInt16 port = SMTP_ PORT); | SMTPClientSession(const std::string& host, Poco::UInt16 port = SMTP_ PORT); | |||
/// Creates the SMTPClientSession using a socket connected | /// Creates the SMTPClientSession using a socket connected | |||
/// to the given host and port. | /// to the given host and port. | |||
virtual ~SMTPClientSession(); | virtual ~SMTPClientSession(); | |||
/// Destroys the SMTPClientSession. | /// Destroys the SMTPClientSession. | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
ServerApplication.h | ServerApplication.h | |||
---|---|---|---|---|
// | // | |||
// ServerApplication.h | // ServerApplication.h | |||
// | // | |||
// $Id: //poco/1.3/Util/include/Poco/Util/ServerApplication.h#3 $ | // $Id: //poco/1.3/Util/include/Poco/Util/ServerApplication.h#4 $ | |||
// | // | |||
// Library: Util | // Library: Util | |||
// Package: Application | // Package: Application | |||
// Module: ServerApplication | // Module: ServerApplication | |||
// | // | |||
// Definition of the ServerApplication class. | // Definition of the ServerApplication class. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 99 | skipping to change at line 99 | |||
/// An application can determine whether it is running as a service by checking | /// An application can determine whether it is running as a service by checking | |||
/// for the "application.runAsService" configuration property. | /// for the "application.runAsService" configuration property. | |||
/// | /// | |||
/// if (config().getBool("application.runAsService", false)) | /// if (config().getBool("application.runAsService", false)) | |||
/// { | /// { | |||
/// // do service specific things | /// // do service specific things | |||
/// } | /// } | |||
/// | /// | |||
/// Note that the working directory for an application running as a service | /// Note that the working directory for an application running as a service | |||
/// is the Windows system directory (e.g., C:\Windows\system32). Tak e this | /// is the Windows system directory (e.g., C:\Windows\system32). Tak e this | |||
/// into account when working with relative filesystem paths. | /// into account when working with relative filesystem paths. Also, | |||
services | ||||
/// run under a different user account, so an application that works | ||||
when | ||||
/// started from the command line may fail to run as a service if it | ||||
depends | ||||
/// on a certain environment (e.g., the PATH environment variable). | ||||
/// | /// | |||
/// An application registered as a Windows service can be started | /// An application registered as a Windows service can be started | |||
/// with the NET START <name> command and stopped with the NET STOP <name> | /// with the NET START <name> command and stopped with the NET STOP <name> | |||
/// command. Alternatively, the Services MMC applet can be used. | /// command. Alternatively, the Services MMC applet can be used. | |||
/// | /// | |||
/// On Unix platforms, an application built on top of the ServerAppl ication | /// On Unix platforms, an application built on top of the ServerAppl ication | |||
/// class can be optionally run as a daemon. A daemon, when launched | /// class can be optionally run as a daemon by giving the --daemon | |||
, immediately | /// command line option. A daemon, when launched, immediately | |||
/// forks off a background process that does the actual work. After launching | /// forks off a background process that does the actual work. After launching | |||
/// the background process, the foreground process exits. | /// the background process, the foreground process exits. | |||
/// | /// | |||
/// After the initialization is complete, but before entering the ma in() method, | /// After the initialization is complete, but before entering the ma in() method, | |||
/// the current working directory for the daemon process is changed to the root | /// the current working directory for the daemon process is changed to the root | |||
/// directory ("/"), as it is common practice for daemon processes. Therefore, be | /// directory ("/"), as it is common practice for daemon processes. Therefore, be | |||
/// careful when working with files, as relative paths may not point to where | /// careful when working with files, as relative paths may not point to where | |||
/// you expect them point to. | /// you expect them point to. | |||
/// | /// | |||
/// An application can determine whether it is running as a daemon b y checking | /// An application can determine whether it is running as a daemon b y checking | |||
/// for the "application.runAsDaemon" configuration property. | /// for the "application.runAsDaemon" configuration property. | |||
/// | /// | |||
/// if (config().getBool("application.runAsDaemon", false)) | /// if (config().getBool("application.runAsDaemon", false)) | |||
/// { | /// { | |||
/// // do daemon specific things | /// // do daemon specific things | |||
/// } | /// } | |||
/// | ||||
/// When running as a daemon, specifying the --pidfile option (e.g., | ||||
/// --pidfile=/var/run/sample.pid) may be useful to record the proce | ||||
ss ID of | ||||
/// the daemon in a file. The PID file will be removed when the daem | ||||
on process | ||||
/// terminates (but not, if it crashes). | ||||
{ | { | |||
public: | public: | |||
ServerApplication(); | ServerApplication(); | |||
/// Creates the ServerApplication. | /// Creates the ServerApplication. | |||
~ServerApplication(); | ~ServerApplication(); | |||
/// Destroys the ServerApplication. | /// Destroys the ServerApplication. | |||
bool isInteractive() const; | bool isInteractive() const; | |||
/// Returns true if the application runs from the command li ne. | /// Returns true if the application runs from the command li ne. | |||
End of changes. 4 change blocks. | ||||
4 lines changed or deleted | 17 lines changed or added | |||
SharedPtr.h | SharedPtr.h | |||
---|---|---|---|---|
// | // | |||
// SharedPtr.h | // SharedPtr.h | |||
// | // | |||
// $Id: //poco/1.3/Foundation/include/Poco/SharedPtr.h#6 $ | // $Id: //poco/1.3/Foundation/include/Poco/SharedPtr.h#7 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: SharedPtr | // Module: SharedPtr | |||
// | // | |||
// Definition of the SharedPtr template class. | // Definition of the SharedPtr template class. | |||
// | // | |||
// Copyright (c) 2005-2008, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2008, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 43 | skipping to change at line 43 | |||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Foundation_SharedPtr_INCLUDED | #ifndef Foundation_SharedPtr_INCLUDED | |||
#define Foundation_SharedPtr_INCLUDED | #define Foundation_SharedPtr_INCLUDED | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
#include "Poco/Exception.h" | #include "Poco/Exception.h" | |||
#include "Poco/Mutex.h" | #include "Poco/AtomicCounter.h" | |||
#include <algorithm> | #include <algorithm> | |||
namespace Poco { | namespace Poco { | |||
class ReferenceCounter | class ReferenceCounter | |||
/// Simple ReferenceCounter object, does not delete itself when coun t reaches 0. | /// Simple ReferenceCounter object, does not delete itself when coun t reaches 0. | |||
{ | { | |||
public: | public: | |||
ReferenceCounter(): _cnt(1) | ReferenceCounter(): _cnt(1) | |||
{ | { | |||
} | } | |||
void duplicate() | void duplicate() | |||
{ | { | |||
FastMutex::ScopedLock lock(_mutex); | ||||
++_cnt; | ++_cnt; | |||
} | } | |||
int release() | int release() | |||
{ | { | |||
FastMutex::ScopedLock lock(_mutex); | ||||
return --_cnt; | return --_cnt; | |||
} | } | |||
int referenceCount() const | int referenceCount() const | |||
{ | { | |||
return _cnt; | return _cnt.value(); | |||
} | } | |||
private: | private: | |||
FastMutex _mutex; | AtomicCounter _cnt; | |||
int _cnt; | ||||
}; | }; | |||
template <class C> | template <class C> | |||
class ReleasePolicy | class ReleasePolicy | |||
/// The default release policy for SharedPtr, which | /// The default release policy for SharedPtr, which | |||
/// simply uses the delete operator to delete an object. | /// simply uses the delete operator to delete an object. | |||
{ | { | |||
public: | public: | |||
static void release(C* pObj) | static void release(C* pObj) | |||
/// Delete the object. | /// Delete the object. | |||
End of changes. 6 change blocks. | ||||
7 lines changed or deleted | 4 lines changed or added | |||
SocketAcceptor.h | SocketAcceptor.h | |||
---|---|---|---|---|
// | // | |||
// SocketAcceptor.h | // SocketAcceptor.h | |||
// | // | |||
// $Id: //poco/1.3/Net/include/Poco/Net/SocketAcceptor.h#1 $ | // $Id: //poco/1.3/Net/include/Poco/Net/SocketAcceptor.h#2 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: Reactor | // Package: Reactor | |||
// Module: SocketAcceptor | // Module: SocketAcceptor | |||
// | // | |||
// Definition of the SocketAcceptor class. | // Definition of the SocketAcceptor class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 88 | skipping to change at line 88 | |||
/// takes a StreamSocket and a SocketReactor as arguments, | /// takes a StreamSocket and a SocketReactor as arguments, | |||
/// e.g.: | /// e.g.: | |||
/// MyServiceHandler(const StreamSocket& socket, ServiceReactor& reactor) | /// MyServiceHandler(const StreamSocket& socket, ServiceReactor& reactor) | |||
/// | /// | |||
/// When the ServiceHandler is done, it must destroy itself. | /// When the ServiceHandler is done, it must destroy itself. | |||
/// | /// | |||
/// Subclasses can override the createServiceHandler() factory metho d | /// Subclasses can override the createServiceHandler() factory metho d | |||
/// if special steps are necessary to create a ServiceHandler object . | /// if special steps are necessary to create a ServiceHandler object . | |||
{ | { | |||
public: | public: | |||
SocketAcceptor(ServerSocket& socket): | explicit SocketAcceptor(ServerSocket& socket): | |||
_socket(socket), | _socket(socket), | |||
_pReactor(0) | _pReactor(0) | |||
/// Creates an SocketAcceptor, using the given ServerSocket. | /// Creates an SocketAcceptor, using the given ServerSocket. | |||
{ | { | |||
} | } | |||
SocketAcceptor(ServerSocket& socket, SocketReactor& reactor): | SocketAcceptor(ServerSocket& socket, SocketReactor& reactor): | |||
_socket(socket), | _socket(socket), | |||
_pReactor(0) | _pReactor(0) | |||
/// Creates an SocketAcceptor, using the given ServerSocket. | /// Creates an SocketAcceptor, using the given ServerSocket. | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
SocketAddress.h | SocketAddress.h | |||
---|---|---|---|---|
// | // | |||
// SocketAddress.h | // SocketAddress.h | |||
// | // | |||
// $Id: //poco/1.3/Net/include/Poco/Net/SocketAddress.h#1 $ | // $Id: //poco/1.3/Net/include/Poco/Net/SocketAddress.h#2 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: NetCore | // Package: NetCore | |||
// Module: SocketAddress | // Module: SocketAddress | |||
// | // | |||
// Definition of the SocketAddress class. | // Definition of the SocketAddress class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 124 | skipping to change at line 124 | |||
const struct sockaddr* addr() const; | const struct sockaddr* addr() const; | |||
/// Returns a pointer to the internal native socket address. | /// Returns a pointer to the internal native socket address. | |||
int af() const; | int af() const; | |||
/// Returns the address family (AF_INET or AF_INET6) of the address. | /// Returns the address family (AF_INET or AF_INET6) of the address. | |||
std::string toString() const; | std::string toString() const; | |||
/// Returns a string representation of the address. | /// Returns a string representation of the address. | |||
IPAddress::Family family() const; | ||||
/// Returns the address family of the host's address. | ||||
enum | enum | |||
{ | { | |||
MAX_ADDRESS_LENGTH = | MAX_ADDRESS_LENGTH = | |||
#if defined(POCO_HAVE_IPv6) | #if defined(POCO_HAVE_IPv6) | |||
sizeof(struct sockaddr_in6) | sizeof(struct sockaddr_in6) | |||
#else | #else | |||
sizeof(struct sockaddr_in) | sizeof(struct sockaddr_in) | |||
#endif | #endif | |||
/// Maximum length in bytes of a socket address. | /// Maximum length in bytes of a socket address. | |||
}; | }; | |||
skipping to change at line 152 | skipping to change at line 155 | |||
}; | }; | |||
// | // | |||
// inlines | // inlines | |||
// | // | |||
inline void swap(SocketAddress& a1, SocketAddress& a2) | inline void swap(SocketAddress& a1, SocketAddress& a2) | |||
{ | { | |||
a1.swap(a2); | a1.swap(a2); | |||
} | } | |||
inline IPAddress::Family SocketAddress::family() const | ||||
{ | ||||
return host().family(); | ||||
} | ||||
} } // namespace Poco::Net | } } // namespace Poco::Net | |||
#endif // Net_SocketAddress_INCLUDED | #endif // Net_SocketAddress_INCLUDED | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 9 lines changed or added | |||
SocketConnector.h | SocketConnector.h | |||
---|---|---|---|---|
// | // | |||
// SocketConnector.h | // SocketConnector.h | |||
// | // | |||
// $Id: //poco/1.3/Net/include/Poco/Net/SocketConnector.h#1 $ | // $Id: //poco/1.3/Net/include/Poco/Net/SocketConnector.h#2 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: Reactor | // Package: Reactor | |||
// Module: SocketConnector | // Module: SocketConnector | |||
// | // | |||
// Definition of the SocketConnector class. | // Definition of the SocketConnector class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 92 | skipping to change at line 92 | |||
/// takes a StreamSocket and a SocketReactor as arguments, | /// takes a StreamSocket and a SocketReactor as arguments, | |||
/// e.g.: | /// e.g.: | |||
/// MyServiceHandler(const StreamSocket& socket, ServiceReactor& reactor) | /// MyServiceHandler(const StreamSocket& socket, ServiceReactor& reactor) | |||
/// | /// | |||
/// When the ServiceHandler is done, it must destroy itself. | /// When the ServiceHandler is done, it must destroy itself. | |||
/// | /// | |||
/// Subclasses can override the createServiceHandler() factory metho d | /// Subclasses can override the createServiceHandler() factory metho d | |||
/// if special steps are necessary to create a ServiceHandler object . | /// if special steps are necessary to create a ServiceHandler object . | |||
{ | { | |||
public: | public: | |||
SocketConnector(SocketAddress& address): | explicit SocketConnector(SocketAddress& address): | |||
_pReactor(0) | _pReactor(0) | |||
/// Creates a SocketConnector, using the given Socket. | /// Creates a SocketConnector, using the given Socket. | |||
{ | { | |||
_socket.connectNB(address); | _socket.connectNB(address); | |||
} | } | |||
SocketConnector(SocketAddress& address, SocketReactor& reactor): | SocketConnector(SocketAddress& address, SocketReactor& reactor): | |||
_pReactor(0) | _pReactor(0) | |||
/// Creates an acceptor, using the given ServerSocket. | /// Creates an acceptor, using the given ServerSocket. | |||
/// The SocketConnector registers itself with the given Sock etReactor. | /// The SocketConnector registers itself with the given Sock etReactor. | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
SocketImpl.h | SocketImpl.h | |||
---|---|---|---|---|
// | // | |||
// SocketImpl.h | // SocketImpl.h | |||
// | // | |||
// $Id: //poco/1.3/Net/include/Poco/Net/SocketImpl.h#4 $ | // $Id: //poco/1.3/Net/include/Poco/Net/SocketImpl.h#6 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: Sockets | // Package: Sockets | |||
// Module: SocketImpl | // Module: SocketImpl | |||
// | // | |||
// Definition of the SocketImpl class. | // Definition of the SocketImpl class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 334 | skipping to change at line 334 | |||
/// disables blocking mode if flag is false. | /// disables blocking mode if flag is false. | |||
virtual bool getBlocking() const; | virtual bool getBlocking() const; | |||
/// Returns the blocking mode of the socket. | /// Returns the blocking mode of the socket. | |||
/// This method will only work if the blocking modes of | /// This method will only work if the blocking modes of | |||
/// the socket are changed via the setBlocking method! | /// the socket are changed via the setBlocking method! | |||
int socketError(); | int socketError(); | |||
/// Returns the value of the SO_ERROR socket option. | /// Returns the value of the SO_ERROR socket option. | |||
poco_socket_t sockfd(); | poco_socket_t sockfd() const; | |||
/// Returns the socket descriptor for the | /// Returns the socket descriptor for the | |||
/// underlying native socket. | /// underlying native socket. | |||
void ioctl(int request, int& arg); | void ioctl(int request, int& arg); | |||
/// A wrapper for the ioctl system call. | /// A wrapper for the ioctl system call. | |||
void ioctl(int request, void* arg); | void ioctl(int request, void* arg); | |||
/// A wrapper for the ioctl system call. | /// A wrapper for the ioctl system call. | |||
bool initialized() const; | bool initialized() const; | |||
skipping to change at line 382 | skipping to change at line 382 | |||
/// used by the socket, which should be either AF_INET or | /// used by the socket, which should be either AF_INET or | |||
/// AF_INET6. | /// AF_INET6. | |||
/// | /// | |||
/// The second argument, type, specifies the type of the | /// The second argument, type, specifies the type of the | |||
/// socket, which can be one of SOCK_STREAM, SOCK_DGRAM | /// socket, which can be one of SOCK_STREAM, SOCK_DGRAM | |||
/// or SOCK_RAW. | /// or SOCK_RAW. | |||
/// | /// | |||
/// The third argument, proto, is normally set to 0, | /// The third argument, proto, is normally set to 0, | |||
/// except for raw sockets. | /// except for raw sockets. | |||
void setSockfd(poco_socket_t aSocket); | void reset(poco_socket_t fd = POCO_INVALID_SOCKET); | |||
/// Allows subclasses to set the socket manually, iff no val id socket is set yet! | /// Allows subclasses to set the socket manually, iff no val id socket is set yet! | |||
void invalidate(); | ||||
/// Sets a socket to POCO_INVALID_SOCKET. It is assumed that the soc | ||||
ket was closed | ||||
/// via a prior operation. | ||||
static int lastError(); | static int lastError(); | |||
/// Returns the last error code. | /// Returns the last error code. | |||
static void error(); | static void error(); | |||
/// Throws an appropriate exception for the last error. | /// Throws an appropriate exception for the last error. | |||
static void error(const std::string& arg); | static void error(const std::string& arg); | |||
/// Throws an appropriate exception for the last error. | /// Throws an appropriate exception for the last error. | |||
static void error(int code); | static void error(int code); | |||
skipping to change at line 422 | skipping to change at line 418 | |||
#endif | #endif | |||
bool _blocking; | bool _blocking; | |||
friend class Socket; | friend class Socket; | |||
friend class SecureSocketImpl; | friend class SecureSocketImpl; | |||
}; | }; | |||
// | // | |||
// inlines | // inlines | |||
// | // | |||
inline poco_socket_t SocketImpl::sockfd() | inline poco_socket_t SocketImpl::sockfd() const | |||
{ | { | |||
return _sockfd; | return _sockfd; | |||
} | } | |||
inline bool SocketImpl::initialized() const | inline bool SocketImpl::initialized() const | |||
{ | { | |||
return _sockfd != POCO_INVALID_SOCKET; | return _sockfd != POCO_INVALID_SOCKET; | |||
} | } | |||
inline int SocketImpl::lastError() | inline int SocketImpl::lastError() | |||
{ | { | |||
#if defined(_WIN32) | #if defined(_WIN32) | |||
return WSAGetLastError(); | return WSAGetLastError(); | |||
#else | #else | |||
return errno; | return errno; | |||
#endif | #endif | |||
} | } | |||
inline void SocketImpl::invalidate() | ||||
{ | ||||
_sockfd = POCO_INVALID_SOCKET; | ||||
} | ||||
inline bool SocketImpl::getBlocking() const | inline bool SocketImpl::getBlocking() const | |||
{ | { | |||
return _blocking; | return _blocking; | |||
} | } | |||
} } // namespace Poco::Net | } } // namespace Poco::Net | |||
#endif // Net_SocketImpl_INCLUDED | #endif // Net_SocketImpl_INCLUDED | |||
End of changes. 6 change blocks. | ||||
14 lines changed or deleted | 4 lines changed or added | |||
SocketNotification.h | SocketNotification.h | |||
---|---|---|---|---|
// | // | |||
// SocketNotification.h | // SocketNotification.h | |||
// | // | |||
// $Id: //poco/1.3/Net/include/Poco/Net/SocketNotification.h#2 $ | // $Id: //poco/1.3/Net/include/Poco/Net/SocketNotification.h#3 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: Reactor | // Package: Reactor | |||
// Module: SocketNotification | // Module: SocketNotification | |||
// | // | |||
// Definition of the SocketNotification class. | // Definition of the SocketNotification class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 55 | skipping to change at line 55 | |||
namespace Poco { | namespace Poco { | |||
namespace Net { | namespace Net { | |||
class SocketReactor; | class SocketReactor; | |||
class Net_API SocketNotification: public Poco::Notification | class Net_API SocketNotification: public Poco::Notification | |||
/// The base class for all notifications generated by | /// The base class for all notifications generated by | |||
/// the SocketReactor. | /// the SocketReactor. | |||
{ | { | |||
public: | public: | |||
SocketNotification(SocketReactor* pReactor); | explicit SocketNotification(SocketReactor* pReactor); | |||
/// Creates the SocketNotification for the given SocketReact or. | /// Creates the SocketNotification for the given SocketReact or. | |||
virtual ~SocketNotification(); | virtual ~SocketNotification(); | |||
/// Destroys the SocketNotification. | /// Destroys the SocketNotification. | |||
SocketReactor& source(); | SocketReactor& source(); | |||
/// Returns the SocketReactor that generated the notificatio n. | /// Returns the SocketReactor that generated the notificatio n. | |||
Socket& socket(); | Socket& socket(); | |||
/// Returns the socket that caused the notification. | /// Returns the socket that caused the notification. | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
SocketNotifier.h | SocketNotifier.h | |||
---|---|---|---|---|
// | // | |||
// SocketNotifier.h | // SocketNotifier.h | |||
// | // | |||
// $Id: //poco/1.3/Net/include/Poco/Net/SocketNotifier.h#1 $ | // $Id: //poco/1.3/Net/include/Poco/Net/SocketNotifier.h#2 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: Reactor | // Package: Reactor | |||
// Module: SocketNotifier | // Module: SocketNotifier | |||
// | // | |||
// Definition of the SocketNotifier class. | // Definition of the SocketNotifier class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 60 | skipping to change at line 60 | |||
class Socket; | class Socket; | |||
class SocketReactor; | class SocketReactor; | |||
class SocketNotification; | class SocketNotification; | |||
class Net_API SocketNotifier: public Poco::RefCountedObject | class Net_API SocketNotifier: public Poco::RefCountedObject | |||
/// This class is used internally by SocketReactor | /// This class is used internally by SocketReactor | |||
/// to notify registered event handlers of socket events. | /// to notify registered event handlers of socket events. | |||
{ | { | |||
public: | public: | |||
SocketNotifier(const Socket& socket); | explicit SocketNotifier(const Socket& socket); | |||
/// Creates the SocketNotifier for the given socket. | /// Creates the SocketNotifier for the given socket. | |||
void addObserver(SocketReactor* pReactor, const Poco::AbstractObserv er& observer); | void addObserver(SocketReactor* pReactor, const Poco::AbstractObserv er& observer); | |||
/// Adds the given observer. | /// Adds the given observer. | |||
void removeObserver(SocketReactor* pReactor, const Poco::AbstractObs erver& observer); | void removeObserver(SocketReactor* pReactor, const Poco::AbstractObs erver& observer); | |||
/// Removes the given observer. | /// Removes the given observer. | |||
bool accepts(SocketNotification* pNotification); | bool accepts(SocketNotification* pNotification); | |||
/// Returns true if there is at least one observer for the g iven notification. | /// Returns true if there is at least one observer for the g iven notification. | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
SocketReactor.h | SocketReactor.h | |||
---|---|---|---|---|
// | // | |||
// SocketReactor.h | // SocketReactor.h | |||
// | // | |||
// $Id: //poco/1.3/Net/include/Poco/Net/SocketReactor.h#2 $ | // $Id: //poco/1.3/Net/include/Poco/Net/SocketReactor.h#3 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: Reactor | // Package: Reactor | |||
// Module: SocketReactor | // Module: SocketReactor | |||
// | // | |||
// Definition of the SocketReactor class. | // Definition of the SocketReactor class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 130 | skipping to change at line 130 | |||
/// | /// | |||
/// It is safe to call addEventHandler() and removeEventHandler() | /// It is safe to call addEventHandler() and removeEventHandler() | |||
/// from another thread while the SocketReactor is running. Also, | /// from another thread while the SocketReactor is running. Also, | |||
/// it is safe to call addEventHandler() and removeEventHandler() | /// it is safe to call addEventHandler() and removeEventHandler() | |||
/// from event handlers. | /// from event handlers. | |||
{ | { | |||
public: | public: | |||
SocketReactor(); | SocketReactor(); | |||
/// Creates the SocketReactor. | /// Creates the SocketReactor. | |||
SocketReactor(const Poco::Timespan& timeout); | explicit SocketReactor(const Poco::Timespan& timeout); | |||
/// Creates the SocketReactor, using the given timeout. | /// Creates the SocketReactor, using the given timeout. | |||
virtual ~SocketReactor(); | virtual ~SocketReactor(); | |||
/// Destroys the SocketReactor. | /// Destroys the SocketReactor. | |||
void run(); | void run(); | |||
/// Runs the SocketReactor. The reactor will run | /// Runs the SocketReactor. The reactor will run | |||
/// until stop() is called (in a separate thread). | /// until stop() is called (in a separate thread). | |||
void stop(); | void stop(); | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
SocketStream.h | SocketStream.h | |||
---|---|---|---|---|
// | // | |||
// SocketStream.h | // SocketStream.h | |||
// | // | |||
// $Id: //poco/1.3/Net/include/Poco/Net/SocketStream.h#1 $ | // $Id: //poco/1.3/Net/include/Poco/Net/SocketStream.h#2 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: Sockets | // Package: Sockets | |||
// Module: SocketStream | // Module: SocketStream | |||
// | // | |||
// Definition of the SocketStream class. | // Definition of the SocketStream class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 117 | skipping to change at line 117 | |||
/// Returns the underlying socket. | /// Returns the underlying socket. | |||
protected: | protected: | |||
SocketStreamBuf _buf; | SocketStreamBuf _buf; | |||
}; | }; | |||
class Net_API SocketOutputStream: public SocketIOS, public std::ostream | class Net_API SocketOutputStream: public SocketIOS, public std::ostream | |||
/// An output stream for writing to a socket. | /// An output stream for writing to a socket. | |||
{ | { | |||
public: | public: | |||
SocketOutputStream(const Socket& socket); | explicit SocketOutputStream(const Socket& socket); | |||
/// Creates the SocketOutputStream with the given socket. | /// Creates the SocketOutputStream with the given socket. | |||
/// | /// | |||
/// The socket's SocketImpl must be a StreamSocketImpl, | /// The socket's SocketImpl must be a StreamSocketImpl, | |||
/// otherwise an InvalidArgumentException is thrown. | /// otherwise an InvalidArgumentException is thrown. | |||
~SocketOutputStream(); | ~SocketOutputStream(); | |||
/// Destroys the SocketOutputStream. | /// Destroys the SocketOutputStream. | |||
/// | /// | |||
/// Flushes the buffer, but does not close the socket. | /// Flushes the buffer, but does not close the socket. | |||
}; | }; | |||
skipping to change at line 142 | skipping to change at line 142 | |||
/// When using formatted input from a SocketInputStream, | /// When using formatted input from a SocketInputStream, | |||
/// always ensure that a receive timeout is set for the | /// always ensure that a receive timeout is set for the | |||
/// socket. Otherwise your program might unexpectedly | /// socket. Otherwise your program might unexpectedly | |||
/// hang. | /// hang. | |||
/// | /// | |||
/// However, using formatted input from a SocketInputStream | /// However, using formatted input from a SocketInputStream | |||
/// is not recommended, due to the read-ahead behavior of | /// is not recommended, due to the read-ahead behavior of | |||
/// istream with formatted reads. | /// istream with formatted reads. | |||
{ | { | |||
public: | public: | |||
SocketInputStream(const Socket& socket); | explicit SocketInputStream(const Socket& socket); | |||
/// Creates the SocketInputStream with the given socket. | /// Creates the SocketInputStream with the given socket. | |||
/// | /// | |||
/// The socket's SocketImpl must be a StreamSocketImpl, | /// The socket's SocketImpl must be a StreamSocketImpl, | |||
/// otherwise an InvalidArgumentException is thrown. | /// otherwise an InvalidArgumentException is thrown. | |||
~SocketInputStream(); | ~SocketInputStream(); | |||
/// Destroys the SocketInputStream. | /// Destroys the SocketInputStream. | |||
}; | }; | |||
class Net_API SocketStream: public SocketIOS, public std::iostream | class Net_API SocketStream: public SocketIOS, public std::iostream | |||
skipping to change at line 165 | skipping to change at line 165 | |||
/// When using formatted input from a SocketStream, | /// When using formatted input from a SocketStream, | |||
/// always ensure that a receive timeout is set for the | /// always ensure that a receive timeout is set for the | |||
/// socket. Otherwise your program might unexpectedly | /// socket. Otherwise your program might unexpectedly | |||
/// hang. | /// hang. | |||
/// | /// | |||
/// However, using formatted input from a SocketStream | /// However, using formatted input from a SocketStream | |||
/// is not recommended, due to the read-ahead behavior of | /// is not recommended, due to the read-ahead behavior of | |||
/// istream with formatted reads. | /// istream with formatted reads. | |||
{ | { | |||
public: | public: | |||
SocketStream(const Socket& socket); | explicit SocketStream(const Socket& socket); | |||
/// Creates the SocketStream with the given socket. | /// Creates the SocketStream with the given socket. | |||
/// | /// | |||
/// The socket's SocketImpl must be a StreamSocketImpl, | /// The socket's SocketImpl must be a StreamSocketImpl, | |||
/// otherwise an InvalidArgumentException is thrown. | /// otherwise an InvalidArgumentException is thrown. | |||
~SocketStream(); | ~SocketStream(); | |||
/// Destroys the SocketStream. | /// Destroys the SocketStream. | |||
/// | /// | |||
/// Flushes the buffer, but does not close the socket. | /// Flushes the buffer, but does not close the socket. | |||
}; | }; | |||
End of changes. 4 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added | |||
StreamSocket.h | StreamSocket.h | |||
---|---|---|---|---|
// | // | |||
// StreamSocket.h | // StreamSocket.h | |||
// | // | |||
// $Id: //poco/1.3/Net/include/Poco/Net/StreamSocket.h#1 $ | // $Id: //poco/1.3/Net/include/Poco/Net/StreamSocket.h#3 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: Sockets | // Package: Sockets | |||
// Module: StreamSocket | // Module: StreamSocket | |||
// | // | |||
// Definition of the StreamSocket class. | // Definition of the StreamSocket class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 60 | skipping to change at line 60 | |||
/// This class provides an interface to a | /// This class provides an interface to a | |||
/// TCP stream socket. | /// TCP stream socket. | |||
{ | { | |||
public: | public: | |||
StreamSocket(); | StreamSocket(); | |||
/// Creates an unconnected stream socket. | /// Creates an unconnected stream socket. | |||
/// | /// | |||
/// Before sending or receiving data, the socket | /// Before sending or receiving data, the socket | |||
/// must be connected with a call to connect(). | /// must be connected with a call to connect(). | |||
StreamSocket(const SocketAddress& address); | explicit StreamSocket(const SocketAddress& address); | |||
/// Creates a stream socket and connects it to | /// Creates a stream socket and connects it to | |||
/// the socket specified by address. | /// the socket specified by address. | |||
explicit StreamSocket(IPAddress::Family family); | ||||
/// Creates an unconnected stream socket | ||||
/// for the given address family. | ||||
/// | ||||
/// This is useful if certain socket options | ||||
/// (like send and receive buffer) sizes, that must | ||||
/// be set before connecting the socket, will be | ||||
/// set later on. | ||||
StreamSocket(const Socket& socket); | StreamSocket(const Socket& socket); | |||
/// Creates the StreamSocket with the SocketImpl | /// Creates the StreamSocket with the SocketImpl | |||
/// from another socket. The SocketImpl must be | /// from another socket. The SocketImpl must be | |||
/// a StreamSocketImpl, otherwise an InvalidArgumentExceptio n | /// a StreamSocketImpl, otherwise an InvalidArgumentExceptio n | |||
/// will be thrown. | /// will be thrown. | |||
virtual ~StreamSocket(); | virtual ~StreamSocket(); | |||
/// Destroys the StreamSocket. | /// Destroys the StreamSocket. | |||
StreamSocket& operator = (const Socket& socket); | StreamSocket& operator = (const Socket& socket); | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 11 lines changed or added | |||
StreamSocketImpl.h | StreamSocketImpl.h | |||
---|---|---|---|---|
// | // | |||
// StreamSocketImpl.h | // StreamSocketImpl.h | |||
// | // | |||
// $Id: //poco/1.3/Net/include/Poco/Net/StreamSocketImpl.h#1 $ | // $Id: //poco/1.3/Net/include/Poco/Net/StreamSocketImpl.h#2 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: Sockets | // Package: Sockets | |||
// Module: StreamSocketImpl | // Module: StreamSocketImpl | |||
// | // | |||
// Definition of the StreamSocketImpl class. | // Definition of the StreamSocketImpl class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 54 | skipping to change at line 54 | |||
namespace Poco { | namespace Poco { | |||
namespace Net { | namespace Net { | |||
class Net_API StreamSocketImpl: public SocketImpl | class Net_API StreamSocketImpl: public SocketImpl | |||
/// This class implements a TCP socket. | /// This class implements a TCP socket. | |||
{ | { | |||
public: | public: | |||
StreamSocketImpl(); | StreamSocketImpl(); | |||
/// Creates a StreamSocketImpl. | /// Creates a StreamSocketImpl. | |||
explicit StreamSocketImpl(IPAddress::Family addressFamily); | ||||
/// Creates a SocketImpl, with the underlying | ||||
/// socket initialized for the given address family. | ||||
StreamSocketImpl(poco_socket_t sockfd); | StreamSocketImpl(poco_socket_t sockfd); | |||
/// Creates a StreamSocketImpl using the given native socket . | /// Creates a StreamSocketImpl using the given native socket . | |||
virtual int sendBytes(const void* buffer, int length, int flags = 0) ; | virtual int sendBytes(const void* buffer, int length, int flags = 0) ; | |||
/// Ensures that all data in buffer is sent. | /// Ensures that all data in buffer is sent. | |||
protected: | protected: | |||
virtual ~StreamSocketImpl(); | virtual ~StreamSocketImpl(); | |||
}; | }; | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 5 lines changed or added | |||
String.h | String.h | |||
---|---|---|---|---|
// | // | |||
// String.h | // String.h | |||
// | // | |||
// $Id: //poco/1.3/Foundation/include/Poco/String.h#4 $ | // $Id: //poco/1.3/Foundation/include/Poco/String.h#5 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: String | // Module: String | |||
// | // | |||
// String utility functions. | // String utility functions. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 207 | skipping to change at line 207 | |||
} | } | |||
if (it1 == end1) | if (it1 == end1) | |||
return it2 == end2 ? 0 : -1; | return it2 == end2 ? 0 : -1; | |||
else | else | |||
return 1; | return 1; | |||
} | } | |||
template <class S> | template <class S> | |||
int icompare(const S& str1, const S& str2) | int icompare(const S& str1, const S& str2) | |||
// A special optimization for an often used case. | ||||
{ | { | |||
return icompare(str1, 0, str1.size(), str2.begin(), str2.end()); | typename S::const_iterator it1(str1.begin()); | |||
typename S::const_iterator end1(str1.end()); | ||||
typename S::const_iterator it2(str2.begin()); | ||||
typename S::const_iterator end2(str2.end()); | ||||
while (it1 != end1 && it2 != end2) | ||||
{ | ||||
typename S::value_type c1(std::tolower(*it1)); | ||||
typename S::value_type c2(std::tolower(*it2)); | ||||
if (c1 < c2) | ||||
return -1; | ||||
else if (c1 > c2) | ||||
return 1; | ||||
++it1; ++it2; | ||||
} | ||||
if (it1 == end1) | ||||
return it2 == end2 ? 0 : -1; | ||||
else | ||||
return 1; | ||||
} | } | |||
template <class S> | template <class S> | |||
int icompare(const S& str1, typename S::size_type n1, const S& str2, typena me S::size_type n2) | int icompare(const S& str1, typename S::size_type n1, const S& str2, typena me S::size_type n2) | |||
{ | { | |||
if (n2 > str2.size()) n2 = str2.size(); | if (n2 > str2.size()) n2 = str2.size(); | |||
return icompare(str1, 0, n1, str2.begin(), str2.begin() + n2); | return icompare(str1, 0, n1, str2.begin(), str2.begin() + n2); | |||
} | } | |||
template <class S> | template <class S> | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 21 lines changed or added | |||
SystemConfiguration.h | SystemConfiguration.h | |||
---|---|---|---|---|
// | // | |||
// SystemConfiguration.h | // SystemConfiguration.h | |||
// | // | |||
// $Id: //poco/1.3/Util/include/Poco/Util/SystemConfiguration.h#2 $ | // $Id: //poco/1.3/Util/include/Poco/Util/SystemConfiguration.h#3 $ | |||
// | // | |||
// Library: Util | // Library: Util | |||
// Package: Configuration | // Package: Configuration | |||
// Module: SystemConfiguration | // Module: SystemConfiguration | |||
// | // | |||
// Definition of the SystemConfiguration class. | // Definition of the SystemConfiguration class. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 59 | skipping to change at line 59 | |||
/// various system properties and environment variables. | /// various system properties and environment variables. | |||
/// | /// | |||
/// The following properties are supported: | /// The following properties are supported: | |||
/// - system.osName: the operating system name | /// - system.osName: the operating system name | |||
/// - system.osVersion: the operating system version | /// - system.osVersion: the operating system version | |||
/// - system.osArchitecture: the operating system architecture | /// - system.osArchitecture: the operating system architecture | |||
/// - system.nodeName: the node (or host) name | /// - system.nodeName: the node (or host) name | |||
/// - system.currentDir: the current working directory | /// - system.currentDir: the current working directory | |||
/// - system.homeDir: the user's home directory | /// - system.homeDir: the user's home directory | |||
/// - system.tempDir: the system's temporary directory | /// - system.tempDir: the system's temporary directory | |||
/// - system.dateTime: the current UTC date and time, formatted in | ||||
ISO 8601 format. | ||||
/// - system.pid: the current process ID. | ||||
/// - system.env.<NAME>: the environment variable with the given < NAME>. | /// - system.env.<NAME>: the environment variable with the given < NAME>. | |||
/// | /// | |||
/// An attempt to set a system variable will result in an | /// An attempt to set a system variable will result in an | |||
/// InvalidAccessException being thrown. | /// InvalidAccessException being thrown. | |||
/// | /// | |||
/// Enumerating environment variables is not supported. | /// Enumerating environment variables is not supported. | |||
/// An attempt to call keys("system.env") will return an empty range . | /// An attempt to call keys("system.env") will return an empty range . | |||
{ | { | |||
public: | public: | |||
SystemConfiguration(); | SystemConfiguration(); | |||
skipping to change at line 87 | skipping to change at line 89 | |||
private: | private: | |||
static bool getEnv(const std::string& name, std::string& value); | static bool getEnv(const std::string& name, std::string& value); | |||
static const std::string OSNAME; | static const std::string OSNAME; | |||
static const std::string OSVERSION; | static const std::string OSVERSION; | |||
static const std::string OSARCHITECTURE; | static const std::string OSARCHITECTURE; | |||
static const std::string NODENAME; | static const std::string NODENAME; | |||
static const std::string CURRENTDIR; | static const std::string CURRENTDIR; | |||
static const std::string HOMEDIR; | static const std::string HOMEDIR; | |||
static const std::string TEMPDIR; | static const std::string TEMPDIR; | |||
static const std::string DATETIME; | ||||
static const std::string PID; | ||||
static const std::string ENV; | static const std::string ENV; | |||
}; | }; | |||
} } // namespace Poco::Util | } } // namespace Poco::Util | |||
#endif // Util_SystemConfiguration_INCLUDED | #endif // Util_SystemConfiguration_INCLUDED | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 6 lines changed or added | |||
TCPServer.h | TCPServer.h | |||
---|---|---|---|---|
// | // | |||
// TCPServer.h | // TCPServer.h | |||
// | // | |||
// $Id: //poco/1.3/Net/include/Poco/Net/TCPServer.h#2 $ | // $Id: //poco/1.3/Net/include/Poco/Net/TCPServer.h#4 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: TCPServer | // Package: TCPServer | |||
// Module: TCPServer | // Module: TCPServer | |||
// | // | |||
// Definition of the TCPServer class. | // Definition of the TCPServer class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 43 | skipping to change at line 43 | |||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Net_TCPServer_INCLUDED | #ifndef Net_TCPServer_INCLUDED | |||
#define Net_TCPServer_INCLUDED | #define Net_TCPServer_INCLUDED | |||
#include "Poco/Net/Net.h" | #include "Poco/Net/Net.h" | |||
#include "Poco/Net/ServerSocket.h" | #include "Poco/Net/ServerSocket.h" | |||
#include "Poco/Net/TCPServerConnectionFactory.h" | ||||
#include "Poco/Net/TCPServerParams.h" | ||||
#include "Poco/Runnable.h" | #include "Poco/Runnable.h" | |||
#include "Poco/Thread.h" | #include "Poco/Thread.h" | |||
#include "Poco/ThreadPool.h" | #include "Poco/ThreadPool.h" | |||
namespace Poco { | namespace Poco { | |||
namespace Net { | namespace Net { | |||
class TCPServerParams; | ||||
class TCPServerDispatcher; | class TCPServerDispatcher; | |||
class TCPServerConnectionFactory; | ||||
class Net_API TCPServer: public Poco::Runnable | class Net_API TCPServer: public Poco::Runnable | |||
/// This class implements a multithreaded TCP server. | /// This class implements a multithreaded TCP server. | |||
/// | /// | |||
/// The server uses a ServerSocket to listen for incoming | /// The server uses a ServerSocket to listen for incoming | |||
/// connections. The ServerSocket must have been bound to | /// connections. The ServerSocket must have been bound to | |||
/// an address before it is passed to the TCPServer constructor. | /// an address before it is passed to the TCPServer constructor. | |||
/// Additionally, the ServerSocket must be put into listening | /// Additionally, the ServerSocket must be put into listening | |||
/// state before the TCPServer is started by calling the start() | /// state before the TCPServer is started by calling the start() | |||
/// method. | /// method. | |||
skipping to change at line 96 | skipping to change at line 96 | |||
/// Thus, the call to start() returns immediately, and the server | /// Thus, the call to start() returns immediately, and the server | |||
/// continues to run in the background. | /// continues to run in the background. | |||
/// | /// | |||
/// To stop the server from accepting new connections, call stop(). | /// To stop the server from accepting new connections, call stop(). | |||
/// | /// | |||
/// After calling stop(), no new connections will be accepted and | /// After calling stop(), no new connections will be accepted and | |||
/// all queued connections will be discarded. | /// all queued connections will be discarded. | |||
/// Already served connections, however, will continue being served. | /// Already served connections, however, will continue being served. | |||
{ | { | |||
public: | public: | |||
TCPServer(TCPServerConnectionFactory* pFactory, const ServerSocket& socket, TCPServerParams* pParams = 0); | TCPServer(TCPServerConnectionFactory::Ptr pFactory, const ServerSock et& socket, TCPServerParams::Ptr pParams = 0); | |||
/// Creates the TCPServer, using the given ServerSocket. | /// Creates the TCPServer, using the given ServerSocket. | |||
/// | /// | |||
/// The server takes ownership of the TCPServerConnectionFac tory | /// The server takes ownership of the TCPServerConnectionFac tory | |||
/// and deletes it when it's no longer needed. | /// and deletes it when it's no longer needed. | |||
/// | /// | |||
/// The server also takes ownership of the TCPServerParams o bject. | /// The server also takes ownership of the TCPServerParams o bject. | |||
/// If no TCPServerParams object is given, the server's TCPS erverDispatcher | /// If no TCPServerParams object is given, the server's TCPS erverDispatcher | |||
/// creates its own one. | /// creates its own one. | |||
/// | /// | |||
/// News threads are taken from the default thread pool. | /// News threads are taken from the default thread pool. | |||
TCPServer(TCPServerConnectionFactory* pFactory, Poco::ThreadPool& th readPool, const ServerSocket& socket, TCPServerParams* pParams = 0); | TCPServer(TCPServerConnectionFactory::Ptr pFactory, Poco::ThreadPool & threadPool, const ServerSocket& socket, TCPServerParams::Ptr pParams = 0) ; | |||
/// Creates the TCPServer, using the given ServerSocket. | /// Creates the TCPServer, using the given ServerSocket. | |||
/// | /// | |||
/// The server takes ownership of the TCPServerConnectionFac tory | /// The server takes ownership of the TCPServerConnectionFac tory | |||
/// and deletes it when it's no longer needed. | /// and deletes it when it's no longer needed. | |||
/// | /// | |||
/// The server also takes ownership of the TCPServerParams o bject. | /// The server also takes ownership of the TCPServerParams o bject. | |||
/// If no TCPServerParams object is given, the server's TCPS erverDispatcher | /// If no TCPServerParams object is given, the server's TCPS erverDispatcher | |||
/// creates its own one. | /// creates its own one. | |||
/// | /// | |||
/// News threads are taken from the given thread pool. | /// News threads are taken from the given thread pool. | |||
End of changes. 6 change blocks. | ||||
5 lines changed or deleted | 5 lines changed or added | |||
TCPServerConnectionFactory.h | TCPServerConnectionFactory.h | |||
---|---|---|---|---|
// | // | |||
// TCPServerConnectionFactory.h | // TCPServerConnectionFactory.h | |||
// | // | |||
// $Id: //poco/1.3/Net/include/Poco/Net/TCPServerConnectionFactory.h#1 $ | // $Id: //poco/1.3/Net/include/Poco/Net/TCPServerConnectionFactory.h#2 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: TCPServer | // Package: TCPServer | |||
// Module: TCPServerConnectionFactory | // Module: TCPServerConnectionFactory | |||
// | // | |||
// Definition of the TCPServerConnectionFactory class. | // Definition of the TCPServerConnectionFactory class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 43 | skipping to change at line 43 | |||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Net_TCPServerConnectionFactory_INCLUDED | #ifndef Net_TCPServerConnectionFactory_INCLUDED | |||
#define Net_TCPServerConnectionFactory_INCLUDED | #define Net_TCPServerConnectionFactory_INCLUDED | |||
#include "Poco/Net/Net.h" | #include "Poco/Net/Net.h" | |||
#include "Poco/Net/TCPServerConnection.h" | #include "Poco/Net/TCPServerConnection.h" | |||
#include "Poco/SharedPtr.h" | ||||
namespace Poco { | namespace Poco { | |||
namespace Net { | namespace Net { | |||
class Net_API TCPServerConnectionFactory | class Net_API TCPServerConnectionFactory | |||
/// A factory for TCPServerConnection objects. | /// A factory for TCPServerConnection objects. | |||
/// | /// | |||
/// The TCPServer class uses a TCPServerConnectionFactory | /// The TCPServer class uses a TCPServerConnectionFactory | |||
/// to create a connection object for each new connection | /// to create a connection object for each new connection | |||
/// it accepts. | /// it accepts. | |||
/// | /// | |||
/// Subclasses must override the createConnection() | /// Subclasses must override the createConnection() | |||
/// method. | /// method. | |||
/// | /// | |||
/// The TCPServerConnectionFactoryImpl template class | /// The TCPServerConnectionFactoryImpl template class | |||
/// can be used to automatically instantiate a | /// can be used to automatically instantiate a | |||
/// TCPServerConnectionFactory for a given subclass | /// TCPServerConnectionFactory for a given subclass | |||
/// of TCPServerConnection. | /// of TCPServerConnection. | |||
{ | { | |||
public: | public: | |||
typedef Poco::SharedPtr<TCPServerConnectionFactory> Ptr; | ||||
virtual ~TCPServerConnectionFactory(); | virtual ~TCPServerConnectionFactory(); | |||
/// Destroys the TCPServerConnectionFactory. | /// Destroys the TCPServerConnectionFactory. | |||
virtual TCPServerConnection* createConnection(const StreamSocket& so cket) = 0; | virtual TCPServerConnection* createConnection(const StreamSocket& so cket) = 0; | |||
/// Creates an instance of a subclass of TCPServerConnection , | /// Creates an instance of a subclass of TCPServerConnection , | |||
/// using the given StreamSocket. | /// using the given StreamSocket. | |||
protected: | protected: | |||
TCPServerConnectionFactory(); | TCPServerConnectionFactory(); | |||
/// Creates the TCPServerConnectionFactory. | /// Creates the TCPServerConnectionFactory. | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 4 lines changed or added | |||
TCPServerDispatcher.h | TCPServerDispatcher.h | |||
---|---|---|---|---|
// | // | |||
// TCPServerDispatcher.h | // TCPServerDispatcher.h | |||
// | // | |||
// $Id: //poco/1.3/Net/include/Poco/Net/TCPServerDispatcher.h#1 $ | // $Id: //poco/1.3/Net/include/Poco/Net/TCPServerDispatcher.h#3 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: TCPServer | // Package: TCPServer | |||
// Module: TCPServerDispatcher | // Module: TCPServerDispatcher | |||
// | // | |||
// Definition of the TCPServerDispatcher class. | // Definition of the TCPServerDispatcher class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 43 | skipping to change at line 43 | |||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Net_TCPServerDispatcher_INCLUDED | #ifndef Net_TCPServerDispatcher_INCLUDED | |||
#define Net_TCPServerDispatcher_INCLUDED | #define Net_TCPServerDispatcher_INCLUDED | |||
#include "Poco/Net/Net.h" | #include "Poco/Net/Net.h" | |||
#include "Poco/Net/StreamSocket.h" | #include "Poco/Net/StreamSocket.h" | |||
#include "Poco/Net/TCPServerConnectionFactory.h" | ||||
#include "Poco/Net/TCPServerParams.h" | ||||
#include "Poco/Runnable.h" | #include "Poco/Runnable.h" | |||
#include "Poco/NotificationQueue.h" | #include "Poco/NotificationQueue.h" | |||
#include "Poco/ThreadPool.h" | #include "Poco/ThreadPool.h" | |||
#include "Poco/Mutex.h" | #include "Poco/Mutex.h" | |||
namespace Poco { | namespace Poco { | |||
namespace Net { | namespace Net { | |||
class TCPServerParams; | ||||
class TCPServerConnectionFactory; | ||||
class Net_API TCPServerDispatcher: public Poco::Runnable | class Net_API TCPServerDispatcher: public Poco::Runnable | |||
/// A helper class for TCPServer that dispatches | /// A helper class for TCPServer that dispatches | |||
/// connections to server connection threads. | /// connections to server connection threads. | |||
{ | { | |||
public: | public: | |||
TCPServerDispatcher(TCPServerConnectionFactory* pFactory, Poco::Thre adPool& threadPool, TCPServerParams* pParams); | TCPServerDispatcher(TCPServerConnectionFactory::Ptr pFactory, Poco:: ThreadPool& threadPool, TCPServerParams::Ptr pParams); | |||
/// Creates the TCPServerDispatcher. | /// Creates the TCPServerDispatcher. | |||
/// | /// | |||
/// The dispatcher takes ownership of the TCPServerParams ob ject. | /// The dispatcher takes ownership of the TCPServerParams ob ject. | |||
/// If no TCPServerParams object is supplied, the TCPServerD ispatcher | /// If no TCPServerParams object is supplied, the TCPServerD ispatcher | |||
/// creates one. | /// creates one. | |||
void duplicate(); | void duplicate(); | |||
/// Increments the object's reference count. | /// Increments the object's reference count. | |||
void release(); | void release(); | |||
skipping to change at line 120 | skipping to change at line 119 | |||
void endConnection(); | void endConnection(); | |||
/// Updates the performance counters. | /// Updates the performance counters. | |||
private: | private: | |||
TCPServerDispatcher(); | TCPServerDispatcher(); | |||
TCPServerDispatcher(const TCPServerDispatcher&); | TCPServerDispatcher(const TCPServerDispatcher&); | |||
TCPServerDispatcher& operator = (const TCPServerDispatcher&); | TCPServerDispatcher& operator = (const TCPServerDispatcher&); | |||
int _rc; | int _rc; | |||
TCPServerParams* _pParams; | TCPServerParams::Ptr _pParams; | |||
int _currentThreads; | int _currentThreads; | |||
int _totalConnections; | int _totalConnections; | |||
int _currentConnections; | int _currentConnections; | |||
int _maxConcurrentConnections; | int _maxConcurrentConnections; | |||
int _refusedConnections; | int _refusedConnections; | |||
bool _stopped; | bool _stopped; | |||
Poco::NotificationQueue _queue; | Poco::NotificationQueue _queue; | |||
TCPServerConnectionFactory* _pConnectionFactory; | TCPServerConnectionFactory::Ptr _pConnectionFactory; | |||
Poco::ThreadPool& _threadPool; | Poco::ThreadPool& _threadPool; | |||
mutable Poco::FastMutex _mutex; | mutable Poco::FastMutex _mutex; | |||
}; | }; | |||
// | // | |||
// inlines | // inlines | |||
// | // | |||
inline const TCPServerParams& TCPServerDispatcher::params() const | inline const TCPServerParams& TCPServerDispatcher::params() const | |||
{ | { | |||
return *_pParams; | return *_pParams; | |||
} | } | |||
End of changes. 6 change blocks. | ||||
10 lines changed or deleted | 9 lines changed or added | |||
TCPServerParams.h | TCPServerParams.h | |||
---|---|---|---|---|
// | // | |||
// TCPServerParams.h | // TCPServerParams.h | |||
// | // | |||
// $Id: //poco/1.3/Net/include/Poco/Net/TCPServerParams.h#2 $ | // $Id: //poco/1.3/Net/include/Poco/Net/TCPServerParams.h#3 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: TCPServer | // Package: TCPServer | |||
// Module: TCPServerParams | // Module: TCPServerParams | |||
// | // | |||
// Definition of the TCPServerParams class. | // Definition of the TCPServerParams class. | |||
// | // | |||
// Copyright (c) 2005-2007, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2007, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 45 | skipping to change at line 45 | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Net_TCPServerParams_INCLUDED | #ifndef Net_TCPServerParams_INCLUDED | |||
#define Net_TCPServerParams_INCLUDED | #define Net_TCPServerParams_INCLUDED | |||
#include "Poco/Net/Net.h" | #include "Poco/Net/Net.h" | |||
#include "Poco/RefCountedObject.h" | #include "Poco/RefCountedObject.h" | |||
#include "Poco/Timespan.h" | #include "Poco/Timespan.h" | |||
#include "Poco/Thread.h" | #include "Poco/Thread.h" | |||
#include "Poco/AutoPtr.h" | ||||
namespace Poco { | namespace Poco { | |||
namespace Net { | namespace Net { | |||
class Net_API TCPServerParams: public Poco::RefCountedObject | class Net_API TCPServerParams: public Poco::RefCountedObject | |||
/// This class is used to specify parameters to both the | /// This class is used to specify parameters to both the | |||
/// TCPServer, as well as to TCPServerDispatcher objects. | /// TCPServer, as well as to TCPServerDispatcher objects. | |||
/// | /// | |||
/// Subclasses may add new parameters to the class. | /// Subclasses may add new parameters to the class. | |||
{ | { | |||
public: | public: | |||
typedef Poco::AutoPtr<TCPServerParams> Ptr; | ||||
TCPServerParams(); | TCPServerParams(); | |||
/// Creates the TCPServerParams. | /// Creates the TCPServerParams. | |||
/// | /// | |||
/// Sets the following default values: | /// Sets the following default values: | |||
/// - threadIdleTime: 10 seconds | /// - threadIdleTime: 10 seconds | |||
/// - maxThreads: 0 | /// - maxThreads: 0 | |||
/// - maxQueued: 64 | /// - maxQueued: 64 | |||
void setThreadIdleTime(const Poco::Timespan& idleTime); | void setThreadIdleTime(const Poco::Timespan& idleTime); | |||
/// Sets the maximum idle time for a thread before | /// Sets the maximum idle time for a thread before | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 4 lines changed or added | |||
Thread_POSIX.h | Thread_POSIX.h | |||
---|---|---|---|---|
// | // | |||
// Thread_POSIX.h | // Thread_POSIX.h | |||
// | // | |||
// $Id: //poco/1.3/Foundation/include/Poco/Thread_POSIX.h#5 $ | // $Id: //poco/1.3/Foundation/include/Poco/Thread_POSIX.h#8 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Threading | // Package: Threading | |||
// Module: Thread | // Module: Thread | |||
// | // | |||
// Definition of the ThreadImpl class for POSIX Threads. | // Definition of the ThreadImpl class for POSIX Threads. | |||
// | // | |||
// Copyright (c) 2004-2007, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2007, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 48 | skipping to change at line 48 | |||
#ifndef Foundation_Thread_POSIX_INCLUDED | #ifndef Foundation_Thread_POSIX_INCLUDED | |||
#define Foundation_Thread_POSIX_INCLUDED | #define Foundation_Thread_POSIX_INCLUDED | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
#include "Poco/Runnable.h" | #include "Poco/Runnable.h" | |||
#include "Poco/SignalHandler.h" | #include "Poco/SignalHandler.h" | |||
#include "Poco/Event.h" | #include "Poco/Event.h" | |||
#include "Poco/RefCountedObject.h" | #include "Poco/RefCountedObject.h" | |||
#include "Poco/AutoPtr.h" | #include "Poco/AutoPtr.h" | |||
#include <pthread.h> | #include <pthread.h> | |||
// must be limits.h (not <climits>) for PTHREAD_STACK_MIN on Solaris | ||||
#include <limits.h> | ||||
#if !defined(POCO_NO_SYS_SELECT_H) | #if !defined(POCO_NO_SYS_SELECT_H) | |||
#include <sys/select.h> | #include <sys/select.h> | |||
#endif | #endif | |||
#include <errno.h> | #include <errno.h> | |||
namespace Poco { | namespace Poco { | |||
class Foundation_API ThreadImpl | class Foundation_API ThreadImpl | |||
{ | { | |||
public: | public: | |||
skipping to change at line 107 | skipping to change at line 109 | |||
static void yieldImpl(); | static void yieldImpl(); | |||
static ThreadImpl* currentImpl(); | static ThreadImpl* currentImpl(); | |||
protected: | protected: | |||
static void* runnableEntry(void* pThread); | static void* runnableEntry(void* pThread); | |||
static void* callableEntry(void* pThread); | static void* callableEntry(void* pThread); | |||
static int mapPrio(int prio); | static int mapPrio(int prio); | |||
static int reverseMapPrio(int osPrio); | static int reverseMapPrio(int osPrio); | |||
private: | private: | |||
class CurrentThreadHolder | ||||
{ | ||||
public: | ||||
CurrentThreadHolder() | ||||
{ | ||||
if (pthread_key_create(&_key, NULL)) | ||||
throw SystemException("cannot allocate threa | ||||
d context key"); | ||||
} | ||||
~CurrentThreadHolder() | ||||
{ | ||||
pthread_key_delete(_key); | ||||
} | ||||
ThreadImpl* get() const | ||||
{ | ||||
return reinterpret_cast<ThreadImpl*>(pthread_getspec | ||||
ific(_key)); | ||||
} | ||||
void set(ThreadImpl* pThread) | ||||
{ | ||||
pthread_setspecific(_key, pThread); | ||||
} | ||||
private: | ||||
pthread_key_t _key; | ||||
}; | ||||
struct ThreadData: public RefCountedObject | struct ThreadData: public RefCountedObject | |||
{ | { | |||
ThreadData(): | ThreadData(): | |||
pRunnableTarget(0), | pRunnableTarget(0), | |||
pCallbackTarget(0), | pCallbackTarget(0), | |||
thread(0), | thread(0), | |||
prio(PRIO_NORMAL_IMPL), | prio(PRIO_NORMAL_IMPL), | |||
done(false), | done(false), | |||
stackSize(POCO_THREAD_STACK_SIZE) | stackSize(POCO_THREAD_STACK_SIZE) | |||
{ | { | |||
skipping to change at line 130 | skipping to change at line 157 | |||
AutoPtr<CallbackData> pCallbackTarget; | AutoPtr<CallbackData> pCallbackTarget; | |||
pthread_t thread; | pthread_t thread; | |||
int prio; | int prio; | |||
int osPrio; | int osPrio; | |||
Event done; | Event done; | |||
std::size_t stackSize; | std::size_t stackSize; | |||
}; | }; | |||
AutoPtr<ThreadData> _pData; | AutoPtr<ThreadData> _pData; | |||
static pthread_key_t _currentKey; | static CurrentThreadHolder _currentThreadHolder; | |||
static bool _haveCurrentKey; | ||||
#if defined(POCO_OS_FAMILY_UNIX) | #if defined(POCO_OS_FAMILY_UNIX) | |||
SignalHandler::JumpBufferVec _jumpBufferVec; | SignalHandler::JumpBufferVec _jumpBufferVec; | |||
friend class SignalHandler; | friend class SignalHandler; | |||
#endif | #endif | |||
}; | }; | |||
// | // | |||
// inlines | // inlines | |||
// | // | |||
End of changes. 4 change blocks. | ||||
3 lines changed or deleted | 31 lines changed or added | |||
Thread_WIN32.h | Thread_WIN32.h | |||
---|---|---|---|---|
// | // | |||
// Thread_WIN32.h | // Thread_WIN32.h | |||
// | // | |||
// $Id: //poco/1.3/Foundation/include/Poco/Thread_WIN32.h#7 $ | // $Id: //poco/1.3/Foundation/include/Poco/Thread_WIN32.h#8 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Threading | // Package: Threading | |||
// Module: Thread | // Module: Thread | |||
// | // | |||
// Definition of the ThreadImpl class for WIN32. | // Definition of the ThreadImpl class for WIN32. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2009, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
// Permission is hereby granted, free of charge, to any person or organizat ion | // Permission is hereby granted, free of charge, to any person or organizat ion | |||
// obtaining a copy of the software and accompanying documentation covered by | // obtaining a copy of the software and accompanying documentation covered by | |||
// this license (the "Software") to use, reproduce, display, distribute, | // this license (the "Software") to use, reproduce, display, distribute, | |||
// execute, and transmit the Software, and to prepare derivative works of t he | // execute, and transmit the Software, and to prepare derivative works of t he | |||
// Software, and to permit third-parties to whom the Software is furnished to | // Software, and to permit third-parties to whom the Software is furnished to | |||
// do so, all subject to the following: | // do so, all subject to the following: | |||
// | // | |||
// The copyright notices in the Software and this entire statement, includi ng | // The copyright notices in the Software and this entire statement, includi ng | |||
skipping to change at line 115 | skipping to change at line 115 | |||
#if defined(_DLL) | #if defined(_DLL) | |||
static DWORD WINAPI callableEntry(LPVOID pThread); | static DWORD WINAPI callableEntry(LPVOID pThread); | |||
#else | #else | |||
static unsigned __stdcall callableEntry(void* pThread); | static unsigned __stdcall callableEntry(void* pThread); | |||
#endif | #endif | |||
void createImpl(Entry ent, void* pData); | void createImpl(Entry ent, void* pData); | |||
void threadCleanup(); | void threadCleanup(); | |||
private: | private: | |||
class CurrentThreadHolder | ||||
{ | ||||
public: | ||||
CurrentThreadHolder(): _slot(TlsAlloc()) | ||||
{ | ||||
if (_slot == TLS_OUT_OF_INDEXES) | ||||
throw SystemException("cannot allocate threa | ||||
d context key"); | ||||
} | ||||
~CurrentThreadHolder() | ||||
{ | ||||
TlsFree(_slot); | ||||
} | ||||
ThreadImpl* get() const | ||||
{ | ||||
return reinterpret_cast<ThreadImpl*>(TlsGetValue(_sl | ||||
ot)); | ||||
} | ||||
void set(ThreadImpl* pThread) | ||||
{ | ||||
TlsSetValue(_slot, pThread); | ||||
} | ||||
private: | ||||
DWORD _slot; | ||||
}; | ||||
Runnable* _pRunnableTarget; | Runnable* _pRunnableTarget; | |||
CallbackData _callbackTarget; | CallbackData _callbackTarget; | |||
HANDLE _thread; | HANDLE _thread; | |||
int _prio; | int _prio; | |||
int _stackSize; | int _stackSize; | |||
static DWORD _currentKey; | static CurrentThreadHolder _currentThreadHolder; | |||
}; | }; | |||
// | // | |||
// inlines | // inlines | |||
// | // | |||
inline int ThreadImpl::getPriorityImpl() const | inline int ThreadImpl::getPriorityImpl() const | |||
{ | { | |||
return _prio; | return _prio; | |||
} | } | |||
End of changes. 4 change blocks. | ||||
3 lines changed or deleted | 30 lines changed or added | |||
Timer.h | Timer.h | |||
---|---|---|---|---|
// | // | |||
// Timer.h | // Timer.h | |||
// | // | |||
// $Id: //poco/1.3/Foundation/include/Poco/Timer.h#3 $ | // $Id: //poco/1.3/Foundation/include/Poco/Timer.h#5 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Threading | // Package: Threading | |||
// Module: Timer | // Module: Timer | |||
// | // | |||
// Definition of the Timer and related classes. | // Definition of the Timer and related classes. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 46 | skipping to change at line 46 | |||
// | // | |||
#ifndef Foundation_Timer_INCLUDED | #ifndef Foundation_Timer_INCLUDED | |||
#define Foundation_Timer_INCLUDED | #define Foundation_Timer_INCLUDED | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
#include "Poco/Runnable.h" | #include "Poco/Runnable.h" | |||
#include "Poco/Mutex.h" | #include "Poco/Mutex.h" | |||
#include "Poco/Event.h" | #include "Poco/Event.h" | |||
#include "Poco/Thread.h" | #include "Poco/Thread.h" | |||
#include "Poco/Timestamp.h" | ||||
namespace Poco { | namespace Poco { | |||
class AbstractTimerCallback; | class AbstractTimerCallback; | |||
class ThreadPool; | class ThreadPool; | |||
class Foundation_API Timer: protected Runnable | class Foundation_API Timer: protected Runnable | |||
/// This class implements a thread-based timer. | /// This class implements a thread-based timer. | |||
/// A timer starts a thread that first waits for a given start inter val. | /// A timer starts a thread that first waits for a given start inter val. | |||
/// Once that interval expires, the timer callback is called repeate dly | /// Once that interval expires, the timer callback is called repeate dly | |||
skipping to change at line 69 | skipping to change at line 70 | |||
/// timer's periodic interval to 0. | /// timer's periodic interval to 0. | |||
/// | /// | |||
/// The timer callback runs in its own thread, so multithreading | /// The timer callback runs in its own thread, so multithreading | |||
/// issues (proper synchronization) have to be considered when writi ng | /// issues (proper synchronization) have to be considered when writi ng | |||
/// the callback method. | /// the callback method. | |||
/// | /// | |||
/// The exact interval at which the callback is called depends on ma ny | /// The exact interval at which the callback is called depends on ma ny | |||
/// factors like operating system, CPU performance and system load a nd | /// factors like operating system, CPU performance and system load a nd | |||
/// may differ from the specified interval. | /// may differ from the specified interval. | |||
/// | /// | |||
/// The time needed to execute the timer callback is not included | ||||
/// in the interval between invocations. For example, if the interva | ||||
l | ||||
/// is 500 milliseconds, and the callback needs 400 milliseconds to | ||||
/// execute, the callback function is nevertheless called every 500 | ||||
/// milliseconds. If the callback takes longer to execute than the | ||||
/// interval, the callback function will be immediately called again | ||||
/// once it returns. | ||||
/// | ||||
/// The timer thread is taken from a thread pool, so | /// The timer thread is taken from a thread pool, so | |||
/// there is a limit to the number of available concurrent timers. | /// there is a limit to the number of available concurrent timers. | |||
{ | { | |||
public: | public: | |||
Timer(long startInterval = 0, long periodicInterval = 0); | Timer(long startInterval = 0, long periodicInterval = 0); | |||
/// Creates a new timer object. StartInterval and periodicIn terval | /// Creates a new timer object. StartInterval and periodicIn terval | |||
/// are given in milliseconds. If a periodicInterval of zero is | /// are given in milliseconds. If a periodicInterval of zero is | |||
/// specified, the callback will only be called once, after the | /// specified, the callback will only be called once, after the | |||
/// startInterval expires. | /// startInterval expires. | |||
/// To start the timer, call the Start() method. | /// To start the timer, call the Start() method. | |||
skipping to change at line 150 | skipping to change at line 159 | |||
protected: | protected: | |||
void run(); | void run(); | |||
private: | private: | |||
volatile long _startInterval; | volatile long _startInterval; | |||
volatile long _periodicInterval; | volatile long _periodicInterval; | |||
Event _wakeUp; | Event _wakeUp; | |||
Event _done; | Event _done; | |||
AbstractTimerCallback* _pCallback; | AbstractTimerCallback* _pCallback; | |||
Poco::Timestamp _nextInvocation; | ||||
mutable FastMutex _mutex; | mutable FastMutex _mutex; | |||
Timer(const Timer&); | Timer(const Timer&); | |||
Timer& operator = (const Timer&); | Timer& operator = (const Timer&); | |||
}; | }; | |||
class Foundation_API AbstractTimerCallback | class Foundation_API AbstractTimerCallback | |||
/// This is the base class for all instantiations of | /// This is the base class for all instantiations of | |||
/// the TimerCallback template. | /// the TimerCallback template. | |||
{ | { | |||
End of changes. 4 change blocks. | ||||
1 lines changed or deleted | 12 lines changed or added | |||
UTF8Encoding.h | UTF8Encoding.h | |||
---|---|---|---|---|
// | // | |||
// UTF8Encoding.h | // UTF8Encoding.h | |||
// | // | |||
// $Id: //poco/1.3/Foundation/include/Poco/UTF8Encoding.h#2 $ | // $Id: //poco/1.3/Foundation/include/Poco/UTF8Encoding.h#3 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Text | // Package: Text | |||
// Module: UTF8Encoding | // Module: UTF8Encoding | |||
// | // | |||
// Definition of the UTF8Encoding class. | // Definition of the UTF8Encoding class. | |||
// | // | |||
// Copyright (c) 2004-2007, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2007, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 58 | skipping to change at line 58 | |||
{ | { | |||
public: | public: | |||
UTF8Encoding(); | UTF8Encoding(); | |||
~UTF8Encoding(); | ~UTF8Encoding(); | |||
const char* canonicalName() const; | const char* canonicalName() const; | |||
bool isA(const std::string& encodingName) const; | bool isA(const std::string& encodingName) const; | |||
const CharacterMap& characterMap() const; | const CharacterMap& characterMap() const; | |||
int convert(const unsigned char* bytes) const; | int convert(const unsigned char* bytes) const; | |||
int convert(int ch, unsigned char* bytes, int length) const; | int convert(int ch, unsigned char* bytes, int length) const; | |||
static bool isLegal(const unsigned char *bytes, int length); | ||||
/// Utility routine to tell whether a sequence of bytes is l | ||||
egal UTF-8. | ||||
/// This must be called with the length pre-determined by th | ||||
e first byte. | ||||
/// The sequence is illegal right away if there aren't enoug | ||||
h bytes | ||||
/// available. If presented with a length > 4, this function | ||||
returns false. | ||||
/// The Unicode definition of UTF-8 goes up to 4-byte sequen | ||||
ces. | ||||
/// | ||||
/// Adapted from ftp://ftp.unicode.org/Public/PROGRAMS/CVTUT | ||||
F/ConvertUTF.c | ||||
/// Copyright 2001-2004 Unicode, Inc. | ||||
private: | private: | |||
static const char* _names[]; | static const char* _names[]; | |||
static const CharacterMap _charMap; | static const CharacterMap _charMap; | |||
}; | }; | |||
} // namespace Poco | } // namespace Poco | |||
#endif // Foundation_UTF8Encoding_INCLUDED | #endif // Foundation_UTF8Encoding_INCLUDED | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 17 lines changed or added | |||
UnWindows.h | UnWindows.h | |||
---|---|---|---|---|
// | // | |||
// UnWindows.h | // UnWindows.h | |||
// | // | |||
// $Id: //poco/1.3/Foundation/include/Poco/UnWindows.h#1 $ | // $Id: //poco/1.3/Foundation/include/Poco/UnWindows.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: UnWindows | // Module: UnWindows | |||
// | // | |||
// A wrapper around the "Poco/UnWindows.h" header file that #undef's some | // A wrapper around the <windows.h> header file that #undef's some | |||
// of the macros for function names defined by "Poco/UnWindows.h" that | // of the macros for function names defined by <windows.h> that | |||
// are a frequent source of conflicts (e.g., GetUserName). | // are a frequent source of conflicts (e.g., GetUserName). | |||
// | // | |||
// Remember, that most of the WIN32 API functions come in two variants, | // Remember, that most of the WIN32 API functions come in two variants, | |||
// an Unicode variant (e.g., GetUserNameA) and an ASCII variant (GetUserNam eW). | // an Unicode variant (e.g., GetUserNameA) and an ASCII variant (GetUserNam eW). | |||
// There is also a macro (GetUserName) that's either defined to be the Unic ode | // There is also a macro (GetUserName) that's either defined to be the Unic ode | |||
// name or the ASCII name, depending on whether the UNICODE macro is #defin e'd | // name or the ASCII name, depending on whether the UNICODE macro is #defin e'd | |||
// or not. POCO always calls the Unicode or ASCII functions directly (depen ding | // or not. POCO always calls the Unicode or ASCII functions directly (depen ding | |||
// on whether POCO_WIN32_UTF8 is #define'd or not), so the macros are not i gnored. | // on whether POCO_WIN32_UTF8 is #define'd or not), so the macros are not i gnored. | |||
// | // | |||
// These macro definitions are a frequent case of problems and naming confl icts, | // These macro definitions are a frequent case of problems and naming confl icts, | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
XMLConfiguration.h | XMLConfiguration.h | |||
---|---|---|---|---|
// | // | |||
// XMLConfiguration.h | // XMLConfiguration.h | |||
// | // | |||
// $Id: //poco/1.3/Util/include/Poco/Util/XMLConfiguration.h#1 $ | // $Id: //poco/1.3/Util/include/Poco/Util/XMLConfiguration.h#2 $ | |||
// | // | |||
// Library: Util | // Library: Util | |||
// Package: Configuration | // Package: Configuration | |||
// Module: XMLConfiguration | // Module: XMLConfiguration | |||
// | // | |||
// Definition of the XMLConfiguration class. | // Definition of the XMLConfiguration class. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 45 | skipping to change at line 45 | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Util_XMLConfiguration_INCLUDED | #ifndef Util_XMLConfiguration_INCLUDED | |||
#define Util_XMLConfiguration_INCLUDED | #define Util_XMLConfiguration_INCLUDED | |||
#include "Poco/Util/Util.h" | #include "Poco/Util/Util.h" | |||
#include "Poco/Util/MapConfiguration.h" | #include "Poco/Util/MapConfiguration.h" | |||
#include "Poco/DOM/Document.h" | #include "Poco/DOM/Document.h" | |||
#include "Poco/DOM/AutoPtr.h" | #include "Poco/DOM/AutoPtr.h" | |||
#include "Poco/DOM/DOMWriter.h" | ||||
#include "Poco/SAX/InputSource.h" | #include "Poco/SAX/InputSource.h" | |||
#include <istream> | #include <istream> | |||
namespace Poco { | namespace Poco { | |||
namespace Util { | namespace Util { | |||
class Util_API XMLConfiguration: public AbstractConfiguration | class Util_API XMLConfiguration: public AbstractConfiguration | |||
/// This configuration class extracts configuration properties | /// This configuration class extracts configuration properties | |||
/// from an XML document. An XPath-like syntax for property | /// from an XML document. An XPath-like syntax for property | |||
/// names is supported to allow full access to the XML document. | /// names is supported to allow full access to the XML document. | |||
skipping to change at line 85 | skipping to change at line 86 | |||
/// prop1 -> value1 | /// prop1 -> value1 | |||
/// prop2 -> value2 | /// prop2 -> value2 | |||
/// prop3.prop4 -> (empty string) | /// prop3.prop4 -> (empty string) | |||
/// prop3.prop4[@attr] -> value3 | /// prop3.prop4[@attr] -> value3 | |||
/// prop3.prop4[1][@attr] -> value4 | /// prop3.prop4[1][@attr] -> value4 | |||
/// prop5[0] -> value5 | /// prop5[0] -> value5 | |||
/// prop5[1] -> value6 | /// prop5[1] -> value6 | |||
/// | /// | |||
/// Enumerating attributes is not supported. | /// Enumerating attributes is not supported. | |||
/// Calling keys("prop3.prop4") will return an empty range. | /// Calling keys("prop3.prop4") will return an empty range. | |||
/// | ||||
/// Setting properties is not supported. An attempt to set a propert | ||||
y results | ||||
/// in a NotImplementedException being thrown. | ||||
{ | { | |||
public: | public: | |||
XMLConfiguration(); | XMLConfiguration(); | |||
/// Creates an empty XMLConfiguration. | /// Creates an empty XMLConfiguration. | |||
XMLConfiguration(Poco::XML::InputSource* pInputSource); | XMLConfiguration(Poco::XML::InputSource* pInputSource); | |||
/// Creates an XMLConfiguration and loads the XML document f rom | /// Creates an XMLConfiguration and loads the XML document f rom | |||
/// the given InputSource. | /// the given InputSource. | |||
XMLConfiguration(std::istream& istr); | XMLConfiguration(std::istream& istr); | |||
skipping to change at line 131 | skipping to change at line 129 | |||
/// from the given file. | /// from the given file. | |||
void load(const Poco::XML::Document* pDocument); | void load(const Poco::XML::Document* pDocument); | |||
/// Loads the XML document containing the configuration data | /// Loads the XML document containing the configuration data | |||
/// from the given XML document. | /// from the given XML document. | |||
void load(const Poco::XML::Node* pNode); | void load(const Poco::XML::Node* pNode); | |||
/// Loads the XML document containing the configuration data | /// Loads the XML document containing the configuration data | |||
/// from the given XML node. | /// from the given XML node. | |||
void loadEmpty(const std::string& rootElementName); | ||||
/// Loads an empty XML document containing only the | ||||
/// root element with the given name. | ||||
void save(const std::string& path) const; | ||||
/// Writes the XML document containing the configuration dat | ||||
a | ||||
/// to the file given by path. | ||||
void save(std::ostream& str) const; | ||||
/// Writes the XML document containing the configuration dat | ||||
a | ||||
/// to the given stream. | ||||
void save(Poco::XML::DOMWriter& writer, const std::string& path) con | ||||
st; | ||||
/// Writes the XML document containing the configuration dat | ||||
a | ||||
/// to the file given by path, using the given DOMWriter. | ||||
/// | ||||
/// This can be used to use a DOMWriter with custom options. | ||||
void save(Poco::XML::DOMWriter& writer, std::ostream& str) const; | ||||
/// Writes the XML document containing the configuration dat | ||||
a | ||||
/// to the given stream. | ||||
/// | ||||
/// This can be used to use a DOMWriter with custom options. | ||||
protected: | protected: | |||
bool getRaw(const std::string& key, std::string& value) const; | bool getRaw(const std::string& key, std::string& value) const; | |||
void setRaw(const std::string& key, const std::string& value); | void setRaw(const std::string& key, const std::string& value); | |||
void enumerate(const std::string& key, Keys& range) const; | void enumerate(const std::string& key, Keys& range) const; | |||
~XMLConfiguration(); | ~XMLConfiguration(); | |||
private: | private: | |||
const Poco::XML::Node* findNode(const std::string& key) const; | const Poco::XML::Node* findNode(const std::string& key) const; | |||
static const Poco::XML::Node* findNode(std::string::const_iterator& | static Poco::XML::Node* findNode(std::string::const_iterator& it, co | |||
it, const std::string::const_iterator& end, const Poco::XML::Node* pNode); | nst std::string::const_iterator& end, Poco::XML::Node* pNode, bool create = | |||
static const Poco::XML::Node* findElement(const std::string& name, c | false); | |||
onst Poco::XML::Node* pNode); | static Poco::XML::Node* findElement(const std::string& name, Poco::X | |||
static const Poco::XML::Node* findElement(int index, const Poco::XML | ML::Node* pNode, bool create); | |||
::Node* pNode); | static Poco::XML::Node* findElement(int index, Poco::XML::Node* pNod | |||
static const Poco::XML::Node* findAttribute(const std::string& name, | e, bool create); | |||
const Poco::XML::Node* pNode); | static Poco::XML::Node* findAttribute(const std::string& name, Poco: | |||
:XML::Node* pNode, bool create); | ||||
Poco::XML::AutoPtr<Poco::XML::Node> _pRoot; | Poco::XML::AutoPtr<Poco::XML::Node> _pRoot; | |||
Poco::XML::AutoPtr<Poco::XML::Document> _pDocument; | Poco::XML::AutoPtr<Poco::XML::Document> _pDocument; | |||
}; | }; | |||
} } // namespace Poco::Util | } } // namespace Poco::Util | |||
#endif // Util_XMLConfiguration_INCLUDED | #endif // Util_XMLConfiguration_INCLUDED | |||
End of changes. 5 change blocks. | ||||
13 lines changed or deleted | 40 lines changed or added | |||