diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d90bd375..c1107521b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,12 +65,7 @@ include(GNUInstallDirs) # Include some common macros to simpilfy the Poco CMake files include(PocoMacros) -if(POCO_STATIC) - message(WARNING "POCO_STATIC has been deprecated. Please use BUILD_SHARED_LIBS=NO to build static libraries.") - option(BUILD_SHARED_LIBS "Build shared libraries" OFF) -else() - option(BUILD_SHARED_LIBS "Build shared libraries" ON) -endif() +option(BUILD_SHARED_LIBS "Build using shared libraries" ON) if(MSVC) option(POCO_MT "Set to OFF|ON (default is OFF) to control build of POCO as /MT instead of /MD" OFF) diff --git a/CppUnit/src/TestCase.cpp b/CppUnit/src/TestCase.cpp index c1e044b78..eda37e242 100644 --- a/CppUnit/src/TestCase.cpp +++ b/CppUnit/src/TestCase.cpp @@ -81,14 +81,14 @@ void TestCase::assertEquals(const char* expected, const std::string& actual, lon void TestCase::assertNotNull(const void* pointer, const std::string& pointerExpression, long lineNumber, const std::string& fileName) { - if (pointer == NULL) + if (pointer == nullptr) throw CppUnitException(pointerExpression + " must not be NULL", lineNumber, fileName); } void TestCase::assertNull(const void* pointer, const std::string& pointerExpression, long lineNumber, const std::string& fileName) { - if (pointer != NULL) + if (pointer != nullptr) throw CppUnitException(pointerExpression + " must be NULL", lineNumber, fileName); } diff --git a/CppUnit/src/TextTestResult.cpp b/CppUnit/src/TextTestResult.cpp index f70ed82bf..ad6b5d922 100644 --- a/CppUnit/src/TextTestResult.cpp +++ b/CppUnit/src/TextTestResult.cpp @@ -162,19 +162,18 @@ void TextTestResult::printErrors(std::ostream& stream) stream << "There were " << testErrors() << " errors: " << std::endl; int i = 1; - for (std::vector::iterator it = errors().begin(); it != errors().end(); ++it) + for (const auto& failure : errors()) { - TestFailure* failure = *it; CppUnitException* e = failure->thrownException(); stream << std::setw(2) << i << ": " << failure->failedTest()->toString() << "\n" - << " \"" << (e ? e->what() : "") << "\"\n" + << " \"" << (e ? e->what() : "") << "\"\n" << " in \"" << (e ? e->fileName() : std::string()) << "\", line "; - if (e == 0) + if (e == nullptr) { stream << "0"; } @@ -210,10 +209,9 @@ void TextTestResult::printFailures(std::ostream& stream) int i = 1; - for (std::vector::iterator it = failures().begin(); it != failures().end(); ++it) + for (const auto& failure : failures()) { - TestFailure* failure = *it; - CppUnitException* e = failure->thrownException(); + CppUnitException* e = failure->thrownException(); stream << std::setw(2) << i << ": " @@ -222,7 +220,7 @@ void TextTestResult::printFailures(std::ostream& stream) << " in \"" << (e ? e->fileName() : std::string()) << "\", line "; - if (e == 0) + if (e == nullptr) { stream << "0"; } diff --git a/Crypto/include/Poco/Crypto/ECKey.h b/Crypto/include/Poco/Crypto/ECKey.h index 950b86928..9bfaf9d20 100644 --- a/Crypto/include/Poco/Crypto/ECKey.h +++ b/Crypto/include/Poco/Crypto/ECKey.h @@ -31,8 +31,8 @@ namespace Crypto { class X509Certificate; class PKCS12Container; +//class [[deprecated]] ECKey; -//@ deprecated class Crypto_API ECKey: public KeyPair /// This class stores an EC key pair, consisting /// of private and public key. Storage of the private diff --git a/Crypto/include/Poco/Crypto/ECKeyImpl.h b/Crypto/include/Poco/Crypto/ECKeyImpl.h index 394cee858..a832491bb 100644 --- a/Crypto/include/Poco/Crypto/ECKeyImpl.h +++ b/Crypto/include/Poco/Crypto/ECKeyImpl.h @@ -22,8 +22,6 @@ #include "Poco/Crypto/Crypto.h" #include "Poco/Crypto/EVPPKey.h" #include "Poco/Crypto/KeyPairImpl.h" -#include "Poco/Crypto/OpenSSLInitializer.h" -#include "Poco/RefCountedObject.h" #include "Poco/AutoPtr.h" #include #include diff --git a/Crypto/include/Poco/Crypto/EVPPKey.h b/Crypto/include/Poco/Crypto/EVPPKey.h index 6f53a96f5..256f1983e 100644 --- a/Crypto/include/Poco/Crypto/EVPPKey.h +++ b/Crypto/include/Poco/Crypto/EVPPKey.h @@ -28,16 +28,15 @@ #include #include #include -#include #include namespace Poco { namespace Crypto { -//@deprecated +//class [[deprecated]] ECKey; +//class [[deprecated]] RSAKey; class ECKey; -//@deprecated class RSAKey; class PKCS12Container; class X509Certificate; @@ -93,8 +92,8 @@ public: /// Constructs EVPPKey from EVP_PKEY pointer. /// The content behind the supplied pointer is internally duplicated. - //@ deprecated template + //[[deprecated]] explicit EVPPKey(K* pKey): _pEVPPKey(EVP_PKEY_new()) explicit EVPPKey(K* pKey): _pEVPPKey(EVP_PKEY_new()) /// Constructs EVPPKey from a "native" OpenSSL (RSA or EC_KEY), /// or a Poco wrapper (RSAKey, ECKey) key pointer. @@ -185,13 +184,16 @@ private: void newECKey(const char* group); void duplicate(EVP_PKEY* pEVPPKey); - //@ deprecated + //[[deprecated]] void setKey(ECKey* pKey); - //@ deprecated + + //[[deprecated]] void setKey(RSAKey* pKey); - //@ deprecated + + //[[deprecated]] void setKey(EC_KEY* pKey); - //@ deprecated + + //[[deprecated]] void setKey(RSA* pKey); static int passCB(char* buf, int size, int, void* pass); @@ -336,9 +338,7 @@ private: EVP_PKEY* _pEVPPKey = 0; static const std::map KNOWN_TYPES; - //@deprecated friend class ECKeyImpl; - //@deprecated friend class RSAKeyImpl; }; diff --git a/Crypto/include/Poco/Crypto/RSADigestEngine.h b/Crypto/include/Poco/Crypto/RSADigestEngine.h index e0c451d24..8c9d1224c 100644 --- a/Crypto/include/Poco/Crypto/RSADigestEngine.h +++ b/Crypto/include/Poco/Crypto/RSADigestEngine.h @@ -51,7 +51,7 @@ public: DIGEST_SHA1 }; - //@ deprecated + //[[deprecated]] RSADigestEngine(const RSAKey& key, DigestType digestType = DIGEST_SHA1); RSADigestEngine(const RSAKey& key, DigestType digestType = DIGEST_SHA1); /// Creates the RSADigestEngine with the given RSA key, /// using the MD5 or SHA-1 hash algorithm. diff --git a/Crypto/include/Poco/Crypto/RSAKey.h b/Crypto/include/Poco/Crypto/RSAKey.h index 767d5cd3d..85fee5b52 100644 --- a/Crypto/include/Poco/Crypto/RSAKey.h +++ b/Crypto/include/Poco/Crypto/RSAKey.h @@ -30,8 +30,8 @@ namespace Crypto { class X509Certificate; class PKCS12Container; +//class [[deprecated]] RSAKey; -//@ deprecated class Crypto_API RSAKey: public KeyPair /// This class stores an RSA key pair, consisting /// of private and public key. Storage of the private @@ -81,7 +81,7 @@ public: /// OpenSSL will auto-create the public key from the private key. RSAKey(std::istream* pPublicKeyStream, - std::istream* pPrivateKeyStream = 0, + std::istream* pPrivateKeyStream = nullptr, const std::string& privateKeyPassphrase = ""); /// Creates the RSAKey, by reading public and private key from the given streams and /// using the given passphrase for the private key. @@ -132,4 +132,4 @@ inline RSAKeyImpl::Ptr RSAKey::impl() const } } // namespace Poco::Crypto -#endif // Crypto_RSAKey_INCLUDED \ No newline at end of file +#endif // Crypto_RSAKey_INCLUDED diff --git a/Crypto/testsuite/src/ECTest.cpp b/Crypto/testsuite/src/ECTest.cpp index 98308f036..a82fcdbe1 100644 --- a/Crypto/testsuite/src/ECTest.cpp +++ b/Crypto/testsuite/src/ECTest.cpp @@ -32,6 +32,7 @@ ECTest::~ECTest() { } +#if defined(POCO_TEST_DEPRECATED) void ECTest::testECNewKeys() { @@ -176,6 +177,7 @@ void ECTest::testECDSASignManipulated() } } +#endif void ECTest::setUp() { @@ -191,10 +193,13 @@ CppUnit::Test* ECTest::suite() { CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("ECTest"); +#if defined(POCO_TEST_DEPRECATED) + CppUnit_addTest(pSuite, ECTest, testECNewKeys); CppUnit_addTest(pSuite, ECTest, testECNewKeysNoPassphrase); CppUnit_addTest(pSuite, ECTest, testECDSASignSha256); CppUnit_addTest(pSuite, ECTest, testECDSASignManipulated); +#endif return pSuite; } diff --git a/Crypto/testsuite/src/ECTest.h b/Crypto/testsuite/src/ECTest.h index ccbf3c241..09fffbe70 100644 --- a/Crypto/testsuite/src/ECTest.h +++ b/Crypto/testsuite/src/ECTest.h @@ -25,11 +25,15 @@ public: ECTest(const std::string& name); ~ECTest(); +#if defined(POCO_TEST_DEPRECATED) + void testECNewKeys(); void testECNewKeysNoPassphrase(); void testECDSASignSha256(); void testECDSASignManipulated(); +#endif + void setUp(); void tearDown(); diff --git a/DNSSD/Bonjour/include/Poco/DNSSD/Bonjour/EventLoop.h b/DNSSD/Bonjour/include/Poco/DNSSD/Bonjour/EventLoop.h index 27f6d573d..3080db6f2 100644 --- a/DNSSD/Bonjour/include/Poco/DNSSD/Bonjour/EventLoop.h +++ b/DNSSD/Bonjour/include/Poco/DNSSD/Bonjour/EventLoop.h @@ -41,7 +41,7 @@ class DNSSD_Bonjour_API EventLoop: public Poco::Runnable /// Bonjour machinery. { public: - typedef Poco::ScopedLock ScopedLock; + using ScopedLock = Poco::ScopedLock; enum { @@ -51,7 +51,7 @@ public: EventLoop(); /// Creates the EventLoop. - ~EventLoop(); + ~EventLoop() override; /// Destroys the EventLoop. void add(DNSServiceRef sdRef); diff --git a/DNSSD/Bonjour/src/EventLoop.cpp b/DNSSD/Bonjour/src/EventLoop.cpp index b74a5cfe7..aa8a3486d 100644 --- a/DNSSD/Bonjour/src/EventLoop.cpp +++ b/DNSSD/Bonjour/src/EventLoop.cpp @@ -15,6 +15,7 @@ #include "Poco/DNSSD/Bonjour/EventLoop.h" +#include "Poco/Net/PollSet.h" #include "Poco/Net/StreamSocket.h" #include "Poco/Net/StreamSocketImpl.h" #include @@ -46,11 +47,9 @@ EventLoop::~EventLoop() void EventLoop::shutdown() { - RefToSock::iterator it = _refs.begin(); - RefToSock::iterator itEnd = _refs.end(); - for (; it != itEnd; ++it) + for (auto& it: _refs) { - DNSServiceRefDeallocate(it->first); + DNSServiceRefDeallocate(it.first); } _refs.clear(); _sockets.clear(); @@ -83,7 +82,7 @@ void EventLoop::remove(DNSServiceRef sdRef) void EventLoop::removeImpl(DNSServiceRef sdRef) { - RefToSock::iterator it = _refs.find(sdRef); + auto it = _refs.find(sdRef); if (it != _refs.end()) { _sockets.erase(it->second); @@ -95,59 +94,52 @@ void EventLoop::removeImpl(DNSServiceRef sdRef) void EventLoop::run() { - Poco::Net::Socket::SocketList readList; - Poco::Net::Socket::SocketList writeList; - Poco::Net::Socket::SocketList errList; + Poco::Net::PollSet pollSet; while (!_stop) { - readList.clear(); if (!_refs.empty() || _refAdded.tryWait(EVENTLOOP_TIMEOUT)) { - Poco::Mutex::ScopedLock lock(_mutex); - - RefToSock::const_iterator it = _refs.begin(); - RefToSock::const_iterator itEnd = _refs.end(); - for (; it != itEnd; ++it) + Poco::Mutex::ScopedLock lock(_mutex); + for (const auto& r: _refs) { - readList.push_back(it->second); + pollSet.add(r.second, Net::Socket::SELECT_READ); } } - if (!readList.empty()) + if (!pollSet.empty()) { - Poco::Timespan timeout(1000*EVENTLOOP_TIMEOUT); - int ready = Poco::Net::Socket::select(readList, writeList, errList, timeout); - if (ready > 0) + Poco::Timespan timeout(1000LL * EVENTLOOP_TIMEOUT); + const auto sm = pollSet.poll(timeout); + if (!sm.empty()) { - Poco::Net::Socket::SocketList::iterator it = readList.begin(); - Poco::Net::Socket::SocketList::iterator itEnd = readList.end(); - for (; it != itEnd; ++it) + for (const auto& it: sm) { Poco::Mutex::ScopedLock lock(_mutex); - - SockToRef::iterator itSock = _sockets.find(*it); - poco_assert_dbg (itSock != _sockets.end()); - RefSet::iterator itSet = _invalidatedRefs.find(itSock->second); - if (itSet != _invalidatedRefs.end()) + if (it.second & Net::PollSet::POLL_READ) { - removeImpl(itSock->second); - _invalidatedRefs.erase(itSet); - } - else - { - DNSServiceProcessResult(itSock->second); + auto& socket = it.first; + const auto itSock = _sockets.find(socket); + poco_assert_dbg (itSock != _sockets.end()); + auto itSet = _invalidatedRefs.find(itSock->second); + if (itSet != _invalidatedRefs.end()) + { + removeImpl(itSock->second); + _invalidatedRefs.erase(itSet); + } + else + { + DNSServiceProcessResult(itSock->second); + } } } } } - Poco::Mutex::ScopedLock lock(_mutex); - RefSet::iterator itSet =_invalidatedRefs.begin(); - RefSet::iterator itSetEnd = _invalidatedRefs.end(); - for (; itSet != itSetEnd; ++itSet) + Poco::Mutex::ScopedLock lock(_mutex); + for (auto& ir: _invalidatedRefs) { - removeImpl(*itSet); + removeImpl(ir); } _invalidatedRefs.clear(); } diff --git a/Data/DataTest/src/SQLExecutor.cpp b/Data/DataTest/src/SQLExecutor.cpp index 65f5a7e68..c8455217a 100644 --- a/Data/DataTest/src/SQLExecutor.cpp +++ b/Data/DataTest/src/SQLExecutor.cpp @@ -2983,7 +2983,7 @@ void SQLExecutor::filter(const std::string& query, const std::string& intFldName { Statement stmt = (session() << query, now); RecordSet rset(stmt); - assertTrue (rset.totalRowCount() == 4); + assertTrue (rset.getTotalRowCount() == 4); RowFilter::Ptr pRF = new RowFilter(&rset); assertTrue (pRF->isEmpty()); pRF->add(intFldName, RowFilter::VALUE_EQUAL, 1); diff --git a/Data/ODBC/include/Poco/Data/ODBC/Diagnostics.h b/Data/ODBC/include/Poco/Data/ODBC/Diagnostics.h index 9b2f3726c..4e0ffbe64 100644 --- a/Data/ODBC/include/Poco/Data/ODBC/Diagnostics.h +++ b/Data/ODBC/include/Poco/Data/ODBC/Diagnostics.h @@ -45,10 +45,10 @@ class Diagnostics { public: - static const unsigned int SQL_STATE_SIZE = SQL_SQLSTATE_SIZE + 1; - static const unsigned int SQL_MESSAGE_LENGTH = SQL_MAX_MESSAGE_LENGTH + 1; - static const unsigned int SQL_NAME_LENGTH = 128; - static const std::string DATA_TRUNCATED; + inline static const unsigned int SQL_STATE_SIZE = SQL_SQLSTATE_SIZE + 1; + inline static const unsigned int SQL_MESSAGE_LENGTH = SQL_MAX_MESSAGE_LENGTH + 1; + inline static const unsigned int SQL_NAME_LENGTH = 128; + inline static const std::string DATA_TRUNCATED; struct DiagnosticFields { diff --git a/Data/ODBC/include/Poco/Data/ODBC/Extractor.h b/Data/ODBC/include/Poco/Data/ODBC/Extractor.h index 7488e8ff9..655e14eb2 100644 --- a/Data/ODBC/include/Poco/Data/ODBC/Extractor.h +++ b/Data/ODBC/include/Poco/Data/ODBC/Extractor.h @@ -323,17 +323,17 @@ public: bool extract(std::size_t pos, std::list& val); /// Extracts an Any list. - bool extract(std::size_t pos, Poco::DynamicAny& val); - /// Extracts a DynamicAny. + bool extract(std::size_t pos, Poco::Dynamic::Var& val); + /// Extracts a Dynamic::Var. - bool extract(std::size_t pos, std::vector& val); - /// Extracts a DynamicAny vector. + bool extract(std::size_t pos, std::vector& val); + /// Extracts a Dynamic::Var vector. - bool extract(std::size_t pos, std::deque& val); - /// Extracts a DynamicAny deque. + bool extract(std::size_t pos, std::deque& val); + /// Extracts a Dynamic::Var deque. - bool extract(std::size_t pos, std::list& val); - /// Extracts a DynamicAny list. + bool extract(std::size_t pos, std::list& val); + /// Extracts a Dynamic::Var list. void setDataExtraction(Preparator::DataExtraction ext); /// Set data extraction mode. @@ -515,7 +515,7 @@ private: template bool extractImpl(std::size_t pos, T& val) - /// Utility function for extraction of Any and DynamicAny. + /// Utility function for extraction of Any and Dynamic::Var. { ODBCMetaColumn column(_rStmt, pos); diff --git a/Data/ODBC/include/Poco/Data/ODBC/Preparator.h b/Data/ODBC/include/Poco/Data/ODBC/Preparator.h index 6b351f8fb..210be4077 100644 --- a/Data/ODBC/include/Poco/Data/ODBC/Preparator.h +++ b/Data/ODBC/include/Poco/Data/ODBC/Preparator.h @@ -27,7 +27,7 @@ #include "Poco/Data/LOB.h" #include "Poco/Types.h" #include "Poco/Any.h" -#include "Poco/DynamicAny.h" +#include "Poco/Dynamic/Var.h" #include "Poco/DateTime.h" #include "Poco/SharedPtr.h" #include "Poco/UTFString.h" @@ -369,17 +369,17 @@ public: void prepare(std::size_t pos, const std::list& val); /// Prepares an Any list. - void prepare(std::size_t pos, const Poco::DynamicAny& val); - /// Prepares a DynamicAny. + void prepare(std::size_t pos, const Poco::Dynamic::Var& val); + /// Prepares a Dynamic::Var. - void prepare(std::size_t pos, const std::vector& val); - /// Prepares a DynamicAny vector. + void prepare(std::size_t pos, const std::vector& val); + /// Prepares a Dynamic::Var vector. - void prepare(std::size_t pos, const std::deque& val); - /// Prepares a DynamicAny deque. + void prepare(std::size_t pos, const std::deque& val); + /// Prepares a Dynamic::Var deque. - void prepare(std::size_t pos, const std::list& val); - /// Prepares a DynamicAny list. + void prepare(std::size_t pos, const std::list& val); + /// Prepares a Dynamic::Var list. std::size_t columns() const; /// Returns the number of columns. @@ -429,7 +429,7 @@ private: template void prepareImpl(std::size_t pos, const C* pVal = 0) - /// Utility function to prepare Any and DynamicAny. + /// Utility function to prepare Any and Dynamic::Var. { ODBCMetaColumn col(_rStmt, pos); @@ -1213,27 +1213,27 @@ inline void Preparator::prepare(std::size_t pos, const std::list& val } -inline void Preparator::prepare(std::size_t pos, const Poco::DynamicAny& val) +inline void Preparator::prepare(std::size_t pos, const Poco::Dynamic::Var& val) { - prepareImpl >(pos); + prepareImpl >(pos); } -inline void Preparator::prepare(std::size_t pos, const std::vector& val) +inline void Preparator::prepare(std::size_t pos, const std::vector& val) { - prepareImpl >(pos, &val); + prepareImpl >(pos, &val); } -inline void Preparator::prepare(std::size_t pos, const std::deque& val) +inline void Preparator::prepare(std::size_t pos, const std::deque& val) { - prepareImpl >(pos, &val); + prepareImpl >(pos, &val); } -inline void Preparator::prepare(std::size_t pos, const std::list& val) +inline void Preparator::prepare(std::size_t pos, const std::list& val) { - prepareImpl >(pos, &val); + prepareImpl >(pos, &val); } diff --git a/Data/ODBC/include/Poco/Data/ODBC/SessionImpl.h b/Data/ODBC/include/Poco/Data/ODBC/SessionImpl.h index 06b2f8126..ba4f1f864 100644 --- a/Data/ODBC/include/Poco/Data/ODBC/SessionImpl.h +++ b/Data/ODBC/include/Poco/Data/ODBC/SessionImpl.h @@ -67,8 +67,7 @@ public: /// Creates the SessionImpl. Opens a connection to the database. /// Throws NotConnectedException if connection was not succesful. - //@ deprecated - SessionImpl(const std::string& connect, + POCO_DEPRECATED("") SessionImpl(const std::string& connect, Poco::Any maxFieldSize = ODBC_MAX_FIELD_SIZE, bool enforceCapability=false, bool autoBind = true, diff --git a/Data/ODBC/include/Poco/Data/ODBC/TypeInfo.h b/Data/ODBC/include/Poco/Data/ODBC/TypeInfo.h index d6e25a6fa..b852ec1ca 100644 --- a/Data/ODBC/include/Poco/Data/ODBC/TypeInfo.h +++ b/Data/ODBC/include/Poco/Data/ODBC/TypeInfo.h @@ -20,7 +20,7 @@ #include "Poco/Data/ODBC/ODBC.h" #include "Poco/NamedTuple.h" -#include "Poco/DynamicAny.h" +#include "Poco/Dynamic/Var.h" #include #include #ifdef POCO_OS_FAMILY_WINDOWS @@ -85,12 +85,12 @@ public: void fillTypeInfo(const SQLHDBC* pHDBC); /// Fills the data type info structure for the database. - DynamicAny getInfo(SQLSMALLINT type, const std::string& param) const; + Dynamic::Var getInfo(SQLSMALLINT type, const std::string& param) const; /// Returns information about specified data type as specified by parameter 'type'. /// The requested information is specified by parameter 'param'. /// Will fail with a Poco::NotFoundException thrown if the param is not found - bool tryGetInfo(SQLSMALLINT type, const std::string& param, DynamicAny& result) const; + bool tryGetInfo(SQLSMALLINT type, const std::string& param, Dynamic::Var& result) const; /// Returns information about specified data type as specified by parameter 'type' in param result. /// The requested information is specified by parameter 'param'. /// Will return false if the param is not found. The value of result will be not changed in this case. diff --git a/Data/ODBC/src/Binder.cpp b/Data/ODBC/src/Binder.cpp index 9c5541319..9c2f7904c 100644 --- a/Data/ODBC/src/Binder.cpp +++ b/Data/ODBC/src/Binder.cpp @@ -518,7 +518,7 @@ void Binder::getColSizeAndPrecision(std::size_t pos, // Hence the funky flow control. if (_pTypeInfo) { - DynamicAny tmp; + Dynamic::Var tmp; bool foundSize(false); bool foundPrec(false); foundSize = _pTypeInfo->tryGetInfo(cDataType, "COLUMN_SIZE", tmp); diff --git a/Data/ODBC/src/Extractor.cpp b/Data/ODBC/src/Extractor.cpp index e9393b7d0..a872e8010 100644 --- a/Data/ODBC/src/Extractor.cpp +++ b/Data/ODBC/src/Extractor.cpp @@ -1328,13 +1328,13 @@ bool Extractor::extract(std::size_t pos, std::list& val) } -bool Extractor::extract(std::size_t pos, Poco::DynamicAny& val) +bool Extractor::extract(std::size_t pos, Poco::Dynamic::Var& val) { return extractImpl(pos, val); } -bool Extractor::extract(std::size_t pos, std::vector& val) +bool Extractor::extract(std::size_t pos, std::vector& val) { if (Preparator::DE_BOUND == _dataExtraction) return extractBoundImpl(pos, val); @@ -1343,7 +1343,7 @@ bool Extractor::extract(std::size_t pos, std::vector& val) } -bool Extractor::extract(std::size_t pos, std::deque& val) +bool Extractor::extract(std::size_t pos, std::deque& val) { if (Preparator::DE_BOUND == _dataExtraction) return extractBoundImpl(pos, val); @@ -1352,7 +1352,7 @@ bool Extractor::extract(std::size_t pos, std::deque& val) } -bool Extractor::extract(std::size_t pos, std::list& val) +bool Extractor::extract(std::size_t pos, std::list& val) { if (Preparator::DE_BOUND == _dataExtraction) return extractBoundImpl(pos, val); diff --git a/Data/ODBC/src/TypeInfo.cpp b/Data/ODBC/src/TypeInfo.cpp index 8d4097a1d..615471a96 100644 --- a/Data/ODBC/src/TypeInfo.cpp +++ b/Data/ODBC/src/TypeInfo.cpp @@ -167,7 +167,7 @@ void TypeInfo::fillTypeInfo(const SQLHDBC* pHDBC) } -DynamicAny TypeInfo::getInfo(SQLSMALLINT type, const std::string& param) const +Dynamic::Var TypeInfo::getInfo(SQLSMALLINT type, const std::string& param) const { TypeInfoVec::const_iterator it = _typeInfo.begin(); TypeInfoVec::const_iterator end = _typeInfo.end(); @@ -181,7 +181,7 @@ DynamicAny TypeInfo::getInfo(SQLSMALLINT type, const std::string& param) const } -bool TypeInfo::tryGetInfo(SQLSMALLINT type, const std::string& param, DynamicAny& result) const +bool TypeInfo::tryGetInfo(SQLSMALLINT type, const std::string& param, Dynamic::Var& result) const { TypeInfoVec::const_iterator it = _typeInfo.begin(); TypeInfoVec::const_iterator end = _typeInfo.end(); diff --git a/Data/ODBC/testsuite/src/ODBCDB2Test.cpp b/Data/ODBC/testsuite/src/ODBCDB2Test.cpp index 633cdc1a8..f6c766904 100644 --- a/Data/ODBC/testsuite/src/ODBCDB2Test.cpp +++ b/Data/ODBC/testsuite/src/ODBCDB2Test.cpp @@ -14,7 +14,7 @@ #include "Poco/String.h" #include "Poco/Format.h" #include "Poco/Any.h" -#include "Poco/DynamicAny.h" +#include "Poco/Dynamic/Var.h" #include "Poco/Tuple.h" #include "Poco/Exception.h" #include "Poco/Data/LOB.h" @@ -38,7 +38,7 @@ using Poco::format; using Poco::Tuple; using Poco::Any; using Poco::AnyCast; -using Poco::DynamicAny; +using Poco::Dynamic::Var; using Poco::NotFoundException; @@ -265,7 +265,7 @@ void ODBCDB2Test::testStoredProcedureAny() } -void ODBCDB2Test::testStoredProcedureDynamicAny() +void ODBCDB2Test::testStoredProcedureDynamicVar() { if (!_pSession) fail ("Test not available."); @@ -273,8 +273,8 @@ void ODBCDB2Test::testStoredProcedureDynamicAny() { _pSession->setFeature("autoBind", bindValue(k)); - DynamicAny i = 2; - DynamicAny j = 0; + Var i = 2; + Var j = 0; *_pSession << "CREATE PROCEDURE storedProcedure(inParam INTEGER, OUT outParam INTEGER) " "BEGIN " @@ -659,7 +659,7 @@ CppUnit::Test* ODBCDB2Test::suite() CppUnit_addTest(pSuite, ODBCDB2Test, testInternalStorageType); CppUnit_addTest(pSuite, ODBCDB2Test, testStoredProcedure); CppUnit_addTest(pSuite, ODBCDB2Test, testStoredProcedureAny); - CppUnit_addTest(pSuite, ODBCDB2Test, testStoredProcedureDynamicAny); + CppUnit_addTest(pSuite, ODBCDB2Test, testStoredProcedureDynamicVar); CppUnit_addTest(pSuite, ODBCDB2Test, testStoredFunction); CppUnit_addTest(pSuite, ODBCDB2Test, testNull); CppUnit_addTest(pSuite, ODBCDB2Test, testRowIterator); diff --git a/Data/ODBC/testsuite/src/ODBCDB2Test.h b/Data/ODBC/testsuite/src/ODBCDB2Test.h index 57263707f..821eba601 100644 --- a/Data/ODBC/testsuite/src/ODBCDB2Test.h +++ b/Data/ODBC/testsuite/src/ODBCDB2Test.h @@ -37,7 +37,7 @@ public: void testStoredProcedure(); void testStoredProcedureAny(); - void testStoredProcedureDynamicAny(); + void testStoredProcedureDynamicVar(); void testStoredFunction(); static CppUnit::Test* suite(); diff --git a/Data/ODBC/testsuite/src/ODBCOracleTest.cpp b/Data/ODBC/testsuite/src/ODBCOracleTest.cpp index f9755b634..99b9e5b3c 100644 --- a/Data/ODBC/testsuite/src/ODBCOracleTest.cpp +++ b/Data/ODBC/testsuite/src/ODBCOracleTest.cpp @@ -15,7 +15,7 @@ #include "Poco/Tuple.h" #include "Poco/Format.h" #include "Poco/Any.h" -#include "Poco/DynamicAny.h" +#include "Poco/Dynamic/Var.h" #include "Poco/DateTime.h" #include "Poco/Data/RecordSet.h" #include "Poco/Data/AutoTransaction.h" @@ -37,7 +37,7 @@ using Poco::format; using Poco::Tuple; using Poco::Any; using Poco::AnyCast; -using Poco::DynamicAny; +using Poco::Dynamic::Var; using Poco::DateTime; @@ -370,21 +370,28 @@ void ODBCOracleTest::testStoredProcedureAny() } -void ODBCOracleTest::testStoredProcedureDynamicAny() +void ODBCOracleTest::testStoredProcedureDynamicVar() { for (int k = 0; k < 8;) { session().setFeature("autoBind", bindValue(k)); - DynamicAny i = 2; - DynamicAny j = 0; + Var i = 2; + Var j = 0; *_pSession << "CREATE OR REPLACE " "PROCEDURE storedProcedure(inParam IN NUMBER, outParam OUT NUMBER) IS " " BEGIN outParam := inParam*inParam; " "END storedProcedure;" , now; - *_pSession << "{call storedProcedure(?, ?)}", in(i), out(j), now; + auto inI = in(i); + auto outJ = out(j); + assertTrue (nullptr != inI); + assertTrue (inI->canBind()); + assertTrue (nullptr != outJ); + assertTrue (outJ->canBind()); + + *_pSession << "{call storedProcedure(?, ?)}", inI, outJ, now; assertTrue (4 == j); dropObject("PROCEDURE", "storedProcedure"); @@ -394,7 +401,12 @@ void ODBCOracleTest::testStoredProcedureDynamicAny() " END storedProcedure;" , now; i = 2; - *_pSession << "{call storedProcedure(?)}", io(i), now; + + auto ioI = io(i); + assertTrue (nullptr != ioI); + assertTrue (ioI->canBind()); + + *_pSession << "{call storedProcedure(?)}", ioI, now; assertTrue (4 == i); dropObject("PROCEDURE", "storedProcedure"); @@ -988,7 +1000,7 @@ CppUnit::Test* ODBCOracleTest::suite() CppUnit_addTest(pSuite, ODBCOracleTest, testStoredProcedure); //CppUnit_addTest(pSuite, ODBCOracleTest, testCursorStoredProcedure); CppUnit_addTest(pSuite, ODBCOracleTest, testStoredProcedureAny); - CppUnit_addTest(pSuite, ODBCOracleTest, testStoredProcedureDynamicAny); + CppUnit_addTest(pSuite, ODBCOracleTest, testStoredProcedureDynamicVar); CppUnit_addTest(pSuite, ODBCOracleTest, testStoredFunction); //CppUnit_addTest(pSuite, ODBCOracleTest, testCursorStoredFunction); CppUnit_addTest(pSuite, ODBCOracleTest, testInternalExtraction); diff --git a/Data/ODBC/testsuite/src/ODBCOracleTest.h b/Data/ODBC/testsuite/src/ODBCOracleTest.h index 6c56fa59f..b8d76163a 100644 --- a/Data/ODBC/testsuite/src/ODBCOracleTest.h +++ b/Data/ODBC/testsuite/src/ODBCOracleTest.h @@ -45,7 +45,7 @@ public: void testStoredFunction(); void testCursorStoredFunction(); void testStoredProcedureAny(); - void testStoredProcedureDynamicAny(); + void testStoredProcedureDynamicVar(); void testAutoTransaction(); void testNull(); diff --git a/Data/ODBC/testsuite/src/ODBCPostgreSQLTest.cpp b/Data/ODBC/testsuite/src/ODBCPostgreSQLTest.cpp index 17da97e3d..ad018accd 100644 --- a/Data/ODBC/testsuite/src/ODBCPostgreSQLTest.cpp +++ b/Data/ODBC/testsuite/src/ODBCPostgreSQLTest.cpp @@ -14,7 +14,7 @@ #include "ODBCTest.h" #include "Poco/Format.h" #include "Poco/Any.h" -#include "Poco/DynamicAny.h" +#include "Poco/Dynamic/Var.h" #include "Poco/DateTime.h" #include "Poco/Data/ODBC/Diagnostics.h" #include "Poco/Data/ODBC/ODBCException.h" @@ -29,7 +29,7 @@ using Poco::Data::ODBC::StatementDiagnostics; using Poco::format; using Poco::Any; using Poco::AnyCast; -using Poco::DynamicAny; +using Poco::Dynamic::Var; using Poco::DateTime; @@ -326,8 +326,8 @@ void ODBCPostgreSQLTest::testStoredFunctionDynamicAny() session().setFeature("autoBind", bindValue(k)); session().setFeature("autoExtract", bindValue(k+1)); - DynamicAny i = 2; - DynamicAny result = 0; + Var i = 2; + Var result = 0; session() << "{? = call storedFunction(?)}", out(result), in(i), now; assertTrue (4 == result); diff --git a/Data/ODBC/testsuite/src/ODBCSQLServerTest.cpp b/Data/ODBC/testsuite/src/ODBCSQLServerTest.cpp index 8b98e0f80..1639cc148 100644 --- a/Data/ODBC/testsuite/src/ODBCSQLServerTest.cpp +++ b/Data/ODBC/testsuite/src/ODBCSQLServerTest.cpp @@ -14,7 +14,7 @@ #include "Poco/String.h" #include "Poco/Format.h" #include "Poco/Any.h" -#include "Poco/DynamicAny.h" +#include "Poco/Dynamic/Var.h" #include "Poco/Tuple.h" #include "Poco/DateTime.h" #include "Poco/Data/RecordSet.h" @@ -38,7 +38,7 @@ using Poco::format; using Poco::Tuple; using Poco::Any; using Poco::AnyCast; -using Poco::DynamicAny; +using Poco::Dynamic::Var; using Poco::DateTime; @@ -554,7 +554,7 @@ void ODBCSQLServerTest::testStoredProcedureAny() } -void ODBCSQLServerTest::testStoredProcedureDynamicAny() +void ODBCSQLServerTest::testStoredProcedureDynamicVar() { try { @@ -562,8 +562,8 @@ void ODBCSQLServerTest::testStoredProcedureDynamicAny() { session().setFeature("autoBind", bindValue(k)); - DynamicAny i = 2; - DynamicAny j = 0; + Var i = 2; + Var j = 0; dropObject("PROCEDURE", "storedProcedure"); session() << "CREATE PROCEDURE storedProcedure(@inParam int, @outParam int OUTPUT) AS " @@ -590,8 +590,8 @@ void ODBCSQLServerTest::testStoredProcedureDynamicAny() } dropObject("PROCEDURE", "storedProcedure"); } - catch (ConnectionException& ce) { std::cout << ce.toString() << std::endl; fail("testStoredProcedureDynamicAny()"); } - catch (StatementException& se) { std::cout << se.toString() << std::endl; fail("testStoredProcedureDynamicAny()"); } + catch (ConnectionException& ce) { std::cout << ce.toString() << std::endl; fail("testStoredProcedureDynamicVar()"); } + catch (StatementException& se) { std::cout << se.toString() << std::endl; fail("testStoredProcedureDynamicVar()"); } } @@ -1033,7 +1033,7 @@ CppUnit::Test* ODBCSQLServerTest::suite() CppUnit_addTest(pSuite, ODBCSQLServerTest, testStoredProcedure); CppUnit_addTest(pSuite, ODBCSQLServerTest, testCursorStoredProcedure); CppUnit_addTest(pSuite, ODBCSQLServerTest, testStoredProcedureAny); - CppUnit_addTest(pSuite, ODBCSQLServerTest, testStoredProcedureDynamicAny); + CppUnit_addTest(pSuite, ODBCSQLServerTest, testStoredProcedureDynamicVar); CppUnit_addTest(pSuite, ODBCSQLServerTest, testStoredProcedureReturn); CppUnit_addTest(pSuite, ODBCSQLServerTest, testStoredFunction); CppUnit_addTest(pSuite, ODBCSQLServerTest, testInternalExtraction); diff --git a/Data/ODBC/testsuite/src/ODBCSQLServerTest.h b/Data/ODBC/testsuite/src/ODBCSQLServerTest.h index a9c3d98fa..ba05b2edb 100644 --- a/Data/ODBC/testsuite/src/ODBCSQLServerTest.h +++ b/Data/ODBC/testsuite/src/ODBCSQLServerTest.h @@ -55,7 +55,7 @@ public: void testStoredProcedure(); void testCursorStoredProcedure(); void testStoredProcedureAny(); - void testStoredProcedureDynamicAny(); + void testStoredProcedureDynamicVar(); void testStoredProcedureReturn(); void testStoredFunction(); diff --git a/Data/ODBC/testsuite/src/ODBCTest.cpp b/Data/ODBC/testsuite/src/ODBCTest.cpp index b2ac22a4f..1686f2e8d 100644 --- a/Data/ODBC/testsuite/src/ODBCTest.cpp +++ b/Data/ODBC/testsuite/src/ODBCTest.cpp @@ -14,7 +14,7 @@ #include "Poco/String.h" #include "Poco/Format.h" #include "Poco/Any.h" -#include "Poco/DynamicAny.h" +#include "Poco/Dynamic/Var.h" #include "Poco/Tuple.h" #include "Poco/DateTime.h" #include "Poco/Exception.h" @@ -43,7 +43,7 @@ using Poco::format; using Poco::Tuple; using Poco::Any; using Poco::AnyCast; -using Poco::DynamicAny; +using Poco::Dynamic::Var; using Poco::DateTime; using Poco::NotFoundException; diff --git a/Data/ODBC/testsuite/src/ODBCTest.h b/Data/ODBC/testsuite/src/ODBCTest.h index 8449324d7..16b733e55 100644 --- a/Data/ODBC/testsuite/src/ODBCTest.h +++ b/Data/ODBC/testsuite/src/ODBCTest.h @@ -132,7 +132,7 @@ public: virtual void testStoredProcedure(); virtual void testStoredProcedureAny(); - virtual void testStoredProcedureDynamicAny(); + virtual void testStoredProcedureDynamicVar(); virtual void testStoredFunction(); virtual void testStoredFunctionAny(); @@ -251,9 +251,9 @@ inline void ODBCTest::testStoredProcedureAny() } -inline void ODBCTest::testStoredProcedureDynamicAny() +inline void ODBCTest::testStoredProcedureDynamicVar() { - throw Poco::NotImplementedException("ODBCTest::testStoredProcedureDynamicAny()"); + throw Poco::NotImplementedException("ODBCTest::testStoredProcedureDynamicVar()"); } diff --git a/Data/ODBC/testsuite/src/ODBCTestSuite.cpp b/Data/ODBC/testsuite/src/ODBCTestSuite.cpp index d9d418a6b..1c80536c4 100644 --- a/Data/ODBC/testsuite/src/ODBCTestSuite.cpp +++ b/Data/ODBC/testsuite/src/ODBCTestSuite.cpp @@ -37,11 +37,12 @@ CppUnit::Test* ODBCTestSuite::suite() // // For the time being, the workaround is to connect to DB2 after connecting to PostgreSQL and Oracle. - addTest(pSuite, ODBCMySQLTest::suite()); + + addTest(pSuite, ODBCSQLServerTest::suite()); addTest(pSuite, ODBCOracleTest::suite()); + addTest(pSuite, ODBCMySQLTest::suite()); addTest(pSuite, ODBCPostgreSQLTest::suite()); addTest(pSuite, ODBCSQLiteTest::suite()); - addTest(pSuite, ODBCSQLServerTest::suite()); addTest(pSuite, ODBCDB2Test::suite()); // MS Access driver does not support connection status detection // disabled for the time being diff --git a/Data/PostgreSQL/include/Poco/Data/PostgreSQL/BinaryExtractor.h b/Data/PostgreSQL/include/Poco/Data/PostgreSQL/BinaryExtractor.h index f5701d25b..f2dce2564 100644 --- a/Data/PostgreSQL/include/Poco/Data/PostgreSQL/BinaryExtractor.h +++ b/Data/PostgreSQL/include/Poco/Data/PostgreSQL/BinaryExtractor.h @@ -25,7 +25,7 @@ #include "Poco/Data/LOB.h" #include "Poco/Types.h" #include "Poco/Any.h" -#include "Poco/DynamicAny.h" +#include "Poco/Dynamic/Var.h" #include "Poco/Dynamic/Var.h" diff --git a/Data/PostgreSQL/include/Poco/Data/PostgreSQL/Extractor.h b/Data/PostgreSQL/include/Poco/Data/PostgreSQL/Extractor.h index fabe39c29..ff7e116bf 100644 --- a/Data/PostgreSQL/include/Poco/Data/PostgreSQL/Extractor.h +++ b/Data/PostgreSQL/include/Poco/Data/PostgreSQL/Extractor.h @@ -25,7 +25,7 @@ #include "Poco/Data/LOB.h" #include "Poco/Types.h" #include "Poco/Any.h" -#include "Poco/DynamicAny.h" +#include "Poco/Dynamic/Var.h" #include "Poco/Dynamic/Var.h" @@ -325,7 +325,7 @@ private: template bool extractStringImpl(std::size_t pos, T& val) - /// Utility function for extraction of Any and DynamicAny. + /// Utility function for extraction of Any and Dynamic::Var. { OutputParameter outputParameter = extractPreamble(pos); diff --git a/Data/SQLParser/src/SQLParser.h b/Data/SQLParser/src/SQLParser.h index 681136d0a..8c44a7805 100644 --- a/Data/SQLParser/src/SQLParser.h +++ b/Data/SQLParser/src/SQLParser.h @@ -2,7 +2,6 @@ #define SQLPARSER_SQLPARSER_H #include "SQLParserResult.h" -#include "sql/statements.h" namespace hsql { @@ -18,12 +17,12 @@ class SQLParser_API SQLParser { // Run tokenization on the given string and store the tokens in the output vector. static bool tokenize(const std::string& sql, std::vector* tokens); - // Deprecated. // Old method to parse SQL strings. Replaced by parse(). + POCO_DEPRECATED("Use parse()") static bool parseSQLString(const char* sql, SQLParserResult* result); - // Deprecated. // Old method to parse SQL strings. Replaced by parse(). + POCO_DEPRECATED("Use parse()") static bool parseSQLString(const std::string& sql, SQLParserResult* result); private: @@ -32,4 +31,4 @@ class SQLParser_API SQLParser { } // namespace hsql -#endif \ No newline at end of file +#endif diff --git a/Data/SQLite/include/Poco/Data/SQLite/Binder.h b/Data/SQLite/include/Poco/Data/SQLite/Binder.h index 3610d7215..b01f94a09 100644 --- a/Data/SQLite/include/Poco/Data/SQLite/Binder.h +++ b/Data/SQLite/include/Poco/Data/SQLite/Binder.h @@ -22,7 +22,7 @@ #include "Poco/Data/AbstractBinder.h" #include "Poco/Data/LOB.h" #include "Poco/Any.h" -#include "Poco/DynamicAny.h" +#include "Poco/Dynamic/Var.h" #include "sqlite3.h" diff --git a/Data/SQLite/include/Poco/Data/SQLite/Extractor.h b/Data/SQLite/include/Poco/Data/SQLite/Extractor.h index ac63be590..3d101f79c 100644 --- a/Data/SQLite/include/Poco/Data/SQLite/Extractor.h +++ b/Data/SQLite/include/Poco/Data/SQLite/Extractor.h @@ -29,7 +29,7 @@ #include "Poco/Data/Date.h" #include "Poco/Data/Time.h" #include "Poco/Any.h" -#include "Poco/DynamicAny.h" +#include "Poco/Dynamic/Var.h" #include "sqlite3.h" #include #include @@ -122,8 +122,8 @@ public: bool extract(std::size_t pos, Poco::Any& val); /// Extracts an Any. - bool extract(std::size_t pos, Poco::DynamicAny& val); - /// Extracts a DynamicAny. + bool extract(std::size_t pos, Poco::Dynamic::Var& val); + /// Extracts a Dynamic::Var. bool isNull(std::size_t pos, std::size_t row = POCO_DATA_INVALID_ROW); /// Returns true if the current row value at pos column is null. @@ -147,7 +147,7 @@ public: private: template bool extractImpl(std::size_t pos, T& val) - /// Utility function for extraction of Any and DynamicAny. + /// Utility function for extraction of Any and Dynamic::Var. { if (isNull(pos)) return false; diff --git a/Data/SQLite/src/Extractor.cpp b/Data/SQLite/src/Extractor.cpp index 697b9bd21..e760f530b 100644 --- a/Data/SQLite/src/Extractor.cpp +++ b/Data/SQLite/src/Extractor.cpp @@ -224,7 +224,7 @@ bool Extractor::extract(std::size_t pos, Poco::Any& val) } -bool Extractor::extract(std::size_t pos, Poco::DynamicAny& val) +bool Extractor::extract(std::size_t pos, Dynamic::Var& val) { return extractImpl(pos, val); } diff --git a/Data/SQLite/testsuite/src/SQLiteTest.cpp b/Data/SQLite/testsuite/src/SQLiteTest.cpp index d86e0838c..e2871eeba 100755 --- a/Data/SQLite/testsuite/src/SQLiteTest.cpp +++ b/Data/SQLite/testsuite/src/SQLiteTest.cpp @@ -32,7 +32,7 @@ #include "Poco/Any.h" #include "Poco/UUIDGenerator.h" #include "Poco/SharedPtr.h" -#include "Poco/DynamicAny.h" +#include "Poco/Dynamic/Var.h" #include "Poco/DateTime.h" #include "Poco/Logger.h" #include "Poco/Message.h" @@ -68,7 +68,7 @@ using Poco::Nullable; using Poco::Tuple; using Poco::Any; using Poco::AnyCast; -using Poco::DynamicAny; +using Poco::Dynamic::Var; using Poco::DateTime; using Poco::Logger; using Poco::Message; @@ -86,7 +86,6 @@ using Poco::Data::SQLite::ConstraintViolationException; using Poco::Data::SQLite::ParameterCountMismatchException; using Poco::Int32; using Poco::Int64; -using Poco::Dynamic::Var; using Poco::Data::SQLite::Utility; using Poco::delegate; using Poco::Stopwatch; @@ -2394,10 +2393,10 @@ void SQLiteTest::testDynamicAny() tmp << "DROP TABLE IF EXISTS Anys", now; tmp << "CREATE TABLE Anys (int0 INTEGER, flt0 REAL, str0 VARCHAR, empty INTEGER)", now; - DynamicAny i = Int32(42); - DynamicAny f = double(42.5); - DynamicAny s = std::string("42"); - DynamicAny e; + Var i = Int32(42); + Var f = double(42.5); + Var s = std::string("42"); + Var e; assertTrue (e.isEmpty()); tmp << "INSERT INTO Anys VALUES (?, ?, ?, null)", use(i), use(f), use(s), now; diff --git a/Data/include/Poco/Data/RecordSet.h b/Data/include/Poco/Data/RecordSet.h index a4483fad4..4500d0e34 100644 --- a/Data/include/Poco/Data/RecordSet.h +++ b/Data/include/Poco/Data/RecordSet.h @@ -140,9 +140,8 @@ public: /// execution. /// The number of rows reported is independent of filtering. + POCO_DEPRECATED("Replaced with subTotalRowCount() and getTotalRowCount()") std::size_t totalRowCount() const; - //@ deprecated - /// Replaced with subTotalRowCount() and getTotalRowCount(). std::size_t getTotalRowCount() const; /// Returns the total number of rows in the RecordSet. diff --git a/Data/include/Poco/Data/SQLChannel.h b/Data/include/Poco/Data/SQLChannel.h index 9491224da..ef3c68abf 100644 --- a/Data/include/Poco/Data/SQLChannel.h +++ b/Data/include/Poco/Data/SQLChannel.h @@ -19,7 +19,6 @@ #include "Poco/Data/Data.h" -#include "Poco/Data/Connector.h" #include "Poco/Data/Session.h" #include "Poco/Data/Statement.h" #include "Poco/Logger.h" @@ -218,7 +217,7 @@ public: static const std::string PROP_TABLE; static const std::string PROP_ARCHIVE_TABLE; static const std::string PROP_MAX_AGE; - static const std::string PROP_ASYNC; + POCO_DEPRECATED("") static const std::string PROP_ASYNC; static const std::string PROP_TIMEOUT; static const std::string PROP_MIN_BATCH; static const std::string PROP_MAX_BATCH; diff --git a/Data/src/SQLChannel.cpp b/Data/src/SQLChannel.cpp index 4507c490d..59181c45d 100644 --- a/Data/src/SQLChannel.cpp +++ b/Data/src/SQLChannel.cpp @@ -13,11 +13,8 @@ #include "Poco/Data/SQLChannel.h" -#include "Poco/Data/SessionFactory.h" #include "Poco/Data/BulkBinding.h" -#include "Poco/DateTime.h" #include "Poco/DateTimeFormatter.h" -#include "Poco/DateTimeFormat.h" #include "Poco/LoggingFactory.h" #include "Poco/Instantiator.h" #include "Poco/NumberParser.h" @@ -27,7 +24,7 @@ #include "Poco/File.h" #include "Poco/UUID.h" #include "Poco/UUIDGenerator.h" -#include + #include @@ -259,6 +256,7 @@ void SQLChannel::run() { try { + sleepTime = 100; if (_reconnect) { close(); @@ -267,7 +265,6 @@ void SQLChannel::run() if (_reconnect && sleepTime < 12800) sleepTime *= 2; } - if (!_reconnect) { if (_logQueue.size()) processBatch(_minBatch); diff --git a/Foundation/include/Poco/AbstractCache.h b/Foundation/include/Poco/AbstractCache.h index 91bd9b174..735ed9469 100644 --- a/Foundation/include/Poco/AbstractCache.h +++ b/Foundation/include/Poco/AbstractCache.h @@ -21,8 +21,7 @@ #include "Poco/KeyValueArgs.h" #include "Poco/ValidArgs.h" #include "Poco/Mutex.h" -#include "Poco/Exception.h" -#include "Poco/FIFOEvent.h" +#include "Poco/BasicEvent.h" #include "Poco/EventArgs.h" #include "Poco/Delegate.h" #include "Poco/SharedPtr.h" @@ -39,16 +38,16 @@ class AbstractCache /// An AbstractCache is the interface of all caches. { public: - FIFOEvent, TEventMutex> Add; - FIFOEvent, TEventMutex> Update; - FIFOEvent Remove; - FIFOEvent Get; - FIFOEvent Clear; + BasicEvent, TEventMutex> Add; + BasicEvent, TEventMutex> Update; + BasicEvent Remove; + BasicEvent Get; + BasicEvent Clear; - typedef std::map> DataHolder; - typedef typename DataHolder::iterator Iterator; - typedef typename DataHolder::const_iterator ConstIterator; - typedef std::set KeySet; + using DataHolder = std::map>; + using Iterator = typename DataHolder::iterator; + using ConstIterator = typename DataHolder::const_iterator; + using KeySet = std::set; AbstractCache() { @@ -72,6 +71,9 @@ public: } } + AbstractCache(const AbstractCache& aCache) = delete; + AbstractCache& operator = (const AbstractCache& aCache) = delete; + void add(const TKey& key, const TValue& val) /// Adds the key value pair to the cache. /// If for the key already an entry exists, it will be overwritten. @@ -194,8 +196,8 @@ public: } protected: - mutable FIFOEvent> IsValid; - mutable FIFOEvent Replace; + mutable BasicEvent> IsValid; + mutable BasicEvent Replace; void initialize() /// Sets up event registration. @@ -371,9 +373,6 @@ protected: mutable DataHolder _data; mutable TMutex _mutex; -private: - AbstractCache(const AbstractCache& aCache); - AbstractCache& operator = (const AbstractCache& aCache); }; diff --git a/Foundation/include/Poco/AbstractObserver.h b/Foundation/include/Poco/AbstractObserver.h index 0b6a60397..0a59a8fc5 100755 --- a/Foundation/include/Poco/AbstractObserver.h +++ b/Foundation/include/Poco/AbstractObserver.h @@ -40,7 +40,7 @@ public: virtual bool equals(const AbstractObserver& observer) const = 0; - [[deprecated("use `Poco::Any accepts(Notification*)` instead")]] + POCO_DEPRECATED("use `Poco::Any accepts(Notification*)` instead") virtual bool accepts(Notification* pNf, const char* pName) const = 0; virtual bool accepts(const Notification::Ptr& pNf) const = 0; diff --git a/Foundation/include/Poco/ClassLibrary.h b/Foundation/include/Poco/ClassLibrary.h index e10dbcbfb..0f8660431 100644 --- a/Foundation/include/Poco/ClassLibrary.h +++ b/Foundation/include/Poco/ClassLibrary.h @@ -67,13 +67,13 @@ extern "C" \ #define POCO_BEGIN_MANIFEST_IMPL(fnName, base) \ bool fnName(Poco::ManifestBase* pManifest_) \ { \ - typedef base _Base; \ - typedef Poco::Manifest<_Base> _Manifest; \ - std::string requiredType(typeid(_Manifest).name()); \ - std::string actualType(pManifest_->className()); \ + using BaseType = base; \ + using ManifestType = Poco::Manifest; \ + const std::string requiredType(typeid(ManifestType).name()); \ + const std::string actualType(pManifest_->className()); \ if (requiredType == actualType) \ { \ - Poco::Manifest<_Base>* pManifest = static_cast<_Manifest*>(pManifest_); + Poco::Manifest* pManifest = static_cast(pManifest_); #define POCO_BEGIN_MANIFEST(base) \ @@ -93,15 +93,15 @@ extern "C" \ #define POCO_EXPORT_CLASS(cls) \ - pManifest->insert(new Poco::MetaObject(#cls)); + pManifest->insert(new Poco::MetaObject(#cls)); #define POCO_EXPORT_INTERFACE(cls, itf) \ - pManifest->insert(new Poco::MetaObject(itf)); + pManifest->insert(new Poco::MetaObject(itf)); #define POCO_EXPORT_SINGLETON(cls) \ - pManifest->insert(new Poco::MetaSingleton(#cls)); + pManifest->insert(new Poco::MetaSingleton(#cls)); #endif // Foundation_ClassLibrary_INCLUDED diff --git a/Foundation/include/Poco/ClassLoader.h b/Foundation/include/Poco/ClassLoader.h index a55c63fdc..4a49c2514 100644 --- a/Foundation/include/Poco/ClassLoader.h +++ b/Foundation/include/Poco/ClassLoader.h @@ -254,7 +254,7 @@ public: if (itm != pManif->end()) return *itm; } - return 0; + return nullptr; } const Meta& classFor(const std::string& className) const diff --git a/Foundation/include/Poco/Config.h b/Foundation/include/Poco/Config.h index cd01069d7..a0168008a 100644 --- a/Foundation/include/Poco/Config.h +++ b/Foundation/include/Poco/Config.h @@ -175,10 +175,6 @@ // to "d.so", "d.dll", etc. for _DEBUG builds in Poco::SharedLibrary. // #define POCO_NO_SHARED_LIBRARY_DEBUG_SUFFIX - -// Disarm POCO_DEPRECATED macro. -// #define POCO_NO_DEPRECATED - // Enable usage of Poco::Mutex and Poco::FastMutex // as wrappers for std::recursive_mutex and std::mutex #ifndef POCO_ENABLE_STD_MUTEX @@ -187,6 +183,13 @@ #define POCO_HAVE_CPP17_COMPILER (__cplusplus >= 201703L) +// Option to silence deprecation warnings. +#ifndef POCO_SILENCE_DEPRECATED + #define POCO_DEPRECATED(reason) [[deprecated(reason)]] +#else + #define POCO_DEPRECATED(reason) +#endif + // Uncomment to explicitly disable SQLParser // #define POCO_DATA_NO_SQL_PARSER diff --git a/Foundation/include/Poco/DirectoryIterator.h b/Foundation/include/Poco/DirectoryIterator.h index fd8e89db1..8749719d8 100644 --- a/Foundation/include/Poco/DirectoryIterator.h +++ b/Foundation/include/Poco/DirectoryIterator.h @@ -75,7 +75,7 @@ public: virtual DirectoryIterator& operator ++ (); // prefix - //@ deprecated + POCO_DEPRECATED("") DirectoryIterator operator ++ (int); // postfix /// Please use the prefix increment operator instead. diff --git a/Foundation/include/Poco/Dynamic/Var.h b/Foundation/include/Poco/Dynamic/Var.h index 076b56646..2eec24cd9 100644 --- a/Foundation/include/Poco/Dynamic/Var.h +++ b/Foundation/include/Poco/Dynamic/Var.h @@ -210,7 +210,7 @@ public: if (pHolder && pHolder->type() == typeid(T)) { - VarHolderImpl* pHolderImpl = static_cast*>(pHolder); + auto* pHolderImpl = static_cast*>(pHolder); return pHolderImpl->value(); } else if (!pHolder) @@ -480,7 +480,7 @@ public: /// If demangling is available and emangle is true, /// the returnsed string will be demangled. - //@ deprecated + POCO_DEPRECATED("Use clear() instead") void empty(); /// Empties Var. /// This function is deprecated and will be removed. @@ -733,7 +733,7 @@ inline bool Var::operator ! () const inline bool Var::isEmpty() const { - return 0 == content(); + return nullptr == content(); } @@ -2288,8 +2288,7 @@ inline bool operator >= (const unsigned long& other, const Var& da) } // namespace Dynamic -//@ deprecated -typedef Dynamic::Var DynamicAny; +using DynamicAny POCO_DEPRECATED("") = Dynamic::Var; } // namespace Poco diff --git a/Foundation/include/Poco/Dynamic/VarHolder.h b/Foundation/include/Poco/Dynamic/VarHolder.h index 2cab44d54..fab0bdb25 100644 --- a/Foundation/include/Poco/Dynamic/VarHolder.h +++ b/Foundation/include/Poco/Dynamic/VarHolder.h @@ -131,12 +131,12 @@ class Foundation_API VarHolder /// throw BadCastException. { public: - typedef Var ArrayValueType; + using ArrayValueType = Var; virtual ~VarHolder(); /// Destroys the VarHolder. - virtual VarHolder* clone(Placeholder* pHolder = 0) const = 0; + virtual VarHolder* clone(Placeholder* pHolder = nullptr) const = 0; /// Implementation must implement this function to /// deep-copy the VarHolder. /// If small object optimization is enabled (i.e. if @@ -323,17 +323,17 @@ protected: } template ::value && std::is_signed::value) || - std::is_floating_point::value, F>::type* = nullptr, - typename std::enable_if<(std::is_integral::value && std::is_signed::value) || - std::is_floating_point::value, T>::type* = nullptr> + std::enable_if_t<(std::is_integral_v && std::is_signed_v) || + std::is_floating_point_v, F>* = nullptr, + std::enable_if_t<(std::is_integral_v && std::is_signed_v) || + std::is_floating_point_v, T>* = nullptr> static void convertToSmaller(const F& from, T& to) /// Converts signed integral, as well as floating-point, values from /// larger to smaller type. It checks the upper and lower bound and /// if from value is within limits of type T (i.e. check calls do not throw), /// it is converted. { - if constexpr((std::is_integral::value) && (std::is_floating_point::value)) + if constexpr((std::is_integral_v) && (std::is_floating_point_v)) { if (isPrecisionLost(from)) POCO_VAR_RANGE_EXCEPTION ("Lost precision", from); @@ -344,8 +344,8 @@ protected: } template ::value && std::is_signed::value, F>::type* = nullptr, - typename std::enable_if::value, T>::type* = nullptr> + std::enable_if_t && std::is_signed_v, F>* = nullptr, + std::enable_if_t, T>* = nullptr> static void convertToSmaller(const F& from, T& to) /// Converts signed integral values from integral to floating-point type. Checks for /// the loss of precision and if from value is within limits of type T (i.e. check calls do not throw), @@ -357,8 +357,8 @@ protected: } template ::value>::type* = nullptr, - typename std::enable_if::value, T>::type* = nullptr> + std::enable_if_t>* = nullptr, + std::enable_if_t, T>* = nullptr> static void convertToSmaller(const F& from, T& to) /// Converts boolean values to floating-point type. { @@ -366,8 +366,8 @@ protected: } template ::value && !std::is_signed::value, F>::type* = nullptr, - typename std::enable_if<(std::is_integral::value && !std::is_signed::value) || std::is_floating_point::value, T>::type* = nullptr> + std::enable_if_t && !std::is_signed_v, F>* = nullptr, + std::enable_if_t<(std::is_integral_v && !std::is_signed::value) || std::is_floating_point::value, T>* = nullptr> static void convertToSmallerUnsigned(const F& from, T& to) /// Converts unsigned integral data types from larger to smaller, as well as to floating-point, types. /// Since lower limit is always 0 for unsigned types, only the upper limit is checked, thus @@ -380,8 +380,8 @@ protected: } template ::value && std::is_signed::value, F>::type* = nullptr, - typename std::enable_if::value && !std::is_signed::value, T>::type* = nullptr> + std::enable_if_t && std::is_signed_v, F>* = nullptr, + std::enable_if_t && !std::is_signed_v, T>* = nullptr> static void convertSignedToUnsigned(const F& from, T& to) /// Converts signed integral data types to unsigned data types. /// Negative values can not be converted and if one is encountered, RangeException is thrown. @@ -393,8 +393,8 @@ protected: to = static_cast(from); } - template ::value, bool> = true, - typename std::enable_if::value && !std::is_signed::value, T>::type* = nullptr> + template , bool> = true, + std::enable_if_t && !std::is_signed_v, T>* = nullptr> static void convertSignedFloatToUnsigned(const F& from, T& to) /// Converts floating point data types to unsigned integral data types. Negative values /// can not be converted and if one is encountered, RangeException is thrown. @@ -407,8 +407,8 @@ protected: } template ::value && !std::is_signed::value, F>::type* = nullptr, - typename std::enable_if::value && std::is_signed::value, T>::type* = nullptr> + std::enable_if_t && !std::is_signed_v, F>* = nullptr, + std::enable_if_t && std::is_signed_v, T>* = nullptr> static void convertUnsignedToSigned(const F& from, T& to) /// Converts unsigned integral data types to signed integral data types. /// If upper limit is within the target data type limits, the conversion is performed. @@ -418,8 +418,8 @@ protected: } template ::value, bool> = true, - std::enable_if_t::value, bool> = true> + std::enable_if_t, bool> = true, + std::enable_if_t, bool> = true> static void convertToFP(F& from, T& to) /// Converts unsigned integral data types to floating-point data types. /// If the number of significant digits used for the integer vaue exceeds the number @@ -433,7 +433,7 @@ protected: private: - template ::value, bool> = true> + template , bool> = true> static constexpr int numValDigits(const T& value) { using U = std::make_unsigned_t; @@ -444,58 +444,58 @@ private: return digitCount; } - template ::value, bool> = true> + template , bool> = true> static constexpr int numValDigits(T value) { return numValDigits(static_cast(value)); } - template ::value, bool> = true> + template , bool> = true> static constexpr int numTypeDigits() { return std::numeric_limits::digits; } - template ::value, bool> = true> + template , bool> = true> static constexpr int numTypeDigits() { return numValDigits(std::numeric_limits::max()); } template ::value, bool> = true, - std::enable_if_t::value, bool> = true> + std::enable_if_t, bool> = true, + std::enable_if_t, bool> = true> static bool isPrecisionLost(const F& from) // Checks for loss of precision in integral -> floating point conversion. { return numValDigits(from) > numTypeDigits(); } - template ::value, bool> = true> + template , bool> = true> static void checkUpperLimit(const F& from) { if (from > static_cast(std::numeric_limits::max())) POCO_VAR_RANGE_EXCEPTION ("Value too big", from); } - template ::value, bool> = true> + template , bool> = true> static void checkLowerLimit(const F& from) { if (from < static_cast(std::numeric_limits::min())) POCO_VAR_RANGE_EXCEPTION ("Value too small", from); } - template ::value, bool> = true> + template , bool> = true> static void checkUpperLimit(const F& from) { if ((from > static_cast(std::numeric_limits::max()))) POCO_VAR_RANGE_EXCEPTION ("Value too big", from); } - template ::value, bool> = true> + template , bool> = true> static void checkLowerLimit(const F& from) { - if constexpr(std::is_floating_point::value) + if constexpr(std::is_floating_point_v) { if (static_cast(-std::numeric_limits::max()) > from) POCO_VAR_RANGE_EXCEPTION ("Value too small", from); @@ -4376,10 +4376,10 @@ private: }; -typedef std::vector Vector; -typedef std::deque Deque; -typedef std::list List; -typedef Vector Array; +using Vector = std::vector; +using Deque = std::deque; +using List = std::list; +using Array = Vector; } } // namespace Poco::Dynamic diff --git a/Foundation/include/Poco/Event.h b/Foundation/include/Poco/Event.h index c59f29acd..b28c98664 100644 --- a/Foundation/include/Poco/Event.h +++ b/Foundation/include/Poco/Event.h @@ -55,7 +55,7 @@ public: /// the event is automatically reset after /// a wait() successfully returns. - //@ deprecated + POCO_DEPRECATED("") explicit Event(bool autoReset); /// Please use Event::Event(EventType) instead. diff --git a/Foundation/include/Poco/FIFOEvent.h b/Foundation/include/Poco/FIFOEvent.h index f4c5007e7..6d8701ba7 100644 --- a/Foundation/include/Poco/FIFOEvent.h +++ b/Foundation/include/Poco/FIFOEvent.h @@ -26,9 +26,8 @@ namespace Poco { -//@ deprecated template -class FIFOEvent: public AbstractEvent < +class POCO_DEPRECATED("use BasicEvent") FIFOEvent: public AbstractEvent < TArgs, FIFOStrategy>, AbstractDelegate, diff --git a/Foundation/include/Poco/FIFOStrategy.h b/Foundation/include/Poco/FIFOStrategy.h index 577bb4ee2..db837f0d7 100644 --- a/Foundation/include/Poco/FIFOStrategy.h +++ b/Foundation/include/Poco/FIFOStrategy.h @@ -24,9 +24,8 @@ namespace Poco { -//@ deprecated template -class FIFOStrategy: public DefaultStrategy +class POCO_DEPRECATED("") FIFOStrategy: public DefaultStrategy /// Note: As of release 1.4.2, DefaultStrategy already /// implements FIFO behavior, so this class is provided /// for backwards compatibility only. diff --git a/Foundation/include/Poco/Foundation.h b/Foundation/include/Poco/Foundation.h index d387f572c..852758759 100644 --- a/Foundation/include/Poco/Foundation.h +++ b/Foundation/include/Poco/Foundation.h @@ -141,25 +141,6 @@ using namespace std::literals; #define POCO_DO_JOIN(X, Y) POCO_DO_JOIN2(X, Y) #define POCO_DO_JOIN2(X, Y) X##Y - -// -// POCO_DEPRECATED -// -// A macro expanding to a compiler-specific clause to -// mark a class or function as deprecated. -// -#if defined(POCO_NO_DEPRECATED) -#define POCO_DEPRECATED -#elif defined(_GNUC_) -#define POCO_DEPRECATED __attribute__((deprecated)) -#elif defined(__clang__) -#define POCO_DEPRECATED __attribute__((deprecated)) -#elif defined(_MSC_VER) -#define POCO_DEPRECATED __declspec(deprecated) -#else -#define POCO_DEPRECATED -#endif - // // MS Visual Studio can use type long for __LINE__ macro // when /ZI compilation flag is used - https://learn.microsoft.com/en-us/cpp/build/reference/z7-zi-zi-debug-information-format?view=msvc-170#zi-1 @@ -176,7 +157,7 @@ using LineNumber = decltype(__LINE__); // #include "Poco/Bugcheck.h" #include "Poco/Types.h" -#include + #endif // Foundation_Foundation_INCLUDED diff --git a/Foundation/include/Poco/HashFunction.h b/Foundation/include/Poco/HashFunction.h index c451d0699..3daabfe72 100644 --- a/Foundation/include/Poco/HashFunction.h +++ b/Foundation/include/Poco/HashFunction.h @@ -25,9 +25,8 @@ namespace Poco { -//@ deprecated template -struct HashFunction +struct POCO_DEPRECATED("use Hash") HashFunction /// A generic hash function. { UInt32 operator () (T key, UInt32 maxValue) const @@ -38,9 +37,8 @@ struct HashFunction }; -//@ deprecated template <> -struct HashFunction +struct POCO_DEPRECATED("use Hash") HashFunction /// A generic hash function. { UInt32 operator () (const std::string& key, UInt32 maxValue) const diff --git a/Foundation/include/Poco/HashMap.h b/Foundation/include/Poco/HashMap.h index 63def8bf9..418bdfba0 100644 --- a/Foundation/include/Poco/HashMap.h +++ b/Foundation/include/Poco/HashMap.h @@ -85,26 +85,23 @@ class HashMap /// A HashMap can be used just like a std::map. { public: - typedef Key KeyType; - typedef Mapped MappedType; - typedef Mapped& Reference; - typedef const Mapped& ConstReference; - typedef Mapped* Pointer; - typedef const Mapped* ConstPointer; + using KeyType = Key; + using MappedType = Mapped; + using Reference = Mapped &; + using ConstReference = const Mapped &; + using Pointer = Mapped *; + using ConstPointer = const Mapped *; - typedef HashMapEntry ValueType; - typedef std::pair PairType; + using ValueType = HashMapEntry; + using PairType = std::pair; - typedef HashMapEntryHash HashType; - typedef LinearHashTable HashTable; + using HashType = HashMapEntryHash; + using HashTable = LinearHashTable; - typedef typename HashTable::Iterator Iterator; - typedef typename HashTable::ConstIterator ConstIterator; + using Iterator = typename HashTable::Iterator; + using ConstIterator = typename HashTable::ConstIterator; - HashMap() - /// Creates an empty HashMap. - { - } + HashMap() = default; HashMap(std::size_t initialReserve): _table(initialReserve) diff --git a/Foundation/include/Poco/HashStatistic.h b/Foundation/include/Poco/HashStatistic.h index b2541ee23..4d1a2fa2a 100644 --- a/Foundation/include/Poco/HashStatistic.h +++ b/Foundation/include/Poco/HashStatistic.h @@ -24,8 +24,8 @@ namespace Poco { +class POCO_DEPRECATED("") HashStatistic; -//@ deprecated class Foundation_API HashStatistic /// HashStatistic class bundles statistical information on the current state of a HashTable { diff --git a/Foundation/include/Poco/HashTable.h b/Foundation/include/Poco/HashTable.h index 259ce8da3..b4b4eed5e 100644 --- a/Foundation/include/Poco/HashTable.h +++ b/Foundation/include/Poco/HashTable.h @@ -31,9 +31,8 @@ namespace Poco { -//@ deprecated template > -class HashTable +class POCO_DEPRECATED("use LinearHashTable") HashTable /// A HashTable stores a key value pair that can be looked up via a hashed key. /// /// Collision handling is done via overflow maps(!). With small hash tables performance of this diff --git a/Foundation/include/Poco/LinearHashTable.h b/Foundation/include/Poco/LinearHashTable.h index 5d7c1f856..e35e8bfa5 100644 --- a/Foundation/include/Poco/LinearHashTable.h +++ b/Foundation/include/Poco/LinearHashTable.h @@ -20,7 +20,6 @@ #include "Poco/Foundation.h" #include "Poco/Hash.h" -#include #include #include #include @@ -55,16 +54,16 @@ class LinearHashTable /// elements in a bucket should not exceed 3. { public: - typedef Value ValueType; - typedef Value& Reference; - typedef const Value& ConstReference; - typedef Value* Pointer; - typedef const Value* ConstPointer; - typedef HashFunc Hash; - typedef std::vector Bucket; - typedef std::vector BucketVec; - typedef typename Bucket::iterator BucketIterator; - typedef typename BucketVec::iterator BucketVecIterator; + using ValueType = Value; + using Reference = Value &; + using ConstReference = const Value &; + using Pointer = Value *; + using ConstPointer = const Value *; + using Hash = HashFunc; + using Bucket = std::vector; + using BucketVec = std::vector; + using BucketIterator = typename Bucket::iterator; + using BucketVecIterator = typename BucketVec::iterator; class ConstIterator { @@ -176,9 +175,7 @@ public: class Iterator: public ConstIterator { public: - Iterator() - { - } + Iterator() = default; Iterator(const BucketVecIterator& vecIt, const BucketVecIterator& endIt, const BucketIterator& buckIt): ConstIterator(vecIt, endIt, buckIt) @@ -238,10 +235,7 @@ public: friend class LinearHashTable; }; - LinearHashTable(std::size_t initialReserve = 64): - _split(0), - _front(1), - _size(0) + LinearHashTable(std::size_t initialReserve = 64) /// Creates the LinearHashTable, using the given initialReserve. { _buckets.reserve(calcSize(initialReserve)); @@ -257,10 +251,8 @@ public: { } - ~LinearHashTable() + ~LinearHashTable() = default; /// Destroys the LinearHashTable. - { - } LinearHashTable& operator = (const LinearHashTable& table) /// Assigns another LinearHashTable. @@ -495,9 +487,9 @@ private: // Evil hack: _buckets must be mutable because both ConstIterator and Iterator hold // ordinary iterator's (not const_iterator's). mutable BucketVec _buckets; - std::size_t _split; - std::size_t _front; - std::size_t _size; + std::size_t _split{0}; + std::size_t _front{1}; + std::size_t _size{0}; HashFunc _hash; }; diff --git a/Foundation/include/Poco/LocalDateTime.h b/Foundation/include/Poco/LocalDateTime.h index 5562309fe..440e1735d 100644 --- a/Foundation/include/Poco/LocalDateTime.h +++ b/Foundation/include/Poco/LocalDateTime.h @@ -67,7 +67,6 @@ public: /// * millisecond is from 0 to 999. /// * microsecond is from 0 to 999. - //@ deprecated LocalDateTime(int tzd, int year, int month, int day, int hour, int minute, int second, int millisecond, int microsecond); /// Creates a LocalDateTime for the given Gregorian date and time in the /// time zone denoted by the time zone differential in tzd. @@ -85,13 +84,11 @@ public: /// Creates a LocalDateTime from the UTC time given in dateTime, /// using the time zone differential of the current time zone. - //@ deprecated LocalDateTime(int tzd, const DateTime& dateTime); /// Creates a LocalDateTime from the UTC time given in dateTime, /// using the given time zone differential. Adjusts dateTime /// for the given time zone differential. - //@ deprecated LocalDateTime(int tzd, const DateTime& dateTime, bool adjust); /// Creates a LocalDateTime from the UTC time given in dateTime, /// using the given time zone differential. If adjust is true, @@ -100,7 +97,6 @@ public: LocalDateTime(double julianDay); /// Creates a LocalDateTime for the given Julian day in the local time zone. - //@ deprecated LocalDateTime(int tzd, double julianDay); /// Creates a LocalDateTime for the given Julian day in the time zone /// denoted by the time zone differential in tzd. @@ -131,7 +127,6 @@ public: /// * millisecond is from 0 to 999. /// * microsecond is from 0 to 999. - //@ deprecated LocalDateTime& assign(int tzd, int year, int month, int day, int hour, int minute, int second, int millisecond, int microseconds); /// Assigns a Gregorian local date and time in the time zone denoted by /// the time zone differential in tzd. @@ -145,7 +140,6 @@ public: /// * millisecond is from 0 to 999. /// * microsecond is from 0 to 999. - //@ deprecated LocalDateTime& assign(int tzd, double julianDay); /// Assigns a Julian day in the time zone denoted by the /// time zone differential in tzd. diff --git a/Foundation/include/Poco/NObserver.h b/Foundation/include/Poco/NObserver.h index a348c9151..72c354434 100755 --- a/Foundation/include/Poco/NObserver.h +++ b/Foundation/include/Poco/NObserver.h @@ -99,7 +99,7 @@ public: return pObs && pObs->_pObject == _pObject && pObs->_handler == _handler && pObs->_matcher == _matcher; } - [[deprecated("use `bool accepts(const Notification::Ptr&)` instead")]] + POCO_DEPRECATED("use `bool accepts(const Notification::Ptr&)` instead") virtual bool accepts(Notification* pNf, const char* pName) const { return (!pName || pNf->name() == pName) && dynamic_cast(pNf) != nullptr; diff --git a/Foundation/include/Poco/NamedTuple.h b/Foundation/include/Poco/NamedTuple.h index fa0b41efa..7b6e1c882 100644 --- a/Foundation/include/Poco/NamedTuple.h +++ b/Foundation/include/Poco/NamedTuple.h @@ -21,7 +21,7 @@ #include "Poco/Foundation.h" #include "Poco/Tuple.h" #include "Poco/TypeList.h" -#include "Poco/DynamicAny.h" +#include "Poco/Dynamic/Var.h" #include "Poco/SharedPtr.h" #include "Poco/Format.h" @@ -265,12 +265,12 @@ struct NamedTuple: public Tuple::CONSTTYPE& t39 = POCO_TYPEWRAPPER_DEFAULTVALUE(T39)): TupleType(t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39), - _pNames(0) + _pNames(nullptr) { init(n0,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,n18,n19,n20,n21,n22,n23,n24,n25,n26,n27,n28,n29,n30,n31,n32,n33,n34,n35,n36,n37,n38,n39); } - const DynamicAny get(const std::string& name) const + const Dynamic::Var get(const std::string& name) const { NameVec::const_iterator it = _pNames->begin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -329,7 +329,7 @@ struct NamedTuple: public Tuplebegin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -780,7 +780,7 @@ struct NamedTuplebegin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -1223,7 +1223,7 @@ struct NamedTuplebegin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -1658,7 +1658,7 @@ struct NamedTuplebegin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -2085,7 +2085,7 @@ struct NamedTuplebegin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -2504,7 +2504,7 @@ struct NamedTuplebegin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -2915,7 +2915,7 @@ struct NamedTuplebegin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -3318,7 +3318,7 @@ struct NamedTuplebegin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -3713,7 +3713,7 @@ struct NamedTuplebegin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -4100,7 +4100,7 @@ struct NamedTuplebegin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -4479,7 +4479,7 @@ struct NamedTuplebegin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -4850,7 +4850,7 @@ struct NamedTuplebegin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -5213,7 +5213,7 @@ struct NamedTuplebegin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -5568,7 +5568,7 @@ struct NamedTuplebegin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -5915,7 +5915,7 @@ struct NamedTuplebegin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -6254,7 +6254,7 @@ struct NamedTuplebegin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -6585,7 +6585,7 @@ struct NamedTuplebegin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -6908,7 +6908,7 @@ struct NamedTuplebegin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -7223,7 +7223,7 @@ struct NamedTuplebegin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -7530,7 +7530,7 @@ struct NamedTuplebegin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -7829,7 +7829,7 @@ struct NamedTuplebegin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -8120,7 +8120,7 @@ struct NamedTuplebegin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -8403,7 +8403,7 @@ struct NamedTuplebegin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -8678,7 +8678,7 @@ struct NamedTuplebegin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -8946,7 +8946,7 @@ struct NamedTuplebegin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -9206,7 +9206,7 @@ struct NamedTuple: init(n0,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13); } - const DynamicAny get(const std::string& name) const + const Dynamic::Var get(const std::string& name) const { NameVec::const_iterator it = _pNames->begin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -9458,7 +9458,7 @@ struct NamedTuple: throw NotFoundException("Name not found: " + name); } - const DynamicAny operator [] (const std::string& name) const + const Dynamic::Var operator [] (const std::string& name) const { return get(name); } @@ -9669,7 +9669,7 @@ struct NamedTuple: init(n0,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12); } - const DynamicAny get(const std::string& name) const + const Dynamic::Var get(const std::string& name) const { NameVec::const_iterator it = _pNames->begin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -9701,7 +9701,7 @@ struct NamedTuple: throw NotFoundException("Name not found: " + name); } - const DynamicAny operator [] (const std::string& name) const + const Dynamic::Var operator [] (const std::string& name) const { return get(name); } @@ -9906,7 +9906,7 @@ struct NamedTuple: init(n0,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11); } - const DynamicAny get(const std::string& name) const + const Dynamic::Var get(const std::string& name) const { NameVec::const_iterator it = _pNames->begin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -9937,7 +9937,7 @@ struct NamedTuple: throw NotFoundException("Name not found: " + name); } - const DynamicAny operator [] (const std::string& name) const + const Dynamic::Var operator [] (const std::string& name) const { return get(name); } @@ -10134,7 +10134,7 @@ struct NamedTuple: init(n0,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10); } - const DynamicAny get(const std::string& name) const + const Dynamic::Var get(const std::string& name) const { NameVec::const_iterator it = _pNames->begin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -10164,7 +10164,7 @@ struct NamedTuple: throw NotFoundException("Name not found: " + name); } - const DynamicAny operator [] (const std::string& name) const + const Dynamic::Var operator [] (const std::string& name) const { return get(name); } @@ -10355,7 +10355,7 @@ struct NamedTuple: init(n0,n1,n2,n3,n4,n5,n6,n7,n8,n9); } - const DynamicAny get(const std::string& name) const + const Dynamic::Var get(const std::string& name) const { NameVec::const_iterator it = _pNames->begin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -10384,7 +10384,7 @@ struct NamedTuple: throw NotFoundException("Name not found: " + name); } - const DynamicAny operator [] (const std::string& name) const + const Dynamic::Var operator [] (const std::string& name) const { return get(name); } @@ -10568,7 +10568,7 @@ struct NamedTuple: init(n0,n1,n2,n3,n4,n5,n6,n7,n8); } - const DynamicAny get(const std::string& name) const + const Dynamic::Var get(const std::string& name) const { NameVec::const_iterator it = _pNames->begin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -10596,7 +10596,7 @@ struct NamedTuple: throw NotFoundException("Name not found: " + name); } - const DynamicAny operator [] (const std::string& name) const + const Dynamic::Var operator [] (const std::string& name) const { return get(name); } @@ -10773,7 +10773,7 @@ struct NamedTuple: init(n0,n1,n2,n3,n4,n5,n6,n7); } - const DynamicAny get(const std::string& name) const + const Dynamic::Var get(const std::string& name) const { NameVec::const_iterator it = _pNames->begin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -10800,7 +10800,7 @@ struct NamedTuple: throw NotFoundException("Name not found: " + name); } - const DynamicAny operator [] (const std::string& name) const + const Dynamic::Var operator [] (const std::string& name) const { return get(name); } @@ -10968,7 +10968,7 @@ struct NamedTuple: init(n0,n1,n2,n3,n4,n5,n6); } - const DynamicAny get(const std::string& name) const + const Dynamic::Var get(const std::string& name) const { NameVec::const_iterator it = _pNames->begin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -10994,7 +10994,7 @@ struct NamedTuple: throw NotFoundException("Name not found: " + name); } - const DynamicAny operator [] (const std::string& name) const + const Dynamic::Var operator [] (const std::string& name) const { return get(name); } @@ -11155,7 +11155,7 @@ struct NamedTuple: init(n0,n1,n2,n3,n4,n5); } - const DynamicAny get(const std::string& name) const + const Dynamic::Var get(const std::string& name) const { NameVec::const_iterator it = _pNames->begin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -11180,7 +11180,7 @@ struct NamedTuple: throw NotFoundException("Name not found: " + name); } - const DynamicAny operator [] (const std::string& name) const + const Dynamic::Var operator [] (const std::string& name) const { return get(name); } @@ -11336,7 +11336,7 @@ struct NamedTuple: init(n0,n1,n2,n3,n4); } - const DynamicAny get(const std::string& name) const + const Dynamic::Var get(const std::string& name) const { NameVec::const_iterator it = _pNames->begin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -11360,7 +11360,7 @@ struct NamedTuple: throw NotFoundException("Name not found: " + name); } - const DynamicAny operator [] (const std::string& name) const + const Dynamic::Var operator [] (const std::string& name) const { return get(name); } @@ -11508,7 +11508,7 @@ struct NamedTuple: init(n0,n1,n2,n3); } - const DynamicAny get(const std::string& name) const + const Dynamic::Var get(const std::string& name) const { NameVec::const_iterator it = _pNames->begin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -11531,7 +11531,7 @@ struct NamedTuple: throw NotFoundException("Name not found: " + name); } - const DynamicAny operator [] (const std::string& name) const + const Dynamic::Var operator [] (const std::string& name) const { return get(name); } @@ -11673,7 +11673,7 @@ struct NamedTuple: init(n0,n1,n2); } - const DynamicAny get(const std::string& name) const + const Dynamic::Var get(const std::string& name) const { NameVec::const_iterator it = _pNames->begin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -11695,7 +11695,7 @@ struct NamedTuple: throw NotFoundException("Name not found: " + name); } - const DynamicAny operator [] (const std::string& name) const + const Dynamic::Var operator [] (const std::string& name) const { return get(name); } @@ -11830,7 +11830,7 @@ struct NamedTuple: init(n0,n1); } - const DynamicAny get(const std::string& name) const + const Dynamic::Var get(const std::string& name) const { NameVec::const_iterator it = _pNames->begin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -11851,7 +11851,7 @@ struct NamedTuple: throw NotFoundException("Name not found: " + name); } - const DynamicAny operator [] (const std::string& name) const + const Dynamic::Var operator [] (const std::string& name) const { return get(name); } @@ -11978,7 +11978,7 @@ struct NamedTuple: init(n0); } - const DynamicAny get(const std::string& name) const + const Dynamic::Var get(const std::string& name) const { NameVec::const_iterator it = _pNames->begin(); NameVec::const_iterator itEnd = _pNames->end(); @@ -11998,7 +11998,7 @@ struct NamedTuple: throw NotFoundException("Name not found: " + name); } - const DynamicAny operator [] (const std::string& name) const + const Dynamic::Var operator [] (const std::string& name) const { return get(name); } diff --git a/Foundation/include/Poco/NumberFormatter.h b/Foundation/include/Poco/NumberFormatter.h index bb9ff309e..11bc107a2 100644 --- a/Foundation/include/Poco/NumberFormatter.h +++ b/Foundation/include/Poco/NumberFormatter.h @@ -517,14 +517,14 @@ public: // Deprecated functions // - [[deprecated("use formatHex with options instead")]] + POCO_DEPRECATED("use formatHex with options instead") static std::string formatHex(int value, bool prefix); /// Formats an int value in hexadecimal notation. /// If prefix is true, "0x" prefix is prepended to the /// resulting string. /// The value is treated as unsigned. - [[deprecated("use formatHex with options instead")]] + POCO_DEPRECATED("use formatHex with options instead") static std::string formatHex(int value, int width, bool prefix); /// Formats an int value in hexadecimal notation, /// right justified and zero-padded in @@ -533,13 +533,13 @@ public: /// resulting string. /// The value is treated as unsigned. - [[deprecated("use formatHex with options instead")]] + POCO_DEPRECATED("use formatHex with options instead") static std::string formatHex(unsigned value, bool prefix); /// Formats an unsigned int value in hexadecimal notation. /// If prefix is true, "0x" prefix is prepended to the /// resulting string. - [[deprecated("use formatHex with options instead")]] + POCO_DEPRECATED("use formatHex with options instead") static std::string formatHex(unsigned value, int width, bool prefix); /// Formats an unsigned value in hexadecimal notation, /// right justified and zero-padded in @@ -547,14 +547,14 @@ public: /// If prefix is true, "0x" prefix is prepended to the /// resulting string. - [[deprecated("use formatHex with options instead")]] + POCO_DEPRECATED("use formatHex with options instead") static std::string formatHex(long value, bool prefix); /// Formats a long value in hexadecimal notation. /// If prefix is true, "0x" prefix is prepended to the /// resulting string. /// The value is treated as unsigned. - [[deprecated("use formatHex with options instead")]] + POCO_DEPRECATED("use formatHex with options instead") static std::string formatHex(long value, int width, bool prefix); /// Formats a long value in hexadecimal notation, /// right justified and zero-padded in a field having at least the @@ -563,13 +563,13 @@ public: /// resulting string. /// The value is treated as unsigned. - [[deprecated("use formatHex with options instead")]] + POCO_DEPRECATED("use formatHex with options instead") static std::string formatHex(unsigned long value, bool prefix); /// Formats an unsigned long value in hexadecimal notation. /// If prefix is true, "0x" prefix is prepended to the /// resulting string. - [[deprecated("use formatHex with options instead")]] + POCO_DEPRECATED("use formatHex with options instead") static std::string formatHex(unsigned long value, int width, bool prefix); /// Formats an unsigned long value in hexadecimal notation, /// right justified and zero-padded in a field having at least the @@ -580,14 +580,14 @@ public: #ifdef POCO_HAVE_INT64 #ifdef POCO_INT64_IS_LONG - [[deprecated("use formatHex with options instead")]] + POCO_DEPRECATED("use formatHex with options instead") static std::string formatHex(long long value, bool prefix); /// Formats a 64-bit integer value in hexadecimal notation. /// If prefix is true, "0x" prefix is prepended to the /// resulting string. /// The value is treated as unsigned. - [[deprecated("use formatHex with options instead")]] + POCO_DEPRECATED("use formatHex with options instead") static std::string formatHex(long long value, int width, bool prefix); /// Formats a 64-bit integer value in hexadecimal notation, /// right justified and zero-padded in a field having at least @@ -595,13 +595,13 @@ public: /// The value is treated as unsigned. /// If prefix is true, "0x" prefix is prepended to the resulting string. - [[deprecated("use formatHex with options instead")]] + POCO_DEPRECATED("use formatHex with options instead") static std::string formatHex(unsigned long long value, bool prefix); /// Formats an unsigned 64-bit integer value in hexadecimal notation. /// If prefix is true, "0x" prefix is prepended to the /// resulting string. - [[deprecated("use formatHex with options instead")]] + POCO_DEPRECATED("use formatHex with options instead") static std::string formatHex(unsigned long long value, int width, bool prefix); /// Formats an unsigned 64-bit integer value in hexadecimal notation, /// right justified and zero-padded in a field having at least @@ -610,14 +610,14 @@ public: #else // ifndef POCO_INT64_IS_LONG - [[deprecated("use formatHex with options instead")]] + POCO_DEPRECATED("use formatHex with options instead") static std::string formatHex(Int64 value, bool prefix); /// Formats a 64-bit integer value in hexadecimal notation. /// If prefix is true, "0x" prefix is prepended to the /// resulting string. /// The value is treated as unsigned. - [[deprecated("use formatHex with options instead")]] + POCO_DEPRECATED("use formatHex with options instead") static std::string formatHex(Int64 value, int width, bool prefix); /// Formats a 64-bit integer value in hexadecimal notation, /// right justified and zero-padded in a field having at least @@ -625,13 +625,13 @@ public: /// The value is treated as unsigned. /// If prefix is true, "0x" prefix is prepended to the resulting string. - [[deprecated("use formatHex with options instead")]] + POCO_DEPRECATED("use formatHex with options instead") static std::string formatHex(UInt64 value, bool prefix); /// Formats an unsigned 64-bit integer value in hexadecimal notation. /// If prefix is true, "0x" prefix is prepended to the /// resulting string. - [[deprecated("use formatHex with options instead")]] + POCO_DEPRECATED("use formatHex with options instead") static std::string formatHex(UInt64 value, int width, bool prefix); /// Formats an unsigned 64-bit integer value in hexadecimal notation, /// right justified and zero-padded in a field having at least diff --git a/Foundation/include/Poco/NumericString.h b/Foundation/include/Poco/NumericString.h index ac571301e..0310b4f35 100644 --- a/Foundation/include/Poco/NumericString.h +++ b/Foundation/include/Poco/NumericString.h @@ -536,7 +536,7 @@ bool intToStr(T value, template -[[deprecated("use intToStr instead")]] +POCO_DEPRECATED("use intToStr instead") bool uIntToStr(T value, unsigned short base, char* result, @@ -581,7 +581,7 @@ bool intToStr (T number, template -[[deprecated("use intToStr instead")]] +POCO_DEPRECATED("use intToStr instead") bool uIntToStr (T number, unsigned short base, std::string& result, diff --git a/Foundation/include/Poco/Observer.h b/Foundation/include/Poco/Observer.h index 2f231cbc4..8e69329ea 100755 --- a/Foundation/include/Poco/Observer.h +++ b/Foundation/include/Poco/Observer.h @@ -87,7 +87,7 @@ public: return pObs && pObs->_pObject == _pObject && pObs->_method == _method; } - [[deprecated("use `bool accepts(const Notification::Ptr&)` instead")]] + POCO_DEPRECATED("use `bool accepts(const Notification::Ptr&)` instead") bool accepts(Notification* pNf, const char* pName) const { return (!pName || pNf->name() == pName) && (dynamic_cast(pNf) != nullptr); diff --git a/Foundation/include/Poco/SimpleHashTable.h b/Foundation/include/Poco/SimpleHashTable.h index ef8b7d634..9c6e9868c 100644 --- a/Foundation/include/Poco/SimpleHashTable.h +++ b/Foundation/include/Poco/SimpleHashTable.h @@ -31,9 +31,8 @@ namespace Poco { -//@ deprecated template > -class SimpleHashTable +class POCO_DEPRECATED("use LinearHashTable") SimpleHashTable /// A SimpleHashTable stores a key value pair that can be looked up via a hashed key. /// /// In comparison to a HashTable, this class handles collisions by sequentially searching the next diff --git a/Foundation/include/Poco/Thread_POSIX.h b/Foundation/include/Poco/Thread_POSIX.h index 15dfc7fdc..5f64ac2ed 100644 --- a/Foundation/include/Poco/Thread_POSIX.h +++ b/Foundation/include/Poco/Thread_POSIX.h @@ -19,6 +19,7 @@ #include "Poco/Foundation.h" +#include "Poco/Mutex.h" #include "Poco/Runnable.h" #include "Poco/SignalHandler.h" #include "Poco/Event.h" @@ -31,7 +32,6 @@ #if !defined(POCO_NO_SYS_SELECT_H) #include #endif -#include #if defined(POCO_VXWORKS) #include #endif @@ -41,8 +41,8 @@ namespace Poco { class Foundation_API ThreadImpl { public: - typedef pthread_t TIDImpl; - typedef void (*Callable)(void*); + using TIDImpl = pthread_t; + using Callable = void (*)(void *); enum Priority { @@ -99,7 +99,7 @@ private: public: CurrentThreadHolder() { - if (pthread_key_create(&_key, NULL)) + if (pthread_key_create(&_key, nullptr)) throw SystemException("cannot allocate thread context key"); } ~CurrentThreadHolder() @@ -126,7 +126,7 @@ private: prio(PRIO_NORMAL_IMPL), osPrio(), policy(SCHED_OTHER), - done(false), + done(Event::EVENT_MANUALRESET), stackSize(POCO_THREAD_STACK_SIZE), started(false), joined(false) diff --git a/Foundation/src/ActiveThreadPool.cpp b/Foundation/src/ActiveThreadPool.cpp index 628c78d6d..91a6099d8 100644 --- a/Foundation/src/ActiveThreadPool.cpp +++ b/Foundation/src/ActiveThreadPool.cpp @@ -20,7 +20,6 @@ #include "Poco/ErrorHandler.h" #include "Poco/NotificationQueue.h" #include -#include #include namespace Poco { @@ -103,7 +102,7 @@ private: ActiveThread::ActiveThread(const std::string& name, int stackSize): _name(name), _thread(name), - _targetCompleted(false) + _targetCompleted(Event::EVENT_MANUALRESET) { poco_assert_dbg (stackSize >= 0); _thread.setStackSize(stackSize); diff --git a/Foundation/src/Event.cpp b/Foundation/src/Event.cpp index 2d8f327e1..8a56727ff 100644 --- a/Foundation/src/Event.cpp +++ b/Foundation/src/Event.cpp @@ -27,7 +27,7 @@ namespace Poco { -Event::Event(EventType type): EventImpl(type == EVENT_AUTORESET) +Event::Event(EventType type) : EventImpl(type == EVENT_AUTORESET) { } @@ -37,9 +37,7 @@ Event::Event(bool autoReset): EventImpl(autoReset) } -Event::~Event() -{ -} +Event::~Event() = default; } // namespace Poco diff --git a/Foundation/src/Thread.cpp b/Foundation/src/Thread.cpp index 19171262b..893f67846 100644 --- a/Foundation/src/Thread.cpp +++ b/Foundation/src/Thread.cpp @@ -66,11 +66,9 @@ public: { } - ~CallableHolder() - { - } + ~CallableHolder() override = default; - void run() + void run() override { _callable(_pData); } @@ -86,8 +84,8 @@ private: Thread::Thread(uint32_t sigMask): _id(uniqueId()), - _pTLS(0), - _event(true) + _pTLS(nullptr), + _event(Event::EVENT_AUTORESET) { setNameImpl(makeName()); #if defined(POCO_OS_FAMILY_UNIX) @@ -98,8 +96,8 @@ Thread::Thread(uint32_t sigMask): Thread::Thread(const std::string& name, uint32_t sigMask): _id(uniqueId()), - _pTLS(0), - _event(true) + _pTLS(nullptr), + _event(Event::EVENT_AUTORESET) { setNameImpl(name); #if defined(POCO_OS_FAMILY_UNIX) @@ -190,7 +188,7 @@ void Thread::clearTLS() if (_pTLS) { delete _pTLS; - _pTLS = 0; + _pTLS = nullptr; } } diff --git a/Foundation/src/ThreadPool.cpp b/Foundation/src/ThreadPool.cpp index e1d0d37cd..757e71acc 100644 --- a/Foundation/src/ThreadPool.cpp +++ b/Foundation/src/ThreadPool.cpp @@ -39,7 +39,7 @@ public: void join(); void activate(); void release(); - void run(); + void run() override; private: volatile bool _idle; @@ -57,14 +57,14 @@ private: PooledThread::PooledThread(const std::string& name, int stackSize): _idle(true), _idleTime(0), - _pTarget(0), + _pTarget(nullptr), _name(name), _thread(name), - _targetCompleted(false) + _targetCompleted(Event::EVENT_MANUALRESET) { poco_assert_dbg (stackSize >= 0); _thread.setStackSize(stackSize); - _idleTime = std::time(NULL); + _idleTime = std::time(nullptr); } @@ -84,7 +84,7 @@ void PooledThread::start(Thread::Priority priority, Runnable& target) { FastMutex::ScopedLock lock(_mutex); - poco_assert (_pTarget == 0); + poco_assert (_pTarget == nullptr); _pTarget = ⌖ _thread.setPriority(priority); @@ -110,7 +110,7 @@ void PooledThread::start(Thread::Priority priority, Runnable& target, const std: _thread.setName(fullName); _thread.setPriority(priority); - poco_assert (_pTarget == 0); + poco_assert (_pTarget == nullptr); _pTarget = ⌖ _targetReady.set(); @@ -128,7 +128,7 @@ int PooledThread::idleTime() { FastMutex::ScopedLock lock(_mutex); - return (int) (time(NULL) - _idleTime); + return (int) (time(nullptr) - _idleTime); } @@ -157,7 +157,7 @@ void PooledThread::release() const long JOIN_TIMEOUT = 10000; _mutex.lock(); - _pTarget = 0; + _pTarget = nullptr; _mutex.unlock(); // In case of a statically allocated thread pool (such // as the default thread pool), Windows may have already @@ -200,8 +200,8 @@ void PooledThread::run() ErrorHandler::handle(); } FastMutex::ScopedLock lock(_mutex); - _pTarget = 0; - _idleTime = time(NULL); + _pTarget = nullptr; + _idleTime = time(nullptr); _idle = true; _targetCompleted.set(); ThreadLocalStorage::clear(); @@ -430,8 +430,8 @@ PooledThread* ThreadPool::getThread() if (++_age == 32) housekeep(); - PooledThread* pThread = 0; - for (ThreadVec::iterator it = _threads.begin(); !pThread && it != _threads.end(); ++it) + PooledThread* pThread = nullptr; + for (auto it = _threads.begin(); !pThread && it != _threads.end(); ++it) { if ((*it)->idle()) pThread = *it; @@ -472,7 +472,7 @@ class ThreadPoolSingletonHolder public: ThreadPoolSingletonHolder() { - _pPool = 0; + _pPool = nullptr; } ~ThreadPoolSingletonHolder() { diff --git a/Foundation/src/Thread_POSIX.cpp b/Foundation/src/Thread_POSIX.cpp index f9ebcb055..89313b15c 100644 --- a/Foundation/src/Thread_POSIX.cpp +++ b/Foundation/src/Thread_POSIX.cpp @@ -17,8 +17,6 @@ #include "Poco/Exception.h" #include "Poco/Error.h" #include "Poco/ErrorHandler.h" -#include "Poco/Timespan.h" -#include "Poco/Timestamp.h" #include "Poco/Format.h" #include "Poco/Error.h" #include diff --git a/Foundation/testsuite/src/ClassLoaderTest.cpp b/Foundation/testsuite/src/ClassLoaderTest.cpp index 45bafbecd..094cbeb48 100644 --- a/Foundation/testsuite/src/ClassLoaderTest.cpp +++ b/Foundation/testsuite/src/ClassLoaderTest.cpp @@ -39,6 +39,11 @@ ClassLoaderTest::~ClassLoaderTest() { } +namespace Poco { + +template class ClassLoader; + +} void ClassLoaderTest::testClassLoader1() { @@ -126,7 +131,7 @@ void ClassLoaderTest::testClassLoader2() TestPlugin& POCO_UNUSED plgB = cl.instance("PluginB"); fail("not a singleton - must throw"); } - catch (InvalidAccessException&) + catch (const Poco::InvalidAccessException&) { } @@ -135,7 +140,7 @@ void ClassLoaderTest::testClassLoader2() TestPlugin* POCO_UNUSED pPluginC = cl.create("PluginC"); fail("cannot create a singleton - must throw"); } - catch (InvalidAccessException&) + catch (const Poco::InvalidAccessException&) { } @@ -145,7 +150,7 @@ void ClassLoaderTest::testClassLoader2() meta.autoDelete(&(meta.instance())); fail("cannot take ownership of a singleton - must throw"); } - catch (InvalidAccessException&) + catch (const Poco::InvalidAccessException&) { } diff --git a/Foundation/testsuite/src/EventTestSuite.cpp b/Foundation/testsuite/src/EventTestSuite.cpp index 0857a81f1..48d9ce4ed 100644 --- a/Foundation/testsuite/src/EventTestSuite.cpp +++ b/Foundation/testsuite/src/EventTestSuite.cpp @@ -9,17 +9,22 @@ #include "EventTestSuite.h" +#if defined(POCO_TEST_DEPRECATED) #include "FIFOEventTest.h" +#endif #include "BasicEventTest.h" #include "PriorityEventTest.h" CppUnit::Test* EventTestSuite::suite() { - CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("EventTestSuite"); + auto* pSuite = new CppUnit::TestSuite("EventTestSuite"); pSuite->addTest(BasicEventTest::suite()); pSuite->addTest(PriorityEventTest::suite()); + +#if defined(POCO_TEST_DEPRECATED) pSuite->addTest(FIFOEventTest::suite()); +#endif return pSuite; } diff --git a/Foundation/testsuite/src/FIFOEventTest.cpp b/Foundation/testsuite/src/FIFOEventTest.cpp index d2c77511e..d28834c8c 100644 --- a/Foundation/testsuite/src/FIFOEventTest.cpp +++ b/Foundation/testsuite/src/FIFOEventTest.cpp @@ -7,6 +7,7 @@ // SPDX-License-Identifier: BSL-1.0 // +#if defined(POCO_TEST_DEPRECATED) #include "FIFOEventTest.h" #include "DummyDelegate.h" @@ -495,3 +496,5 @@ CppUnit::Test* FIFOEventTest::suite() //CppUnit_addTest(pSuite, FIFOEventTest, testAsyncNotifyBenchmark); return pSuite; } + +#endif diff --git a/Foundation/testsuite/src/FIFOEventTest.h b/Foundation/testsuite/src/FIFOEventTest.h index f66d6a802..8cf74bb93 100644 --- a/Foundation/testsuite/src/FIFOEventTest.h +++ b/Foundation/testsuite/src/FIFOEventTest.h @@ -13,6 +13,7 @@ #ifndef FIFOEventTest_INCLUDED #define FIFOEventTest_INCLUDED +#if defined(POCO_TEST_DEPRECATED) #include "Poco/Foundation.h" #include "CppUnit/TestCase.h" @@ -68,5 +69,6 @@ private: std::atomic _count; }; +#endif #endif // FIFOEventTest_INCLUDED diff --git a/Foundation/testsuite/src/HashTableTest.cpp b/Foundation/testsuite/src/HashTableTest.cpp index c80ee6a2b..73e8bb433 100644 --- a/Foundation/testsuite/src/HashTableTest.cpp +++ b/Foundation/testsuite/src/HashTableTest.cpp @@ -7,6 +7,8 @@ // SPDX-License-Identifier: BSL-1.0 // +#if defined(POCO_TEST_DEPRECATED) + #include "HashTableTest.h" #include "CppUnit/TestCaller.h" @@ -200,3 +202,5 @@ CppUnit::Test* HashTableTest::suite() return pSuite; } + +#endif diff --git a/Foundation/testsuite/src/HashTableTest.h b/Foundation/testsuite/src/HashTableTest.h index cd1b2fc5f..95b716f9f 100644 --- a/Foundation/testsuite/src/HashTableTest.h +++ b/Foundation/testsuite/src/HashTableTest.h @@ -13,6 +13,8 @@ #ifndef HashTableTest_INCLUDED #define HashTableTest_INCLUDED +#if defined(POCO_TEST_DEPRECATED) + #include "Poco/Foundation.h" #include "CppUnit/TestCase.h" @@ -39,5 +41,6 @@ public: private: }; +#endif #endif // HashTableTest_INCLUDED diff --git a/Foundation/testsuite/src/HashingTestSuite.cpp b/Foundation/testsuite/src/HashingTestSuite.cpp index c36742dbf..7de35dc05 100644 --- a/Foundation/testsuite/src/HashingTestSuite.cpp +++ b/Foundation/testsuite/src/HashingTestSuite.cpp @@ -9,8 +9,10 @@ #include "HashingTestSuite.h" +#if defined(POCO_TEST_DEPRECATED) #include "HashTableTest.h" #include "SimpleHashTableTest.h" +#endif #include "LinearHashTableTest.h" #include "HashSetTest.h" #include "HashMapTest.h" @@ -20,8 +22,10 @@ CppUnit::Test* HashingTestSuite::suite() { CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("HashingTestSuite"); +#if defined(POCO_TEST_DEPRECATED) pSuite->addTest(HashTableTest::suite()); pSuite->addTest(SimpleHashTableTest::suite()); +#endif pSuite->addTest(LinearHashTableTest::suite()); pSuite->addTest(HashSetTest::suite()); pSuite->addTest(HashMapTest::suite()); diff --git a/Foundation/testsuite/src/LinearHashTableTest.cpp b/Foundation/testsuite/src/LinearHashTableTest.cpp index c66b93031..200a34714 100644 --- a/Foundation/testsuite/src/LinearHashTableTest.cpp +++ b/Foundation/testsuite/src/LinearHashTableTest.cpp @@ -12,12 +12,14 @@ #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" #include "Poco/LinearHashTable.h" -#include "Poco/HashTable.h" #include "Poco/Stopwatch.h" #include "Poco/NumberFormatter.h" #include -#include +#if defined(POCO_TEST_DEPRECATED) +#include "Poco/HashTable.h" +#include +#endif #ifdef POCO_COMPILER_MSVC #pragma warning(push) @@ -27,9 +29,11 @@ using Poco::LinearHashTable; using Poco::Hash; -using Poco::HashTable; using Poco::Stopwatch; using Poco::NumberFormatter; +#if defined(POCO_TEST_DEPRECATED) +using Poco::HashTable; +#endif LinearHashTableTest::LinearHashTableTest(const std::string& name): CppUnit::TestCase(name) @@ -189,10 +193,11 @@ void LinearHashTableTest::testConstIterator() assertTrue (values.size() == N); } +#if defined(POCO_TEST_DEPRECATED) void LinearHashTableTest::testPerformanceInt() { - const int N = 5000000; + const int N = 50000000; Stopwatch sw; { @@ -263,10 +268,11 @@ void LinearHashTableTest::testPerformanceInt() void LinearHashTableTest::testPerformanceStr() { - const int N = 5000000; + const int N = 50000000; Stopwatch sw; std::vector values; + values.reserve(N); for (int i = 0; i < N; ++i) { values.push_back(NumberFormatter::format0(i, 8)); @@ -336,6 +342,7 @@ void LinearHashTableTest::testPerformanceStr() } } +#endif void LinearHashTableTest::setUp() { @@ -355,8 +362,11 @@ CppUnit::Test* LinearHashTableTest::suite() CppUnit_addTest(pSuite, LinearHashTableTest, testErase); CppUnit_addTest(pSuite, LinearHashTableTest, testIterator); CppUnit_addTest(pSuite, LinearHashTableTest, testConstIterator); - //CppUnit_addTest(pSuite, LinearHashTableTest, testPerformanceInt); - //CppUnit_addTest(pSuite, LinearHashTableTest, testPerformanceStr); + +#if defined(POCO_TEST_DEPRECATED) + CppUnit_addTest(pSuite, LinearHashTableTest, testPerformanceInt); + CppUnit_addTest(pSuite, LinearHashTableTest, testPerformanceStr); +#endif return pSuite; } diff --git a/Foundation/testsuite/src/LinearHashTableTest.h b/Foundation/testsuite/src/LinearHashTableTest.h index a7ec64f87..39729c0da 100644 --- a/Foundation/testsuite/src/LinearHashTableTest.h +++ b/Foundation/testsuite/src/LinearHashTableTest.h @@ -22,17 +22,20 @@ class LinearHashTableTest: public CppUnit::TestCase { public: LinearHashTableTest(const std::string& name); - ~LinearHashTableTest(); + ~LinearHashTableTest() override; void testInsert(); void testErase(); void testIterator(); void testConstIterator(); + +#if defined(POCO_TEST_DEPRECATED) void testPerformanceInt(); void testPerformanceStr(); +#endif - void setUp(); - void tearDown(); + void setUp() override; + void tearDown() override; static CppUnit::Test* suite(); diff --git a/Foundation/testsuite/src/SimpleHashTableTest.cpp b/Foundation/testsuite/src/SimpleHashTableTest.cpp index 0197ebfdd..8cd9efd11 100644 --- a/Foundation/testsuite/src/SimpleHashTableTest.cpp +++ b/Foundation/testsuite/src/SimpleHashTableTest.cpp @@ -7,6 +7,7 @@ // SPDX-License-Identifier: BSL-1.0 // +#if defined(POCO_TEST_DEPRECATED) #include "SimpleHashTableTest.h" #include "CppUnit/TestCaller.h" @@ -153,3 +154,5 @@ CppUnit::Test* SimpleHashTableTest::suite() return pSuite; } + +#endif diff --git a/Foundation/testsuite/src/SimpleHashTableTest.h b/Foundation/testsuite/src/SimpleHashTableTest.h index b65b8d57b..91e0085eb 100644 --- a/Foundation/testsuite/src/SimpleHashTableTest.h +++ b/Foundation/testsuite/src/SimpleHashTableTest.h @@ -13,6 +13,8 @@ #ifndef SimpleHashTableTest_INCLUDED #define SimpleHashTableTest_INCLUDED +#if defined(POCO_TEST_DEPRECATED) + #include "Poco/Foundation.h" #include "CppUnit/TestCase.h" @@ -39,5 +41,6 @@ public: private: }; +#endif #endif // SimpleHashTableTest_INCLUDED diff --git a/Foundation/testsuite/src/ThreadPoolTest.cpp b/Foundation/testsuite/src/ThreadPoolTest.cpp index 29aba374a..1ce1a0cd5 100644 --- a/Foundation/testsuite/src/ThreadPoolTest.cpp +++ b/Foundation/testsuite/src/ThreadPoolTest.cpp @@ -23,7 +23,7 @@ using Poco::RunnableAdapter; using Poco::Thread; -ThreadPoolTest::ThreadPoolTest(const std::string& name): CppUnit::TestCase(name), _event(false) +ThreadPoolTest::ThreadPoolTest(const std::string& name): CppUnit::TestCase(name), _event(Poco::Event::EVENT_MANUALRESET) { } diff --git a/Foundation/testsuite/src/VarTest.cpp b/Foundation/testsuite/src/VarTest.cpp index f3e883070..65f8c9576 100644 --- a/Foundation/testsuite/src/VarTest.cpp +++ b/Foundation/testsuite/src/VarTest.cpp @@ -3002,7 +3002,7 @@ void VarTest::testEmpty() std::string s = da.extract(); assertTrue ("123" == s); assertTrue (!da.isEmpty()); - da.empty(); + da.clear(); assertTrue (da.isEmpty()); assertTrue (da.type() == typeid(void)); assertTrue (!da.isArray()); diff --git a/JSON/samples/Benchmark/src/Benchmark.cpp b/JSON/samples/Benchmark/src/Benchmark.cpp index edb7ba674..8d8e42fe5 100644 --- a/JSON/samples/Benchmark/src/Benchmark.cpp +++ b/JSON/samples/Benchmark/src/Benchmark.cpp @@ -79,7 +79,7 @@ int main(int argc, char** argv) Poco::JSON::Parser sparser; sw.restart(); sparser.parse(jsonStr); - Poco::DynamicAny result = sparser.result(); + Poco::Dynamic::Var result = sparser.result(); sw.stop(); std::cout << "-----------------------------------------" << std::endl; std::cout << "[std::string] parsed/handled in " << sw.elapsed() << " [us]" << std::endl; diff --git a/JSON/src/ParseHandler.cpp b/JSON/src/ParseHandler.cpp index fdb2d995e..345e4853b 100644 --- a/JSON/src/ParseHandler.cpp +++ b/JSON/src/ParseHandler.cpp @@ -37,7 +37,7 @@ void ParseHandler::reset() { while (!_stack.empty()) _stack.pop(); _key = ""; - _result.empty(); + _result.clear(); } diff --git a/JSON/src/Query.cpp b/JSON/src/Query.cpp index 731681aaf..03e05095a 100644 --- a/JSON/src/Query.cpp +++ b/JSON/src/Query.cpp @@ -142,7 +142,7 @@ Var Query::find(const std::string& path) const result = o.get(name); found = true; } - else result.empty(); + else result.clear(); } @@ -166,7 +166,7 @@ Var Query::find(const std::string& path) const } } } - if (!found) result.empty(); + if (!found) result.clear(); return result; } diff --git a/MongoDB/include/Poco/MongoDB/Cursor.h b/MongoDB/include/Poco/MongoDB/Cursor.h index 5c0513b1c..6339bc290 100644 --- a/MongoDB/include/Poco/MongoDB/Cursor.h +++ b/MongoDB/include/Poco/MongoDB/Cursor.h @@ -26,6 +26,8 @@ namespace Poco { namespace MongoDB { +//class [[deprecated]] Cursor; +class Cursor; class MongoDB_API Cursor: public Document /// Cursor is an helper class for querying multiple documents. diff --git a/MongoDB/include/Poco/MongoDB/Database.h b/MongoDB/include/Poco/MongoDB/Database.h index 4cd1c57ac..350c55cae 100644 --- a/MongoDB/include/Poco/MongoDB/Database.h +++ b/MongoDB/include/Poco/MongoDB/Database.h @@ -72,25 +72,31 @@ public: /// /// If the command fails, -1 is returned. + //[[deprecated]] Poco::SharedPtr createCommand() const; /// Creates a QueryRequest for a command. (old wire protocol) + //[[deprecated]] Poco::SharedPtr createCountRequest(const std::string& collectionName) const; /// Creates a QueryRequest to count the given collection. /// The collectionname must not contain the database name. (old wire protocol) + //[[deprecated]] Poco::SharedPtr createDeleteRequest(const std::string& collectionName) const; /// Creates a DeleteRequest to delete documents in the given collection. /// The collectionname must not contain the database name. (old wire protocol) + //[[deprecated]] Poco::SharedPtr createInsertRequest(const std::string& collectionName) const; /// Creates an InsertRequest to insert new documents in the given collection. /// The collectionname must not contain the database name. (old wire protocol) + //[[deprecated]] Poco::SharedPtr createQueryRequest(const std::string& collectionName) const; /// Creates a QueryRequest. (old wire protocol) /// The collectionname must not contain the database name. + //[[deprecated]] Poco::SharedPtr createUpdateRequest(const std::string& collectionName) const; /// Creates an UpdateRequest. (old wire protocol) /// The collectionname must not contain the database name. @@ -115,10 +121,12 @@ public: /// Creates an index. The document returned is the result of a getLastError call. /// For more info look at the ensureIndex information on the MongoDB website. (old wire protocol) + //[[deprecated]] Document::Ptr getLastErrorDoc(Connection& connection) const; /// Sends the getLastError command to the database and returns the error document. /// (old wire protocol) + //[[deprecated]] std::string getLastError(Connection& connection) const; /// Sends the getLastError command to the database and returns the err element /// from the error document. When err is null, an empty string is returned. diff --git a/MongoDB/include/Poco/MongoDB/DeleteRequest.h b/MongoDB/include/Poco/MongoDB/DeleteRequest.h index 7eecd9997..0226df5f2 100644 --- a/MongoDB/include/Poco/MongoDB/DeleteRequest.h +++ b/MongoDB/include/Poco/MongoDB/DeleteRequest.h @@ -26,6 +26,8 @@ namespace Poco { namespace MongoDB { +//class [[deprecated]] DeleteRequest; +class DeleteRequest; class MongoDB_API DeleteRequest: public RequestMessage /// A DeleteRequest is used to delete one ore more documents from a database. diff --git a/MongoDB/include/Poco/MongoDB/GetMoreRequest.h b/MongoDB/include/Poco/MongoDB/GetMoreRequest.h index 4c9d5e718..ac3d5d846 100644 --- a/MongoDB/include/Poco/MongoDB/GetMoreRequest.h +++ b/MongoDB/include/Poco/MongoDB/GetMoreRequest.h @@ -25,6 +25,8 @@ namespace Poco { namespace MongoDB { +//class [[deprecated]] GetMoreRequest; +class GetMoreRequest; class MongoDB_API GetMoreRequest: public RequestMessage /// A GetMoreRequest is used to query the database for more documents in a collection diff --git a/MongoDB/include/Poco/MongoDB/InsertRequest.h b/MongoDB/include/Poco/MongoDB/InsertRequest.h index ca4ff2ed8..ce42f55f0 100644 --- a/MongoDB/include/Poco/MongoDB/InsertRequest.h +++ b/MongoDB/include/Poco/MongoDB/InsertRequest.h @@ -26,6 +26,8 @@ namespace Poco { namespace MongoDB { +//class [[deprecated]] InsertRequest; +class InsertRequest; class MongoDB_API InsertRequest: public RequestMessage /// A request for inserting one or more documents to the database diff --git a/MongoDB/include/Poco/MongoDB/MessageHeader.h b/MongoDB/include/Poco/MongoDB/MessageHeader.h index 3524954ab..292db0bdf 100644 --- a/MongoDB/include/Poco/MongoDB/MessageHeader.h +++ b/MongoDB/include/Poco/MongoDB/MessageHeader.h @@ -38,7 +38,16 @@ public: enum OpCode { +#if false // Opcodes deprecated in MongoDB 5.0 + OP_REPLY [[deprecated]] = 1, + OP_UPDATE [[deprecated]] = 2001, + OP_INSERT [[deprecated]] = 2002, + OP_QUERY [[deprecated]] = 2004, + OP_GET_MORE [[deprecated]] = 2005, + OP_DELETE [[deprecated]] = 2006, + OP_KILL_CURSORS [[deprecated]] = 2007, +#else OP_REPLY = 1, OP_UPDATE = 2001, OP_INSERT = 2002, @@ -46,6 +55,7 @@ public: OP_GET_MORE = 2005, OP_DELETE = 2006, OP_KILL_CURSORS = 2007, +#endif /// Opcodes supported in MongoDB 5.1 and later OP_COMPRESSED = 2012, diff --git a/MongoDB/include/Poco/MongoDB/QueryRequest.h b/MongoDB/include/Poco/MongoDB/QueryRequest.h index eda980b03..032d5ca03 100644 --- a/MongoDB/include/Poco/MongoDB/QueryRequest.h +++ b/MongoDB/include/Poco/MongoDB/QueryRequest.h @@ -26,6 +26,8 @@ namespace Poco { namespace MongoDB { +//class [[deprecated]] QueryRequest; +class QueryRequest; class MongoDB_API QueryRequest: public RequestMessage /// A request to query documents in a MongoDB database diff --git a/MongoDB/include/Poco/MongoDB/RequestMessage.h b/MongoDB/include/Poco/MongoDB/RequestMessage.h index 9ebb4a569..93686b050 100644 --- a/MongoDB/include/Poco/MongoDB/RequestMessage.h +++ b/MongoDB/include/Poco/MongoDB/RequestMessage.h @@ -26,6 +26,8 @@ namespace Poco { namespace MongoDB { +//class [[deprecated]] RequestMessage; +class RequestMessage; class MongoDB_API RequestMessage: public Message /// Base class for a request sent to the MongoDB server. diff --git a/MongoDB/include/Poco/MongoDB/ResponseMessage.h b/MongoDB/include/Poco/MongoDB/ResponseMessage.h index a53aa29c0..7679cffa5 100644 --- a/MongoDB/include/Poco/MongoDB/ResponseMessage.h +++ b/MongoDB/include/Poco/MongoDB/ResponseMessage.h @@ -28,6 +28,8 @@ namespace Poco { namespace MongoDB { +//class [[deprecated]] ResponseMessage; +class ResponseMessage; class MongoDB_API ResponseMessage: public Message /// This class represents a response (OP_REPLY) from MongoDB. diff --git a/MongoDB/include/Poco/MongoDB/UpdateRequest.h b/MongoDB/include/Poco/MongoDB/UpdateRequest.h index f1209708d..e7315c1ba 100644 --- a/MongoDB/include/Poco/MongoDB/UpdateRequest.h +++ b/MongoDB/include/Poco/MongoDB/UpdateRequest.h @@ -26,6 +26,8 @@ namespace Poco { namespace MongoDB { +//class [[deprecated]] UpdateRequest; +class UpdateRequest; class MongoDB_API UpdateRequest: public RequestMessage /// This request is used to update a document in a database diff --git a/Net/include/Poco/Net/HTTPResponse.h b/Net/include/Poco/Net/HTTPResponse.h index e42ebfa07..de280e6d4 100644 --- a/Net/include/Poco/Net/HTTPResponse.h +++ b/Net/include/Poco/Net/HTTPResponse.h @@ -62,7 +62,7 @@ public: HTTP_SEE_OTHER = 303, HTTP_NOT_MODIFIED = 304, HTTP_USE_PROXY = 305, - HTTP_USEPROXY = 305, /// @deprecated + HTTP_USEPROXY POCO_DEPRECATED("use HTTP_USE_PROXY") = 305, // UNUSED: 306 HTTP_TEMPORARY_REDIRECT = 307, HTTP_PERMANENT_REDIRECT = 308, @@ -80,11 +80,11 @@ public: HTTP_LENGTH_REQUIRED = 411, HTTP_PRECONDITION_FAILED = 412, HTTP_REQUEST_ENTITY_TOO_LARGE = 413, - HTTP_REQUESTENTITYTOOLARGE = 413, /// @deprecated + HTTP_REQUESTENTITYTOOLARGE POCO_DEPRECATED("") = 413, HTTP_REQUEST_URI_TOO_LONG = 414, - HTTP_REQUESTURITOOLONG = 414, /// @deprecated + HTTP_REQUESTURITOOLONG POCO_DEPRECATED("") = 414, HTTP_UNSUPPORTED_MEDIA_TYPE = 415, - HTTP_UNSUPPORTEDMEDIATYPE = 415, /// @deprecated + HTTP_UNSUPPORTEDMEDIATYPE POCO_DEPRECATED("") = 415, HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = 416, HTTP_EXPECTATION_FAILED = 417, HTTP_IM_A_TEAPOT = 418, @@ -134,7 +134,7 @@ public: HTTPResponse(const HTTPResponse& other); /// Creates the HTTPResponse by copying another one. - virtual ~HTTPResponse(); + ~HTTPResponse() override; /// Destroys the HTTPResponse. HTTPResponse& operator = (const HTTPResponse& other); @@ -185,11 +185,11 @@ public: /// May throw an exception in case of a malformed /// Set-Cookie header. - void write(std::ostream& ostr) const; + void write(std::ostream& ostr) const override; /// Writes the HTTP response to the given /// output stream. - void read(std::istream& istr); + void read(std::istream& istr) override; /// Reads the HTTP response from the /// given input stream. /// diff --git a/Net/include/Poco/Net/NetworkInterface.h b/Net/include/Poco/Net/NetworkInterface.h index 1ea864425..b45e73354 100644 --- a/Net/include/Poco/Net/NetworkInterface.h +++ b/Net/include/Poco/Net/NetworkInterface.h @@ -60,14 +60,14 @@ class Net_API NetworkInterface /// and XP. { public: - typedef std::vector List; - typedef List NetworkInterfaceList;//@deprecated - typedef std::map Map; - typedef Poco::Tuple AddressTuple; - typedef std::vector AddressList; - typedef AddressList::iterator AddressIterator; - typedef AddressList::const_iterator ConstAddressIterator; - typedef std::vector MACAddress; + using List = std::vector; + using NetworkInterfaceList POCO_DEPRECATED("") = List; + using Map = std::map; + using AddressTuple = Poco::Tuple; + using AddressList = std::vector; + using AddressIterator = AddressList::iterator; + using ConstAddressIterator = AddressList::const_iterator; + using MACAddress = std::vector; enum AddressType { @@ -281,13 +281,13 @@ public: /// member of the pair. protected: - NetworkInterface(const std::string& name, const std::string& displayName, const std::string& adapterName, const IPAddress& address, unsigned index, MACAddress* pMACAddress = 0); + NetworkInterface(const std::string& name, const std::string& displayName, const std::string& adapterName, const IPAddress& address, unsigned index, MACAddress* pMACAddress = nullptr); /// Creates the NetworkInterface. - NetworkInterface(const std::string& name, const std::string& displayName, const std::string& adapterName, unsigned index, MACAddress* pMACAddress = 0); + NetworkInterface(const std::string& name, const std::string& displayName, const std::string& adapterName, unsigned index, MACAddress* pMACAddress = nullptr); /// Creates the NetworkInterface. - NetworkInterface(const std::string& name, const IPAddress& address, unsigned index, MACAddress* pMACAddress = 0); + NetworkInterface(const std::string& name, const IPAddress& address, unsigned index, MACAddress* pMACAddress = nullptr); /// Creates the NetworkInterface. NetworkInterface(const std::string& name, @@ -297,7 +297,7 @@ protected: const IPAddress& subnetMask, const IPAddress& broadcastAddress, unsigned index, - MACAddress* pMACAddress = 0); + MACAddress* pMACAddress = nullptr); /// Creates the NetworkInterface. NetworkInterface(const std::string& name, @@ -305,7 +305,7 @@ protected: const IPAddress& subnetMask, const IPAddress& broadcastAddress, unsigned index, - MACAddress* pMACAddress = 0); + MACAddress* pMACAddress = nullptr); /// Creates the NetworkInterface. IPAddress interfaceNameToAddress(const std::string& interfaceName) const; diff --git a/Net/include/Poco/Net/Socket.h b/Net/include/Poco/Net/Socket.h index 281715041..f7118e939 100644 --- a/Net/include/Poco/Net/Socket.h +++ b/Net/include/Poco/Net/Socket.h @@ -134,7 +134,7 @@ public: void close(); /// Closes the socket. - //@deprecated + POCO_DEPRECATED("Use PollSet instead") static int select(SocketList& readList, SocketList& writeList, SocketList& exceptList, const Poco::Timespan& timeout); /// Determines the status of one or more sockets, /// using a call to select(). diff --git a/Net/src/PollSet.cpp b/Net/src/PollSet.cpp index c9579acfe..e8f03f940 100644 --- a/Net/src/PollSet.cpp +++ b/Net/src/PollSet.cpp @@ -14,7 +14,6 @@ #include "Poco/Net/PollSet.h" #include "Poco/Net/SocketImpl.h" -#include "Poco/TemporaryFile.h" #include "Poco/Mutex.h" #include @@ -395,13 +394,13 @@ public: { Poco::FastMutex::ScopedLock lock(_mutex); poco_socket_t fd = socket.impl()->sockfd(); - for (auto it = _pollfds.begin(); it != _pollfds.end(); ++it) + for (auto& _pollfd : _pollfds) { - if (it->fd == fd) + if (_pollfd.fd == fd) { - it->events = 0; - it->revents = 0; - setMode(it->events, mode); + _pollfd.events = 0; + _pollfd.revents = 0; + setMode(_pollfd.events, mode); } } } @@ -436,13 +435,13 @@ public: } _pollfds.reserve(_pollfds.size() + _addMap.size()); - for (auto it = _addMap.begin(); it != _addMap.end(); ++it) + for (auto& it : _addMap) { pollfd pfd; - pfd.fd = it->first; + pfd.fd = it.first; pfd.events = 0; pfd.revents = 0; - setMode(pfd.events, it->second); + setMode(pfd.events, it.second); _pollfds.push_back(pfd); } _addMap.clear(); @@ -482,7 +481,7 @@ public: { for (auto it = _pollfds.begin() + 1; it != _pollfds.end(); ++it) { - std::map::const_iterator its = _socketMap.find(it->fd); + auto its = _socketMap.find(it->fd); if (its != _socketMap.end()) { if (it->revents & POLLIN) diff --git a/Net/testsuite/src/SocketTest.cpp b/Net/testsuite/src/SocketTest.cpp index 17289f7f3..3a232a611 100644 --- a/Net/testsuite/src/SocketTest.cpp +++ b/Net/testsuite/src/SocketTest.cpp @@ -434,6 +434,7 @@ void SocketTest::testOptions() assertTrue (!ss.getOOBInline()); } +#if defined(POCO_TEST_DEPRECATED) void SocketTest::testSelect() { @@ -536,6 +537,7 @@ void SocketTest::testSelect3() assertTrue (rc == 0); } +#endif void SocketTest::testEchoUnixLocal() { @@ -690,9 +692,13 @@ CppUnit::Test* SocketTest::suite() CppUnit_addTest(pSuite, SocketTest, testTimeout); CppUnit_addTest(pSuite, SocketTest, testBufferSize); CppUnit_addTest(pSuite, SocketTest, testOptions); + +#if defined(POCO_TEST_DEPRECATED) CppUnit_addTest(pSuite, SocketTest, testSelect); CppUnit_addTest(pSuite, SocketTest, testSelect2); CppUnit_addTest(pSuite, SocketTest, testSelect3); +#endif + CppUnit_addTest(pSuite, SocketTest, testEchoUnixLocal); CppUnit_addTest(pSuite, SocketTest, testUnixLocalAbstract); CppUnit_addTest(pSuite, SocketTest, testUseFd); diff --git a/Net/testsuite/src/SocketTest.h b/Net/testsuite/src/SocketTest.h index badaea913..8ac15e850 100644 --- a/Net/testsuite/src/SocketTest.h +++ b/Net/testsuite/src/SocketTest.h @@ -22,7 +22,7 @@ class SocketTest: public CppUnit::TestCase { public: SocketTest(const std::string& name); - ~SocketTest(); + ~SocketTest() override; void testEcho(); void testMoveStreamSocket(); @@ -38,15 +38,18 @@ public: void testTimeout(); void testBufferSize(); void testOptions(); + +#if defined(POCO_TEST_DEPRECATED) void testSelect(); void testSelect2(); void testSelect3(); +#endif void testEchoUnixLocal(); void testUnixLocalAbstract(); void testUseFd(); - void setUp(); - void tearDown(); + void setUp() override; + void tearDown() override; static CppUnit::Test* suite(); diff --git a/NetSSL_OpenSSL/include/Poco/Net/Context.h b/NetSSL_OpenSSL/include/Poco/Net/Context.h index 52fb9cf4a..fc0ace585 100644 --- a/NetSSL_OpenSSL/include/Poco/Net/Context.h +++ b/NetSSL_OpenSSL/include/Poco/Net/Context.h @@ -289,7 +289,7 @@ public: void addCertificateAuthority(const Poco::Crypto::X509Certificate& certificate); /// Add one trusted certification authority to be used by the Context. - //@deprecated + //POCO_DEPRECATED("") void usePrivateKey(const Poco::Crypto::RSAKey& key); /// Sets the private key to be used by the Context. /// diff --git a/NetSSL_OpenSSL/src/HTTPSStreamFactory.cpp b/NetSSL_OpenSSL/src/HTTPSStreamFactory.cpp index 05a5f1b9b..21dc4e3ea 100644 --- a/NetSSL_OpenSSL/src/HTTPSStreamFactory.cpp +++ b/NetSSL_OpenSSL/src/HTTPSStreamFactory.cpp @@ -147,7 +147,7 @@ std::istream* HTTPSStreamFactory::open(const URI& uri) { return new HTTPResponseStream(rs, pSession); } - else if (res.getStatus() == HTTPResponse::HTTP_USEPROXY && !retry) + else if (res.getStatus() == HTTPResponse::HTTP_USE_PROXY && !retry) { // The requested resource MUST be accessed through the proxy // given by the Location field. The Location field gives the diff --git a/Util/include/Poco/Util/JSONConfiguration.h b/Util/include/Poco/Util/JSONConfiguration.h index ff4944f2c..9f33675fb 100644 --- a/Util/include/Poco/Util/JSONConfiguration.h +++ b/Util/include/Poco/Util/JSONConfiguration.h @@ -133,7 +133,7 @@ private: void getIndexes(std::string& name, std::vector& indexes); - void setValue(const std::string& key, const Poco::DynamicAny& value); + void setValue(const std::string& key, const Poco::Dynamic::Var& value); JSON::Object::Ptr _object; diff --git a/Util/src/JSONConfiguration.cpp b/Util/src/JSONConfiguration.cpp index 8645eae96..a8071419d 100644 --- a/Util/src/JSONConfiguration.cpp +++ b/Util/src/JSONConfiguration.cpp @@ -74,7 +74,7 @@ void JSONConfiguration::load(std::istream& istr) JSON::Parser parser; parser.parse(istr); - DynamicAny result = parser.result(); + Dynamic::Var result = parser.result(); if (result.type() == typeid(JSON::Object::Ptr)) { _object = result.extract(); @@ -95,7 +95,7 @@ void JSONConfiguration::loadEmpty(const std::string& root) bool JSONConfiguration::getRaw(const std::string & key, std::string & value) const { JSON::Query query(_object); - Poco::DynamicAny result = query.find(key); + Poco::Dynamic::Var result = query.find(key); if (!result.isEmpty()) { value = result.convert(); @@ -144,7 +144,7 @@ JSON::Object::Ptr JSONConfiguration::findStart(const std::string& key, std::stri std::string name = tokenizer[i]; getIndexes(name, indexes); - DynamicAny result = currentObject->get(name); + Dynamic::Var result = currentObject->get(name); if (result.isEmpty()) // Not found { @@ -174,7 +174,7 @@ JSON::Object::Ptr JSONConfiguration::findStart(const std::string& key, std::stri for(int i = 0; i <= *it - 1; ++i) { - Poco::DynamicAny nullValue; + Poco::Dynamic::Var nullValue; newArray->add(nullValue); } @@ -246,7 +246,7 @@ JSON::Object::Ptr JSONConfiguration::findStart(const std::string& key, std::stri } -void JSONConfiguration::setValue(const std::string& key, const Poco::DynamicAny& value) +void JSONConfiguration::setValue(const std::string& key, const Dynamic::Var& value) { std::string sValue; @@ -270,7 +270,7 @@ void JSONConfiguration::setValue(const std::string& key, const Poco::DynamicAny& } else { - DynamicAny result = parentObject->get(lastPart); + Dynamic::Var result = parentObject->get(lastPart); if (result.isEmpty()) { result = JSON::Array::Ptr(new JSON::Array()); @@ -289,7 +289,7 @@ void JSONConfiguration::setValue(const std::string& key, const Poco::DynamicAny& { for (int i = static_cast(arr->size()); i <= *it; ++i) { - Poco::DynamicAny nullValue; + Poco::Dynamic::Var nullValue; arr->add(nullValue); } nextArray = new JSON::Array(); @@ -340,7 +340,7 @@ void JSONConfiguration::setDouble(const std::string& key, double value) void JSONConfiguration::enumerate(const std::string& key, Keys& range) const { JSON::Query query(_object); - Poco::DynamicAny result = query.find(key); + Poco::Dynamic::Var result = query.find(key); if (result.type() == typeid(JSON::Object::Ptr)) { JSON::Object::Ptr object = result.extract(); @@ -370,7 +370,7 @@ void JSONConfiguration::removeRaw(const std::string& key) } else { - DynamicAny result = parentObject->get(lastPart); + Dynamic::Var result = parentObject->get(lastPart); if (!result.isEmpty() && result.type() == typeid(JSON::Array::Ptr)) { JSON::Array::Ptr arr = result.extract(); diff --git a/Zip/include/Poco/Zip/Compress.h b/Zip/include/Poco/Zip/Compress.h index c8a33d664..d3c90c869 100644 --- a/Zip/include/Poco/Zip/Compress.h +++ b/Zip/include/Poco/Zip/Compress.h @@ -20,7 +20,7 @@ #include "Poco/Zip/Zip.h" #include "Poco/Zip/ZipArchive.h" -#include "Poco/FIFOEvent.h" +#include "Poco/BasicEvent.h" #include #include #include @@ -34,7 +34,7 @@ class Zip_API Compress /// Compresses a directory or files as zip. { public: - Poco::FIFOEvent EDone; + Poco::BasicEvent EDone; Compress(std::ostream& out, bool seekableOut, bool forceZip64 = false); /// seekableOut determines how we write the zip, setting it to true is recommended for local files (smaller zip file), diff --git a/Zip/include/Poco/Zip/Decompress.h b/Zip/include/Poco/Zip/Decompress.h index e74e7e47c..83b959c2e 100644 --- a/Zip/include/Poco/Zip/Decompress.h +++ b/Zip/include/Poco/Zip/Decompress.h @@ -22,7 +22,7 @@ #include "Poco/Zip/ParseCallback.h" #include "Poco/Zip/ZipArchive.h" #include "Poco/Path.h" -#include "Poco/FIFOEvent.h" +#include "Poco/BasicEvent.h" namespace Poco { @@ -39,10 +39,10 @@ public: using ZipMapping = std::map; /// Maps key of FileInfo entries to their local decompressed representation - Poco::FIFOEvent> EError; + Poco::BasicEvent> EError; /// Thrown whenever an error is detected when handling a ZipLocalFileHeader entry. The string contains an error message - Poco::FIFOEvent> EOk; + Poco::BasicEvent> EOk; /// Thrown whenever a file was successfully decompressed Decompress(std::istream& in, const Poco::Path& outputDir, bool flattenDirs = false, bool keepIncompleteFiles = false); @@ -52,14 +52,14 @@ public: /// If flattenDirs is set to true, the directory structure of the zip file is not recreated. /// Instead, all files are extracted into one single directory. - ~Decompress(); + ~Decompress() override; /// Destroys the Decompress. ZipArchive decompressAllFiles(); /// Decompresses all files stored in the zip File. Can only be called once per Decompress object. /// Use mapping to retrieve the location of the decompressed files - bool handleZipEntry(std::istream& zipStream, const ZipLocalFileHeader& hdr); + bool handleZipEntry(std::istream& zipStream, const ZipLocalFileHeader& hdr) override; const ZipMapping& mapping() const; /// A ZipMapping stores as key the full name of the ZipFileInfo/ZipLocalFileHeader and as value the decompressed file diff --git a/Zip/include/Poco/Zip/ZipManipulator.h b/Zip/include/Poco/Zip/ZipManipulator.h index 5d69c7952..0077e50bc 100644 --- a/Zip/include/Poco/Zip/ZipManipulator.h +++ b/Zip/include/Poco/Zip/ZipManipulator.h @@ -22,7 +22,7 @@ #include "Poco/Zip/ZipArchive.h" #include "Poco/Zip/ZipCommon.h" #include "Poco/Zip/ZipOperation.h" -#include "Poco/FIFOEvent.h" +#include "Poco/BasicEvent.h" #include "Poco/SharedPtr.h" #include @@ -38,7 +38,7 @@ class Zip_API ZipManipulator /// ZipManipulator allows to add/remove/update files inside zip files { public: - Poco::FIFOEvent EDone; + Poco::BasicEvent EDone; // Fired for each entry once commit is invoked ZipManipulator(const std::string& zipFile, bool backupOriginalFile); diff --git a/cmake/FindAPR.cmake b/cmake/FindAPR.cmake index fdcabed3a..87a79e9cd 100644 --- a/cmake/FindAPR.cmake +++ b/cmake/FindAPR.cmake @@ -66,8 +66,8 @@ if(APR_FOUND) set(APR_DEFINITIONS ${PC_APR_CFLAGS_OTHER}) # Deprecated declarations. - SET (NATIVE_APR_INCLUDE_PATH ${APR_INCLUDE_DIR} ) - GET_FILENAME_COMPONENT (NATIVE_APR_LIB_PATH ${APR_LIBRARY} PATH) + #SET (NATIVE_APR_INCLUDE_PATH ${APR_INCLUDE_DIR} ) + #GET_FILENAME_COMPONENT (NATIVE_APR_LIB_PATH ${APR_LIBRARY} PATH) endif() if(APR_FOUND AND NOT TARGET Apache::Apr) diff --git a/cmake/FindAPRUTIL.cmake b/cmake/FindAPRUTIL.cmake index 018e7a279..6f7a043ae 100644 --- a/cmake/FindAPRUTIL.cmake +++ b/cmake/FindAPRUTIL.cmake @@ -62,8 +62,8 @@ if(APRUTIL_FOUND) set(APRUTIL_DEFINITIONS ${PC_APRUTIL_CFLAGS_OTHER}) # Deprecated declarations. - SET (NATIVE_APRUTIL_INCLUDE_PATH ${APRUTIL_INCLUDE_DIR} ) - GET_FILENAME_COMPONENT (NATIVE_APRUTIL_LIB_PATH ${APRUTIL_LIBRARY} PATH) + #SET (NATIVE_APRUTIL_INCLUDE_PATH ${APRUTIL_INCLUDE_DIR} ) + #GET_FILENAME_COMPONENT (NATIVE_APRUTIL_LIB_PATH ${APRUTIL_LIBRARY} PATH) endif() if(APRUTIL_FOUND AND NOT TARGET Apache::Aprutil)