various bugfixes and improvements - see CHANGELOG for details

This commit is contained in:
Guenter Obiltschnig
2009-10-30 20:59:03 +00:00
parent 04ce436139
commit 015281b776
27 changed files with 506 additions and 108 deletions

View File

@@ -1,6 +1,6 @@
This is the changelog file for the POCO C++ Libraries. This is the changelog file for the POCO C++ Libraries.
Release 1.3.6 (2009-09-xx) Release 1.3.6 (2009-11-xx)
========================== ==========================
- added Environment::processorCount() - added Environment::processorCount()
@@ -44,6 +44,23 @@ Release 1.3.6 (2009-09-xx)
functions can be used to call WSAStartup() and WSACleanup(), respectively, functions can be used to call WSAStartup() and WSACleanup(), respectively,
in a platform-independent way (on platforms other than Windows, these in a platform-independent way (on platforms other than Windows, these
functions will simply do nothing). functions will simply do nothing).
- added VCexpress build script support (contributed by Jolyon Wright)
- fixed SF# 2851052: Poco::DirectoryIterator copy constructor is broken
- fixed SF# 2851197: IPAddress ctor throw keyword missing
- added Poco::ProtocolException
- PageCompiler improvements: new tags, support for buffered output, etc.
- better error reporting in Data MySQL connector (patch #2881270 by Jan "HanzZ" Kaluza)
- fixed SF# 1892462: FTPClient:Choose explicitely between EPSV and PASV
- fixed SF# 2806365: Option for PageCompiler to write output to different dir
- fixed a documentation bug (wrong sample code) in Process::launch() documentation
- added --header-output-dir option to PageCompiler
- fixed SF# 2849144: Zip::Decompress notifications error
- SAXParser has a new feature: "http://www.appinf.com/features/enable-partial-reads".
See ParserEngine::setEnablePartialReads() for a description of what this does.
- fixed SF# 2876179: MySQL Signed/Unsigned value bug
- fixed SF# 2877970: possible bug in timer task
- fixed SF# 2874104: wrong parsing empty http headers
- fixed SF# 2860694: Incorrect return code from SecureStreamSocketImpl::sendBytes
Release 1.3.5 (2009-05-11) Release 1.3.5 (2009-05-11)
@@ -1090,4 +1107,4 @@ building the libraries.
-- --
$Id: //poco/1.3/dist/CHANGELOG#50 $ $Id: //poco/1.3/dist/CHANGELOG#51 $

View File

@@ -1,7 +1,7 @@
// //
// MySQLException.cpp // MySQLException.cpp
// //
// $Id: //poco/1.3/Data/MySQL/src/ResultMetadata.cpp#6 $ // $Id: //poco/1.3/Data/MySQL/src/ResultMetadata.cpp#7 $
// //
// Library: Data/MySQL // Library: Data/MySQL
// Package: MySQL // Package: MySQL
@@ -235,7 +235,7 @@ void ResultMetadata::init(MYSQL_STMT* stmt)
_row[i].buffer = &_buffer[0] + offset; _row[i].buffer = &_buffer[0] + offset;
_row[i].length = &_lengths[i]; _row[i].length = &_lengths[i];
_row[i].is_null = &_isNull[i]; _row[i].is_null = &_isNull[i];
_row[i].is_unsigned = (my_bool) ((fields[i].flags & UNSIGNED_FLAG) == UNSIGNED_FLAG);
offset += _row[i].buffer_length; offset += _row[i].buffer_length;
} }
} }

View File

@@ -1,7 +1,7 @@
// //
// InflatingStream.h // InflatingStream.h
// //
// $Id: //poco/1.3/Foundation/include/Poco/InflatingStream.h#2 $ // $Id: //poco/1.3/Foundation/include/Poco/InflatingStream.h#3 $
// //
// Library: Foundation // Library: Foundation
// Package: Streams // Package: Streams
@@ -69,6 +69,7 @@ public:
InflatingStreamBuf(std::ostream& ostr, StreamType type); InflatingStreamBuf(std::ostream& ostr, StreamType type);
~InflatingStreamBuf(); ~InflatingStreamBuf();
int close(); int close();
void reset();
protected: protected:
int readFromDevice(char* buffer, std::streamsize length); int readFromDevice(char* buffer, std::streamsize length);
@@ -110,6 +111,7 @@ protected:
class Foundation_API InflatingOutputStream: public InflatingIOS, public std::ostream class Foundation_API InflatingOutputStream: public InflatingIOS, public std::ostream
/// This stream decompresses all data passing through it /// This stream decompresses all data passing through it
/// using zlib's inflate algorithm. /// using zlib's inflate algorithm.
///
/// After all data has been written to the stream, close() /// After all data has been written to the stream, close()
/// must be called to ensure completion of decompression. /// must be called to ensure completion of decompression.
{ {
@@ -128,10 +130,15 @@ class Foundation_API InflatingInputStream: public InflatingIOS, public std::istr
/// InflatingInputStream inflater(istr, InflatingStreamBuf::STREAM_GZIP); /// InflatingInputStream inflater(istr, InflatingStreamBuf::STREAM_GZIP);
/// std::string data; /// std::string data;
/// istr >> data; /// istr >> data;
///
/// The underlying input stream can contain more than one gzip/deflate stream.
/// After a gzip/deflate stream has been processed, reset() can be called
/// to inflate the next stream.
{ {
public: public:
InflatingInputStream(std::istream& istr, InflatingStreamBuf::StreamType type = InflatingStreamBuf::STREAM_ZLIB); InflatingInputStream(std::istream& istr, InflatingStreamBuf::StreamType type = InflatingStreamBuf::STREAM_ZLIB);
~InflatingInputStream(); ~InflatingInputStream();
void reset();
}; };

View File

@@ -1,7 +1,7 @@
// //
// Process.h // Process.h
// //
// $Id: //poco/1.3/Foundation/include/Poco/Process.h#1 $ // $Id: //poco/1.3/Foundation/include/Poco/Process.h#2 $
// //
// Library: Foundation // Library: Foundation
// Package: Processes // Package: Processes
@@ -139,7 +139,7 @@ public:
/// Usage example: /// Usage example:
/// Pipe outPipe; /// Pipe outPipe;
/// Process::Args args; /// Process::Args args;
/// ProcessHandle ph(launch("/bin/ps", args, &outPipe, 0, 0)); /// ProcessHandle ph(launch("/bin/ps", args, 0, &outPipe, 0));
/// PipeInputStream istr(outPipe); /// PipeInputStream istr(outPipe);
/// ... // read output of ps from istr /// ... // read output of ps from istr
/// int rc = ph.wait(); /// int rc = ph.wait();

View File

@@ -1,7 +1,7 @@
// //
// InflatingStream.cpp // InflatingStream.cpp
// //
// $Id: //poco/1.3/Foundation/src/InflatingStream.cpp#2 $ // $Id: //poco/1.3/Foundation/src/InflatingStream.cpp#3 $
// //
// Library: Foundation // Library: Foundation
// Package: Streams // Package: Streams
@@ -112,6 +112,16 @@ int InflatingStreamBuf::close()
} }
void InflatingStreamBuf::reset()
{
int rc = inflateReset(&_zstr);
if (rc == Z_OK)
_eof = false;
else
throw IOException(zError(rc));
}
int InflatingStreamBuf::readFromDevice(char* buffer, std::streamsize length) int InflatingStreamBuf::readFromDevice(char* buffer, std::streamsize length)
{ {
if (_eof || !_pIstr) return 0; if (_eof || !_pIstr) return 0;
@@ -262,4 +272,11 @@ InflatingInputStream::~InflatingInputStream()
} }
void InflatingInputStream::reset()
{
_buf.reset();
clear();
}
} // namespace Poco } // namespace Poco

View File

@@ -1,7 +1,7 @@
// //
// ZLibTest.cpp // ZLibTest.cpp
// //
// $Id: //poco/1.3/Foundation/testsuite/src/ZLibTest.cpp#1 $ // $Id: //poco/1.3/Foundation/testsuite/src/ZLibTest.cpp#2 $
// //
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
@@ -150,6 +150,35 @@ void ZLibTest::testGzip2()
} }
void ZLibTest::testGzip3()
{
std::stringstream buffer;
DeflatingOutputStream deflater1(buffer, DeflatingStreamBuf::STREAM_GZIP);
deflater1 << "abcdefabcdefabcdefabcdefabcdefabcdef" << std::endl;
deflater1 << "abcdefabcdefabcdefabcdefabcdefabcdef" << std::endl;
deflater1.close();
DeflatingOutputStream deflater2(buffer, DeflatingStreamBuf::STREAM_GZIP);
deflater2 << "bcdefabcdefabcdefabcdefabcdefabcdefa" << std::endl;
deflater2 << "bcdefabcdefabcdefabcdefabcdefabcdefa" << std::endl;
deflater2.close();
InflatingInputStream inflater(buffer, InflatingStreamBuf::STREAM_GZIP);
std::string data;
inflater >> data;
assert (data == "abcdefabcdefabcdefabcdefabcdefabcdef");
inflater >> data;
assert (data == "abcdefabcdefabcdefabcdefabcdefabcdef");
data.clear();
inflater >> data;
assert (data.empty());
assert (inflater.eof());
inflater.reset();
inflater >> data;
assert (data == "bcdefabcdefabcdefabcdefabcdefabcdefa");
inflater >> data;
assert (data == "bcdefabcdefabcdefabcdefabcdefabcdefa");
}
void ZLibTest::setUp() void ZLibTest::setUp()
{ {
} }
@@ -169,6 +198,7 @@ CppUnit::Test* ZLibTest::suite()
CppUnit_addTest(pSuite, ZLibTest, testDeflate3); CppUnit_addTest(pSuite, ZLibTest, testDeflate3);
CppUnit_addTest(pSuite, ZLibTest, testGzip1); CppUnit_addTest(pSuite, ZLibTest, testGzip1);
CppUnit_addTest(pSuite, ZLibTest, testGzip2); CppUnit_addTest(pSuite, ZLibTest, testGzip2);
CppUnit_addTest(pSuite, ZLibTest, testGzip3);
return pSuite; return pSuite;
} }

View File

@@ -1,7 +1,7 @@
// //
// ZLibTest.h // ZLibTest.h
// //
// $Id: //poco/1.3/Foundation/testsuite/src/ZLibTest.h#1 $ // $Id: //poco/1.3/Foundation/testsuite/src/ZLibTest.h#2 $
// //
// Definition of the ZLibTest class. // Definition of the ZLibTest class.
// //
@@ -51,6 +51,7 @@ public:
void testDeflate3(); void testDeflate3();
void testGzip1(); void testGzip1();
void testGzip2(); void testGzip2();
void testGzip3();
void setUp(); void setUp();
void tearDown(); void tearDown();

View File

@@ -1,7 +1,7 @@
// //
// FTPClientSession.h // FTPClientSession.h
// //
// $Id: //poco/1.3/Net/include/Poco/Net/FTPClientSession.h#1 $ // $Id: //poco/1.3/Net/include/Poco/Net/FTPClientSession.h#2 $
// //
// Library: Net // Library: Net
// Package: FTP // Package: FTP
@@ -101,8 +101,13 @@ public:
Poco::Timespan getTimeout() const; Poco::Timespan getTimeout() const;
/// Returns the timeout for socket operations. /// Returns the timeout for socket operations.
void setPassive(bool flag); void setPassive(bool flag, bool useRFC1738 = true);
/// Enables (default) or disables FTP passive mode for this session. /// Enables (default) or disables FTP passive mode for this session.
///
/// If useRFC1738 is true (the default), the RFC 1738
/// EPSV command is used (with a fallback to PASV if EPSV fails)
/// for switching to passive mode. The same applies to
/// EPRT and PORT for active connections.
bool getPassive() const; bool getPassive() const;
/// Returns true iff passive mode is enabled for this connection. /// Returns true iff passive mode is enabled for this connection.

View File

@@ -1,7 +1,7 @@
// //
// SocketImpl.h // SocketImpl.h
// //
// $Id: //poco/1.3/Net/include/Poco/Net/SocketImpl.h#6 $ // $Id: //poco/1.3/Net/include/Poco/Net/SocketImpl.h#7 $
// //
// Library: Net // Library: Net
// Package: Sockets // Package: Sockets
@@ -135,12 +135,18 @@ public:
/// ///
/// Returns the number of bytes sent, which may be /// Returns the number of bytes sent, which may be
/// less than the number of bytes specified. /// less than the number of bytes specified.
///
/// Certain socket implementations may also return a negative
/// value denoting a certain condition.
virtual int receiveBytes(void* buffer, int length, int flags = 0); virtual int receiveBytes(void* buffer, int length, int flags = 0);
/// Receives data from the socket and stores it /// Receives data from the socket and stores it
/// in buffer. Up to length bytes are received. /// in buffer. Up to length bytes are received.
/// ///
/// Returns the number of bytes received. /// Returns the number of bytes received.
///
/// Certain socket implementations may also return a negative
/// value denoting a certain condition.
virtual int sendTo(const void* buffer, int length, const SocketAddress& address, int flags = 0); virtual int sendTo(const void* buffer, int length, const SocketAddress& address, int flags = 0);
/// Sends the contents of the given buffer through /// Sends the contents of the given buffer through

View File

@@ -1,7 +1,7 @@
// //
// StreamSocket.h // StreamSocket.h
// //
// $Id: //poco/1.3/Net/include/Poco/Net/StreamSocket.h#3 $ // $Id: //poco/1.3/Net/include/Poco/Net/StreamSocket.h#4 $
// //
// Library: Net // Library: Net
// Package: Sockets // Package: Sockets
@@ -124,6 +124,9 @@ public:
/// ///
/// Returns the number of bytes sent, which may be /// Returns the number of bytes sent, which may be
/// less than the number of bytes specified. /// less than the number of bytes specified.
///
/// Certain socket implementations may also return a negative
/// value denoting a certain condition.
int receiveBytes(void* buffer, int length, int flags = 0); int receiveBytes(void* buffer, int length, int flags = 0);
/// Receives data from the socket and stores it /// Receives data from the socket and stores it

View File

@@ -1,7 +1,7 @@
// //
// StreamSocketImpl.h // StreamSocketImpl.h
// //
// $Id: //poco/1.3/Net/include/Poco/Net/StreamSocketImpl.h#2 $ // $Id: //poco/1.3/Net/include/Poco/Net/StreamSocketImpl.h#3 $
// //
// Library: Net // Library: Net
// Package: Sockets // Package: Sockets
@@ -63,7 +63,12 @@ public:
/// 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 if the socket
/// is blocking. In case of a non-blocking socket, sends as
/// many bytes as possible.
///
/// Returns the number of bytes sent. The return value may also be
/// negative to denote some special condition.
protected: protected:
virtual ~StreamSocketImpl(); virtual ~StreamSocketImpl();

View File

@@ -1,7 +1,7 @@
// //
// FTPClientSession.cpp // FTPClientSession.cpp
// //
// $Id: //poco/1.3/Net/src/FTPClientSession.cpp#2 $ // $Id: //poco/1.3/Net/src/FTPClientSession.cpp#3 $
// //
// Library: Net // Library: Net
// Package: FTP // Package: FTP
@@ -101,9 +101,10 @@ Poco::Timespan FTPClientSession::getTimeout() const
} }
void FTPClientSession::setPassive(bool flag) void FTPClientSession::setPassive(bool flag, bool useRFC1738)
{ {
_passiveMode = flag; _passiveMode = flag;
_supports1738 = useRFC1738;
} }

View File

@@ -1,7 +1,7 @@
// //
// MessageHeader.cpp // MessageHeader.cpp
// //
// $Id: //poco/1.3/Net/src/MessageHeader.cpp#3 $ // $Id: //poco/1.3/Net/src/MessageHeader.cpp#4 $
// //
// Library: Net // Library: Net
// Package: Messages // Package: Messages
@@ -94,7 +94,7 @@ void MessageHeader::read(std::istream& istr)
if (ch == '\n') { ch = istr.get(); continue; } // ignore invalid header lines if (ch == '\n') { ch = istr.get(); continue; } // ignore invalid header lines
if (ch != ':') throw MessageException("Field name too long/no colon found"); if (ch != ':') throw MessageException("Field name too long/no colon found");
if (ch != eof) ch = istr.get(); // ':' if (ch != eof) ch = istr.get(); // ':'
while (std::isspace(ch)) ch = istr.get(); while (ch != eof && std::isspace(ch) && ch != '\r' && ch != '\n') ch = istr.get();
while (ch != eof && ch != '\r' && ch != '\n' && value.length() < MAX_VALUE_LENGTH) { value += ch; ch = istr.get(); } while (ch != eof && ch != '\r' && ch != '\n' && value.length() < MAX_VALUE_LENGTH) { value += ch; ch = istr.get(); }
if (ch == '\r') ch = istr.get(); if (ch == '\r') ch = istr.get();
if (ch == '\n') if (ch == '\n')

View File

@@ -1,7 +1,7 @@
// //
// StreamSocketImpl.cpp // StreamSocketImpl.cpp
// //
// $Id: //poco/1.3/Net/src/StreamSocketImpl.cpp#6 $ // $Id: //poco/1.3/Net/src/StreamSocketImpl.cpp#7 $
// //
// Library: Net // Library: Net
// Package: Sockets // Package: Sockets
@@ -73,14 +73,16 @@ int StreamSocketImpl::sendBytes(const void* buffer, int length, int flags)
{ {
const char* p = reinterpret_cast<const char*>(buffer); const char* p = reinterpret_cast<const char*>(buffer);
int remaining = length; int remaining = length;
while (remaining > 0) int sent = 0;
while (remaining > 0 && getBlocking())
{ {
int n = SocketImpl::sendBytes(p, remaining, flags); int n = SocketImpl::sendBytes(p, remaining, flags);
if (n <= 0) return n; if (n <= 0) return n;
p += n; p += n;
remaining -= n; remaining -= n;
sent += n;
} }
return length; return sent;
} }

View File

@@ -1,7 +1,7 @@
// //
// MessageHeaderTest.cpp // MessageHeaderTest.cpp
// //
// $Id: //poco/1.3/Net/testsuite/src/MessageHeaderTest.cpp#1 $ // $Id: //poco/1.3/Net/testsuite/src/MessageHeaderTest.cpp#2 $
// //
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
@@ -123,6 +123,19 @@ void MessageHeaderTest::testRead4()
} }
void MessageHeaderTest::testRead5()
{
std::string s("name1:\r\nname2: value2\r\nname3: value3\r\n");
std::istringstream istr(s);
MessageHeader mh;
mh.read(istr);
assert (mh.size() == 3);
assert (mh["name1"] == "");
assert (mh["name2"] == "value2");
assert (mh["name3"] == "value3");
}
void MessageHeaderTest::testReadFolding1() void MessageHeaderTest::testReadFolding1()
{ {
std::string s("name1: value1\r\nname2: value21\r\n value22\r\nname3: value3\r\n"); std::string s("name1: value1\r\nname2: value21\r\n value22\r\nname3: value3\r\n");
@@ -371,6 +384,7 @@ CppUnit::Test* MessageHeaderTest::suite()
CppUnit_addTest(pSuite, MessageHeaderTest, testRead2); CppUnit_addTest(pSuite, MessageHeaderTest, testRead2);
CppUnit_addTest(pSuite, MessageHeaderTest, testRead3); CppUnit_addTest(pSuite, MessageHeaderTest, testRead3);
CppUnit_addTest(pSuite, MessageHeaderTest, testRead4); CppUnit_addTest(pSuite, MessageHeaderTest, testRead4);
CppUnit_addTest(pSuite, MessageHeaderTest, testRead5);
CppUnit_addTest(pSuite, MessageHeaderTest, testReadFolding1); CppUnit_addTest(pSuite, MessageHeaderTest, testReadFolding1);
CppUnit_addTest(pSuite, MessageHeaderTest, testReadFolding2); CppUnit_addTest(pSuite, MessageHeaderTest, testReadFolding2);
CppUnit_addTest(pSuite, MessageHeaderTest, testReadFolding3); CppUnit_addTest(pSuite, MessageHeaderTest, testReadFolding3);

View File

@@ -1,7 +1,7 @@
// //
// MessageHeaderTest.h // MessageHeaderTest.h
// //
// $Id: //poco/1.3/Net/testsuite/src/MessageHeaderTest.h#1 $ // $Id: //poco/1.3/Net/testsuite/src/MessageHeaderTest.h#2 $
// //
// Definition of the MessageHeaderTest class. // Definition of the MessageHeaderTest class.
// //
@@ -51,6 +51,7 @@ public:
void testRead2(); void testRead2();
void testRead3(); void testRead3();
void testRead4(); void testRead4();
void testRead5();
void testReadFolding1(); void testReadFolding1();
void testReadFolding2(); void testReadFolding2();
void testReadFolding3(); void testReadFolding3();

View File

@@ -1,7 +1,7 @@
// //
// SecureStreamSocketImpl.cpp // SecureStreamSocketImpl.cpp
// //
// $Id: //poco/1.3/NetSSL_OpenSSL/src/SecureStreamSocketImpl.cpp#6 $ // $Id: //poco/1.3/NetSSL_OpenSSL/src/SecureStreamSocketImpl.cpp#7 $
// //
// Library: NetSSL_OpenSSL // Library: NetSSL_OpenSSL
// Package: SSLSockets // Package: SSLSockets
@@ -126,13 +126,16 @@ int SecureStreamSocketImpl::sendBytes(const void* buffer, int length, int flags)
{ {
const char* p = reinterpret_cast<const char*>(buffer); const char* p = reinterpret_cast<const char*>(buffer);
int remaining = length; int remaining = length;
while (remaining > 0) int sent = 0;
while (remaining > 0 && getBlocking())
{ {
int n = _impl.sendBytes(p, length, flags); int n = _impl.sendBytes(p, remaining, flags);
if (n < 0) return n;
p += n; p += n;
remaining -= n; remaining -= n;
sent += n;
} }
return length; return sent;
} }

View File

@@ -1,7 +1,7 @@
// //
// PageCompiler.cpp // PageCompiler.cpp
// //
// $Id: //poco/1.3/PageCompiler/src/PageCompiler.cpp#3 $ // $Id: //poco/1.3/PageCompiler/src/PageCompiler.cpp#4 $
// //
// A compiler that compiler HTML pages containing JSP directives into C++ classes. // A compiler that compiler HTML pages containing JSP directives into C++ classes.
// //
@@ -118,6 +118,20 @@ protected:
.argument("<file>") .argument("<file>")
.callback(OptionCallback<CompilerApp>(this, &CompilerApp::handleConfig))); .callback(OptionCallback<CompilerApp>(this, &CompilerApp::handleConfig)));
options.addOption(
Option("output-dir", "o", "Write output files to directory <dir>.")
.required(false)
.repeatable(false)
.argument("<dir>")
.callback(OptionCallback<CompilerApp>(this, &CompilerApp::handleOutputDir)));
options.addOption(
Option("header-output-dir", "H", "Write header file to directory <dir>.")
.required(false)
.repeatable(false)
.argument("<dir>")
.callback(OptionCallback<CompilerApp>(this, &CompilerApp::handleHeaderOutputDir)));
options.addOption( options.addOption(
Option("osp", "O", "Add factory class definition and implementation for use with the Open Service Platform.") Option("osp", "O", "Add factory class definition and implementation for use with the Open Service Platform.")
.required(false) .required(false)
@@ -153,6 +167,16 @@ protected:
loadConfiguration(value); loadConfiguration(value);
} }
void handleOutputDir(const std::string& name, const std::string& value)
{
_outputDir = value;
}
void handleHeaderOutputDir(const std::string& name, const std::string& value)
{
_headerOutputDir = value;
}
void handleOSP(const std::string& name, const std::string& value) void handleOSP(const std::string& name, const std::string& value)
{ {
_generateOSPCode = true; _generateOSPCode = true;
@@ -232,7 +256,7 @@ protected:
Path p(path); Path p(path);
config().setString("inputFileName", p.getFileName()); config().setString("inputFileName", p.getFileName());
config().setString("inputFilePath", p.toString()); config().setString("inputFilePath", p.toString());
DateTime now; DateTime now;
config().setString("dateTime", DateTimeFormatter::format(now, DateTimeFormat::SORTABLE_FORMAT)); config().setString("dateTime", DateTimeFormatter::format(now, DateTimeFormat::SORTABLE_FORMAT));
@@ -250,24 +274,35 @@ protected:
std::auto_ptr<CodeWriter> pCodeWriter(createCodeWriter(page, clazz)); std::auto_ptr<CodeWriter> pCodeWriter(createCodeWriter(page, clazz));
if (!_outputDir.empty())
{
p = Path(_outputDir, p.getBaseName());
}
p.setExtension("cpp");
std::string implPath = p.toString();
std::string implFileName = p.getFileName();
if (!_headerOutputDir.empty())
{
p = Path(_headerOutputDir, p.getBaseName());
}
p.setExtension("h"); p.setExtension("h");
std::string headerPath = p.toString(); std::string headerPath = p.toString();
std::string headerFileName = p.getFileName(); std::string headerFileName = p.getFileName();
config().setString("outputFileName", p.getFileName());
config().setString("outputFilePath", headerPath);
FileOutputStream headerStream(headerPath);
OutputLineEndingConverter headerLEC(headerStream);
writeFileHeader(headerLEC);
pCodeWriter->writeHeader(headerLEC, p.getFileName());
p.setExtension("cpp"); config().setString("outputFileName", implFileName);
std::string implPath = p.toString();
config().setString("outputFileName", p.getFileName());
config().setString("outputFilePath", implPath); config().setString("outputFilePath", implPath);
FileOutputStream implStream(implPath); FileOutputStream implStream(implPath);
OutputLineEndingConverter implLEC(implStream); OutputLineEndingConverter implLEC(implStream);
writeFileHeader(implLEC); writeFileHeader(implLEC);
pCodeWriter->writeImpl(implLEC, headerFileName); pCodeWriter->writeImpl(implLEC, headerFileName);
config().setString("outputFileName", headerFileName);
config().setString("outputFilePath", headerPath);
FileOutputStream headerStream(headerPath);
OutputLineEndingConverter headerLEC(headerStream);
writeFileHeader(headerLEC);
pCodeWriter->writeHeader(headerLEC, headerFileName);
} }
void writeFileHeader(std::ostream& ostr) void writeFileHeader(std::ostream& ostr)
@@ -295,6 +330,8 @@ private:
bool _generateOSPCode; bool _generateOSPCode;
bool _generateApacheCode; bool _generateApacheCode;
bool _emitLineDirectives; bool _emitLineDirectives;
std::string _outputDir;
std::string _headerOutputDir;
}; };

View File

@@ -20,7 +20,6 @@ using Poco::DateTimeFormat;
</head> </head>
<%-- This is a server-side comment --%> <%-- This is a server-side comment --%>
<body> <body>
<%@ include page="header.inc" %>
<h1>Hello, World!</h1> <h1>Hello, World!</h1>
<p><%= dt %></p> <p><%= dt %></p>
</body> </body>

View File

@@ -1,7 +1,7 @@
// //
// Timer.cpp // Timer.cpp
// //
// $Id: //poco/1.3/Util/src/Timer.cpp#2 $ // $Id: //poco/1.3/Util/src/Timer.cpp#3 $
// //
// Library: Util // Library: Util
// Package: Timer // Package: Timer
@@ -237,16 +237,14 @@ Timer::Timer(Poco::Thread::Priority priority)
Timer::~Timer() Timer::~Timer()
{ {
Poco::Timestamp now; _queue.enqueueNotification(new StopNotification(_queue), 0);
_queue.enqueueNotification(new StopNotification(_queue), now);
_thread.join(); _thread.join();
} }
void Timer::cancel() void Timer::cancel()
{ {
Poco::Timestamp now; _queue.enqueueNotification(new CancelNotification(_queue), 0);
_queue.enqueueNotification(new CancelNotification(_queue), now);
} }

View File

@@ -1,7 +1,7 @@
// //
// SAXParser.h // SAXParser.h
// //
// $Id: //poco/1.3/XML/include/Poco/SAX/SAXParser.h#2 $ // $Id: //poco/1.3/XML/include/Poco/SAX/SAXParser.h#3 $
// //
// Library: XML // Library: XML
// Package: SAX // Package: SAX
@@ -59,6 +59,10 @@ class XML_API SAXParser: public XMLReader
/// * http://xml.org/sax/features/namespace-prefixes /// * http://xml.org/sax/features/namespace-prefixes
/// * http://xml.org/sax/properties/lexical-handler /// * http://xml.org/sax/properties/lexical-handler
/// * http://xml.org/sax/properties/declaration-handler /// * http://xml.org/sax/properties/declaration-handler
///
/// The following proprietary extensions are supported:
/// * http://www.appinf.com/features/enable-partial-reads --
/// see ParserEngine::setEnablePartialReads()
{ {
public: public:
SAXParser(); SAXParser();
@@ -102,6 +106,8 @@ public:
/// Extensions /// Extensions
void parseString(const std::string& xml); void parseString(const std::string& xml);
static const XMLString FEATURE_PARTIAL_READS;
protected: protected:
void setupParse(); void setupParse();

View File

@@ -1,7 +1,7 @@
// //
// ParserEngine.h // ParserEngine.h
// //
// $Id: //poco/1.3/XML/include/Poco/XML/ParserEngine.h#2 $ // $Id: //poco/1.3/XML/include/Poco/XML/ParserEngine.h#3 $
// //
// Library: XML // Library: XML
// Package: XML // Package: XML
@@ -160,6 +160,26 @@ public:
ErrorHandler* getErrorHandler() const; ErrorHandler* getErrorHandler() const;
/// Return the current error handler. /// Return the current error handler.
void setEnablePartialReads(bool flag = true);
/// Enable or disable partial reads from the input source.
///
/// This is useful for parsing XML from a socket stream for
/// a protocol like XMPP, where basically single elements
/// are read one at a time from the input source's stream, and
/// following elements depend upon responses sent back to
/// the peer.
///
/// Normally, the parser always reads blocks of PARSE_BUFFER_SIZE
/// at a time, and blocks until a complete block has been read (or
/// the end of the stream has been reached).
/// This allows for efficient parsing of "complete" XML documents,
/// but fails in a case such as XMPP, where only XML fragments
/// are sent at a time.
bool getEnablePartialReads() const;
/// Returns true if partial reads are enabled (see
/// setEnablePartialReads()), false otherwise.
void parse(InputSource* pInputSource); void parse(InputSource* pInputSource);
/// Parse an XML document from the given InputSource. /// Parse an XML document from the given InputSource.
@@ -189,6 +209,12 @@ protected:
void parseCharInputStream(XMLCharInputStream& istr); void parseCharInputStream(XMLCharInputStream& istr);
/// Parses an entity from the given stream. /// Parses an entity from the given stream.
std::streamsize readBytes(XMLByteInputStream& istr, char* pBuffer, std::streamsize bufferSize);
/// Reads at most bufferSize bytes from the given stream into the given buffer.
std::streamsize readChars(XMLCharInputStream& istr, XMLChar* pBuffer, std::streamsize bufferSize);
/// Reads at most bufferSize chars from the given stream into the given buffer.
void handleError(int errorNo); void handleError(int errorNo);
/// Throws an XMLException with a message corresponding /// Throws an XMLException with a message corresponding
@@ -252,6 +278,7 @@ private:
bool _expandInternalEntities; bool _expandInternalEntities;
bool _externalGeneralEntities; bool _externalGeneralEntities;
bool _externalParameterEntities; bool _externalParameterEntities;
bool _enablePartialReads;
NamespaceStrategy* _pNamespaceStrategy; NamespaceStrategy* _pNamespaceStrategy;
EncodingMap _encodings; EncodingMap _encodings;
ContextStack _context; ContextStack _context;
@@ -337,6 +364,12 @@ inline ErrorHandler* ParserEngine::getErrorHandler() const
} }
inline bool ParserEngine::getEnablePartialReads() const
{
return _enablePartialReads;
}
} } // namespace Poco::XML } } // namespace Poco::XML

View File

@@ -1,7 +1,7 @@
// //
// ParserEngine.cpp // ParserEngine.cpp
// //
// $Id: //poco/1.3/XML/src/ParserEngine.cpp#5 $ // $Id: //poco/1.3/XML/src/ParserEngine.cpp#6 $
// //
// Library: XML // Library: XML
// Package: XML // Package: XML
@@ -112,6 +112,7 @@ ParserEngine::ParserEngine():
_expandInternalEntities(true), _expandInternalEntities(true),
_externalGeneralEntities(false), _externalGeneralEntities(false),
_externalParameterEntities(false), _externalParameterEntities(false),
_enablePartialReads(false),
_pNamespaceStrategy(new NoNamespacesStrategy()), _pNamespaceStrategy(new NoNamespacesStrategy()),
_pEntityResolver(0), _pEntityResolver(0),
_pDTDHandler(0), _pDTDHandler(0),
@@ -131,6 +132,7 @@ ParserEngine::ParserEngine(const XMLString& encoding):
_expandInternalEntities(true), _expandInternalEntities(true),
_externalGeneralEntities(false), _externalGeneralEntities(false),
_externalParameterEntities(false), _externalParameterEntities(false),
_enablePartialReads(false),
_pNamespaceStrategy(new NoNamespacesStrategy()), _pNamespaceStrategy(new NoNamespacesStrategy()),
_pEntityResolver(0), _pEntityResolver(0),
_pDTDHandler(0), _pDTDHandler(0),
@@ -232,6 +234,12 @@ void ParserEngine::setErrorHandler(ErrorHandler* pErrorHandler)
} }
void ParserEngine::setEnablePartialReads(bool flag)
{
_enablePartialReads = flag;
}
void ParserEngine::parse(InputSource* pInputSource) void ParserEngine::parse(InputSource* pInputSource)
{ {
init(); init();
@@ -266,18 +274,15 @@ void ParserEngine::parse(const char* pBuffer, std::size_t size)
void ParserEngine::parseByteInputStream(XMLByteInputStream& istr) void ParserEngine::parseByteInputStream(XMLByteInputStream& istr)
{ {
istr.read(_pBuffer, PARSE_BUFFER_SIZE); std::streamsize n = readBytes(istr, _pBuffer, PARSE_BUFFER_SIZE);
int n = static_cast<int>(istr.gcount());
while (n > 0) while (n > 0)
{ {
if (!XML_Parse(_parser, _pBuffer, n, 0)) if (!XML_Parse(_parser, _pBuffer, n, 0))
handleError(XML_GetErrorCode(_parser)); handleError(XML_GetErrorCode(_parser));
if (istr.good()) if (istr.good())
{ n = readBytes(istr, _pBuffer, PARSE_BUFFER_SIZE);
istr.read(_pBuffer, PARSE_BUFFER_SIZE); else
n = static_cast<int>(istr.gcount()); n = 0;
}
else n = 0;
} }
if (!XML_Parse(_parser, _pBuffer, 0, 1)) if (!XML_Parse(_parser, _pBuffer, 0, 1))
handleError(XML_GetErrorCode(_parser)); handleError(XML_GetErrorCode(_parser));
@@ -286,18 +291,15 @@ void ParserEngine::parseByteInputStream(XMLByteInputStream& istr)
void ParserEngine::parseCharInputStream(XMLCharInputStream& istr) void ParserEngine::parseCharInputStream(XMLCharInputStream& istr)
{ {
istr.read(reinterpret_cast<XMLChar*>(_pBuffer), PARSE_BUFFER_SIZE/sizeof(XMLChar)); std::streamsize n = readChars(istr, reinterpret_cast<XMLChar*>(_pBuffer), PARSE_BUFFER_SIZE/sizeof(XMLChar));
int n = static_cast<int>(istr.gcount());
while (n > 0) while (n > 0)
{ {
if (!XML_Parse(_parser, _pBuffer, n*sizeof(XMLChar), 0)) if (!XML_Parse(_parser, _pBuffer, n*sizeof(XMLChar), 0))
handleError(XML_GetErrorCode(_parser)); handleError(XML_GetErrorCode(_parser));
if (istr.good()) if (istr.good())
{ n = readChars(istr, reinterpret_cast<XMLChar*>(_pBuffer), PARSE_BUFFER_SIZE/sizeof(XMLChar));
istr.read(reinterpret_cast<XMLChar*>(_pBuffer), PARSE_BUFFER_SIZE/sizeof(XMLChar)); else
n = static_cast<int>(istr.gcount()); n = 0;
}
else n = 0;
} }
if (!XML_Parse(_parser, _pBuffer, 0, 1)) if (!XML_Parse(_parser, _pBuffer, 0, 1))
handleError(XML_GetErrorCode(_parser)); handleError(XML_GetErrorCode(_parser));
@@ -321,18 +323,15 @@ void ParserEngine::parseExternalByteInputStream(XML_Parser extParser, XMLByteInp
char *pBuffer = new char[PARSE_BUFFER_SIZE]; char *pBuffer = new char[PARSE_BUFFER_SIZE];
try try
{ {
istr.read(pBuffer, PARSE_BUFFER_SIZE); std::streamsize n = readBytes(istr, pBuffer, PARSE_BUFFER_SIZE);
int n = static_cast<int>(istr.gcount());
while (n > 0) while (n > 0)
{ {
if (!XML_Parse(extParser, pBuffer, n, 0)) if (!XML_Parse(extParser, pBuffer, n, 0))
handleError(XML_GetErrorCode(extParser)); handleError(XML_GetErrorCode(extParser));
if (istr.good()) if (istr.good())
{ n = readBytes(istr, pBuffer, PARSE_BUFFER_SIZE);
istr.read(pBuffer, PARSE_BUFFER_SIZE); else
n = static_cast<int>(istr.gcount()); n = 0;
}
else n = 0;
} }
if (!XML_Parse(extParser, pBuffer, 0, 1)) if (!XML_Parse(extParser, pBuffer, 0, 1))
handleError(XML_GetErrorCode(extParser)); handleError(XML_GetErrorCode(extParser));
@@ -351,18 +350,15 @@ void ParserEngine::parseExternalCharInputStream(XML_Parser extParser, XMLCharInp
XMLChar *pBuffer = new XMLChar[PARSE_BUFFER_SIZE/sizeof(XMLChar)]; XMLChar *pBuffer = new XMLChar[PARSE_BUFFER_SIZE/sizeof(XMLChar)];
try try
{ {
istr.read(pBuffer, PARSE_BUFFER_SIZE/sizeof(XMLChar)); std::streamsize n = readBytes(istr, pBuffer, PARSE_BUFFER_SIZE/sizeof(XMLChar));
int n = static_cast<int>(istr.gcount());
while (n > 0) while (n > 0)
{ {
if (!XML_Parse(extParser, reinterpret_cast<char*>(pBuffer), n*sizeof(XMLChar), 0)) if (!XML_Parse(extParser, reinterpret_cast<char*>(pBuffer), n*sizeof(XMLChar), 0))
handleError(XML_GetErrorCode(extParser)); handleError(XML_GetErrorCode(extParser));
if (istr.good()) if (istr.good())
{ n = readBytes(istr, pBuffer, PARSE_BUFFER_SIZE/sizeof(XMLChar));
istr.read(pBuffer, PARSE_BUFFER_SIZE/sizeof(XMLChar)); else
n = static_cast<int>(istr.gcount()); n = 0;
}
else n = 0;
} }
if (!XML_Parse(extParser, reinterpret_cast<char*>(pBuffer), 0, 1)) if (!XML_Parse(extParser, reinterpret_cast<char*>(pBuffer), 0, 1))
handleError(XML_GetErrorCode(extParser)); handleError(XML_GetErrorCode(extParser));
@@ -376,6 +372,46 @@ void ParserEngine::parseExternalCharInputStream(XML_Parser extParser, XMLCharInp
} }
std::streamsize ParserEngine::readBytes(XMLByteInputStream& istr, char* pBuffer, std::streamsize bufferSize)
{
if (_enablePartialReads)
{
istr.read(pBuffer, 1);
if (istr.gcount() == 1)
{
std::streamsize n = istr.readsome(pBuffer + 1, bufferSize - 1);
return n + 1;
}
else return 0;
}
else
{
istr.read(pBuffer, bufferSize);
return istr.gcount();
}
}
std::streamsize ParserEngine::readChars(XMLCharInputStream& istr, XMLChar* pBuffer, std::streamsize bufferSize)
{
if (_enablePartialReads)
{
istr.read(_pBuffer, 1);
if (istr.gcount() == 1)
{
std::streamsize n = istr.readsome(pBuffer + 1, bufferSize - 1);
return n + 1;
}
else return 0;
}
else
{
istr.read(pBuffer, bufferSize);
return istr.gcount();
}
}
XMLString ParserEngine::getPublicId() const XMLString ParserEngine::getPublicId() const
{ {
return locator().getPublicId(); return locator().getPublicId();

View File

@@ -1,7 +1,7 @@
// //
// SAXParser.cpp // SAXParser.cpp
// //
// $Id: //poco/1.3/XML/src/SAXParser.cpp#2 $ // $Id: //poco/1.3/XML/src/SAXParser.cpp#3 $
// //
// Library: XML // Library: XML
// Package: SAX // Package: SAX
@@ -46,6 +46,9 @@ namespace Poco {
namespace XML { namespace XML {
const XMLString SAXParser::FEATURE_PARTIAL_READS = toXMLString("http://www.appinf.com/features/enable-partial-reads");
SAXParser::SAXParser(): SAXParser::SAXParser():
_namespaces(true), _namespaces(true),
_namespacePrefixes(false) _namespacePrefixes(false)
@@ -144,6 +147,8 @@ void SAXParser::setFeature(const XMLString& featureId, bool state)
_namespaces = state; _namespaces = state;
else if (featureId == XMLReader::FEATURE_NAMESPACE_PREFIXES) else if (featureId == XMLReader::FEATURE_NAMESPACE_PREFIXES)
_namespacePrefixes = state; _namespacePrefixes = state;
else if (featureId == FEATURE_PARTIAL_READS)
_engine.setEnablePartialReads(state);
else throw SAXNotRecognizedException(fromXMLString(featureId)); else throw SAXNotRecognizedException(fromXMLString(featureId));
} }
@@ -160,6 +165,8 @@ bool SAXParser::getFeature(const XMLString& featureId) const
return _namespaces; return _namespaces;
else if (featureId == XMLReader::FEATURE_NAMESPACE_PREFIXES) else if (featureId == XMLReader::FEATURE_NAMESPACE_PREFIXES)
return _namespacePrefixes; return _namespacePrefixes;
else if (featureId == FEATURE_PARTIAL_READS)
return _engine.getEnablePartialReads();
else throw SAXNotRecognizedException(fromXMLString(featureId)); else throw SAXNotRecognizedException(fromXMLString(featureId));
} }

View File

@@ -1,7 +1,7 @@
// //
// SAXParserTest.cpp // SAXParserTest.cpp
// //
// $Id: //poco/1.3/XML/testsuite/src/SAXParserTest.cpp#3 $ // $Id: //poco/1.3/XML/testsuite/src/SAXParserTest.cpp#4 $
// //
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
@@ -320,8 +320,18 @@ void SAXParserTest::testCharacters()
void SAXParserTest::testParseMemory() void SAXParserTest::testParseMemory()
{ {
SAXParser parser; SAXParser parser;
std::string xml = parseMemory(parser, XMLWriter::CANONICAL, ATTRIBUTES); std::string xml = parseMemory(parser, XMLWriter::CANONICAL | XMLWriter::PRETTY_PRINT, WSDL);
assert (xml == ATTRIBUTES); assert (xml == WSDL);
}
void SAXParserTest::testParsePartialReads()
{
SAXParser parser;
parser.setFeature("http://www.appinf.com/features/enable-partial-reads", true);
std::string xml = parse(parser, XMLWriter::CANONICAL | XMLWriter::PRETTY_PRINT, WSDL);
assert (xml == WSDL);
} }
@@ -340,6 +350,7 @@ std::string SAXParserTest::parse(XMLReader& reader, int options, const std::stri
std::istringstream istr(data); std::istringstream istr(data);
std::ostringstream ostr; std::ostringstream ostr;
XMLWriter writer(ostr, options); XMLWriter writer(ostr, options);
writer.setNewLine(XMLWriter::NEWLINE_LF);
reader.setContentHandler(&writer); reader.setContentHandler(&writer);
reader.setDTDHandler(&writer); reader.setDTDHandler(&writer);
reader.setProperty(XMLReader::PROPERTY_LEXICAL_HANDLER, static_cast<Poco::XML::LexicalHandler*>(&writer)); reader.setProperty(XMLReader::PROPERTY_LEXICAL_HANDLER, static_cast<Poco::XML::LexicalHandler*>(&writer));
@@ -351,9 +362,9 @@ std::string SAXParserTest::parse(XMLReader& reader, int options, const std::stri
std::string SAXParserTest::parseMemory(XMLReader& reader, int options, const std::string& data) std::string SAXParserTest::parseMemory(XMLReader& reader, int options, const std::string& data)
{ {
std::istringstream istr(data);
std::ostringstream ostr; std::ostringstream ostr;
XMLWriter writer(ostr, options); XMLWriter writer(ostr, options);
writer.setNewLine(XMLWriter::NEWLINE_LF);
reader.setContentHandler(&writer); reader.setContentHandler(&writer);
reader.setDTDHandler(&writer); reader.setDTDHandler(&writer);
reader.setProperty(XMLReader::PROPERTY_LEXICAL_HANDLER, static_cast<Poco::XML::LexicalHandler*>(&writer)); reader.setProperty(XMLReader::PROPERTY_LEXICAL_HANDLER, static_cast<Poco::XML::LexicalHandler*>(&writer));
@@ -386,8 +397,9 @@ CppUnit::Test* SAXParserTest::suite()
CppUnit_addTest(pSuite, SAXParserTest, testUndeclaredNoNamespace); CppUnit_addTest(pSuite, SAXParserTest, testUndeclaredNoNamespace);
CppUnit_addTest(pSuite, SAXParserTest, testRSS); CppUnit_addTest(pSuite, SAXParserTest, testRSS);
CppUnit_addTest(pSuite, SAXParserTest, testEncoding); CppUnit_addTest(pSuite, SAXParserTest, testEncoding);
CppUnit_addTest(pSuite, SAXParserTest, testParseMemory);
CppUnit_addTest(pSuite, SAXParserTest, testCharacters); CppUnit_addTest(pSuite, SAXParserTest, testCharacters);
CppUnit_addTest(pSuite, SAXParserTest, testParseMemory);
CppUnit_addTest(pSuite, SAXParserTest, testParsePartialReads);
return pSuite; return pSuite;
} }
@@ -1034,3 +1046,148 @@ const std::string SAXParserTest::RSS =
const std::string SAXParserTest::ENCODING = const std::string SAXParserTest::ENCODING =
"<?xml version=\"1.0\" encoding=\"ISO-8859-15\"?>" "<?xml version=\"1.0\" encoding=\"ISO-8859-15\"?>"
"<euro-sign>\244</euro-sign>"; "<euro-sign>\244</euro-sign>";
const std::string SAXParserTest::WSDL =
"<!-- WSDL description of the Google Web APIs.\n"
" The Google Web APIs are in beta release. All interfaces are subject to\n"
" change as we refine and extend our APIs. Please see the terms of use\n"
" for more information. -->\n"
"<!-- Revision 2002-08-16 -->\n"
"<ns1:definitions name=\"GoogleSearch\" targetNamespace=\"urn:GoogleSearch\" xmlns:ns1=\"http://schemas.xmlsoap.org/wsdl/\">\n"
"\t<!-- Types for search - result elements, directory categories -->\n"
"\t<ns1:types>\n"
"\t\t<ns2:schema targetNamespace=\"urn:GoogleSearch\" xmlns:ns2=\"http://www.w3.org/2001/XMLSchema\">\n"
"\t\t\t<ns2:complexType name=\"GoogleSearchResult\">\n"
"\t\t\t\t<ns2:all>\n"
"\t\t\t\t\t<ns2:element name=\"documentFiltering\" type=\"xsd:boolean\"/>\n"
"\t\t\t\t\t<ns2:element name=\"searchComments\" type=\"xsd:string\"/>\n"
"\t\t\t\t\t<ns2:element name=\"estimatedTotalResultsCount\" type=\"xsd:int\"/>\n"
"\t\t\t\t\t<ns2:element name=\"estimateIsExact\" type=\"xsd:boolean\"/>\n"
"\t\t\t\t\t<ns2:element name=\"resultElements\" type=\"typens:ResultElementArray\"/>\n"
"\t\t\t\t\t<ns2:element name=\"searchQuery\" type=\"xsd:string\"/>\n"
"\t\t\t\t\t<ns2:element name=\"startIndex\" type=\"xsd:int\"/>\n"
"\t\t\t\t\t<ns2:element name=\"endIndex\" type=\"xsd:int\"/>\n"
"\t\t\t\t\t<ns2:element name=\"searchTips\" type=\"xsd:string\"/>\n"
"\t\t\t\t\t<ns2:element name=\"directoryCategories\" type=\"typens:DirectoryCategoryArray\"/>\n"
"\t\t\t\t\t<ns2:element name=\"searchTime\" type=\"xsd:double\"/>\n"
"\t\t\t\t</ns2:all>\n"
"\t\t\t</ns2:complexType>\n"
"\t\t\t<ns2:complexType name=\"ResultElement\">\n"
"\t\t\t\t<ns2:all>\n"
"\t\t\t\t\t<ns2:element name=\"summary\" type=\"xsd:string\"/>\n"
"\t\t\t\t\t<ns2:element name=\"URL\" type=\"xsd:string\"/>\n"
"\t\t\t\t\t<ns2:element name=\"snippet\" type=\"xsd:string\"/>\n"
"\t\t\t\t\t<ns2:element name=\"title\" type=\"xsd:string\"/>\n"
"\t\t\t\t\t<ns2:element name=\"cachedSize\" type=\"xsd:string\"/>\n"
"\t\t\t\t\t<ns2:element name=\"relatedInformationPresent\" type=\"xsd:boolean\"/>\n"
"\t\t\t\t\t<ns2:element name=\"hostName\" type=\"xsd:string\"/>\n"
"\t\t\t\t\t<ns2:element name=\"directoryCategory\" type=\"typens:DirectoryCategory\"/>\n"
"\t\t\t\t\t<ns2:element name=\"directoryTitle\" type=\"xsd:string\"/>\n"
"\t\t\t\t</ns2:all>\n"
"\t\t\t</ns2:complexType>\n"
"\t\t\t<ns2:complexType name=\"ResultElementArray\">\n"
"\t\t\t\t<ns2:complexContent>\n"
"\t\t\t\t\t<ns2:restriction base=\"soapenc:Array\">\n"
"\t\t\t\t\t\t<ns2:attribute ns1:arrayType=\"typens:ResultElement[]\" ref=\"soapenc:arrayType\"/>\n"
"\t\t\t\t\t</ns2:restriction>\n"
"\t\t\t\t</ns2:complexContent>\n"
"\t\t\t</ns2:complexType>\n"
"\t\t\t<ns2:complexType name=\"DirectoryCategoryArray\">\n"
"\t\t\t\t<ns2:complexContent>\n"
"\t\t\t\t\t<ns2:restriction base=\"soapenc:Array\">\n"
"\t\t\t\t\t\t<ns2:attribute ns1:arrayType=\"typens:DirectoryCategory[]\" ref=\"soapenc:arrayType\"/>\n"
"\t\t\t\t\t</ns2:restriction>\n"
"\t\t\t\t</ns2:complexContent>\n"
"\t\t\t</ns2:complexType>\n"
"\t\t\t<ns2:complexType name=\"DirectoryCategory\">\n"
"\t\t\t\t<ns2:all>\n"
"\t\t\t\t\t<ns2:element name=\"fullViewableName\" type=\"xsd:string\"/>\n"
"\t\t\t\t\t<ns2:element name=\"specialEncoding\" type=\"xsd:string\"/>\n"
"\t\t\t\t</ns2:all>\n"
"\t\t\t</ns2:complexType>\n"
"\t\t</ns2:schema>\n"
"\t</ns1:types>\n"
"\t<!-- Messages for Google Web APIs - cached page, search, spelling. -->\n"
"\t<ns1:message name=\"doGetCachedPage\">\n"
"\t\t<ns1:part name=\"key\" type=\"xsd:string\"/>\n"
"\t\t<ns1:part name=\"url\" type=\"xsd:string\"/>\n"
"\t</ns1:message>\n"
"\t<ns1:message name=\"doGetCachedPageResponse\">\n"
"\t\t<ns1:part name=\"return\" type=\"xsd:base64Binary\"/>\n"
"\t</ns1:message>\n"
"\t<ns1:message name=\"doSpellingSuggestion\">\n"
"\t\t<ns1:part name=\"key\" type=\"xsd:string\"/>\n"
"\t\t<ns1:part name=\"phrase\" type=\"xsd:string\"/>\n"
"\t</ns1:message>\n"
"\t<ns1:message name=\"doSpellingSuggestionResponse\">\n"
"\t\t<ns1:part name=\"return\" type=\"xsd:string\"/>\n"
"\t</ns1:message>\n"
"\t<!-- note, ie and oe are ignored by server; all traffic is UTF-8. -->\n"
"\t<ns1:message name=\"doGoogleSearch\">\n"
"\t\t<ns1:part name=\"key\" type=\"xsd:string\"/>\n"
"\t\t<ns1:part name=\"q\" type=\"xsd:string\"/>\n"
"\t\t<ns1:part name=\"start\" type=\"xsd:int\"/>\n"
"\t\t<ns1:part name=\"maxResults\" type=\"xsd:int\"/>\n"
"\t\t<ns1:part name=\"filter\" type=\"xsd:boolean\"/>\n"
"\t\t<ns1:part name=\"restrict\" type=\"xsd:string\"/>\n"
"\t\t<ns1:part name=\"safeSearch\" type=\"xsd:boolean\"/>\n"
"\t\t<ns1:part name=\"lr\" type=\"xsd:string\"/>\n"
"\t\t<ns1:part name=\"ie\" type=\"xsd:string\"/>\n"
"\t\t<ns1:part name=\"oe\" type=\"xsd:string\"/>\n"
"\t</ns1:message>\n"
"\t<ns1:message name=\"doGoogleSearchResponse\">\n"
"\t\t<ns1:part name=\"return\" type=\"typens:GoogleSearchResult\"/>\n"
"\t</ns1:message>\n"
"\t<!-- Port for Google Web APIs, \"GoogleSearch\" -->\n"
"\t<ns1:portType name=\"GoogleSearchPort\">\n"
"\t\t<ns1:operation name=\"doGetCachedPage\">\n"
"\t\t\t<ns1:input message=\"typens:doGetCachedPage\"/>\n"
"\t\t\t<ns1:output message=\"typens:doGetCachedPageResponse\"/>\n"
"\t\t</ns1:operation>\n"
"\t\t<ns1:operation name=\"doSpellingSuggestion\">\n"
"\t\t\t<ns1:input message=\"typens:doSpellingSuggestion\"/>\n"
"\t\t\t<ns1:output message=\"typens:doSpellingSuggestionResponse\"/>\n"
"\t\t</ns1:operation>\n"
"\t\t<ns1:operation name=\"doGoogleSearch\">\n"
"\t\t\t<ns1:input message=\"typens:doGoogleSearch\"/>\n"
"\t\t\t<ns1:output message=\"typens:doGoogleSearchResponse\"/>\n"
"\t\t</ns1:operation>\n"
"\t</ns1:portType>\n"
"\t<!-- Binding for Google Web APIs - RPC, SOAP over HTTP -->\n"
"\t<ns1:binding name=\"GoogleSearchBinding\" type=\"typens:GoogleSearchPort\">\n"
"\t\t<ns3:binding style=\"rpc\" transport=\"http://schemas.xmlsoap.org/soap/http\" xmlns:ns3=\"http://schemas.xmlsoap.org/wsdl/soap/\"/>\n"
"\t\t<ns1:operation name=\"doGetCachedPage\" xmlns:ns3=\"http://schemas.xmlsoap.org/wsdl/soap/\">\n"
"\t\t\t<ns3:operation soapAction=\"urn:GoogleSearchAction\"/>\n"
"\t\t\t<ns1:input>\n"
"\t\t\t\t<ns3:body encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" namespace=\"urn:GoogleSearch\" use=\"encoded\"/>\n"
"\t\t\t</ns1:input>\n"
"\t\t\t<ns1:output>\n"
"\t\t\t\t<ns3:body encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" namespace=\"urn:GoogleSearch\" use=\"encoded\"/>\n"
"\t\t\t</ns1:output>\n"
"\t\t</ns1:operation>\n"
"\t\t<ns1:operation name=\"doSpellingSuggestion\" xmlns:ns3=\"http://schemas.xmlsoap.org/wsdl/soap/\">\n"
"\t\t\t<ns3:operation soapAction=\"urn:GoogleSearchAction\"/>\n"
"\t\t\t<ns1:input>\n"
"\t\t\t\t<ns3:body encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" namespace=\"urn:GoogleSearch\" use=\"encoded\"/>\n"
"\t\t\t</ns1:input>\n"
"\t\t\t<ns1:output>\n"
"\t\t\t\t<ns3:body encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" namespace=\"urn:GoogleSearch\" use=\"encoded\"/>\n"
"\t\t\t</ns1:output>\n"
"\t\t</ns1:operation>\n"
"\t\t<ns1:operation name=\"doGoogleSearch\" xmlns:ns3=\"http://schemas.xmlsoap.org/wsdl/soap/\">\n"
"\t\t\t<ns3:operation soapAction=\"urn:GoogleSearchAction\"/>\n"
"\t\t\t<ns1:input>\n"
"\t\t\t\t<ns3:body encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" namespace=\"urn:GoogleSearch\" use=\"encoded\"/>\n"
"\t\t\t</ns1:input>\n"
"\t\t\t<ns1:output>\n"
"\t\t\t\t<ns3:body encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" namespace=\"urn:GoogleSearch\" use=\"encoded\"/>\n"
"\t\t\t</ns1:output>\n"
"\t\t</ns1:operation>\n"
"\t</ns1:binding>\n"
"\t<!-- Endpoint for Google Web APIs -->\n"
"\t<ns1:service name=\"GoogleSearchService\">\n"
"\t\t<ns1:port binding=\"typens:GoogleSearchBinding\" name=\"GoogleSearchPort\">\n"
"\t\t\t<ns4:address location=\"http://api.google.com/search/beta2\" xmlns:ns4=\"http://schemas.xmlsoap.org/wsdl/soap/\"/>\n"
"\t\t</ns1:port>\n"
"\t</ns1:service>\n"
"</ns1:definitions>\n";

View File

@@ -1,7 +1,7 @@
// //
// SAXParserTest.h // SAXParserTest.h
// //
// $Id: //poco/1.3/XML/testsuite/src/SAXParserTest.h#2 $ // $Id: //poco/1.3/XML/testsuite/src/SAXParserTest.h#3 $
// //
// Definition of the SAXParserTest class. // Definition of the SAXParserTest class.
// //
@@ -69,6 +69,7 @@ public:
void testEncoding(); void testEncoding();
void testParseMemory(); void testParseMemory();
void testCharacters(); void testCharacters();
void testParsePartialReads();
void setUp(); void setUp();
void tearDown(); void tearDown();
@@ -96,6 +97,7 @@ public:
static const std::string XHTML_LATIN1_ENTITIES; static const std::string XHTML_LATIN1_ENTITIES;
static const std::string RSS; static const std::string RSS;
static const std::string ENCODING; static const std::string ENCODING;
static const std::string WSDL;
}; };

View File

@@ -8,12 +8,13 @@ rem command-line build script for MS Visual Studio
rem rem
rem Usage: rem Usage:
rem ------ rem ------
rem buildwin VS_VERSION [ACTION] [LINKMODE] [CONFIGURATION] [SAMPLES] rem buildwin VS_VERSION [ACTION] [LINKMODE] [CONFIGURATION] [SAMPLES] [DEVENV]
rem VS_VERSION: 71|80|90 rem VS_VERSION: 71|80|90
rem ACTION: build|rebuild|clean rem ACTION: build|rebuild|clean
rem LINKMODE: static|shared|both rem LINKMODE: static|shared|both
rem CONFIG: release|debug|both rem CONFIG: release|debug|both
rem SAMPLES: yes|no (shared only) rem SAMPLES: yes|no (shared only)
rem DEVENV: devenv|vcexpress
rem rem
rem VS_VERSION is required argument. Default is build all. rem VS_VERSION is required argument. Default is build all.
@@ -30,6 +31,15 @@ rem VS version {71|80|90}
if "%1"=="" goto usage if "%1"=="" goto usage
set VS_VERSION=vs%1 set VS_VERSION=vs%1
if "%6"=="" goto USE_DEVENV
set BUILD_TOOL="%6"
goto USE_CUSTOM
:USE_DEVENV
set BUILD_TOOL=devenv
:USE_CUSTOM
rem Action [build|rebuild|clean] rem Action [build|rebuild|clean]
set ACTION=%2 set ACTION=%2
if not "%ACTION%"=="build" ( if not "%ACTION%"=="build" (
@@ -134,37 +144,37 @@ for /f %%G in ('findstr /R "." components') do (
if exist %%Q_%VS_VERSION%.sln ( if exist %%Q_%VS_VERSION%.sln (
echo. echo.
echo ========== Building %%G ========== echo ========== Building %%G ==========
if %DEBUG_SHARED%==1 (devenv /useenv /%ACTION% debug_shared %%Q_%VS_VERSION%.sln) if %DEBUG_SHARED%==1 (%BUILD_TOOL% /useenv /%ACTION% debug_shared %%Q_%VS_VERSION%.sln)
if %RELEASE_SHARED%==1 (devenv /useenv /%ACTION% release_shared %%Q_%VS_VERSION%.sln) if %RELEASE_SHARED%==1 (%BUILD_TOOL% /useenv /%ACTION% release_shared %%Q_%VS_VERSION%.sln)
if %DEBUG_STATIC%==1 (devenv /useenv /%ACTION% debug_static %%Q_%VS_VERSION%.sln) if %DEBUG_STATIC%==1 (%BUILD_TOOL% /useenv /%ACTION% debug_static %%Q_%VS_VERSION%.sln)
if %RELEASE_STATIC%==1 (devenv /useenv /%ACTION% release_static %%Q_%VS_VERSION%.sln) if %RELEASE_STATIC%==1 (%BUILD_TOOL% /useenv /%ACTION% release_static %%Q_%VS_VERSION%.sln)
) )
if exist %%R_%VS_VERSION%.sln ( if exist %%R_%VS_VERSION%.sln (
echo. echo.
echo ========== Building %%G ========== echo ========== Building %%G ==========
if %DEBUG_SHARED%==1 (devenv /useenv /%ACTION% debug_shared %%R_%VS_VERSION%.sln) if %DEBUG_SHARED%==1 (%BUILD_TOOL% /useenv /%ACTION% debug_shared %%R_%VS_VERSION%.sln)
if %RELEASE_SHARED%==1 (devenv /useenv /%ACTION% release_shared %%R_%VS_VERSION%.sln) if %RELEASE_SHARED%==1 (%BUILD_TOOL% /useenv /%ACTION% release_shared %%R_%VS_VERSION%.sln)
if %DEBUG_STATIC%==1 (devenv /useenv /%ACTION% debug_static %%R_%VS_VERSION%.sln) if %DEBUG_STATIC%==1 (%BUILD_TOOL% /useenv /%ACTION% debug_static %%R_%VS_VERSION%.sln)
if %RELEASE_STATIC%==1 (devenv /useenv /%ACTION% release_static %%R_%VS_VERSION%.sln) if %RELEASE_STATIC%==1 (%BUILD_TOOL% /useenv /%ACTION% release_static %%R_%VS_VERSION%.sln)
) )
if exist %%S_%VS_VERSION%.sln ( if exist %%S_%VS_VERSION%.sln (
echo. echo.
echo ========== Building %%G ========== echo ========== Building %%G ==========
if %DEBUG_SHARED%==1 (devenv /useenv /%ACTION% debug_shared %%S_%VS_VERSION%.sln) if %DEBUG_SHARED%==1 (%BUILD_TOOL% /useenv /%ACTION% debug_shared %%S_%VS_VERSION%.sln)
if %RELEASE_SHARED%==1 (devenv /useenv /%ACTION% release_shared %%S_%VS_VERSION%.sln) if %RELEASE_SHARED%==1 (%BUILD_TOOL% /useenv /%ACTION% release_shared %%S_%VS_VERSION%.sln)
if %DEBUG_STATIC%==1 (devenv /useenv /%ACTION% debug_static %%S_%VS_VERSION%.sln) if %DEBUG_STATIC%==1 (%BUILD_TOOL% /useenv /%ACTION% debug_static %%S_%VS_VERSION%.sln)
if %RELEASE_STATIC%==1 (devenv /useenv /%ACTION% release_static %%S_%VS_VERSION%.sln) if %RELEASE_STATIC%==1 (%BUILD_TOOL% /useenv /%ACTION% release_static %%S_%VS_VERSION%.sln)
) )
if exist %%T_%VS_VERSION%.sln ( if exist %%T_%VS_VERSION%.sln (
echo. echo.
echo ========== Building %%G ========== echo ========== Building %%G ==========
if %DEBUG_SHARED%==1 (devenv /useenv /%ACTION% debug_shared %%T_%VS_VERSION%.sln) if %DEBUG_SHARED%==1 (%BUILD_TOOL% /useenv /%ACTION% debug_shared %%T_%VS_VERSION%.sln)
if %RELEASE_SHARED%==1 (devenv /useenv /%ACTION% release_shared %%T_%VS_VERSION%.sln) if %RELEASE_SHARED%==1 (%BUILD_TOOL% /useenv /%ACTION% release_shared %%T_%VS_VERSION%.sln)
if %DEBUG_STATIC%==1 (devenv /useenv /%ACTION% debug_static %%T_%VS_VERSION%.sln) if %DEBUG_STATIC%==1 (%BUILD_TOOL% /useenv /%ACTION% debug_static %%T_%VS_VERSION%.sln)
if %RELEASE_STATIC%==1 (devenv /useenv /%ACTION% release_static %%T_%VS_VERSION%.sln) if %RELEASE_STATIC%==1 (%BUILD_TOOL% /useenv /%ACTION% release_static %%T_%VS_VERSION%.sln)
) )
) )
cd %POCOBASE% cd %POCOBASE%
@@ -179,8 +189,8 @@ for /f %%G in ('findstr /R "." components') do (
cd %%G\samples cd %%G\samples
echo. echo.
echo ========== Building %%G/samples ========== echo ========== Building %%G/samples ==========
if %DEBUG_SHARED%==1 devenv /useenv /%ACTION% debug_shared samples_%VS_VERSION%.sln if %DEBUG_SHARED%==1 %BUILD_TOOL% /useenv /%ACTION% debug_shared samples_%VS_VERSION%.sln
if %RELEASE_SHARED%==1 devenv /useenv /%ACTION% release_shared samples_%VS_VERSION%.sln if %RELEASE_SHARED%==1 %BUILD_TOOL% /useenv /%ACTION% release_shared samples_%VS_VERSION%.sln
cd %POCOBASE% cd %POCOBASE%
) )
) )
@@ -190,12 +200,13 @@ goto :EOF
:usage :usage
echo Usage: echo Usage:
echo ------ echo ------
echo buildwin VS_VERSION [ACTION] [LINKMODE] [CONFIGURATION] [SAMPLES] echo buildwin VS_VERSION [ACTION] [LINKMODE] [CONFIGURATION] [SAMPLES] [DEVENV]
echo VS_VERSION: "71|80|90" echo VS_VERSION: "71|80|90"
echo ACTION: "build|rebuild|clean" echo ACTION: "build|rebuild|clean"
echo LINKMODE: "static|shared|both" echo LINKMODE: "static|shared|both"
echo CONFIG: "release|debug|both" echo CONFIG: "release|debug|both"
echo SAMPLES: "yes|no" (shared only) echo SAMPLES: "yes|no" (shared only)
echo. echo DEVENV: "devenv|vcexpress"
echo.
echo Default is build all. echo Default is build all.
endlocal endlocal