mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-14 02:57:45 +01:00
ifdef auto_ptr
This commit is contained in:
parent
87ec631b4a
commit
1a18621ff8
@ -170,8 +170,9 @@ extern "C" int ApacheConnector_handler(request_rec *r)
|
|||||||
|
|
||||||
apr_status_t rv;
|
apr_status_t rv;
|
||||||
if ((rv = ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK)))
|
if ((rv = ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK)))
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
|
#ifndef POCO_ENABLE_CPP11
|
||||||
std::auto_ptr<ApacheServerRequest> pRequest(new ApacheServerRequest(
|
std::auto_ptr<ApacheServerRequest> pRequest(new ApacheServerRequest(
|
||||||
&rec,
|
&rec,
|
||||||
r->connection->local_ip,
|
r->connection->local_ip,
|
||||||
@ -180,13 +181,28 @@ extern "C" int ApacheConnector_handler(request_rec *r)
|
|||||||
r->connection->remote_addr->port));
|
r->connection->remote_addr->port));
|
||||||
|
|
||||||
std::auto_ptr<ApacheServerResponse> pResponse(new ApacheServerResponse(pRequest.get()));
|
std::auto_ptr<ApacheServerResponse> pResponse(new ApacheServerResponse(pRequest.get()));
|
||||||
|
#else
|
||||||
|
std::unique_ptr<ApacheServerRequest> pRequest(new ApacheServerRequest(
|
||||||
|
&rec,
|
||||||
|
r->connection->local_ip,
|
||||||
|
r->connection->local_addr->port,
|
||||||
|
r->connection->remote_ip,
|
||||||
|
r->connection->remote_addr->port));
|
||||||
|
|
||||||
|
std::unique_ptr<ApacheServerResponse> pResponse(new ApacheServerResponse(pRequest.get()));
|
||||||
|
#endif // POCO_ENABLE_CPP11
|
||||||
|
|
||||||
// add header information to request
|
// add header information to request
|
||||||
rec.copyHeaders(*pRequest);
|
rec.copyHeaders(*pRequest);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#ifndef POCO_ENABLE_CPP11
|
||||||
std::auto_ptr<HTTPRequestHandler> pHandler(app.factory().createRequestHandler(*pRequest));
|
std::auto_ptr<HTTPRequestHandler> pHandler(app.factory().createRequestHandler(*pRequest));
|
||||||
|
#else
|
||||||
|
std::unique_ptr<HTTPRequestHandler> pHandler(app.factory().createRequestHandler(*pRequest));
|
||||||
|
#endif // POCO_ENABLE_CPP11
|
||||||
|
|
||||||
if (pHandler.get())
|
if (pHandler.get())
|
||||||
{
|
{
|
||||||
|
@ -79,11 +79,11 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
TestMethod _test;
|
TestMethod _test;
|
||||||
#if __cplusplus < 201103L
|
#ifndef POCO_ENABLE_CPP11
|
||||||
std::auto_ptr<Fixture> _fixture;
|
std::auto_ptr<Fixture> _fixture;
|
||||||
#else
|
#else
|
||||||
std::unique_ptr<Fixture> _fixture;
|
std::unique_ptr<Fixture> _fixture;
|
||||||
#endif
|
#endif // POCO_ENABLE_CPP11
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -87,11 +87,12 @@ public:
|
|||||||
|
|
||||||
FastMutex::ScopedLock lock(_mutex);
|
FastMutex::ScopedLock lock(_mutex);
|
||||||
|
|
||||||
#if __cplusplus < 201103L
|
#ifndef POCO_ENABLE_CPP11
|
||||||
std::auto_ptr<AbstractFactory> ptr(pAbstractFactory);
|
std::auto_ptr<AbstractFactory> ptr(pAbstractFactory);
|
||||||
#else
|
#else
|
||||||
std::unique_ptr<AbstractFactory> ptr(pAbstractFactory);
|
std::unique_ptr<AbstractFactory> ptr(pAbstractFactory);
|
||||||
#endif
|
#endif // POCO_ENABLE_CPP11
|
||||||
|
|
||||||
typename FactoryMap::iterator it = _map.find(className);
|
typename FactoryMap::iterator it = _map.find(className);
|
||||||
if (it == _map.end())
|
if (it == _map.end())
|
||||||
_map[className] = ptr.release();
|
_map[className] = ptr.release();
|
||||||
|
@ -57,11 +57,11 @@ void pad(std::string& str, int precision, int width, char prefix = ' ', char dec
|
|||||||
std::string::size_type frac = str.length() - decSepPos - 1;
|
std::string::size_type frac = str.length() - decSepPos - 1;
|
||||||
|
|
||||||
std::string::size_type ePos = str.find_first_of("eE");
|
std::string::size_type ePos = str.find_first_of("eE");
|
||||||
#if __cplusplus < 201103L
|
#ifndef POCO_ENABLE_CPP11
|
||||||
std::auto_ptr<std::string> eStr;
|
std::auto_ptr<std::string> eStr;
|
||||||
#else
|
#else
|
||||||
std::unique_ptr<std::string> eStr;
|
std::unique_ptr<std::string> eStr;
|
||||||
#endif
|
#endif // POCO_ENABLE_CPP11
|
||||||
if (ePos != std::string::npos)
|
if (ePos != std::string::npos)
|
||||||
{
|
{
|
||||||
eStr.reset(new std::string(str.substr(ePos, std::string::npos)));
|
eStr.reset(new std::string(str.substr(ePos, std::string::npos)));
|
||||||
|
@ -65,10 +65,15 @@ void DynamicFactoryTest::testDynamicFactory()
|
|||||||
assert (dynFactory.isClass("B"));
|
assert (dynFactory.isClass("B"));
|
||||||
|
|
||||||
assert (!dynFactory.isClass("C"));
|
assert (!dynFactory.isClass("C"));
|
||||||
|
|
||||||
|
#ifndef POCO_ENABLE_CPP11
|
||||||
std::auto_ptr<A> a(dynamic_cast<A*>(dynFactory.createInstance("A")));
|
std::auto_ptr<A> a(dynamic_cast<A*>(dynFactory.createInstance("A")));
|
||||||
std::auto_ptr<B> b(dynamic_cast<B*>(dynFactory.createInstance("B")));
|
std::auto_ptr<B> b(dynamic_cast<B*>(dynFactory.createInstance("B")));
|
||||||
|
#else
|
||||||
|
std::unique_ptr<A> a(dynamic_cast<A*>(dynFactory.createInstance("A")));
|
||||||
|
std::unique_ptr<B> b(dynamic_cast<B*>(dynFactory.createInstance("B")));
|
||||||
|
#endif // POCO_ENABLE_CPP11
|
||||||
|
|
||||||
assertNotNull(a.get());
|
assertNotNull(a.get());
|
||||||
assertNotNull(b.get());
|
assertNotNull(b.get());
|
||||||
|
|
||||||
@ -87,7 +92,11 @@ void DynamicFactoryTest::testDynamicFactory()
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
#ifndef POCO_ENABLE_CPP11
|
||||||
std::auto_ptr<B> b(dynamic_cast<B*>(dynFactory.createInstance("B")));
|
std::auto_ptr<B> b(dynamic_cast<B*>(dynFactory.createInstance("B")));
|
||||||
|
#else
|
||||||
|
std::unique_ptr<B> b(dynamic_cast<B*>(dynFactory.createInstance("B")));
|
||||||
|
#endif // POCO_ENABLE_CPP11
|
||||||
fail("unregistered - must throw");
|
fail("unregistered - must throw");
|
||||||
}
|
}
|
||||||
catch (Poco::NotFoundException&)
|
catch (Poco::NotFoundException&)
|
||||||
|
@ -111,8 +111,12 @@ void LoggingFactoryTest::testBuiltins()
|
|||||||
|
|
||||||
void LoggingFactoryTest::testCustom()
|
void LoggingFactoryTest::testCustom()
|
||||||
{
|
{
|
||||||
|
#ifndef POCO_ENABLE_CPP11
|
||||||
std::auto_ptr<LoggingFactory> fact(new LoggingFactory);
|
std::auto_ptr<LoggingFactory> fact(new LoggingFactory);
|
||||||
|
#else
|
||||||
|
std::unique_ptr<LoggingFactory> fact(new LoggingFactory);
|
||||||
|
#endif // POCO_ENABLE_CPP11
|
||||||
|
|
||||||
fact->registerChannelClass("CustomChannel", new Instantiator<CustomChannel, Channel>);
|
fact->registerChannelClass("CustomChannel", new Instantiator<CustomChannel, Channel>);
|
||||||
fact->registerFormatterClass("CustomFormatter", new Instantiator<CustomFormatter, Formatter>);
|
fact->registerFormatterClass("CustomFormatter", new Instantiator<CustomFormatter, Formatter>);
|
||||||
|
|
||||||
|
@ -47,7 +47,11 @@ int main(int argc, char** argv)
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
URI uri(argv[1]);
|
URI uri(argv[1]);
|
||||||
|
#ifndef POCO_ENABLE_CPP11
|
||||||
std::auto_ptr<std::istream> pStr(URIStreamOpener::defaultOpener().open(uri));
|
std::auto_ptr<std::istream> pStr(URIStreamOpener::defaultOpener().open(uri));
|
||||||
|
#else
|
||||||
|
std::unique_ptr<std::istream> pStr(URIStreamOpener::defaultOpener().open(uri));
|
||||||
|
#endif // POCO_ENABLE_CPP11
|
||||||
StreamCopier::copyStream(*pStr.get(), std::cout);
|
StreamCopier::copyStream(*pStr.get(), std::cout);
|
||||||
}
|
}
|
||||||
catch (Exception& exc)
|
catch (Exception& exc)
|
||||||
|
@ -76,7 +76,7 @@ void HTTPServerConnection::run()
|
|||||||
response.set("Server", server);
|
response.set("Server", server);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
#if __cplusplus < 201103L
|
#ifndef POCO_ENABLE_CPP11
|
||||||
std::auto_ptr<HTTPRequestHandler> pHandler(_pFactory->createRequestHandler(request));
|
std::auto_ptr<HTTPRequestHandler> pHandler(_pFactory->createRequestHandler(request));
|
||||||
#else
|
#else
|
||||||
std::unique_ptr<HTTPRequestHandler> pHandler(_pFactory->createRequestHandler(request));
|
std::unique_ptr<HTTPRequestHandler> pHandler(_pFactory->createRequestHandler(request));
|
||||||
|
@ -108,11 +108,11 @@ void TCPServerDispatcher::run()
|
|||||||
TCPConnectionNotification* pCNf = dynamic_cast<TCPConnectionNotification*>(pNf.get());
|
TCPConnectionNotification* pCNf = dynamic_cast<TCPConnectionNotification*>(pNf.get());
|
||||||
if (pCNf)
|
if (pCNf)
|
||||||
{
|
{
|
||||||
#if __cplusplus < 201103L
|
#ifndef POCO_ENABLE_CPP11
|
||||||
std::auto_ptr<TCPServerConnection> pConnection(_pConnectionFactory->createConnection(pCNf->socket()));
|
std::auto_ptr<TCPServerConnection> pConnection(_pConnectionFactory->createConnection(pCNf->socket()));
|
||||||
#else
|
#else
|
||||||
std::unique_ptr<TCPServerConnection> pConnection(_pConnectionFactory->createConnection(pCNf->socket()));
|
std::unique_ptr<TCPServerConnection> pConnection(_pConnectionFactory->createConnection(pCNf->socket()));
|
||||||
#endif
|
#endif // POCO_ENABLE_CPP11
|
||||||
poco_check_ptr(pConnection.get());
|
poco_check_ptr(pConnection.get());
|
||||||
beginConnection();
|
beginConnection();
|
||||||
pConnection->start();
|
pConnection->start();
|
||||||
|
@ -79,8 +79,11 @@ void FTPStreamFactoryTest::testDownload()
|
|||||||
uri.setPort(server.port());
|
uri.setPort(server.port());
|
||||||
uri.setPath("/test.txt;type=a");
|
uri.setPath("/test.txt;type=a");
|
||||||
FTPStreamFactory sf;
|
FTPStreamFactory sf;
|
||||||
|
#ifndef POCO_ENABLE_CPP11
|
||||||
std::auto_ptr<std::istream> pStr(sf.open(uri));
|
std::auto_ptr<std::istream> pStr(sf.open(uri));
|
||||||
|
#else
|
||||||
|
std::unique_ptr<std::istream> pStr(sf.open(uri));
|
||||||
|
#endif // POCO_ENABLE_CPP11
|
||||||
std::ostringstream dataStr;
|
std::ostringstream dataStr;
|
||||||
StreamCopier::copyStream(*pStr.get(), dataStr);
|
StreamCopier::copyStream(*pStr.get(), dataStr);
|
||||||
|
|
||||||
@ -117,7 +120,11 @@ void FTPStreamFactoryTest::testList()
|
|||||||
uri.setPort(server.port());
|
uri.setPort(server.port());
|
||||||
uri.setPath("/usr/guest/data;type=d");
|
uri.setPath("/usr/guest/data;type=d");
|
||||||
FTPStreamFactory sf;
|
FTPStreamFactory sf;
|
||||||
|
#ifndef POCO_ENABLE_CPP11
|
||||||
std::auto_ptr<std::istream> pStr(sf.open(uri));
|
std::auto_ptr<std::istream> pStr(sf.open(uri));
|
||||||
|
#else
|
||||||
|
std::unique_ptr<std::istream> pStr(sf.open(uri));
|
||||||
|
#endif // POCO_ENABLE_CPP11
|
||||||
|
|
||||||
std::ostringstream dataStr;
|
std::ostringstream dataStr;
|
||||||
StreamCopier::copyStream(*pStr.get(), dataStr);
|
StreamCopier::copyStream(*pStr.get(), dataStr);
|
||||||
@ -155,7 +162,11 @@ void FTPStreamFactoryTest::testUserInfo()
|
|||||||
uri.setPath("/test.txt;type=a");
|
uri.setPath("/test.txt;type=a");
|
||||||
uri.setUserInfo("user:secret");
|
uri.setUserInfo("user:secret");
|
||||||
FTPStreamFactory sf;
|
FTPStreamFactory sf;
|
||||||
|
#ifndef POCO_ENABLE_CPP11
|
||||||
std::auto_ptr<std::istream> pStr(sf.open(uri));
|
std::auto_ptr<std::istream> pStr(sf.open(uri));
|
||||||
|
#else
|
||||||
|
std::unique_ptr<std::istream> pStr(sf.open(uri));
|
||||||
|
#endif // POCO_ENABLE_CPP11
|
||||||
|
|
||||||
std::ostringstream dataStr;
|
std::ostringstream dataStr;
|
||||||
StreamCopier::copyStream(*pStr.get(), dataStr);
|
StreamCopier::copyStream(*pStr.get(), dataStr);
|
||||||
@ -194,7 +205,11 @@ void FTPStreamFactoryTest::testPasswordProvider()
|
|||||||
uri.setPath("/test.txt;type=a");
|
uri.setPath("/test.txt;type=a");
|
||||||
uri.setUserInfo("user");
|
uri.setUserInfo("user");
|
||||||
FTPStreamFactory sf;
|
FTPStreamFactory sf;
|
||||||
|
#ifndef POCO_ENABLE_CPP11
|
||||||
std::auto_ptr<std::istream> pStr(sf.open(uri));
|
std::auto_ptr<std::istream> pStr(sf.open(uri));
|
||||||
|
#else
|
||||||
|
std::unique_ptr<std::istream> pStr(sf.open(uri));
|
||||||
|
#endif // POCO_ENABLE_CPP11
|
||||||
|
|
||||||
std::ostringstream dataStr;
|
std::ostringstream dataStr;
|
||||||
StreamCopier::copyStream(*pStr.get(), dataStr);
|
StreamCopier::copyStream(*pStr.get(), dataStr);
|
||||||
@ -224,7 +239,11 @@ void FTPStreamFactoryTest::testMissingPasswordProvider()
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
FTPStreamFactory sf;
|
FTPStreamFactory sf;
|
||||||
|
#ifndef POCO_ENABLE_CPP11
|
||||||
std::auto_ptr<std::istream> pStr(sf.open(uri));
|
std::auto_ptr<std::istream> pStr(sf.open(uri));
|
||||||
|
#else
|
||||||
|
std::unique_ptr<std::istream> pStr(sf.open(uri));
|
||||||
|
#endif // POCO_ENABLE_CPP11
|
||||||
fail("no password provider - must throw");
|
fail("no password provider - must throw");
|
||||||
}
|
}
|
||||||
catch (FTPException&)
|
catch (FTPException&)
|
||||||
|
@ -44,7 +44,11 @@ void HTTPStreamFactoryTest::testNoRedirect()
|
|||||||
HTTPStreamFactory factory;
|
HTTPStreamFactory factory;
|
||||||
URI uri("http://localhost/large");
|
URI uri("http://localhost/large");
|
||||||
uri.setPort(server.port());
|
uri.setPort(server.port());
|
||||||
|
#ifndef POCO_ENABLE_CPP11
|
||||||
std::auto_ptr<std::istream> pStr(factory.open(uri));
|
std::auto_ptr<std::istream> pStr(factory.open(uri));
|
||||||
|
#else
|
||||||
|
std::unique_ptr<std::istream> pStr(factory.open(uri));
|
||||||
|
#endif // POCO_ENABLE_CPP11
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
StreamCopier::copyStream(*pStr.get(), ostr);
|
StreamCopier::copyStream(*pStr.get(), ostr);
|
||||||
assert (ostr.str() == HTTPTestServer::LARGE_BODY);
|
assert (ostr.str() == HTTPTestServer::LARGE_BODY);
|
||||||
@ -57,7 +61,11 @@ void HTTPStreamFactoryTest::testEmptyPath()
|
|||||||
HTTPStreamFactory factory;
|
HTTPStreamFactory factory;
|
||||||
URI uri("http://localhost");
|
URI uri("http://localhost");
|
||||||
uri.setPort(server.port());
|
uri.setPort(server.port());
|
||||||
|
#ifndef POCO_ENABLE_CPP11
|
||||||
std::auto_ptr<std::istream> pStr(factory.open(uri));
|
std::auto_ptr<std::istream> pStr(factory.open(uri));
|
||||||
|
#else
|
||||||
|
std::unique_ptr<std::istream> pStr(factory.open(uri));
|
||||||
|
#endif // POCO_ENABLE_CPP11
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
StreamCopier::copyStream(*pStr.get(), ostr);
|
StreamCopier::copyStream(*pStr.get(), ostr);
|
||||||
assert (ostr.str() == HTTPTestServer::SMALL_BODY);
|
assert (ostr.str() == HTTPTestServer::SMALL_BODY);
|
||||||
@ -71,7 +79,11 @@ void HTTPStreamFactoryTest::testRedirect()
|
|||||||
opener.registerStreamFactory("http", new HTTPStreamFactory);
|
opener.registerStreamFactory("http", new HTTPStreamFactory);
|
||||||
URI uri("http://localhost/redirect");
|
URI uri("http://localhost/redirect");
|
||||||
uri.setPort(server.port());
|
uri.setPort(server.port());
|
||||||
|
#ifndef POCO_ENABLE_CPP11
|
||||||
std::auto_ptr<std::istream> pStr(opener.open(uri));
|
std::auto_ptr<std::istream> pStr(opener.open(uri));
|
||||||
|
#else
|
||||||
|
std::unique_ptr<std::istream> pStr(opener.open(uri));
|
||||||
|
#endif // POCO_ENABLE_CPP11
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
StreamCopier::copyStream(*pStr.get(), ostr);
|
StreamCopier::copyStream(*pStr.get(), ostr);
|
||||||
assert (ostr.str() == HTTPTestServer::LARGE_BODY);
|
assert (ostr.str() == HTTPTestServer::LARGE_BODY);
|
||||||
@ -83,7 +95,11 @@ void HTTPStreamFactoryTest::testProxy()
|
|||||||
HTTPTestServer server;
|
HTTPTestServer server;
|
||||||
HTTPStreamFactory factory("localhost", server.port());
|
HTTPStreamFactory factory("localhost", server.port());
|
||||||
URI uri("http://www.somehost.com/large");
|
URI uri("http://www.somehost.com/large");
|
||||||
|
#ifndef POCO_ENABLE_CPP11
|
||||||
std::auto_ptr<std::istream> pStr(factory.open(uri));
|
std::auto_ptr<std::istream> pStr(factory.open(uri));
|
||||||
|
#else
|
||||||
|
std::unique_ptr<std::istream> pStr(factory.open(uri));
|
||||||
|
#endif // POCO_ENABLE_CPP11
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
StreamCopier::copyStream(*pStr.get(), ostr);
|
StreamCopier::copyStream(*pStr.get(), ostr);
|
||||||
assert (ostr.str() == HTTPTestServer::LARGE_BODY);
|
assert (ostr.str() == HTTPTestServer::LARGE_BODY);
|
||||||
|
@ -82,7 +82,11 @@ int main(int argc, char** argv)
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
URI uri(argv[1]);
|
URI uri(argv[1]);
|
||||||
|
#ifndef POCO_ENABLE_CPP11
|
||||||
std::auto_ptr<std::istream> pStr(URIStreamOpener::defaultOpener().open(uri));
|
std::auto_ptr<std::istream> pStr(URIStreamOpener::defaultOpener().open(uri));
|
||||||
|
#else
|
||||||
|
std::unique_ptr<std::istream> pStr(URIStreamOpener::defaultOpener().open(uri));
|
||||||
|
#endif
|
||||||
StreamCopier::copyStream(*pStr.get(), std::cout);
|
StreamCopier::copyStream(*pStr.get(), std::cout);
|
||||||
}
|
}
|
||||||
catch (Exception& exc)
|
catch (Exception& exc)
|
||||||
|
@ -47,7 +47,11 @@ void HTTPSStreamFactoryTest::testNoRedirect()
|
|||||||
HTTPSStreamFactory factory;
|
HTTPSStreamFactory factory;
|
||||||
URI uri("https://localhost/large");
|
URI uri("https://localhost/large");
|
||||||
uri.setPort(server.port());
|
uri.setPort(server.port());
|
||||||
|
#ifndef POCO_ENABLE_CPP11
|
||||||
std::auto_ptr<std::istream> pStr(factory.open(uri));
|
std::auto_ptr<std::istream> pStr(factory.open(uri));
|
||||||
|
#else
|
||||||
|
std::unique_ptr<std::istream> pStr(factory.open(uri));
|
||||||
|
#endif // POCO_ENABLE_CPP11
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
StreamCopier::copyStream(*pStr.get(), ostr);
|
StreamCopier::copyStream(*pStr.get(), ostr);
|
||||||
assert (ostr.str() == HTTPSTestServer::LARGE_BODY);
|
assert (ostr.str() == HTTPSTestServer::LARGE_BODY);
|
||||||
@ -60,7 +64,11 @@ void HTTPSStreamFactoryTest::testEmptyPath()
|
|||||||
HTTPSStreamFactory factory;
|
HTTPSStreamFactory factory;
|
||||||
URI uri("https://localhost");
|
URI uri("https://localhost");
|
||||||
uri.setPort(server.port());
|
uri.setPort(server.port());
|
||||||
|
#ifndef POCO_ENABLE_CPP11
|
||||||
std::auto_ptr<std::istream> pStr(factory.open(uri));
|
std::auto_ptr<std::istream> pStr(factory.open(uri));
|
||||||
|
#else
|
||||||
|
std::unique_ptr<std::istream> pStr(factory.open(uri));
|
||||||
|
#endif // POCO_ENABLE_CPP11
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
StreamCopier::copyStream(*pStr.get(), ostr);
|
StreamCopier::copyStream(*pStr.get(), ostr);
|
||||||
assert (ostr.str() == HTTPSTestServer::SMALL_BODY);
|
assert (ostr.str() == HTTPSTestServer::SMALL_BODY);
|
||||||
@ -73,7 +81,11 @@ void HTTPSStreamFactoryTest::testRedirect()
|
|||||||
HTTPSStreamFactory factory;
|
HTTPSStreamFactory factory;
|
||||||
URI uri("https://localhost/redirect");
|
URI uri("https://localhost/redirect");
|
||||||
uri.setPort(server.port());
|
uri.setPort(server.port());
|
||||||
|
#ifndef POCO_ENABLE_CPP11
|
||||||
std::auto_ptr<std::istream> pStr(factory.open(uri));
|
std::auto_ptr<std::istream> pStr(factory.open(uri));
|
||||||
|
#else
|
||||||
|
std::unique_ptr<std::istream> pStr(factory.open(uri));
|
||||||
|
#endif // POCO_ENABLE_CPP11
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
StreamCopier::copyStream(*pStr.get(), ostr);
|
StreamCopier::copyStream(*pStr.get(), ostr);
|
||||||
assert (ostr.str() == HTTPSTestServer::LARGE_BODY);
|
assert (ostr.str() == HTTPSTestServer::LARGE_BODY);
|
||||||
@ -88,7 +100,11 @@ void HTTPSStreamFactoryTest::testProxy()
|
|||||||
Application::instance().config().getInt("testsuite.proxy.port")
|
Application::instance().config().getInt("testsuite.proxy.port")
|
||||||
);
|
);
|
||||||
URI uri("https://secure.appinf.com/public/poco/NetSSL.txt");
|
URI uri("https://secure.appinf.com/public/poco/NetSSL.txt");
|
||||||
|
#ifndef POCO_ENABLE_CPP11
|
||||||
std::auto_ptr<std::istream> pStr(factory.open(uri));
|
std::auto_ptr<std::istream> pStr(factory.open(uri));
|
||||||
|
#else
|
||||||
|
std::unique_ptr<std::istream> pStr(factory.open(uri));
|
||||||
|
#endif // POCO_ENABLE_CPP11
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
StreamCopier::copyStream(*pStr.get(), ostr);
|
StreamCopier::copyStream(*pStr.get(), ostr);
|
||||||
assert (ostr.str().length() > 0);
|
assert (ostr.str().length() > 0);
|
||||||
|
@ -79,7 +79,11 @@ int main(int argc, char** argv)
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
URI uri(argv[1]);
|
URI uri(argv[1]);
|
||||||
|
#ifndef POCO_ENABLE_CPP11
|
||||||
std::auto_ptr<std::istream> pStr(URIStreamOpener::defaultOpener().open(uri));
|
std::auto_ptr<std::istream> pStr(URIStreamOpener::defaultOpener().open(uri));
|
||||||
|
#else
|
||||||
|
std::unique_ptr<std::istream> pStr(URIStreamOpener::defaultOpener().open(uri));
|
||||||
|
#endif // POCO_ENABLE_CPP11
|
||||||
StreamCopier::copyStream(*pStr.get(), std::cout);
|
StreamCopier::copyStream(*pStr.get(), std::cout);
|
||||||
}
|
}
|
||||||
catch (Exception& exc)
|
catch (Exception& exc)
|
||||||
|
@ -47,7 +47,11 @@ void HTTPSStreamFactoryTest::testNoRedirect()
|
|||||||
HTTPSStreamFactory factory;
|
HTTPSStreamFactory factory;
|
||||||
URI uri("https://localhost/large");
|
URI uri("https://localhost/large");
|
||||||
uri.setPort(server.port());
|
uri.setPort(server.port());
|
||||||
|
#ifndef POCO_ENABLE_CPP11
|
||||||
std::auto_ptr<std::istream> pStr(factory.open(uri));
|
std::auto_ptr<std::istream> pStr(factory.open(uri));
|
||||||
|
#else
|
||||||
|
std::unique_ptr<std::istream> pStr(factory.open(uri));
|
||||||
|
#endif // POCO_ENABLE_CPP11
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
StreamCopier::copyStream(*pStr.get(), ostr);
|
StreamCopier::copyStream(*pStr.get(), ostr);
|
||||||
assert (ostr.str() == HTTPSTestServer::LARGE_BODY);
|
assert (ostr.str() == HTTPSTestServer::LARGE_BODY);
|
||||||
@ -60,7 +64,11 @@ void HTTPSStreamFactoryTest::testEmptyPath()
|
|||||||
HTTPSStreamFactory factory;
|
HTTPSStreamFactory factory;
|
||||||
URI uri("https://localhost");
|
URI uri("https://localhost");
|
||||||
uri.setPort(server.port());
|
uri.setPort(server.port());
|
||||||
|
#ifndef POCO_ENABLE_CPP11
|
||||||
std::auto_ptr<std::istream> pStr(factory.open(uri));
|
std::auto_ptr<std::istream> pStr(factory.open(uri));
|
||||||
|
#else
|
||||||
|
std::unique_ptr<std::istream> pStr(factory.open(uri));
|
||||||
|
#endif // POCO_ENABLE_CPP11
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
StreamCopier::copyStream(*pStr.get(), ostr);
|
StreamCopier::copyStream(*pStr.get(), ostr);
|
||||||
assert (ostr.str() == HTTPSTestServer::SMALL_BODY);
|
assert (ostr.str() == HTTPSTestServer::SMALL_BODY);
|
||||||
@ -73,7 +81,11 @@ void HTTPSStreamFactoryTest::testRedirect()
|
|||||||
HTTPSStreamFactory factory;
|
HTTPSStreamFactory factory;
|
||||||
URI uri("https://localhost/redirect");
|
URI uri("https://localhost/redirect");
|
||||||
uri.setPort(server.port());
|
uri.setPort(server.port());
|
||||||
|
#ifndef POCO_ENABLE_CPP11
|
||||||
std::auto_ptr<std::istream> pStr(factory.open(uri));
|
std::auto_ptr<std::istream> pStr(factory.open(uri));
|
||||||
|
#else
|
||||||
|
std::unique_ptr<std::istream> pStr(factory.open(uri));
|
||||||
|
#endif // POCO_ENABLE_CPP11
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
StreamCopier::copyStream(*pStr.get(), ostr);
|
StreamCopier::copyStream(*pStr.get(), ostr);
|
||||||
assert (ostr.str() == HTTPSTestServer::LARGE_BODY);
|
assert (ostr.str() == HTTPSTestServer::LARGE_BODY);
|
||||||
@ -88,7 +100,11 @@ void HTTPSStreamFactoryTest::testProxy()
|
|||||||
Application::instance().config().getInt("testsuite.proxy.port")
|
Application::instance().config().getInt("testsuite.proxy.port")
|
||||||
);
|
);
|
||||||
URI uri("https://secure.appinf.com/public/poco/NetSSL.txt");
|
URI uri("https://secure.appinf.com/public/poco/NetSSL.txt");
|
||||||
|
#ifndef POCO_ENABLE_CPP11
|
||||||
std::auto_ptr<std::istream> pStr(factory.open(uri));
|
std::auto_ptr<std::istream> pStr(factory.open(uri));
|
||||||
|
#else
|
||||||
|
std::unique_ptr<std::istream> pStr(factory.open(uri));
|
||||||
|
#endif // POCO_ENABLE_CPP11
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
StreamCopier::copyStream(*pStr.get(), ostr);
|
StreamCopier::copyStream(*pStr.get(), ostr);
|
||||||
assert (ostr.str().length() > 0);
|
assert (ostr.str().length() > 0);
|
||||||
|
@ -283,7 +283,7 @@ protected:
|
|||||||
p.setBaseName(clazz);
|
p.setBaseName(clazz);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __cplusplus < 201103L
|
#ifndef POCO_ENABLE_CPP11
|
||||||
std::auto_ptr<CodeWriter> pCodeWriter(createCodeWriter(page, clazz));
|
std::auto_ptr<CodeWriter> pCodeWriter(createCodeWriter(page, clazz));
|
||||||
#else
|
#else
|
||||||
std::unique_ptr<CodeWriter> pCodeWriter(createCodeWriter(page, clazz));
|
std::unique_ptr<CodeWriter> pCodeWriter(createCodeWriter(page, clazz));
|
||||||
|
@ -257,12 +257,15 @@ protected:
|
|||||||
return new Preprocessor(proc, new std::ifstream(pp.getFileName().c_str()), pp.getFileName());
|
return new Preprocessor(proc, new std::ifstream(pp.getFileName().c_str()), pp.getFileName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void parse(const std::string& file)
|
void parse(const std::string& file)
|
||||||
{
|
{
|
||||||
logger().information("Preprocessing " + file);
|
logger().information("Preprocessing " + file);
|
||||||
|
#ifndef POCO_ENABLE_CPP11
|
||||||
std::auto_ptr<Preprocessor> pPreProc(preprocess(file));
|
std::auto_ptr<Preprocessor> pPreProc(preprocess(file));
|
||||||
|
#else
|
||||||
|
std::unique_ptr<Preprocessor> pPreProc(preprocess(file));
|
||||||
|
#endif // POCO_ENABLE_CPP11
|
||||||
logger().information("Parsing " + file);
|
logger().information("Parsing " + file);
|
||||||
if (pPreProc->stream().good())
|
if (pPreProc->stream().good())
|
||||||
{
|
{
|
||||||
@ -271,7 +274,7 @@ protected:
|
|||||||
}
|
}
|
||||||
else throw Poco::OpenFileException("cannot read from preprocessor");
|
else throw Poco::OpenFileException("cannot read from preprocessor");
|
||||||
}
|
}
|
||||||
|
|
||||||
int parseAll()
|
int parseAll()
|
||||||
{
|
{
|
||||||
int errors = 0;
|
int errors = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user