merge some changes from develop branch; modernize and clean-up code; remove support for compiling without POCO_WIN32_UTF8

This commit is contained in:
Günter Obiltschnig 2020-01-09 10:08:09 +01:00
parent 7c177b6f89
commit 1bf40a0cd2
389 changed files with 3029 additions and 4111 deletions

View File

@ -9,7 +9,7 @@
#include "CppUnit/CppUnit.h"
#include <string>
#include <stdio.h>
#include <cstdio>
namespace CppUnit {
@ -33,7 +33,7 @@ inline std::string estring(std::string& expandedString)
inline std::string estring(int number)
{
char buffer[50];
sprintf(buffer, "%d", number);
std::snprintf(buffer, sizeof(buffer), "%d", number);
return std::string (buffer);
}
@ -42,7 +42,7 @@ inline std::string estring(int number)
inline std::string estring(long number)
{
char buffer[50];
sprintf(buffer, "%ld", number);
std::snprintf(buffer, sizeof(buffer), "%ld", number);
return std::string (buffer);
}
@ -51,7 +51,7 @@ inline std::string estring(long number)
inline std::string estring(double number)
{
char buffer[50];
sprintf(buffer, "%lf", number);
std::snprintf(buffer, sizeof(buffer), "%lf", number);
return std::string(buffer);
}
@ -60,7 +60,7 @@ inline std::string estring(double number)
inline std::string estring(const void* ptr)
{
char buffer[50];
sprintf(buffer, "%p", ptr);
std::snprintf(buffer, sizeof(buffer), "%p", ptr);
return std::string(buffer);
}

View File

@ -37,7 +37,7 @@ namespace Poco {
namespace Data {
typedef NullType NullData;
using NullData = NullType;
namespace Keywords {
@ -53,7 +53,7 @@ class Data_API AbstractBinder
/// Interface for Binding data types to placeholders.
{
public:
typedef SharedPtr<AbstractBinder> Ptr;
using Ptr = SharedPtr<AbstractBinder>;
enum Direction
/// Binding direction for a parameter.

View File

@ -37,8 +37,8 @@ class Data_API AbstractBinding
/// AbstractBinding connects a value with a placeholder via an AbstractBinder interface.
{
public:
typedef SharedPtr<AbstractBinding> Ptr;
typedef AbstractBinder::Ptr BinderPtr;
using Ptr = SharedPtr<AbstractBinding>;
using BinderPtr = AbstractBinder::Ptr;
enum Direction
{
@ -100,9 +100,9 @@ private:
};
typedef std::vector<AbstractBinding::Ptr> AbstractBindingVec;
typedef std::deque<AbstractBinding::Ptr> AbstractBindingDeq;
typedef std::list<AbstractBinding::Ptr> AbstractBindingLst;
using AbstractBindingVec = std::vector<AbstractBinding::Ptr>;
using AbstractBindingDeq = std::deque<AbstractBinding::Ptr>;
using AbstractBindingLst = std::list<AbstractBinding::Ptr>;
//

View File

@ -43,9 +43,9 @@ class Data_API AbstractExtraction
/// retrieved via an AbstractExtractor.
{
public:
typedef SharedPtr<AbstractExtraction> Ptr;
typedef SharedPtr<AbstractExtractor> ExtractorPtr;
typedef SharedPtr<AbstractPreparator> PreparatorPtr;
using Ptr = SharedPtr<AbstractExtraction>;
using ExtractorPtr = SharedPtr<AbstractExtractor>;
using PreparatorPtr = SharedPtr<AbstractPreparator>;
AbstractExtraction(Poco::UInt32 limit = Limit::LIMIT_UNLIMITED,
Poco::UInt32 position = 0, bool bulk = false);
@ -172,12 +172,12 @@ private:
};
typedef std::vector<AbstractExtraction::Ptr> AbstractExtractionVec;
typedef std::vector<AbstractExtractionVec> AbstractExtractionVecVec;
typedef std::deque<AbstractExtraction::Ptr> AbstractExtractionDeq;
typedef std::vector<AbstractExtractionDeq> AbstractExtractionDeqVec;
typedef std::list<AbstractExtraction::Ptr> AbstractExtractionLst;
typedef std::vector<AbstractExtractionLst> AbstractExtractionLstVec;
using AbstractExtractionVec = std::vector<AbstractExtraction::Ptr>;
using AbstractExtractionVecVec = std::vector<AbstractExtractionVec>;
using AbstractExtractionDeq = std::deque<AbstractExtraction::Ptr>;
using AbstractExtractionDeqVec = std::vector<AbstractExtractionDeq>;
using AbstractExtractionLst = std::list<AbstractExtraction::Ptr>;
using AbstractExtractionLstVec = std::vector<AbstractExtractionLst>;
//

View File

@ -51,7 +51,7 @@ class Data_API AbstractExtractor
/// If an extractor receives null it is not allowed to change val!
{
public:
typedef SharedPtr<AbstractExtractor> Ptr;
using Ptr = SharedPtr<AbstractExtractor>;
AbstractExtractor();
/// Creates the AbstractExtractor.

View File

@ -32,8 +32,8 @@ class Data_API AbstractPreparation
/// Interface for calling the appropriate AbstractPreparator method
{
public:
typedef SharedPtr<AbstractPreparation> Ptr;
typedef AbstractPreparator::Ptr PreparatorPtr;
using Ptr = SharedPtr<AbstractPreparation>;
using PreparatorPtr = AbstractPreparator::Ptr;
AbstractPreparation(PreparatorPtr pPreparator);
/// Creates the AbstractPreparation.

View File

@ -57,7 +57,7 @@ class Data_API AbstractPreparator
/// after SQL execution (e.g. SQLite) do not need this functionality at all.
{
public:
typedef SharedPtr<AbstractPreparator> Ptr;
using Ptr = SharedPtr<AbstractPreparator>;
AbstractPreparator(Poco::UInt32 length = 1u);
/// Creates the AbstractPreparator.

View File

@ -59,7 +59,7 @@ public:
/// Creates the AbstractSessionImpl.
///
/// Adds "storage" property and sets the default internal storage container
/// type to std::deque.
/// type to std::vector.
/// The storage is created by statements automatically whenever a query
/// returning results is executed but external storage is provided by the user.
/// Storage type can be reconfigured at runtime both globally (for the
@ -296,8 +296,8 @@ private:
PropertyGetter getter;
};
typedef std::map<std::string, Feature> FeatureMap;
typedef std::map<std::string, Property> PropertyMap;
using FeatureMap = std::map<std::string, Feature>;
using PropertyMap = std::map<std::string, Property>;
FeatureMap _features;
PropertyMap _properties;

View File

@ -70,8 +70,8 @@ public:
/// Sets the archive threshold.
protected:
typedef Poco::SharedPtr<Session> SessionPtr;
typedef Poco::SharedPtr<Statement> StatementPtr;
using SessionPtr = Poco::SharedPtr<Session>;
using StatementPtr = Poco::SharedPtr<Statement>;
Session& session();

View File

@ -26,7 +26,7 @@ namespace Poco {
namespace Data {
typedef Transaction AutoTransaction;
using AutoTransaction = Transaction;
} } // namespace Poco::Data

View File

@ -51,10 +51,10 @@ class Binding: public AbstractBinding
/// function. An attempt to pass a constant by reference shall result in compile-time error.
{
public:
typedef T ValType;
typedef SharedPtr<ValType> ValPtr;
typedef Binding<ValType> Type;
typedef SharedPtr<Type> Ptr;
using ValType = T;
using ValPtr = SharedPtr<ValType>;
using Type = Binding<ValType>;
using Ptr = SharedPtr<Type>;
explicit Binding(T& val,
const std::string& name = "",
@ -121,10 +121,10 @@ class CopyBinding: public AbstractBinding
/// Variables can be passed as either copies or references (i.e. using either use() or bind()).
{
public:
typedef T ValType;
typedef SharedPtr<ValType> ValPtr;
typedef CopyBinding<ValType> Type;
typedef SharedPtr<Type> Ptr;
using ValType = T;
using ValPtr = SharedPtr<ValType>;
using Type = CopyBinding<ValType>;
using Ptr = SharedPtr<Type>;
explicit CopyBinding(T& val,
const std::string& name = "",
@ -184,10 +184,10 @@ class Binding<const char*>: public AbstractBinding
/// Binding const char* specialization wraps char pointer into string.
{
public:
typedef const char* ValType;
typedef SharedPtr<ValType> ValPtr;
typedef Binding<const char*> Type;
typedef SharedPtr<Type> Ptr;
using ValType = const char*;
using ValPtr = SharedPtr<ValType>;
using Type = Binding<const char*>;
using Ptr = SharedPtr<Type>;
explicit Binding(const char* pVal,
const std::string& name = "",
@ -246,10 +246,10 @@ class CopyBinding<const char*>: public AbstractBinding
/// Binding const char* specialization wraps char pointer into string.
{
public:
typedef const char* ValType;
typedef SharedPtr<ValType> ValPtr;
typedef CopyBinding<const char*> Type;
typedef SharedPtr<Type> Ptr;
using ValType = const char*;
using ValPtr = SharedPtr<ValType>;
using Type = CopyBinding<const char*>;
using Ptr = SharedPtr<Type>;
explicit CopyBinding(const char* pVal,
const std::string& name = "",
@ -307,10 +307,10 @@ class Binding<std::vector<T> >: public AbstractBinding
/// Specialization for std::vector.
{
public:
typedef std::vector<T> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef SharedPtr<Binding<ValType> > Ptr;
typedef typename ValType::const_iterator Iterator;
using ValType = std::vector<T>;
using ValPtr = SharedPtr<ValType>;
using Ptr = SharedPtr<Binding<ValType>>;
using Iterator = typename ValType::const_iterator;
explicit Binding(std::vector<T>& val,
const std::string& name = "",
@ -374,10 +374,10 @@ class CopyBinding<std::vector<T> >: public AbstractBinding
{
public:
typedef std::vector<T> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef SharedPtr<CopyBinding<ValType> > Ptr;
typedef typename ValType::const_iterator Iterator;
using ValType = std::vector<T>;
using ValPtr = SharedPtr<ValType>;
using Ptr = SharedPtr<CopyBinding<ValType>>;
using Iterator = typename ValType::const_iterator;
explicit CopyBinding(std::vector<T>& val,
const std::string& name = "",
@ -451,10 +451,10 @@ class Binding<std::vector<bool> >: public AbstractBinding
/// Only IN binding is supported.
{
public:
typedef std::vector<bool> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef SharedPtr<Binding<ValType> > Ptr;
typedef ValType::const_iterator Iterator;
using ValType = std::vector<bool>;
using ValPtr = SharedPtr<ValType>;
using Ptr = SharedPtr<Binding<ValType>>;
using Iterator = ValType::const_iterator;
explicit Binding(const std::vector<bool>& val,
const std::string& name = "",
@ -500,7 +500,6 @@ public:
poco_assert_dbg(canBind());
TypeHandler<bool>::bind(pos, *_begin, getBinder(), getDirection());
++_begin;
}
void reset()
@ -533,10 +532,10 @@ class CopyBinding<std::vector<bool> >: public AbstractBinding
/// Only IN binding is supported.
{
public:
typedef std::vector<bool> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef SharedPtr<CopyBinding<ValType> > Ptr;
typedef ValType::const_iterator Iterator;
using ValType = std::vector<bool>;
using ValPtr = SharedPtr<ValType>;
using Ptr = SharedPtr<CopyBinding<ValType>>;
using Iterator = ValType::const_iterator;
explicit CopyBinding(const std::vector<bool>& val,
const std::string& name = "",
@ -602,10 +601,10 @@ class Binding<std::list<T> >: public AbstractBinding
/// Specialization for std::list.
{
public:
typedef std::list<T> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef SharedPtr<Binding<ValType> > Ptr;
typedef typename ValType::const_iterator Iterator;
using ValType = std::list<T>;
using ValPtr = SharedPtr<ValType>;
using Ptr = SharedPtr<Binding<ValType>>;
using Iterator = typename ValType::const_iterator;
explicit Binding(std::list<T>& val,
const std::string& name = "",
@ -667,10 +666,10 @@ class CopyBinding<std::list<T> >: public AbstractBinding
/// Specialization for std::list.
{
public:
typedef typename std::list<T> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef SharedPtr<CopyBinding<ValType> > Ptr;
typedef typename ValType::const_iterator Iterator;
using ValType = typename std::list<T>;
using ValPtr = SharedPtr<ValType>;
using Ptr = SharedPtr<CopyBinding<ValType>>;
using Iterator = typename ValType::const_iterator;
explicit CopyBinding(ValType& val,
const std::string& name = "",
@ -732,10 +731,10 @@ class Binding<std::deque<T> >: public AbstractBinding
/// Specialization for std::deque.
{
public:
typedef std::deque<T> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef SharedPtr<Binding<ValType> > Ptr;
typedef typename ValType::const_iterator Iterator;
using ValType = std::deque<T>;
using ValPtr = SharedPtr<ValType>;
using Ptr = SharedPtr<Binding<ValType>>;
using Iterator = typename ValType::const_iterator;
explicit Binding(std::deque<T>& val,
const std::string& name = "",
@ -797,10 +796,10 @@ class CopyBinding<std::deque<T> >: public AbstractBinding
/// Specialization for std::deque.
{
public:
typedef std::deque<T> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef SharedPtr<CopyBinding<ValType> > Ptr;
typedef typename ValType::const_iterator Iterator;
using ValType = std::deque<T>;
using ValPtr = SharedPtr<ValType>;
using Ptr = SharedPtr<CopyBinding<ValType>>;
using Iterator = typename ValType::const_iterator;
explicit CopyBinding(std::deque<T>& val,
const std::string& name = "",
@ -862,10 +861,10 @@ class Binding<std::set<T> >: public AbstractBinding
/// Specialization for std::set.
{
public:
typedef std::set<T> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef SharedPtr<Binding<ValType> > Ptr;
typedef typename ValType::const_iterator Iterator;
using ValType = std::set<T>;
using ValPtr = SharedPtr<ValType>;
using Ptr = SharedPtr<Binding<ValType>>;
using Iterator = typename ValType::const_iterator;
explicit Binding(std::set<T>& val,
const std::string& name = "",
@ -927,10 +926,10 @@ class CopyBinding<std::set<T> >: public AbstractBinding
/// Specialization for std::set.
{
public:
typedef std::set<T> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef SharedPtr<CopyBinding<ValType> > Ptr;
typedef typename ValType::const_iterator Iterator;
using ValType = std::set<T>;
using ValPtr = SharedPtr<ValType>;
using Ptr = SharedPtr<CopyBinding<ValType>>;
using Iterator = typename ValType::const_iterator;
explicit CopyBinding(std::set<T>& val,
const std::string& name = "",
@ -992,10 +991,10 @@ class Binding<std::multiset<T> >: public AbstractBinding
/// Specialization for std::multiset.
{
public:
typedef std::multiset<T> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef SharedPtr<Binding<ValType> > Ptr;
typedef typename ValType::const_iterator Iterator;
using ValType = std::multiset<T>;
using ValPtr = SharedPtr<ValType>;
using Ptr = SharedPtr<Binding<ValType>>;
using Iterator = typename ValType::const_iterator;
explicit Binding(std::multiset<T>& val,
const std::string& name = "",
@ -1057,10 +1056,10 @@ class CopyBinding<std::multiset<T> >: public AbstractBinding
/// Specialization for std::multiset.
{
public:
typedef std::multiset<T> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef SharedPtr<CopyBinding<ValType> > Ptr;
typedef typename ValType::const_iterator Iterator;
using ValType = std::multiset<T>;
using ValPtr = SharedPtr<ValType>;
using Ptr = SharedPtr<CopyBinding<ValType>>;
using Iterator = typename ValType::const_iterator;
explicit CopyBinding(std::multiset<T>& val,
const std::string& name = "",
@ -1122,10 +1121,10 @@ class Binding<std::map<K, V> >: public AbstractBinding
/// Specialization for std::map.
{
public:
typedef std::map<K, V> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef SharedPtr<Binding<ValType> > Ptr;
typedef typename ValType::const_iterator Iterator;
using ValType = std::map<K, V>;
using ValPtr = SharedPtr<ValType>;
using Ptr = SharedPtr<Binding<ValType>>;
using Iterator = typename ValType::const_iterator;
explicit Binding(std::map<K, V>& val,
const std::string& name = "",
@ -1187,10 +1186,10 @@ class CopyBinding<std::map<K, V> >: public AbstractBinding
/// Specialization for std::map.
{
public:
typedef std::map<K, V> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef SharedPtr<CopyBinding<ValType> > Ptr;
typedef typename ValType::const_iterator Iterator;
using ValType = std::map<K, V>;
using ValPtr = SharedPtr<ValType>;
using Ptr = SharedPtr<CopyBinding<ValType>>;
using Iterator = typename ValType::const_iterator;
explicit CopyBinding(std::map<K, V>& val,
const std::string& name = "",
@ -1252,10 +1251,10 @@ class Binding<std::multimap<K, V> >: public AbstractBinding
/// Specialization for std::multimap.
{
public:
typedef std::multimap<K, V> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef SharedPtr<Binding<ValType> > Ptr;
typedef typename ValType::const_iterator Iterator;
using ValType = std::multimap<K, V>;
using ValPtr = SharedPtr<ValType>;
using Ptr = SharedPtr<Binding<ValType>>;
using Iterator = typename ValType::const_iterator;
explicit Binding(std::multimap<K, V>& val,
const std::string& name = "",
@ -1317,10 +1316,10 @@ class CopyBinding<std::multimap<K, V> >: public AbstractBinding
/// Specialization for std::multimap.
{
public:
typedef std::multimap<K, V> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef SharedPtr<CopyBinding<ValType> > Ptr;
typedef typename ValType::const_iterator Iterator;
using ValType = std::multimap<K, V>;
using ValPtr = SharedPtr<ValType>;
using Ptr = SharedPtr<CopyBinding<ValType>>;
using Iterator = typename ValType::const_iterator;
explicit CopyBinding(std::multimap<K, V>& val,
const std::string& name = "",

View File

@ -38,11 +38,11 @@ class BulkExtraction: public AbstractExtraction
/// - std::list
{
public:
typedef C ValType;
typedef typename C::value_type CValType;
typedef SharedPtr<ValType> ValPtr;
typedef BulkExtraction<ValType> Type;
typedef SharedPtr<Type> Ptr;
using ValType = C;
using CValType = typename C::value_type;
using ValPtr = SharedPtr<ValType>;
using Type = BulkExtraction<ValType>;
using Ptr = SharedPtr<Type>;
BulkExtraction(C& result, Poco::UInt32 limit, const Position& pos = Position(0)):
AbstractExtraction(limit, pos.value(), true),
@ -146,11 +146,11 @@ class InternalBulkExtraction: public BulkExtraction<C>
/// InternalBulkExtraction objects can not be copied or assigned.
{
public:
typedef C ValType;
typedef typename C::value_type CValType;
typedef SharedPtr<ValType> ValPtr;
typedef InternalBulkExtraction<ValType> Type;
typedef SharedPtr<Type> Ptr;
using ValType = C;
using CValType = typename C::value_type;
using ValPtr = SharedPtr<ValType>;
using Type = InternalBulkExtraction<ValType>;
using Ptr = SharedPtr<Type>;
InternalBulkExtraction(C& result,
Column<C>* pColumn,

View File

@ -39,12 +39,12 @@ class Column
/// This class owns the data assigned to it and deletes the storage on destruction.
{
public:
typedef C Container;
typedef Poco::SharedPtr<C> ContainerPtr;
typedef typename C::const_iterator Iterator;
typedef typename C::const_reverse_iterator RIterator;
typedef typename C::size_type Size;
typedef typename C::value_type Type;
using Container = C;
using ContainerPtr = Poco::SharedPtr<C>;
using Iterator = typename C::const_iterator;
using RIterator = typename C::const_reverse_iterator;
using Size = typename C::size_type;
using Type = typename C::value_type;
Column(const MetaColumn& metaColumn, Container* pData):
_metaColumn(metaColumn),
@ -62,6 +62,13 @@ public:
{
}
Column(Column&& col) noexcept:
_metaColumn(std::move(col._metaColumn)),
_pData(std::move(col._pData))
/// Creates the Column.
{
}
~Column()
/// Destroys the Column.
{
@ -75,6 +82,14 @@ public:
return *this;
}
Column& operator = (Column&& col) noexcept
/// Assignment operator.
{
_metaColumn = std::move(col._metaColumn);
_pData = std::move(col._pData);
return *this;
}
void swap(Column& other)
/// Swaps the column with another one.
{
@ -186,11 +201,11 @@ class Column<std::vector<bool> >
/// column data.
{
public:
typedef std::vector<bool> Container;
typedef Poco::SharedPtr<Container> ContainerPtr;
typedef Container::const_iterator Iterator;
typedef Container::const_reverse_iterator RIterator;
typedef Container::size_type Size;
using Container = std::vector<bool>;
using ContainerPtr = Poco::SharedPtr<Container>;
using Iterator = Container::const_iterator;
using RIterator = Container::const_reverse_iterator;
using Size = Container::size_type;
Column(const MetaColumn& metaColumn, Container* pData):
_metaColumn(metaColumn),
@ -329,11 +344,11 @@ class Column<std::list<T> >
/// Column specialization for std::list
{
public:
typedef std::list<T> Container;
typedef Poco::SharedPtr<Container> ContainerPtr;
typedef typename Container::const_iterator Iterator;
typedef typename Container::const_reverse_iterator RIterator;
typedef typename Container::size_type Size;
using Container = std::list<T>;
using ContainerPtr = Poco::SharedPtr<Container>;
using Iterator = typename Container::const_iterator;
using RIterator = typename Container::const_reverse_iterator;
using Size = typename Container::size_type;
Column(const MetaColumn& metaColumn, std::list<T>* pData):
_metaColumn(metaColumn),

View File

@ -27,8 +27,8 @@ namespace Poco {
namespace Data {
template <typename T> class LOB;
typedef LOB<unsigned char> BLOB;
typedef LOB<char> CLOB;
using BLOB = LOB<unsigned char>;
using CLOB = LOB<char>;
} } // namespace Poco::Data

View File

@ -42,10 +42,10 @@ class Extraction: public AbstractExtraction
/// Concrete Data Type specific extraction of values from a query result set.
{
public:
typedef T ValType;
typedef SharedPtr<ValType> ValPtr;
typedef Extraction<ValType> Type;
typedef SharedPtr<Type> Ptr;
using ValType = T;
using ValPtr = SharedPtr<ValType>;
using Type = Extraction<ValType>;
using Ptr = SharedPtr<Type>;
Extraction(T& result, const Position& pos = Position(0)):
AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()),
@ -133,11 +133,10 @@ class Extraction<std::vector<T> >: public AbstractExtraction
/// Vector Data Type specialization for extraction of values from a query result set.
{
public:
typedef std::vector<T> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef Extraction<ValType> Type;
typedef SharedPtr<Type> Ptr;
using ValType = std::vector<T>;
using ValPtr = SharedPtr<ValType>;
using Type = Extraction<ValType>;
using Ptr = SharedPtr<Type>;
Extraction(std::vector<T>& result, const Position& pos = Position(0)):
AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()),
@ -224,10 +223,10 @@ class Extraction<std::vector<bool> >: public AbstractExtraction
/// Vector bool specialization for extraction of values from a query result set.
{
public:
typedef std::vector<bool> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef Extraction<ValType> Type;
typedef SharedPtr<Type> Ptr;
using ValType = std::vector<bool>;
using ValPtr = SharedPtr<ValType>;
using Type = Extraction<ValType>;
using Ptr = SharedPtr<Type>;
Extraction(std::vector<bool>& result, const Position& pos = Position(0)):
AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()),
@ -316,10 +315,10 @@ class Extraction<std::list<T> >: public AbstractExtraction
/// List Data Type specialization for extraction of values from a query result set.
{
public:
typedef std::list<T> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef Extraction<ValType> Type;
typedef SharedPtr<Type> Ptr;
using ValType = std::list<T>;
using ValPtr = SharedPtr<ValType>;
using Type = Extraction<ValType>;
using Ptr = SharedPtr<Type>;
Extraction(std::list<T>& result, const Position& pos = Position(0)):
AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()),
@ -406,10 +405,10 @@ class Extraction<std::deque<T> >: public AbstractExtraction
/// Deque Data Type specialization for extraction of values from a query result set.
{
public:
typedef std::deque<T> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef Extraction<ValType> Type;
typedef SharedPtr<Type> Ptr;
using ValType = std::deque<T>;
using ValPtr = SharedPtr<ValType>;
using Type = Extraction<ValType>;
using Ptr = SharedPtr<Type>;
Extraction(std::deque<T>& result, const Position& pos = Position(0)):
AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()),
@ -504,10 +503,10 @@ class InternalExtraction: public Extraction<C>
/// InternalExtraction objects can not be copied or assigned.
{
public:
typedef typename C::value_type ValType;
typedef SharedPtr<ValType> ValPtr;
typedef Extraction<ValType> Type;
typedef SharedPtr<Type> Ptr;
using ValType = typename C::value_type;
using ValPtr = SharedPtr<ValType>;
using Type = Extraction<ValType>;
using Ptr = SharedPtr<Type>;
InternalExtraction(C& result, Column<C>* pColumn, const Position& pos = Position(0)):
@ -565,11 +564,11 @@ class Extraction<std::set<T> >: public AbstractExtraction
/// Set Data Type specialization for extraction of values from a query result set.
{
public:
typedef std::set<T> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef Extraction<ValType> Type;
typedef SharedPtr<Type> Ptr;
typedef typename ValType::iterator Iterator;
using ValType = std::set<T>;
using ValPtr = SharedPtr<ValType>;
using Type = Extraction<ValType>;
using Ptr = SharedPtr<Type>;
using Iterator = typename ValType::iterator;
Extraction(std::set<T>& result, const Position& pos = Position(0)):
AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()),
@ -630,10 +629,10 @@ class Extraction<std::multiset<T> >: public AbstractExtraction
/// Multiset Data Type specialization for extraction of values from a query result set.
{
public:
typedef std::multiset<T> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef Extraction<ValType> Type;
typedef SharedPtr<Type> Ptr;
using ValType = std::multiset<T>;
using ValPtr = SharedPtr<ValType>;
using Type = Extraction<ValType>;
using Ptr = SharedPtr<Type>;
Extraction(std::multiset<T>& result, const Position& pos = Position(0)):
AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()),
@ -694,10 +693,10 @@ class Extraction<std::map<K, V> >: public AbstractExtraction
/// Map Data Type specialization for extraction of values from a query result set.
{
public:
typedef std::map<K, V> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef Extraction<ValType> Type;
typedef SharedPtr<Type> Ptr;
using ValType = std::map<K, V>;
using ValPtr = SharedPtr<ValType>;
using Type = Extraction<ValType>;
using Ptr = SharedPtr<Type>;
Extraction(std::map<K, V>& result, const Position& pos = Position(0)):
AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()),
@ -758,10 +757,10 @@ class Extraction<std::multimap<K, V> >: public AbstractExtraction
/// Multimap Data Type specialization for extraction of values from a query result set.
{
public:
typedef std::multimap<K, V> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef Extraction<ValType> Type;
typedef SharedPtr<Type> Ptr;
using ValType = std::multimap<K, V>;
using ValPtr = SharedPtr<ValType>;
using Type = Extraction<ValType>;
using Ptr = SharedPtr<Type>;
Extraction(std::multimap<K, V>& result, const Position& pos = Position(0)):
AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()),

View File

@ -41,10 +41,10 @@ class LOB
/// a convenient way to access the data in a LOB.
{
public:
typedef typename std::vector<T>::const_iterator Iterator;
typedef T ValueType;
typedef typename std::vector<T> Container;
typedef Poco::SharedPtr<Container> ContentPtr;
using Iterator = typename std::vector<T>::const_iterator;
using ValueType = T;
using Container = std::vector<T>;
using ContentPtr = Poco::SharedPtr<Container>;
LOB(): _pContent(new std::vector<T>())
/// Creates an empty LOB.
@ -74,6 +74,10 @@ public:
{
}
LOB(LOB&& other) noexcept: _pContent(std::move(other._pContent))
{
}
~LOB()
/// Destroys the LOB.
{
@ -87,6 +91,12 @@ public:
return *this;
}
LOB& operator = (LOB&& other) noexcept
{
_pContent = std::move(other._pContent);
return *this;
}
bool operator == (const LOB& other) const
/// Compares for equality LOB by value.
{
@ -180,8 +190,8 @@ private:
};
typedef LOB<unsigned char> BLOB;
typedef LOB<char> CLOB;
using BLOB = LOB<unsigned char>;
using CLOB = LOB<char>;
//

View File

@ -46,8 +46,8 @@ public:
}
protected:
typedef std::char_traits<T> TraitsType;
typedef BasicUnbufferedStreamBuf<T, TraitsType> BaseType;
using TraitsType = std::char_traits<T>;
using BaseType = BasicUnbufferedStreamBuf<T, TraitsType>;
typename BaseType::int_type readFromDevice()
{
@ -138,11 +138,11 @@ public:
};
typedef LOBOutputStream<unsigned char> BLOBOutputStream;
typedef LOBOutputStream<char> CLOBOutputStream;
using BLOBOutputStream = LOBOutputStream<unsigned char>;
using CLOBOutputStream = LOBOutputStream<char>;
typedef LOBInputStream<unsigned char> BLOBInputStream;
typedef LOBInputStream<char> CLOBInputStream;
using BLOBInputStream = LOBInputStream<unsigned char>;
using CLOBInputStream = LOBInputStream<char>;
} } // namespace Poco::Data

View File

@ -29,7 +29,7 @@ class Data_API Limit
/// Limit stores information how many rows a query should return.
{
public:
typedef Poco::UInt32 SizeT;
using SizeT = Poco::UInt32;
enum Type
{

View File

@ -64,7 +64,22 @@ public:
bool nullable = false);
/// Creates the MetaColumn.
virtual ~MetaColumn();
MetaColumn(const MetaColumn& other);
/// Copy constructor.
MetaColumn(MetaColumn&& other) noexcept;
/// Move constructor.
MetaColumn& operator = (const MetaColumn& other);
/// Assignment operator.
MetaColumn& operator = (MetaColumn&& other) noexcept;
/// Assignment operator.
void swap(MetaColumn& other);
/// Swaps the contents with another instance.
~MetaColumn();
/// Destroys the MetaColumn.
const std::string& name() const;

View File

@ -69,9 +69,9 @@ class Data_API RecordSet: private Statement
/// a limit for the Statement.
{
public:
typedef std::map<std::size_t, Row*> RowMap;
typedef const RowIterator ConstIterator;
typedef RowIterator Iterator;
using RowMap = std::map<std::size_t, Row*>;
using ConstIterator = const RowIterator;
using Iterator = RowIterator;
using Statement::isNull;
using Statement::subTotalRowCount;
@ -107,15 +107,24 @@ public:
RecordSet(const RecordSet& other);
/// Copy-creates the recordset.
RecordSet(RecordSet&& other) noexcept;
/// Move-creates the recordset.
~RecordSet();
/// Destroys the RecordSet.
void setRowFormatter(RowFormatter::Ptr pRowFormatter);
/// Assigns the row formatter to the statement and all recordset rows.
Statement& operator = (const Statement& stmt);
RecordSet& operator = (const Statement& stmt);
/// Assignment operator.
RecordSet& operator = (const RecordSet& other);
/// Assignment operator.
RecordSet& operator = (RecordSet&& other) noexcept;
/// Move assignment.
std::size_t rowCount() const;
/// Returns the number of rows in the RecordSet.
/// The number of rows reported is dependent on filtering.
@ -159,12 +168,12 @@ public:
{
if (isBulkExtraction())
{
typedef InternalBulkExtraction<C> E;
using E = InternalBulkExtraction<C>;
return columnImpl<C,E>(name);
}
else
{
typedef InternalExtraction<C> E;
using E = InternalExtraction<C>;
return columnImpl<C,E>(name);
}
}
@ -175,12 +184,12 @@ public:
{
if (isBulkExtraction())
{
typedef InternalBulkExtraction<C> E;
using E = InternalBulkExtraction<C>;
return columnImpl<C,E>(pos);
}
else
{
typedef InternalExtraction<C> E;
using E = InternalExtraction<C>;
return columnImpl<C,E>(pos);
}
}
@ -200,18 +209,18 @@ public:
{
case STORAGE_VECTOR:
{
typedef typename std::vector<T> C;
using C = typename std::vector<T>;
return column<C>(col).value(row);
}
case STORAGE_LIST:
{
typedef typename std::list<T> C;
using C = typename std::list<T>;
return column<C>(col).value(row);
}
case STORAGE_DEQUE:
case STORAGE_UNKNOWN:
{
typedef typename std::deque<T> C;
using C = typename std::deque<T>;
return column<C>(col).value(row);
}
default:
@ -230,18 +239,18 @@ public:
{
case STORAGE_VECTOR:
{
typedef typename std::vector<T> C;
using C = typename std::vector<T>;
return column<C>(name).value(row);
}
case STORAGE_LIST:
{
typedef typename std::list<T> C;
using C = typename std::list<T>;
return column<C>(name).value(row);
}
case STORAGE_DEQUE:
case STORAGE_UNKNOWN:
{
typedef typename std::deque<T> C;
using C = typename std::deque<T>;
return column<C>(name).value(row);
}
default:
@ -404,8 +413,8 @@ private:
std::size_t columnPosition(const std::string& name) const
/// Returns the position of the column with specified name.
{
typedef typename C::value_type T;
typedef const E* ExtractionVecPtr;
using T = typename C::value_type;
using ExtractionVecPtr = const E*;
bool typeFound = false;
@ -443,8 +452,8 @@ private:
const Column<C>& columnImpl(std::size_t pos) const
/// Returns the reference to column at specified position.
{
typedef typename C::value_type T;
typedef const E* ExtractionVecPtr;
using T = typename C::value_type;
using ExtractionVecPtr = const E*;
const AbstractExtractionVec& rExtractions = extractions();
@ -532,13 +541,20 @@ inline std::size_t RecordSet::columnCount() const
}
inline Statement& RecordSet::operator = (const Statement& stmt)
inline RecordSet& RecordSet::operator = (const Statement& stmt)
{
reset(stmt);
return *this;
}
inline RecordSet& RecordSet::operator = (const RecordSet& other)
{
reset(other);
return *this;
}
inline Poco::Dynamic::Var RecordSet::value(const std::string& name)
{
return value(name, _currentRow);

View File

@ -57,9 +57,9 @@ class Data_API Row
/// The stream operator is provided for Row data type as a free-standing function.
{
public:
typedef RowFormatter::NameVec NameVec;
typedef RowFormatter::NameVecPtr NameVecPtr;
typedef RowFormatter::ValueVec ValueVec;
using NameVec = RowFormatter::NameVec;
using NameVecPtr = RowFormatter::NameVecPtr;
using ValueVec = RowFormatter::ValueVec;
enum ComparisonType
{
@ -69,14 +69,14 @@ public:
COMPARE_AS_STRING
};
typedef Tuple<std::size_t, ComparisonType> SortTuple;
typedef std::vector<SortTuple> SortMap;
using SortTuple = Tuple<std::size_t, ComparisonType>;
using SortMap = std::vector<SortTuple>;
/// The type for map holding fields used for sorting criteria.
/// Fields are added sequentially and have precedence that
/// corresponds to field adding sequence order (rather than field's
/// position in the row).
/// This requirement rules out use of std::map due to its sorted nature.
typedef SharedPtr<SortMap> SortMapPtr;
using SortMapPtr = SharedPtr<SortMap>;
Row();
/// Creates the Row.

View File

@ -68,11 +68,11 @@ public:
};
typedef bool (*CompT)(const Poco::Dynamic::Var&, const Poco::Dynamic::Var&);
typedef AutoPtr<RowFilter> Ptr;
typedef std::map<std::string, Comparison> Comparisons;
typedef Tuple<Poco::Dynamic::Var, Comparison, LogicOperator> ComparisonEntry;
typedef std::multimap<std::string, ComparisonEntry> ComparisonMap;
typedef std::map<AutoPtr<RowFilter>, LogicOperator> FilterMap;
using Ptr = AutoPtr<RowFilter>;
using Comparisons = std::map<std::string, Comparison>;
using ComparisonEntry = Tuple<Poco::Dynamic::Var, Comparison, LogicOperator>;
using ComparisonMap = std::multimap<std::string, ComparisonEntry>;
using FilterMap = std::map<AutoPtr<RowFilter>, LogicOperator>;
RowFilter(RecordSet* pRecordSet);
/// Creates the top-level RowFilter and associates it with the recordset.

View File

@ -68,10 +68,10 @@ class Data_API RowFormatter
///
{
public:
typedef SharedPtr<RowFormatter> Ptr;
typedef std::vector<std::string> NameVec;
typedef SharedPtr<std::vector<std::string> > NameVecPtr;
typedef std::vector<Poco::Dynamic::Var> ValueVec;
using Ptr = SharedPtr<RowFormatter>;
using NameVec = std::vector<std::string>;
using NameVecPtr = SharedPtr<std::vector<std::string>>;
using ValueVec = std::vector<Poco::Dynamic::Var>;
static const int INVALID_ROW_COUNT = -1;

View File

@ -36,11 +36,11 @@ class Data_API RowIterator
/// RowIterator class.
{
public:
typedef std::bidirectional_iterator_tag iterator_category;
typedef Row value_type;
typedef std::ptrdiff_t difference_type;
typedef Row* pointer;
typedef Row& reference;
using iterator_category = std::bidirectional_iterator_tag;
using value_type = Row;
using difference_type = std::ptrdiff_t;
using pointer = Row*;
using reference = Row&;
static const std::size_t POSITION_END;
/// End position indicator.
@ -53,12 +53,18 @@ public:
RowIterator(const RowIterator& other);
/// Creates a copy of other RowIterator.
RowIterator(RowIterator&& other) noexcept;
/// Move constructor.
~RowIterator();
/// Destroys the RowIterator.
RowIterator& operator = (const RowIterator& other);
/// Assigns the other RowIterator.
RowIterator& operator = (RowIterator&& other) noexcept;
/// Move assignment.
bool operator == (const RowIterator& other) const;
/// Equality operator.

View File

@ -61,6 +61,8 @@ class Data_API SQLChannel: public Poco::Channel
/// a risk of long blocking periods in case of remote server communication delays.
{
public:
using Ptr = Poco::AutoPtr<SQLChannel>;
SQLChannel();
/// Creates SQLChannel.
@ -140,10 +142,10 @@ protected:
~SQLChannel();
private:
typedef Poco::SharedPtr<Session> SessionPtr;
typedef Poco::SharedPtr<Statement> StatementPtr;
typedef Poco::Message::Priority Priority;
typedef Poco::SharedPtr<ArchiveStrategy> StrategyPtr;
using SessionPtr = Poco::SharedPtr<Session>;
using StatementPtr = Poco::SharedPtr<Statement>;
using Priority = Poco::Message::Priority;
using StrategyPtr = Poco::SharedPtr<ArchiveStrategy>;
void initLogStatement();
/// Initiallizes the log statement.

View File

@ -176,9 +176,15 @@ public:
Session(const Session&);
/// Creates a session by copying another one.
Session(Session&&) noexcept;
/// Creates a session by moving another one.
Session& operator = (const Session&);
/// Assignment operator.
Session& operator = (Session&&) noexcept;
/// Move assignment.
~Session();
/// Destroys the Session.

View File

@ -39,7 +39,7 @@ class Data_API SessionImpl: public Poco::RefCountedObject
/// SessionImpl objects are noncopyable.
{
public:
typedef Poco::AutoPtr<SessionImpl> Ptr;
using Ptr = Poco::AutoPtr<SessionImpl>;
static const std::size_t LOGIN_TIMEOUT_INFINITE = 0;
/// Infinite connection/login timeout.

View File

@ -30,9 +30,9 @@ class Data_API SimpleRowFormatter: public RowFormatter
/// A simple row formatting class.
{
public:
//typedef RowFormatter::NameVec NameVec;
//typedef RowFormatter::NameVecPtr NameVecPtr;
//typedef RowFormatter::ValueVec ValueVec;
//using NameVec = RowFormatter::NameVec;
//using NameVecPtr = RowFormatter::NameVecPtr;
//using ValueVec = RowFormatter::ValueVec;
static const int DEFAULT_COLUMN_WIDTH = 16;
static const int DEFAULT_SPACING = 1;

View File

@ -74,10 +74,10 @@ class Data_API Statement
public:
typedef void (*Manipulator)(Statement&);
typedef ActiveResult<std::size_t> Result;
typedef SharedPtr<Result> ResultPtr;
typedef ActiveMethod<std::size_t, bool, StatementImpl> AsyncExecMethod;
typedef SharedPtr<AsyncExecMethod> AsyncExecMethodPtr;
using Result = ActiveResult<std::size_t>;
using ResultPtr = SharedPtr<Result>;
using AsyncExecMethod = ActiveMethod<std::size_t, bool, StatementImpl>;
using AsyncExecMethodPtr = SharedPtr<AsyncExecMethod>;
static const int WAIT_FOREVER = -1;
@ -115,9 +115,15 @@ public:
/// synchronized prior to copy operation (i.e. is copied while executing),
/// this constructor shall synchronize it.
Statement(Statement&& other) noexcept;
/// Move constructor.
Statement& operator = (const Statement& stmt);
/// Assignment operator.
Statement& operator = (Statement&& stmt) noexcept;
/// Move assignment.
void swap(Statement& other);
/// Swaps the statement with another one.
@ -379,7 +385,7 @@ public:
/// Statement takes the ownership of the formatter.
protected:
typedef StatementImpl::Ptr ImplPtr;
using ImplPtr = StatementImpl::Ptr;
const AbstractExtractionVec& extractions() const;
/// Returns the extractions vector.
@ -406,7 +412,6 @@ protected:
/// Returns the underlying session.
private:
const Result& doAsyncExec(bool reset = true);
/// Asynchronously executes the statement.

View File

@ -41,12 +41,18 @@ public:
StatementCreator(const StatementCreator& other);
/// Creates a StatementCreator by copying another one.
StatementCreator(StatementCreator&& other) noexcept;
/// Creates a StatementCreator by moving another one.
~StatementCreator();
/// Destroys the StatementCreator.
StatementCreator& operator = (const StatementCreator& other);
/// Assignment operator.
StatementCreator& operator = (StatementCreator&& other) noexcept;
/// Assignment operator.
void swap(StatementCreator& other);
/// Swaps the StatementCreator with another one.

View File

@ -48,7 +48,7 @@ class Data_API StatementImpl
/// StatementImpl's are noncopyable.
{
public:
typedef Poco::SharedPtr<StatementImpl> Ptr;
using Ptr = Poco::SharedPtr<StatementImpl>;
enum State
{
@ -243,11 +243,11 @@ protected:
/// session is queried for container type setting. If the
/// session container type setting is found, it is used.
/// 3. If neither session nor statement have the internal
/// container type set, std::deque is used.
/// container type set, std::vector is used.
///
/// Supported internal extraction container types are:
/// - std::deque (default)
/// - std::vector
/// - std::vector (default)
/// - std::deque
/// - std::list
SessionImpl& session();
@ -346,7 +346,7 @@ private:
/// overrides the session setting for storage, otherwise the
/// session setting is used.
/// If neither this statement nor the session have the storage
/// type set, std::deque is the default container type used.
/// type set, std::vector is the default container type used.
{
std::string storage;
@ -430,7 +430,7 @@ private:
StatementImpl(const StatementImpl& stmt);
StatementImpl& operator = (const StatementImpl& stmt);
typedef std::vector<std::size_t> CountVec;
using CountVec = std::vector<std::size_t>;
State _state;
Limit _extrLimit;

View File

@ -366,8 +366,8 @@ template <class T0,
class TypeHandler<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19>>
{
public:
typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19> >::CONSTREFTYPE TupleConstRef;
typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19> >::REFTYPE TupleRef;
using TupleConstRef = typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19>>::CONSTREFTYPE;
using TupleRef = typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19>>::REFTYPE;
static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir)
{
@ -496,8 +496,8 @@ template <class T0,
class TypeHandler<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18>>
{
public:
typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18> >::CONSTREFTYPE TupleConstRef;
typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18> >::REFTYPE TupleRef;
using TupleConstRef = typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18>>::CONSTREFTYPE;
using TupleRef = typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18>>::REFTYPE;
static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir)
{
@ -621,8 +621,8 @@ template <class T0,
class TypeHandler<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17>>
{
public:
typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17> >::CONSTREFTYPE TupleConstRef;
typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17> >::REFTYPE TupleRef;
using TupleConstRef = typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17>>::CONSTREFTYPE;
using TupleRef = typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17>>::REFTYPE;
static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir)
{
@ -741,8 +741,8 @@ template <class T0,
class TypeHandler<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>>
{
public:
typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16> >::CONSTREFTYPE TupleConstRef;
typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16> >::REFTYPE TupleRef;
using TupleConstRef = typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>>::CONSTREFTYPE;
using TupleRef = typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>>::REFTYPE;
static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir)
{
@ -856,8 +856,8 @@ template <class T0,
class TypeHandler<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15>>
{
public:
typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15> >::CONSTREFTYPE TupleConstRef;
typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15> >::REFTYPE TupleRef;
using TupleConstRef = typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15>>::CONSTREFTYPE;
using TupleRef = typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15>>::REFTYPE;
static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir)
{
@ -966,8 +966,8 @@ template <class T0,
class TypeHandler<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>>
{
public:
typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14> >::CONSTREFTYPE TupleConstRef;
typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14> >::REFTYPE TupleRef;
using TupleConstRef = typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>>::CONSTREFTYPE;
using TupleRef = typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>>::REFTYPE;
static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir)
{
@ -1071,8 +1071,8 @@ template <class T0,
class TypeHandler<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>>
{
public:
typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13> >::CONSTREFTYPE TupleConstRef;
typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13> >::REFTYPE TupleRef;
using TupleConstRef = typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>>::CONSTREFTYPE;
using TupleRef = typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>>::REFTYPE;
static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir)
{
@ -1171,8 +1171,8 @@ template <class T0,
class TypeHandler<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>>
{
public:
typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12> >::CONSTREFTYPE TupleConstRef;
typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12> >::REFTYPE TupleRef;
using TupleConstRef = typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>>::CONSTREFTYPE;
using TupleRef = typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>>::REFTYPE;
static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir)
{
@ -1266,8 +1266,8 @@ template <class T0,
class TypeHandler<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>>
{
public:
typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11> >::CONSTREFTYPE TupleConstRef;
typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11> >::REFTYPE TupleRef;
using TupleConstRef = typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>>::CONSTREFTYPE;
using TupleRef = typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>>::REFTYPE;
static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir)
{
@ -1356,8 +1356,8 @@ template <class T0,
class TypeHandler<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>>
{
public:
typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> >::CONSTREFTYPE TupleConstRef;
typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> >::REFTYPE TupleRef;
using TupleConstRef = typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>>::CONSTREFTYPE;
using TupleRef = typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>>::REFTYPE;
static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir)
{
@ -1432,8 +1432,8 @@ template <class T0, class T1, class T2, class T3, class T4, class T5, class T6,
class TypeHandler<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>>
{
public:
typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> >::CONSTREFTYPE TupleConstRef;
typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> >::REFTYPE TupleRef;
using TupleConstRef = typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>>::CONSTREFTYPE;
using TupleRef = typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>>::REFTYPE;
static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir)
{
@ -1504,8 +1504,8 @@ template <class T0, class T1, class T2, class T3, class T4, class T5, class T6,
class TypeHandler<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, NullTypeList>>
{
public:
typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, NullTypeList> >::CONSTREFTYPE TupleConstRef;
typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, NullTypeList> >::REFTYPE TupleRef;
using TupleConstRef = typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, NullTypeList>>::CONSTREFTYPE;
using TupleRef = typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, NullTypeList>>::REFTYPE;
static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir)
{
@ -1572,8 +1572,8 @@ template <class T0, class T1, class T2, class T3, class T4, class T5, class T6,
class TypeHandler<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, NullTypeList>>
{
public:
typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, NullTypeList> >::CONSTREFTYPE TupleConstRef;
typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, NullTypeList> >::REFTYPE TupleRef;
using TupleConstRef = typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, NullTypeList>>::CONSTREFTYPE;
using TupleRef = typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, NullTypeList>>::REFTYPE;
static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir)
{
@ -1636,8 +1636,8 @@ template <class T0, class T1, class T2, class T3, class T4, class T5, class T6>
class TypeHandler<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, NullTypeList>>
{
public:
typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, NullTypeList> >::CONSTREFTYPE TupleConstRef;
typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, NullTypeList> >::REFTYPE TupleRef;
using TupleConstRef = typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, NullTypeList>>::CONSTREFTYPE;
using TupleRef = typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, NullTypeList>>::REFTYPE;
static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir)
{
@ -1696,8 +1696,8 @@ template <class T0, class T1, class T2, class T3, class T4, class T5>
class TypeHandler<Poco::Tuple<T0, T1, T2, T3, T4, T5, NullTypeList>>
{
public:
typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, T5, NullTypeList> >::CONSTREFTYPE TupleConstRef;
typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, T5, NullTypeList> >::REFTYPE TupleRef;
using TupleConstRef = typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, T5, NullTypeList>>::CONSTREFTYPE;
using TupleRef = typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, T5, NullTypeList>>::REFTYPE;
static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir)
{
@ -1752,8 +1752,8 @@ template <class T0, class T1, class T2, class T3, class T4>
class TypeHandler<Poco::Tuple<T0, T1, T2, T3, T4, NullTypeList>>
{
public:
typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, NullTypeList> >::CONSTREFTYPE TupleConstRef;
typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, NullTypeList> >::REFTYPE TupleRef;
using TupleConstRef = typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, NullTypeList>>::CONSTREFTYPE;
using TupleRef = typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, NullTypeList>>::REFTYPE;
static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir)
{
@ -1804,8 +1804,8 @@ template <class T0, class T1, class T2, class T3>
class TypeHandler<Poco::Tuple<T0, T1, T2, T3, NullTypeList>>
{
public:
typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, NullTypeList> >::CONSTREFTYPE TupleConstRef;
typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, NullTypeList> >::REFTYPE TupleRef;
using TupleConstRef = typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, NullTypeList>>::CONSTREFTYPE;
using TupleRef = typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, NullTypeList>>::REFTYPE;
static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir)
{
@ -1852,8 +1852,8 @@ template <class T0, class T1, class T2>
class TypeHandler<Poco::Tuple<T0, T1, T2, NullTypeList>>
{
public:
typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, NullTypeList> >::CONSTREFTYPE TupleConstRef;
typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, NullTypeList> >::REFTYPE TupleRef;
using TupleConstRef = typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, NullTypeList>>::CONSTREFTYPE;
using TupleRef = typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, NullTypeList>>::REFTYPE;
static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir)
{
@ -1896,8 +1896,8 @@ template <class T0, class T1>
class TypeHandler<Poco::Tuple<T0, T1, NullTypeList>>
{
public:
typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, NullTypeList> >::CONSTREFTYPE TupleConstRef;
typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, NullTypeList> >::REFTYPE TupleRef;
using TupleConstRef = typename Poco::TypeWrapper<Poco::Tuple<T0, T1, NullTypeList>>::CONSTREFTYPE;
using TupleRef = typename Poco::TypeWrapper<Poco::Tuple<T0, T1, NullTypeList>>::REFTYPE;
static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir)
{
@ -1936,8 +1936,8 @@ template <class T0>
class TypeHandler<Poco::Tuple<T0, NullTypeList>>
{
public:
typedef typename Poco::TypeWrapper<Poco::Tuple<T0, NullTypeList> >::CONSTREFTYPE TupleConstRef;
typedef typename Poco::TypeWrapper<Poco::Tuple<T0, NullTypeList> >::REFTYPE TupleRef;
using TupleConstRef = typename Poco::TypeWrapper<Poco::Tuple<T0, NullTypeList>>::CONSTREFTYPE;
using TupleRef = typename Poco::TypeWrapper<Poco::Tuple<T0, NullTypeList>>::REFTYPE;
static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir)
{

View File

@ -45,9 +45,61 @@ MetaColumn::MetaColumn(std::size_t position,
}
MetaColumn::MetaColumn(const MetaColumn& other):
_name(other._name),
_length(other._length),
_precision(other._precision),
_position(other._position),
_type(other._type),
_nullable(other._nullable)
{
}
MetaColumn::MetaColumn(MetaColumn&& other) noexcept:
_name(std::move(other._name)),
_length(other._length),
_precision(other._precision),
_position(other._position),
_type(other._type),
_nullable(other._nullable)
{
}
MetaColumn::~MetaColumn()
{
}
MetaColumn& MetaColumn::operator = (const MetaColumn& other)
{
MetaColumn tmp(other);
swap(tmp);
return *this;
}
MetaColumn& MetaColumn::operator = (MetaColumn&& other) noexcept
{
_name = std::move(other._name);
_length = other._length;
_precision = other._precision;
_position = other._position;
_type = other._type;
_nullable = other._nullable;
return *this;
}
void MetaColumn::swap(MetaColumn& other)
{
std::swap(_name, other._name);
std::swap(_length, other._length);
std::swap(_precision, other._precision);
std::swap(_position, other._position);
std::swap(_type, other._type);
std::swap(_nullable, other._nullable);
}
} } // namespace Poco::Data

View File

@ -69,6 +69,17 @@ RecordSet::RecordSet(const RecordSet& other):
}
RecordSet::RecordSet(RecordSet&& other) noexcept:
Statement(std::move(other)),
_currentRow(std::move(other._currentRow)),
_pBegin(std::move(other._pBegin)),
_pEnd(std::move(other._pEnd)),
_pFilter(std::move(other._pFilter)),
_totalRowCount(std::move(other._totalRowCount))
{
}
RecordSet::~RecordSet()
{
try
@ -87,6 +98,19 @@ RecordSet::~RecordSet()
}
RecordSet& RecordSet::operator = (RecordSet&& other) noexcept
{
Statement::operator = (std::move(other));
_currentRow = std::move(other._currentRow);
_pBegin = std::move(other._pBegin);
_pEnd = std::move(other._pEnd);
_pFilter = std::move(other._pFilter);
_totalRowCount = std::move(other._totalRowCount);
return *this;
}
void RecordSet::reset(const Statement& stmt)
{
delete _pBegin;

View File

@ -40,6 +40,12 @@ RowIterator::RowIterator(const RowIterator& other):
}
RowIterator::RowIterator(RowIterator&& other) noexcept:
_pRecordSet(std::move(other._pRecordSet)),
_position(std::move(other._position))
{
}
RowIterator::~RowIterator()
{
}
@ -53,6 +59,14 @@ RowIterator& RowIterator::operator = (const RowIterator& other)
}
RowIterator& RowIterator::operator = (RowIterator&& other) noexcept
{
_pRecordSet = std::move(other._pRecordSet);
_position = std::move(other._position);
return *this;
}
void RowIterator::swap(RowIterator& other)
{
using std::swap;

View File

@ -48,12 +48,19 @@ Session::Session(const std::string& connection,
}
Session::Session(const Session& other): _pImpl(other._pImpl),
Session::Session(const Session& other):
_pImpl(other._pImpl),
_statementCreator(other._pImpl)
{
}
Session::Session(Session&& other) noexcept:
_pImpl(std::move(other._pImpl)),
_statementCreator(std::move(other._pImpl))
{
}
Session::~Session()
{
}
@ -67,6 +74,14 @@ Session& Session::operator = (const Session& other)
}
Session& Session::operator = (Session&& other) noexcept
{
_pImpl = std::move(other._pImpl);
_statementCreator = std::move(other._statementCreator);
return *this;
}
void Session::swap(Session& other)
{
using std::swap;

View File

@ -53,6 +53,17 @@ Statement::Statement(const Statement& stmt):
}
Statement::Statement(Statement&& stmt) noexcept:
_pImpl(std::move(stmt._pImpl)),
_async(std::move(stmt._async)),
_pResult(std::move(stmt._pResult)),
_pAsyncExec(std::move(stmt._pAsyncExec)),
_arguments(std::move(stmt._arguments)),
_pRowFormatter(std::move(stmt._pRowFormatter))
{
}
Statement::~Statement()
{
}
@ -66,6 +77,18 @@ Statement& Statement::operator = (const Statement& stmt)
}
Statement& Statement::operator = (Statement&& stmt) noexcept
{
_pImpl = std::move(stmt._pImpl);
_async = std::move(stmt._async);
_pResult = std::move(stmt._pResult);
_pAsyncExec = std::move(stmt._pAsyncExec);
_arguments = std::move(stmt._arguments);
_pRowFormatter = std::move(stmt._pRowFormatter);
return *this;
}
void Statement::swap(Statement& other)
{
using std::swap;

View File

@ -37,6 +37,12 @@ StatementCreator::StatementCreator(const StatementCreator& other):
}
StatementCreator::StatementCreator(StatementCreator&& other) noexcept:
_ptrImpl(std::move(other._ptrImpl))
{
}
StatementCreator& StatementCreator::operator = (const StatementCreator& other)
{
StatementCreator tmp(other);
@ -45,6 +51,12 @@ StatementCreator& StatementCreator::operator = (const StatementCreator& other)
}
StatementCreator& StatementCreator::operator = (StatementCreator&& other) noexcept
{
_ptrImpl = std::move(other._ptrImpl);
return *this;
}
void StatementCreator::swap(StatementCreator& other)
{
using std::swap;

View File

@ -642,8 +642,8 @@ void DataTest::testColumnVectorBool()
void DataTest::testColumnDeque()
{
typedef std::deque<int> ContainerType;
typedef Column<ContainerType> ColumnType;
using ContainerType = std::deque<int>;
using ColumnType = Column<ContainerType>;
MetaColumn mc(0, "mc", MetaColumn::FDT_DOUBLE, 2, 3, true);
@ -759,8 +759,8 @@ void DataTest::testColumnDeque()
void DataTest::testColumnList()
{
typedef std::list<int> ContainerType;
typedef Column<ContainerType> ColumnType;
using ContainerType = std::list<int>;
using ColumnType = Column<ContainerType>;
MetaColumn mc(0, "mc", MetaColumn::FDT_DOUBLE, 2, 3, true);

View File

@ -48,7 +48,7 @@ bool TestStatementImpl::canBind() const
void TestStatementImpl::bindImpl()
{
// bind
typedef Poco::Data::AbstractBindingVec Bindings;
using Bindings = Poco::Data::AbstractBindingVec;
Bindings& binds = bindings();
if (binds.empty())
return;

View File

@ -244,14 +244,16 @@ public:
strategy.notify(pSender, args);
}
bool hasDelegates() const {
bool hasDelegates() const
/// Returns true if there are registered delegates.
{
return !empty();
}
ActiveResult<TArgs> notifyAsync(const void* pSender, const TArgs& args)
/// Sends a notification to all registered delegates. The order is
/// determined by the TStrategy. This method is not blocking and will
/// immediately return. The delegates are invoked in a seperate thread.
/// immediately return. The delegates are invoked in a separate thread.
/// Call activeResult.wait() to wait until the notification has ended.
/// While executing, other objects can change the delegate list. These changes don't
/// influence the current active notifications but are activated with
@ -293,6 +295,7 @@ public:
}
bool isEnabled() const
/// Returns true if event is enabled.
{
typename TMutex::ScopedLock lock(_mutex);
return _enabled;
@ -342,7 +345,7 @@ protected:
}
TStrategy _strategy; /// The strategy used to notify observers.
bool _enabled; /// Stores if an event is enabled. Notfies on disabled events have no effect
bool _enabled; /// Stores if an event is enabled. Notifies on disabled events have no effect
/// but it is possible to change the observers.
mutable TMutex _mutex;
@ -453,7 +456,7 @@ public:
ActiveResult<void> notifyAsync(const void* pSender)
/// Sends a notification to all registered delegates. The order is
/// determined by the TStrategy. This method is not blocking and will
/// immediately return. The delegates are invoked in a seperate thread.
/// immediately return. The delegates are invoked in a separate thread.
/// Call activeResult.wait() to wait until the notification has ended.
/// While executing, other objects can change the delegate list. These changes don't
/// influence the current active notifications but are activated with
@ -542,7 +545,7 @@ protected:
}
TStrategy _strategy; /// The strategy used to notify observers.
bool _enabled; /// Stores if an event is enabled. Notfies on disabled events have no effect
bool _enabled; /// Stores if an event is enabled. Notifies on disabled events have no effect
/// but it is possible to change the observers.
mutable TMutex _mutex;

View File

@ -67,7 +67,7 @@ public:
virtual void onReplace(const void* pSender, std::set<TKey>& elemsToRemove) = 0;
/// Used by the Strategy to indicate which elements should be removed from
/// the cache. Note that onReplace does not change the current list of keys.
/// The cache object is reponsible to remove the elements.
/// The cache object is responsible to remove the elements.
};

View File

@ -39,7 +39,7 @@ class AccessExpireLRUCache: public AbstractCache<TKey, TValue, StrategyCollectio
/// but also limits the size of the cache (per default: 1024).
{
public:
AccessExpireLRUCache(long cacheSize = 1024, Timestamp::TimeDiff expire = 600000):
AccessExpireLRUCache(std::size_t cacheSize = 1024, Timestamp::TimeDiff expire = 600000):
AbstractCache<TKey, TValue, StrategyCollection<TKey, TValue>, TMutex, TEventMutex >(StrategyCollection<TKey, TValue>())
{
this->_strategy.pushBack(new LRUStrategy<TKey, TValue>(cacheSize));

View File

@ -41,7 +41,7 @@ public:
ActiveResultHolder():
_pData(0),
_pExc(0),
_event(false)
_event(Event::EVENT_MANUALRESET)
/// Creates an ActiveResultHolder.
{
}
@ -147,7 +147,7 @@ class ActiveResultHolder<void>: public RefCountedObject
public:
ActiveResultHolder():
_pExc(0),
_event(false)
_event(Event::EVENT_MANUALRESET)
/// Creates an ActiveResultHolder.
{
}

View File

@ -33,7 +33,7 @@ class ActiveRunnableBase: public Runnable, public RefCountedObject
/// The base class for all ActiveRunnable instantiations.
{
public:
typedef AutoPtr<ActiveRunnableBase> Ptr;
using Ptr = AutoPtr<ActiveRunnableBase>;
};

View File

@ -82,7 +82,7 @@ public:
_runnable(*pOwner, method),
_stopped(true),
_running(false),
_done(false)
_done(Event::EVENT_MANUALRESET)
/// Creates the activity. Call start() to
/// start it.
{
@ -134,8 +134,6 @@ public:
void stop()
/// Requests to stop the activity.
{
FastMutex::ScopedLock lock(_mutex);
_stopped = true;
}
@ -195,8 +193,8 @@ private:
C* _pOwner;
RunnableAdapterType _runnable;
volatile bool _stopped;
volatile bool _running;
std::atomic<bool> _stopped;
std::atomic<bool> _running;
Event _done;
FastMutex _mutex;
};

View File

@ -14,233 +14,12 @@
//
// Adapted for POCO from LLVM Compiler Infrastructure code:
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source License
//
//===----------------------------------------------------------------------===//
//
// This file defines the AlignOf function that computes alignments for
// arbitrary types.
//
//===----------------------------------------------------------------------===//
#ifndef Foundation_AlignOf_INCLUDED
#define Foundation_AlignOf_INCLUDED
#include <cstddef>
#ifdef POCO_ENABLE_CPP11
#ifndef Foundation_Alignment_INCLUDED
#define Foundation_Alignment_INCLUDED
#include <type_traits>
#define POCO_HAVE_ALIGNMENT
#else
namespace Poco {
template <typename T>
struct AlignmentCalcImpl
{
char x;
T t;
private:
AlignmentCalcImpl() {} // Never instantiate.
};
template <typename T>
struct AlignOf
/// A templated class that contains an enum value representing
/// the alignment of the template argument. For example,
/// AlignOf<int>::Alignment represents the alignment of type "int". The
/// alignment calculated is the minimum alignment, and not necessarily
/// the "desired" alignment returned by GCC's __alignof__ (for example). Note
/// that because the alignment is an enum value, it can be used as a
/// compile-time constant (e.g., for template instantiation).
{
enum
{
Alignment = static_cast<unsigned int>(sizeof(AlignmentCalcImpl<T>) - sizeof(T))
};
enum { Alignment_GreaterEqual_2Bytes = Alignment >= 2 ? 1 : 0 };
enum { Alignment_GreaterEqual_4Bytes = Alignment >= 4 ? 1 : 0 };
enum { Alignment_GreaterEqual_8Bytes = Alignment >= 8 ? 1 : 0 };
enum { Alignment_GreaterEqual_16Bytes = Alignment >= 16 ? 1 : 0 };
enum { Alignment_LessEqual_2Bytes = Alignment <= 2 ? 1 : 0 };
enum { Alignment_LessEqual_4Bytes = Alignment <= 4 ? 1 : 0 };
enum { Alignment_LessEqual_8Bytes = Alignment <= 8 ? 1 : 0 };
enum { Alignment_LessEqual_16Bytes = Alignment <= 16 ? 1 : 0 };
};
template <typename T>
inline unsigned alignOf()
/// A templated function that returns the minimum alignment of
/// of a type. This provides no extra functionality beyond the AlignOf
/// class besides some cosmetic cleanliness. Example usage:
/// alignOf<int>() returns the alignment of an int.
{
return AlignOf<T>::Alignment;
}
template <std::size_t Alignment> struct AlignedCharArrayImpl;
/// Helper for building an aligned character array type.
///
/// This template is used to explicitly build up a collection of aligned
/// character types. We have to build these up using a macro and explicit
/// specialization to cope with old versions of MSVC and GCC where only an
/// integer literal can be used to specify an alignment constraint. Once built
/// up here, we can then begin to indirect between these using normal C++
/// template parameters.
// MSVC requires special handling here.
#ifndef _MSC_VER
#ifdef POCO_COMPILER_CLANG
#if __has_feature(cxx_alignas)
#define POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(x) \
template <> struct AlignedCharArrayImpl<x> \
{ \
char aligned alignas(x); \
}
#define POCO_HAVE_ALIGNMENT
#endif
#elif defined(__GNUC__) || defined(__IBM_ATTRIBUTES)
#define POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(x) \
template <> struct AlignedCharArrayImpl<x> \
{ \
char aligned __attribute__((aligned(x))); \
}
#define POCO_HAVE_ALIGNMENT
#endif
#ifdef POCO_HAVE_ALIGNMENT
POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(1);
POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(2);
POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(4);
POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(8);
POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(16);
POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(32);
POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(64);
POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(128);
POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(512);
POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(1024);
POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(2048);
POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(4096);
POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(8192);
#undef POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT
#endif // POCO_HAVE_ALIGNMENT
#else // _MSC_VER
// We provide special variations of this template for the most common
// alignments because __declspec(align(...)) doesn't actually work when it is
// a member of a by-value function argument in MSVC, even if the alignment
// request is something reasonably like 8-byte or 16-byte.
template <> struct AlignedCharArrayImpl<1> { char aligned; };
template <> struct AlignedCharArrayImpl<2> { short aligned; };
template <> struct AlignedCharArrayImpl<4> { int aligned; };
template <> struct AlignedCharArrayImpl<8> { double aligned; };
#define POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(x) \
template <> struct AlignedCharArrayImpl<x> { \
__declspec(align(x)) char aligned; \
}
POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(16);
POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(32);
POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(64);
POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(128);
#if (_MSC_VER > 1600) // MSVC 2010 complains on alignment larger than 128
POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(512);
POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(1024);
POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(2048);
POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(4096);
POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(8192);
#endif // _MSC_VER > 1600
// Any larger and MSVC complains.
#undef POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT
#define POCO_HAVE_ALIGNMENT
#endif // _MSC_VER
// POCO_HAVE_ALIGNMENT will be defined on the pre-C++11 platforms/compilers where
// it can be reliably determined and used. Uncomment the line below to explicitly
// disable use of alignment even for those platforms.
// #undef POCO_HAVE_ALIGNMENT
#ifdef POCO_HAVE_ALIGNMENT
template <typename T1, typename T2 = char, typename T3 = char, typename T4 = char>
union AlignedCharArrayUnion
/// This union template exposes a suitably aligned and sized character
/// array member which can hold elements of any of up to four types.
///
/// These types may be arrays, structs, or any other types. The goal is to
/// produce a union type containing a character array which, when used, forms
/// storage suitable to placement new any of these types over. Support for more
/// than four types can be added at the cost of more boiler plate.
{
private:
class AlignerImpl
{
T1 t1;
T2 t2;
T3 t3;
T4 t4;
AlignerImpl(); // Never defined or instantiated.
};
union SizerImpl
{
char arr1[sizeof(T1)];
char arr2[sizeof(T2)];
char arr3[sizeof(T3)];
char arr4[sizeof(T4)];
};
public:
char buffer[sizeof(SizerImpl)];
/// The character array buffer for use by clients.
///
/// No other member of this union should be referenced. They exist purely to
/// constrain the layout of this character array.
private:
Poco::AlignedCharArrayImpl<AlignOf<AlignerImpl>::Alignment> _nonceMember;
};
#endif // POCO_HAVE_ALIGNMENT
} // namespace Poco
#endif // POCO_ENABLE_CPP11
#endif // Foundation_AlignOf_INCLUDED
#endif // Foundation_Alignment_INCLUDED

View File

@ -33,16 +33,13 @@ namespace Dynamic {
class Var;
class VarHolder;
template <class> class VarHolderImpl;
template <class T> class VarHolderImpl;
}
#ifndef POCO_NO_SOO
#ifndef POCO_ENABLE_CPP11
// C++11 needed for std::aligned_storage
#error "Any SOO can only be enabled with C++11 support"
#endif
template <typename PlaceholderT, unsigned int SizeV = POCO_SMALL_OBJECT_SIZE>
union Placeholder
@ -121,7 +118,6 @@ union Placeholder
/// where the object was allocated (0 => heap, 1 => local).
{
public:
Placeholder ()
{
}
@ -201,7 +197,7 @@ public:
Any& swap(Any& other)
/// Swaps the content of the two Anys.
///
/// When small object optimizaton is enabled, swap only
/// When small object optimization is enabled, swap only
/// has no-throw guarantee when both (*this and other)
/// objects are allocated on the heap.
{
@ -270,14 +266,10 @@ public:
}
private:
class ValueHolder
{
public:
virtual ~ValueHolder()
{
}
virtual ~ValueHolder() = default;
virtual const std::type_info & type() const = 0;
virtual void clone(Placeholder<ValueHolder>*) const = 0;
@ -427,9 +419,7 @@ private:
class ValueHolder
{
public:
virtual ~ValueHolder()
{
}
virtual ~ValueHolder() = default;
virtual const std::type_info& type() const = 0;
virtual ValueHolder* clone() const = 0;
@ -476,6 +466,14 @@ private:
template <typename ValueType>
friend ValueType* UnsafeAnyCast(Any*);
template <typename ValueType>
friend const ValueType& RefAnyCast(const Any&);
template <typename ValueType>
friend ValueType& RefAnyCast(Any&);
template <typename ValueType>
friend ValueType AnyCast(Any&);
};
@ -514,14 +512,26 @@ ValueType AnyCast(Any& operand)
/// Example Usage:
/// MyType tmp = AnyCast<MyType>(anAny).
/// Will throw a BadCastException if the cast fails.
/// Dont use an AnyCast in combination with references, i.e. MyType& tmp = ... or const MyType& tmp = ...
/// Do not use an AnyCast in combination with references, i.e. MyType& tmp = ... or const MyType& tmp = ...
/// Some compilers will accept this code although a copy is returned. Use the RefAnyCast in
/// these cases.
{
typedef typename TypeWrapper<ValueType>::TYPE NonRef;
NonRef* result = AnyCast<NonRef>(&operand);
if (!result) throw BadCastException("Failed to convert between Any types");
if (!result)
{
std::string s = "RefAnyCast: Failed to convert between Any types ";
if (operand._pHolder)
{
s.append(1, '(');
s.append(operand._pHolder->type().name());
s.append(" => ");
s.append(typeid(ValueType).name());
s.append(1, ')');
}
throw BadCastException(s);
}
return *result;
}
@ -533,7 +543,7 @@ ValueType AnyCast(const Any& operand)
/// Example Usage:
/// MyType tmp = AnyCast<MyType>(anAny).
/// Will throw a BadCastException if the cast fails.
/// Dont use an AnyCast in combination with references, i.e. MyType& tmp = ... or const MyType& = ...
/// Do not use an AnyCast in combination with references, i.e. MyType& tmp = ... or const MyType& = ...
/// Some compilers will accept this code although a copy is returned. Use the RefAnyCast in
/// these cases.
{
@ -551,7 +561,15 @@ const ValueType& RefAnyCast(const Any & operand)
/// const MyType& tmp = RefAnyCast<MyType>(anAny);
{
ValueType* result = AnyCast<ValueType>(const_cast<Any*>(&operand));
if (!result) throw BadCastException("RefAnyCast: Failed to convert between const Any types");
std::string s = "RefAnyCast: Failed to convert between Any types ";
if (operand._pHolder)
{
s.append(1, '(');
s.append(operand._pHolder->type().name());
s.append(" => ");
s.append(typeid(ValueType).name());
s.append(1, ')');
}
return *result;
}
@ -564,7 +582,19 @@ ValueType& RefAnyCast(Any& operand)
/// MyType& tmp = RefAnyCast<MyType>(anAny);
{
ValueType* result = AnyCast<ValueType>(&operand);
if (!result) throw BadCastException("RefAnyCast: Failed to convert between Any types");
if (!result)
{
std::string s = "RefAnyCast: Failed to convert between Any types ";
if (operand._pHolder)
{
s.append(1, '(');
s.append(operand._pHolder->type().name());
s.append(" => ");
s.append(typeid(ValueType).name());
s.append(1, ')');
}
throw BadCastException(s);
}
return *result;
}

View File

@ -24,12 +24,15 @@
#ifndef Foundation_Array_INCLUDED
#define Foundation_Array_INCLUDED
#include "Poco/Exception.h"
#include "Poco/Bugcheck.h"
#include <algorithm>
namespace Poco {
template<class T, std::size_t N>
class Array
/// STL container like C-style array replacement class.
@ -37,9 +40,7 @@ class Array
/// This implementation is based on the idea of Nicolai Josuttis.
/// His original implementation can be found at http://www.josuttis.com/cppcode/array.html .
{
public:
typedef T value_type;
typedef T* iterator;
typedef const T* const_iterator;
@ -158,7 +159,8 @@ public:
enum { static_size = N };
void swap (Array<T,N>& y) {
void swap (Array<T,N>& y)
{
std::swap_ranges(begin(),end(),y.begin());
}
@ -173,7 +175,8 @@ public:
return elems;
}
T* c_array(){
T* c_array()
{
/// Use array as C array (direct read/write access to data)
return elems;
}
@ -193,12 +196,12 @@ public:
}
public:
T elems[N];
/// Fixed-size array of elements of type T, public specifier used to make this class a aggregate.
};
// comparisons
template<class T, std::size_t N>
bool operator== (const Array<T,N>& x, const Array<T,N>& y)
@ -206,36 +209,42 @@ bool operator== (const Array<T,N>& x, const Array<T,N>& y)
return std::equal(x.begin(), x.end(), y.begin());
}
template<class T, std::size_t N>
bool operator< (const Array<T,N>& x, const Array<T,N>& y)
{
return std::lexicographical_compare(x.begin(),x.end(),y.begin(),y.end());
}
template<class T, std::size_t N>
bool operator!= (const Array<T,N>& x, const Array<T,N>& y)
{
return !(x==y);
}
template<class T, std::size_t N>
bool operator> (const Array<T,N>& x, const Array<T,N>& y)
{
return y<x;
}
template<class T, std::size_t N>
bool operator<= (const Array<T,N>& x, const Array<T,N>& y)
{
return !(y<x);
}
template<class T, std::size_t N>
bool operator>= (const Array<T,N>& x, const Array<T,N>& y)
{
return !(x<y);
}
template<class T, std::size_t N>
inline void swap (Array<T,N>& x, Array<T,N>& y)
/// global swap()
@ -243,7 +252,9 @@ inline void swap (Array<T,N>& x, Array<T,N>& y)
x.swap(y);
}
}// namespace Poco
#endif // Foundation_Array_INCLUDED

View File

@ -103,6 +103,9 @@ public:
/// Returns true iff the given character is an uppercase alphabetic
/// character.
static bool isPrintable(int ch);
/// Returns true iff the given character is printable.
static int toLower(int ch);
/// If the given character is an uppercase character,
/// return its lowercase counterpart, otherwise return
@ -196,6 +199,12 @@ inline bool Ascii::isUpper(int ch)
}
inline bool Ascii::isPrintable(int ch)
{
return hasProperties(ch, ACP_PRINT);
}
inline int Ascii::toLower(int ch)
{
if (isUpper(ch))

View File

@ -23,6 +23,7 @@
#include "Poco/Thread.h"
#include "Poco/Mutex.h"
#include "Poco/Runnable.h"
#include "Poco/AutoPtr.h"
#include "Poco/NotificationQueue.h"
@ -40,15 +41,17 @@ class Foundation_API AsyncChannel: public Channel, public Runnable
/// then processed by a separate thread.
{
public:
AsyncChannel(Channel* pChannel = 0, Thread::Priority prio = Thread::PRIO_NORMAL);
using Ptr = AutoPtr<AsyncChannel>;
AsyncChannel(Channel::Ptr pChannel = 0, Thread::Priority prio = Thread::PRIO_NORMAL);
/// Creates the AsyncChannel and connects it to
/// the given channel.
void setChannel(Channel* pChannel);
void setChannel(Channel::Ptr pChannel);
/// Connects the AsyncChannel to the given target channel.
/// All messages will be forwarded to this channel.
Channel* getChannel() const;
Channel::Ptr getChannel() const;
/// Returns the target channel.
void open();
@ -86,7 +89,7 @@ protected:
void setPriority(const std::string& value);
private:
Channel* _pChannel;
Channel::Ptr _pChannel;
Thread _thread;
FastMutex _threadMutex;
FastMutex _channelMutex;

View File

@ -19,33 +19,7 @@
#include "Poco/Foundation.h"
#if POCO_OS == POCO_OS_WINDOWS_NT
#include "Poco/UnWindows.h"
#elif POCO_OS == POCO_OS_MAC_OS_X
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101200 || __IPHONE_OS_VERSION_MAX_ALLOWED >= 100000 || __TV_OS_VERSION_MAX_ALLOWED >= 100000 || __WATCH_OS_VERSION_MAX_ALLOWED >= 30000
#if __cplusplus >= 201103L
#ifndef POCO_HAVE_STD_ATOMICS
#define POCO_HAVE_STD_ATOMICS
#endif
#else
#include <libkern/OSAtomic.h>
#endif
#else
#include <libkern/OSAtomic.h>
#endif
#elif ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2) || __GNUC__ > 4) && (defined(__x86_64__) || defined(__i386__))
#if !defined(POCO_HAVE_GCC_ATOMICS) && !defined(POCO_NO_GCC_ATOMICS)
#define POCO_HAVE_GCC_ATOMICS
#endif
#elif ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3) || __GNUC__ > 4)
#if !defined(POCO_HAVE_GCC_ATOMICS) && !defined(POCO_NO_GCC_ATOMICS)
#define POCO_HAVE_GCC_ATOMICS
#endif
#endif // POCO_OS
#include "Poco/Mutex.h"
#ifdef POCO_HAVE_STD_ATOMICS
#include <atomic>
#endif
namespace Poco {
@ -57,19 +31,7 @@ class Foundation_API AtomicCounter
/// use in a multithreaded environment.
///
/// Typical usage of AtomicCounter is for implementing
/// reference counting and similar things.
///
/// On some platforms, the implementation of AtomicCounter
/// is based on atomic primitives specific to the platform
/// (such as InterlockedIncrement, etc. on Windows), and
/// thus very efficient. On platforms that do not support
/// atomic primitives, operations are guarded by a FastMutex.
///
/// The following platforms currently have atomic
/// primitives:
/// - Windows
/// - Mac OS X
/// - GCC 4.1+ (Intel platforms only)
/// reference counting and similar functionality.
{
public:
typedef int ValueType; /// The underlying integer type.
@ -94,7 +56,7 @@ public:
/// Assigns a value to the counter.
operator ValueType () const;
/// Returns the value of the counter.
/// Converts the AtomicCounter to ValueType.
ValueType value() const;
/// Returns the value of the counter.
@ -115,23 +77,7 @@ public:
/// Returns true if the counter is zero, false otherwise.
private:
#if defined(POCO_HAVE_STD_ATOMICS)
typedef std::atomic<int> ImplType;
#elif POCO_OS == POCO_OS_WINDOWS_NT
typedef volatile LONG ImplType;
#elif POCO_OS == POCO_OS_MAC_OS_X
typedef int32_t ImplType;
#elif defined(POCO_HAVE_GCC_ATOMICS)
typedef int ImplType;
#else // generic implementation based on FastMutex
struct ImplType
{
mutable FastMutex mutex;
volatile int value;
};
#endif // POCO_OS
ImplType _counter;
std::atomic<int> _counter;
};
@ -139,11 +85,6 @@ private:
// inlines
//
#if defined(POCO_HAVE_STD_ATOMICS)
//
// C++11 atomics
//
inline AtomicCounter::operator AtomicCounter::ValueType () const
{
return _counter.load();
@ -186,231 +127,6 @@ inline bool AtomicCounter::operator ! () const
}
#elif POCO_OS == POCO_OS_WINDOWS_NT
//
// Windows
//
inline AtomicCounter::operator AtomicCounter::ValueType () const
{
return _counter;
}
inline AtomicCounter::ValueType AtomicCounter::value() const
{
return _counter;
}
inline AtomicCounter::ValueType AtomicCounter::operator ++ () // prefix
{
return InterlockedIncrement(&_counter);
}
inline AtomicCounter::ValueType AtomicCounter::operator ++ (int) // postfix
{
ValueType result = InterlockedIncrement(&_counter);
return --result;
}
inline AtomicCounter::ValueType AtomicCounter::operator -- () // prefix
{
return InterlockedDecrement(&_counter);
}
inline AtomicCounter::ValueType AtomicCounter::operator -- (int) // postfix
{
ValueType result = InterlockedDecrement(&_counter);
return ++result;
}
inline bool AtomicCounter::operator ! () const
{
return _counter == 0;
}
#elif POCO_OS == POCO_OS_MAC_OS_X
//
// Mac OS X
//
inline AtomicCounter::operator AtomicCounter::ValueType () const
{
return _counter;
}
inline AtomicCounter::ValueType AtomicCounter::value() const
{
return _counter;
}
inline AtomicCounter::ValueType AtomicCounter::operator ++ () // prefix
{
return OSAtomicIncrement32(&_counter);
}
inline AtomicCounter::ValueType AtomicCounter::operator ++ (int) // postfix
{
ValueType result = OSAtomicIncrement32(&_counter);
return --result;
}
inline AtomicCounter::ValueType AtomicCounter::operator -- () // prefix
{
return OSAtomicDecrement32(&_counter);
}
inline AtomicCounter::ValueType AtomicCounter::operator -- (int) // postfix
{
ValueType result = OSAtomicDecrement32(&_counter);
return ++result;
}
inline bool AtomicCounter::operator ! () const
{
return _counter == 0;
}
#elif defined(POCO_HAVE_GCC_ATOMICS)
//
// GCC 4.1+ atomic builtins.
//
inline AtomicCounter::operator AtomicCounter::ValueType () const
{
return _counter;
}
inline AtomicCounter::ValueType AtomicCounter::value() const
{
return _counter;
}
inline AtomicCounter::ValueType AtomicCounter::operator ++ () // prefix
{
return __sync_add_and_fetch(&_counter, 1);
}
inline AtomicCounter::ValueType AtomicCounter::operator ++ (int) // postfix
{
return __sync_fetch_and_add(&_counter, 1);
}
inline AtomicCounter::ValueType AtomicCounter::operator -- () // prefix
{
return __sync_sub_and_fetch(&_counter, 1);
}
inline AtomicCounter::ValueType AtomicCounter::operator -- (int) // postfix
{
return __sync_fetch_and_sub(&_counter, 1);
}
inline bool AtomicCounter::operator ! () const
{
return _counter == 0;
}
#else
//
// Generic implementation based on FastMutex
//
inline AtomicCounter::operator AtomicCounter::ValueType () const
{
ValueType result;
{
FastMutex::ScopedLock lock(_counter.mutex);
result = _counter.value;
}
return result;
}
inline AtomicCounter::ValueType AtomicCounter::value() const
{
ValueType result;
{
FastMutex::ScopedLock lock(_counter.mutex);
result = _counter.value;
}
return result;
}
inline AtomicCounter::ValueType AtomicCounter::operator ++ () // prefix
{
ValueType result;
{
FastMutex::ScopedLock lock(_counter.mutex);
result = ++_counter.value;
}
return result;
}
inline AtomicCounter::ValueType AtomicCounter::operator ++ (int) // postfix
{
ValueType result;
{
FastMutex::ScopedLock lock(_counter.mutex);
result = _counter.value++;
}
return result;
}
inline AtomicCounter::ValueType AtomicCounter::operator -- () // prefix
{
ValueType result;
{
FastMutex::ScopedLock lock(_counter.mutex);
result = --_counter.value;
}
return result;
}
inline AtomicCounter::ValueType AtomicCounter::operator -- (int) // postfix
{
ValueType result;
{
FastMutex::ScopedLock lock(_counter.mutex);
result = _counter.value--;
}
return result;
}
inline bool AtomicCounter::operator ! () const
{
bool result;
{
FastMutex::ScopedLock lock(_counter.mutex);
result = _counter.value == 0;
}
return result;
}
#endif // POCO_OS
} // namespace Poco

View File

@ -14,9 +14,6 @@
//
#ifdef POCO_HAVE_STD_ATOMICS
#ifndef Foundation_AtomicFlag_INCLUDED
#define Foundation_AtomicFlag_INCLUDED
@ -67,10 +64,10 @@ class Foundation_API AtomicFlag
/// while (++i < 10) myClass.myFunc();
{
public:
AtomicFlag();
AtomicFlag() = default;
/// Creates AtomicFlag.
~AtomicFlag();
~AtomicFlag() = default;
/// Destroys AtomicFlag.
bool set();
@ -98,6 +95,7 @@ private:
// inlines
//
inline bool AtomicFlag::set()
{
return _flag.test_and_set(std::memory_order_acquire);
@ -121,5 +119,3 @@ inline AtomicFlag::operator bool ()
#endif // Foundation_AtomicFlag_INCLUDED
#endif // POCO_HAVE_STD_ATOMICS

View File

@ -61,7 +61,7 @@ class AutoPtr
/// Note that AutoPtr allows casting of its encapsulated data types.
{
public:
AutoPtr(): _ptr(0)
AutoPtr(): _ptr(nullptr)
{
}
@ -79,6 +79,11 @@ public:
if (_ptr) _ptr->duplicate();
}
AutoPtr(AutoPtr&& ptr) noexcept: _ptr(std::move(ptr._ptr))
{
ptr._ptr = nullptr;
}
template <class Other>
AutoPtr(const AutoPtr<Other>& ptr): _ptr(const_cast<Other*>(ptr.get()))
{
@ -139,7 +144,7 @@ public:
if (_ptr)
{
_ptr->release();
_ptr = 0;
_ptr = nullptr;
}
}
@ -174,6 +179,14 @@ public:
return assign(ptr);
}
AutoPtr& operator = (AutoPtr&& ptr) noexcept
{
if (_ptr) _ptr->release();
_ptr = std::move(ptr._ptr);
ptr._ptr = nullptr;
return *this;
}
template <class Other>
AutoPtr& operator = (const AutoPtr<Other>& ptr)
{
@ -264,12 +277,12 @@ public:
bool operator ! () const
{
return _ptr == 0;
return _ptr == nullptr;
}
bool isNull() const
{
return _ptr == 0;
return _ptr == nullptr;
}
C* duplicate()
@ -380,6 +393,13 @@ inline void swap(AutoPtr<C>& p1, AutoPtr<C>& p2)
}
template<typename T, typename... Args>
AutoPtr<T> makeAuto(Args&&... args)
{
return AutoPtr<T>(new T(std::forward<Args>(args)...));
}
} // namespace Poco

View File

@ -29,7 +29,7 @@ template <class C>
class AutoReleasePool
/// An AutoReleasePool implements simple garbage collection for
/// reference-counted objects.
/// It temporarily takes ownwership of reference-counted objects that
/// It temporarily takes ownership of reference-counted objects that
/// nobody else wants to take ownership of and releases them
/// at a later, appropriate point in time.
///

View File

@ -82,6 +82,8 @@ class Foundation_API Base32Decoder: public Base32DecoderIOS, public std::istream
/// This istream base32-decodes all data
/// read from the istream connected to it.
///
/// The class implements RFC 4648 - https://tools.ietf.org/html/rfc4648
///
/// Note: For performance reasons, the characters
/// are read directly from the given istream's
/// underlying streambuf, so the state

View File

@ -89,6 +89,8 @@ class Foundation_API Base32Encoder: public Base32EncoderIOS, public std::ostream
/// writing data, to ensure proper
/// completion of the encoding operation.
///
/// The class implements RFC 4648 - https://tools.ietf.org/html/rfc4648
///
/// Note: The characters are directly written
/// to the ostream's streambuf, thus bypassing
/// the ostream. The ostream's state is therefore

View File

@ -86,6 +86,8 @@ class Foundation_API Base64Decoder: public Base64DecoderIOS, public std::istream
/// This istream base64-decodes all data
/// read from the istream connected to it.
///
/// The class implements RFC 4648 - https://tools.ietf.org/html/rfc4648
///
/// Note: For performance reasons, the characters
/// are read directly from the given istream's
/// underlying streambuf, so the state

View File

@ -117,6 +117,8 @@ class Foundation_API Base64Encoder: public Base64EncoderIOS, public std::ostream
/// writing data, to ensure proper
/// completion of the encoding operation.
///
/// The class implements RFC 4648 - https://tools.ietf.org/html/rfc4648
///
/// Note: The characters are directly written
/// to the ostream's streambuf, thus bypassing
/// the ostream. The ostream's state is therefore

View File

@ -94,9 +94,9 @@ public:
Poco::UInt32 size(static_cast<Poco::UInt32>(value.size()));
*this << size;
for (typename std::vector<T>::const_iterator it = value.begin(); it != value.end(); ++it)
for (const auto& v: value)
{
*this << *it;
*this << v;
}
return *this;

View File

@ -36,16 +36,16 @@ class Buffer
/// is needed.
{
public:
Buffer(std::size_t capacity):
_capacity(capacity),
_used(capacity),
Buffer(std::size_t length):
_capacity(length),
_used(length),
_ptr(0),
_ownMem(true)
/// Creates and allocates the Buffer.
{
if (capacity > 0)
if (length > 0)
{
_ptr = new T[capacity];
_ptr = new T[length];
}
}
@ -94,6 +94,19 @@ public:
}
}
Buffer(Buffer&& other) :
/// Copy constructor.
_capacity(other._capacity),
_used(other._used),
_ptr(other._ptr),
_ownMem(other._ownMem)
{
other._capacity = 0;
other._used = 0;
other._ownMem = false;
other._ptr = nullptr;
}
Buffer& operator = (const Buffer& other)
/// Assignment operator.
{
@ -106,6 +119,25 @@ public:
return *this;
}
Buffer& operator = (Buffer&& other)
/// Assignment operator.
{
if (this != &other)
{
_capacity = other._capacity;
_used = other._used;
_ptr = other._ptr;
_ownMem = other._ownMem;
other._capacity = 0;
other._used = 0;
other._ownMem = false;
other._ptr = nullptr;
}
return *this;
}
~Buffer()
/// Destroys the Buffer.
{
@ -225,6 +257,7 @@ public:
swap(_ptr, other._ptr);
swap(_capacity, other._capacity);
swap(_used, other._used);
swap(_ownMem, other._ownMem);
}
bool operator == (const Buffer& other) const

View File

@ -39,7 +39,7 @@ public:
return new char_type[static_cast<std::size_t>(size)];
}
static void deallocate(char_type* ptr, std::streamsize /*size*/) throw()
static void deallocate(char_type* ptr, std::streamsize /*size*/) noexcept
{
delete [] ptr;
}

View File

@ -64,9 +64,16 @@ public:
}
~BasicBufferedStreamBuf()
{
try
{
Allocator::deallocate(_pBuffer, _bufsize);
}
catch (...)
{
poco_unexpected();
}
}
virtual int_type overflow(int_type c)
{

View File

@ -36,6 +36,8 @@ public:
static UInt16 flipBytes(UInt16 value);
static Int32 flipBytes(Int32 value);
static UInt32 flipBytes(UInt32 value);
static float flipBytes(float value);
static double flipBytes(double value);
#if defined(POCO_HAVE_INT64)
static Int64 flipBytes(Int64 value);
static UInt64 flipBytes(UInt64 value);
@ -94,6 +96,21 @@ public:
static Int64 fromNetwork(Int64 value);
static UInt64 fromNetwork (UInt64 value);
#endif
private:
template<typename T>
static T flip(T value)
{
T flip = value;
std::size_t halfSize = sizeof(T) / 2;
char* flipP = reinterpret_cast<char*>(&flip);
for (std::size_t i = 0; i < halfSize; i++)
{
std::swap(flipP[i], flipP[sizeof(T) - i - 1]);
}
return flip;
}
};
@ -150,6 +167,18 @@ inline Int32 ByteOrder::flipBytes(Int32 value)
}
inline float ByteOrder::flipBytes(float value)
{
return flip(value);
}
inline double ByteOrder::flipBytes(double value)
{
return flip(value);
}
#if defined(POCO_HAVE_INT64)
inline UInt64 ByteOrder::flipBytes(UInt64 value)
{

View File

@ -22,6 +22,7 @@
#include "Poco/Configurable.h"
#include "Poco/Mutex.h"
#include "Poco/RefCountedObject.h"
#include "Poco/AutoPtr.h"
namespace Poco {
@ -38,6 +39,8 @@ class Foundation_API Channel: public Configurable, public RefCountedObject
/// of getProperty() and setProperty().
{
public:
using Ptr = AutoPtr<Channel>;
Channel();
/// Creates the channel and initializes
/// the reference count to one.

View File

@ -25,6 +25,8 @@
#if defined(_WIN32)
#define POCO_LIBRARY_API __declspec(dllexport)
#elif defined(__GNUC__) && (__GNUC__ >= 4)
#define POCO_LIBRARY_API __attribute__ ((visibility ("default")))
#else
#define POCO_LIBRARY_API
#endif
@ -94,6 +96,10 @@ extern "C" \
pManifest->insert(new Poco::MetaObject<cls, _Base>(#cls));
#define POCO_EXPORT_INTERFACE(cls, itf) \
pManifest->insert(new Poco::MetaObject<cls, _Base>(itf));
#define POCO_EXPORT_SINGLETON(cls) \
pManifest->insert(new Poco::MetaSingleton<cls, _Base>(#cls));

View File

@ -132,10 +132,10 @@ public:
virtual ~ClassLoader()
/// Destroys the ClassLoader.
{
for (typename LibraryMap::const_iterator it = _map.begin(); it != _map.end(); ++it)
for (auto& p: _map)
{
delete it->second.pLibrary;
delete it->second.pManifest;
delete p.second.pLibrary;
delete p.second.pManifest;
}
}
@ -247,9 +247,9 @@ public:
{
FastMutex::ScopedLock lock(_mutex);
for (typename LibraryMap::const_iterator it = _map.begin(); it != _map.end(); ++it)
for (const auto& p: _map)
{
const Manif* pManif = it->second.pManifest;
const Manif* pManif = p.second.pManifest;
typename Manif::Iterator itm = pManif->find(className);
if (itm != pManif->end())
return *itm;

View File

@ -28,7 +28,7 @@ class Foundation_API Clock
/// A Clock stores a monotonic* clock value
/// with (theoretical) microseconds resolution.
/// Clocks can be compared with each other
/// and simple arithmetics are supported.
/// and simple arithmetic is supported.
///
/// [*] Note that Clock values are only monotonic if
/// the operating system provides a monotonic clock.
@ -108,7 +108,7 @@ public:
static ClockDiff resolution();
/// Returns the resolution in units per second.
/// Since the Clock clas has microsecond resolution,
/// Since the Clock class has microsecond resolution,
/// the returned value is always 1000000.
static ClockDiff accuracy();

View File

@ -18,16 +18,6 @@
#define Foundation_Config_INCLUDED
// Define to enable Windows Unicode (UTF-8) support
// NOTE: As of POCO C++ Libraries release 1.6.0, compiling POCO
// without POCO_WIN32_UTF8 defined on Windows is deprecated.
#define POCO_WIN32_UTF8
// Define to enable C++11 support
// #define POCO_ENABLE_CPP11
// Define to disable implicit linking
// #define POCO_NO_AUTOMATIC_LIBS

View File

@ -43,6 +43,8 @@ class Foundation_API ConsoleChannel: public Channel
/// same stream.
{
public:
using Ptr = AutoPtr<ConsoleChannel>;
ConsoleChannel();
/// Creates the channel and attaches std::clog.

View File

@ -46,34 +46,34 @@ public:
~CountingStreamBuf();
/// Destroys the CountingStream.
int chars() const;
std::streamsize chars() const;
/// Returns the total number of characters.
int lines() const;
std::streamsize lines() const;
/// Returns the total number of lines.
int pos() const;
std::streamsize pos() const;
/// Returns the number of characters on the current line.
void reset();
/// Resets all counters.
void setCurrentLineNumber(int line);
void setCurrentLineNumber(std::streamsize line);
/// Sets the current line number.
///
/// This is mainly useful when parsing C/C++
/// preprocessed source code containing #line directives.
int getCurrentLineNumber() const;
std::streamsize getCurrentLineNumber() const;
/// Returns the current line number (same as lines()).
void addChars(int chars);
void addChars(std::streamsize chars);
/// Add to the total number of characters.
void addLines(int lines);
void addLines(std::streamsize lines);
/// Add to the total number of lines.
void addPos(int pos);
void addPos(std::streamsize pos);
/// Add to the number of characters on the current line.
protected:
@ -83,9 +83,9 @@ protected:
private:
std::istream* _pIstr;
std::ostream* _pOstr;
int _chars;
int _lines;
int _pos;
std::streamsize _chars;
std::streamsize _lines;
std::streamsize _pos;
};
@ -110,34 +110,34 @@ public:
~CountingIOS();
/// Destroys the stream.
int chars() const;
std::streamsize chars() const;
/// Returns the total number of characters.
int lines() const;
std::streamsize lines() const;
/// Returns the total number of lines.
int pos() const;
std::streamsize pos() const;
/// Returns the number of characters on the current line.
void reset();
/// Resets all counters.
void setCurrentLineNumber(int line);
void setCurrentLineNumber(std::streamsize line);
/// Sets the current line number.
///
/// This is mainly useful when parsing C/C++
/// preprocessed source code containing #line directives.
int getCurrentLineNumber() const;
std::streamsize getCurrentLineNumber() const;
/// Returns the current line number (same as lines()).
void addChars(int chars);
void addChars(std::streamsize chars);
/// Add to the total number of characters.
void addLines(int lines);
void addLines(std::streamsize lines);
/// Add to the total number of lines.
void addPos(int pos);
void addPos(std::streamsize pos);
/// Add to the number of characters on the current line.
CountingStreamBuf* rdbuf();
@ -183,49 +183,49 @@ public:
//
// inlines
//
inline int CountingStreamBuf::chars() const
inline std::streamsize CountingStreamBuf::chars() const
{
return _chars;
}
inline int CountingStreamBuf::lines() const
inline std::streamsize CountingStreamBuf::lines() const
{
return _lines;
}
inline int CountingStreamBuf::pos() const
inline std::streamsize CountingStreamBuf::pos() const
{
return _pos;
}
inline int CountingStreamBuf::getCurrentLineNumber() const
inline std::streamsize CountingStreamBuf::getCurrentLineNumber() const
{
return _lines;
}
inline int CountingIOS::chars() const
inline std::streamsize CountingIOS::chars() const
{
return _buf.chars();
}
inline int CountingIOS::lines() const
inline std::streamsize CountingIOS::lines() const
{
return _buf.lines();
}
inline int CountingIOS::pos() const
inline std::streamsize CountingIOS::pos() const
{
return _buf.pos();
}
inline int CountingIOS::getCurrentLineNumber() const
inline std::streamsize CountingIOS::getCurrentLineNumber() const
{
return _buf.getCurrentLineNumber();
}

View File

@ -107,9 +107,11 @@ public:
/// * day is from 1 to 31.
/// * hour is from 0 to 23.
/// * minute is from 0 to 59.
/// * second is from 0 to 60 (allowing leap seconds).
/// * second is from 0 to 60.
/// * millisecond is from 0 to 999.
/// * microsecond is from 0 to 999.
///
/// Throws an InvalidArgumentException if an argument date is out of range.
DateTime(double julianDay);
/// Creates a DateTime for the given Julian day.
@ -141,9 +143,11 @@ public:
/// * day is from 1 to 31.
/// * hour is from 0 to 23.
/// * minute is from 0 to 59.
/// * second is from 0 to 60 (allowing leap seconds).
/// * second is from 0 to 60.
/// * millisecond is from 0 to 999.
/// * microsecond is from 0 to 999.
///
/// Throws an InvalidArgumentException if an argument date is out of range.
void swap(DateTime& dateTime);
/// Swaps the DateTime with another one.
@ -164,11 +168,11 @@ public:
/// on a Saturday, week 1 will be the week starting on Monday, January 3.
/// January 1 and 2 will fall within week 0 (or the last week of the previous year).
///
/// For 2007, which starts on a Monday, week 1 will be the week startung on Monday, January 1.
/// For 2007, which starts on a Monday, week 1 will be the week starting on Monday, January 1.
/// There will be no week 0 in 2007.
int day() const;
/// Returns the day witin the month (1 to 31).
/// Returns the day within the month (1 to 31).
int dayOfWeek() const;
/// Returns the weekday (0 to 6, where
@ -254,7 +258,7 @@ protected:
/// Computes the Julian day for an UTC time.
static double toJulianDay(int year, int month, int day, int hour = 0, int minute = 0, int second = 0, int millisecond = 0, int microsecond = 0);
/// Computes the Julian day for a gregorian calendar date and time.
/// Computes the Julian day for a Gregorian calendar date and time.
/// See <http://vsg.cape.com/~pbaum/date/jdimp.htm>, section 2.3.1 for the algorithm.
static Timestamp::UtcTimeVal toUtcTime(double julianDay);
@ -287,6 +291,21 @@ private:
//
// inlines
//
inline double DateTime::toJulianDay(Timestamp::UtcTimeVal utcTime)
{
double utcDays = double(utcTime)/864000000000.0;
return utcDays + 2299160.5; // first day of Gregorian reform (Oct 15 1582)
}
inline Timestamp::UtcTimeVal DateTime::toUtcTime(double julianDay)
{
return Timestamp::UtcTimeVal((julianDay - 2299160.5)*864000000000.0);
}
inline Timestamp DateTime::timestamp() const
{
return Timestamp::fromUtcTime(_utcTime);

View File

@ -101,7 +101,7 @@ public:
static int parseDayOfWeek(std::string::const_iterator& it, const std::string::const_iterator& end);
/// Tries to interpret the given range as a weekday name. The range must be at least
/// three characters long.
/// Returns the weekday number (0 .. 6, where 0 = Synday, 1 = Monday, etc.) if the
/// Returns the weekday number (0 .. 6, where 0 = Sunday, 1 = Monday, etc.) if the
/// weekday name is valid. Otherwise throws a SyntaxException.
protected:

View File

@ -35,10 +35,10 @@ class DefaultStrategy: public NotificationStrategy<TArgs, TDelegate>
/// order in which they have been registered.
{
public:
typedef TDelegate* DelegateHandle;
typedef SharedPtr<TDelegate> DelegatePtr;
typedef std::vector<DelegatePtr> Delegates;
typedef typename Delegates::iterator Iterator;
using DelegateHandle = TDelegate*;
using DelegatePtr = SharedPtr<TDelegate>;
using Delegates = std::vector<DelegatePtr>;
using Iterator = typename Delegates::iterator;
public:
DefaultStrategy()
@ -132,10 +132,10 @@ class DefaultStrategy<void,TDelegate>: public NotificationStrategy<void, TDelega
/// order in which they have been registered.
{
public:
typedef TDelegate* DelegateHandle;
typedef SharedPtr<TDelegate> DelegatePtr;
typedef std::vector<DelegatePtr> Delegates;
typedef typename Delegates::iterator Iterator;
using DelegateHandle = TDelegate*;
using DelegatePtr = SharedPtr<TDelegate>;
using Delegates = std::vector<DelegatePtr>;
using Iterator = typename Delegates::iterator;
public:
DefaultStrategy()

View File

@ -36,7 +36,7 @@ class Foundation_API DigestEngine
/// digest.
{
public:
typedef std::vector<unsigned char> Digest;
using Digest = std::vector<unsigned char>;
DigestEngine();
virtual ~DigestEngine();

View File

@ -31,8 +31,8 @@ namespace Poco {
class Foundation_API TraverseBase
{
public:
typedef std::stack<DirectoryIterator> Stack;
typedef std::function<UInt16(const Stack&)> DepthFun;
using Stack = std::stack<DirectoryIterator>;
using DepthFun = std::function<UInt16(const Stack&)>;
enum
{

View File

@ -33,7 +33,7 @@ class Pair
/// Pair allows to define a pair of values.
{
public:
typedef typename std::pair<K, Var> Data;
using Data = typename std::pair<K, Var>;
Pair(): _data()
/// Creates an empty Pair
@ -96,7 +96,7 @@ public:
std::string toString()
{
std::string str;
Var(*this).convert<std::string>(str);
Var(*this).template convert<std::string>(str);
return str;
}

View File

@ -62,16 +62,12 @@ public:
assignMap(val);
}
#ifdef POCO_ENABLE_CPP11
template <typename T>
Struct(const OrderedMap<K, T>& val)
{
assignMap(val);
}
#endif // POCO_ENABLE_CPP11
virtual ~Struct()
/// Destroys the Struct.
{
@ -171,18 +167,24 @@ public:
_data.erase(it);
}
inline void clear()
/// Remove all elements from the struct
{
_data.clear();
}
inline void swap(Struct& other)
/// Swap content of Struct with another Struct
{
_data.swap(other._data);
}
inline bool empty() const
/// Returns true if the Struct doesn't contain any members
{
return _data.empty();
}
inline void clear()
/// Clears the Struct contents
{
_data.clear();
}
SizeType size() const
/// Returns the number of members the Struct contains
{
@ -199,10 +201,35 @@ public:
return keys;
}
inline Var getVar(const K& key) const
/// Returns the var value of the element with the given name.
/// Throws a NotFoundException if the key does not exist.
{
ConstIterator it = find(key);
if(it == end())
{
throw NotFoundException("Key not found in Struct");
}
return it->second;
}
template<typename DefT = Var>
inline Var getVar(const K& key, const DefT& defaultValue) const
/// Returns the var value of the element with the given name.
/// or defaultValue if none is found.
{
ConstIterator it = find(key);
if(it == end())
{
return defaultValue;
}
return it->second;
}
std::string toString() const
{
std::string str;
Var(*this).convert<std::string>(str);
Var(*this).template convert<std::string>(str);
return str;
}
@ -593,9 +620,6 @@ private:
};
#ifdef POCO_ENABLE_CPP11
template <>
class VarHolderImpl<Struct<std::string, Poco::OrderedMap<std::string, Var>, Poco::OrderedSet<std::string>>> : public VarHolder
{
@ -968,17 +992,12 @@ private:
};
#endif // POCO_ENABLE_CPP11
} // namespace Dynamic
typedef Dynamic::Struct<std::string> DynamicStruct;
#ifdef POCO_ENABLE_CPP11
typedef Dynamic::Struct<std::string, Poco::OrderedMap<std::string, Dynamic::Var>, Poco::OrderedSet<std::string>> OrderedDynamicStruct;
#endif // POCO_ENABLE_CPP11
} // namespace Poco

View File

@ -81,9 +81,9 @@ class Foundation_API Var
/// VarHolderImpl is available. For supported types, see VarHolder documentation.
{
public:
typedef SharedPtr<Var> Ptr;
typedef Poco::Dynamic::VarIterator Iterator;
typedef const VarIterator ConstIterator;
using Ptr = SharedPtr<Var>;
using Iterator = Poco::Dynamic::VarIterator;
using ConstIterator = const VarIterator;
Var();
/// Creates an empty Var.
@ -798,8 +798,7 @@ inline bool Var::isEmpty() const
inline bool Var::isArray() const
{
if (isEmpty() ||
isString()) return false;
if (isEmpty() || isString()) return false;
VarHolder* pHolder = content();
return pHolder ? pHolder->isArray() : false;
@ -2231,6 +2230,110 @@ inline bool operator >= (const long& other, const Var& da)
}
inline unsigned long operator + (const unsigned long& other, const Var& da)
/// Addition operator for adding Var to unsigned long
{
return other + da.convert<unsigned long>();
}
inline unsigned long operator - (const unsigned long& other, const Var& da)
/// Subtraction operator for subtracting Var from unsigned long
{
return other - da.convert<unsigned long>();
}
inline unsigned long operator * (const unsigned long& other, const Var& da)
/// Multiplication operator for multiplying Var with unsigned long
{
return other * da.convert<unsigned long>();
}
inline unsigned long operator / (const unsigned long& other, const Var& da)
/// Division operator for dividing Var with unsigned long
{
return other / da.convert<unsigned long>();
}
inline unsigned long operator += (unsigned long& other, const Var& da)
/// Addition assignment operator for adding Var to unsigned long
{
return other += da.convert<unsigned long>();
}
inline unsigned long operator -= (unsigned long& other, const Var& da)
/// Subtraction assignment operator for subtracting Var from unsigned long
{
return other -= da.convert<unsigned long>();
}
inline unsigned long operator *= (unsigned long& other, const Var& da)
/// Multiplication assignment operator for multiplying Var with unsigned long
{
return other *= da.convert<unsigned long>();
}
inline unsigned long operator /= (unsigned long& other, const Var& da)
/// Division assignment operator for dividing Var with unsigned long
{
return other /= da.convert<unsigned long>();
}
inline bool operator == (const unsigned long& other, const Var& da)
/// Equality operator for comparing Var with unsigned long
{
if (da.isEmpty()) return false;
return other == da.convert<unsigned long>();
}
inline bool operator != (const unsigned long& other, const Var& da)
/// Inequality operator for comparing Var with unsigned long
{
if (da.isEmpty()) return true;
return other != da.convert<unsigned long>();
}
inline bool operator < (const unsigned long& other, const Var& da)
/// Less than operator for comparing Var with unsigned long
{
if (da.isEmpty()) return false;
return other < da.convert<unsigned long>();
}
inline bool operator <= (const unsigned long& other, const Var& da)
/// Less than or equal operator for comparing Var with unsigned long
{
if (da.isEmpty()) return false;
return other <= da.convert<unsigned long>();
}
inline bool operator > (const unsigned long& other, const Var& da)
/// Greater than operator for comparing Var with unsigned long
{
if (da.isEmpty()) return false;
return other > da.convert<unsigned long>();
}
inline bool operator >= (const unsigned long& other, const Var& da)
/// Greater than or equal operator for comparing Var with unsigned long
{
if (da.isEmpty()) return false;
return other >= da.convert<unsigned long>();
}
#endif // POCO_LONG_IS_64_BIT

View File

@ -670,6 +670,7 @@ inline bool VarHolder::isDateTime() const
return false;
}
inline std::size_t VarHolder::size() const
{
return 1u;

View File

@ -45,9 +45,9 @@ public:
/// Destroys the DynamicFactory and deletes the instantiators for
/// all registered classes.
{
for (typename FactoryMap::iterator it = _map.begin(); it != _map.end(); ++it)
for (auto& p: _map)
{
delete it->second;
delete p.second;
}
}

View File

@ -44,11 +44,21 @@ class Foundation_API Event: private EventImpl
/// for an event to become signalled.
{
public:
Event(bool autoReset = true);
/// Creates the event. If autoReset is true,
enum EventType
{
EVENT_MANUALRESET, /// Manual reset event
EVENT_AUTORESET /// Auto-reset event
};
explicit Event(EventType type = EVENT_AUTORESET);
/// Creates the event. If type is EVENT_AUTORESET,
/// the event is automatically reset after
/// a wait() successfully returns.
//@ deprecated
explicit Event(bool autoReset);
/// Please use Event::Event(EventType) instead.
~Event();
/// Destroys the event.

View File

@ -33,6 +33,8 @@ class Foundation_API EventChannel: public Channel
/// the logging framework.
{
public:
using Ptr = AutoPtr<EventChannel>;
Poco::BasicEvent<const Message> messageLogged;
/// Fired when a message is logged by calling the log() method.

View File

@ -35,6 +35,8 @@ class Foundation_API EventLogChannel: public Channel
/// containing the message definition resources can be found in $PATH.
{
public:
using Ptr = AutoPtr<EventLogChannel>;
EventLogChannel();
/// Creates the EventLogChannel.
/// The name of the current application (or more correctly,
@ -85,11 +87,7 @@ protected:
static int getType(const Message& msg);
static int getCategory(const Message& msg);
void setUpRegistry() const;
#if defined(POCO_WIN32_UTF8)
static std::wstring findLibrary(const wchar_t* name);
#else
static std::string findLibrary(const char* name);
#endif
private:
std::string _name;

View File

@ -43,19 +43,19 @@ public:
Exception(const Exception& exc);
/// Copy constructor.
~Exception() throw();
~Exception() noexcept;
/// Destroys the exception and deletes the nested exception.
Exception& operator = (const Exception& exc);
/// Assignment operator.
virtual const char* name() const throw();
virtual const char* name() const noexcept;
/// Returns a static string describing the exception.
virtual const char* className() const throw();
virtual const char* className() const noexcept;
/// Returns the name of the exception class.
virtual const char* what() const throw();
virtual const char* what() const noexcept;
/// Returns a static string describing the exception.
///
/// Same as name(), but for compatibility with std::exception.
@ -146,10 +146,10 @@ inline int Exception::code() const
CLS(const std::string& msg, const std::string& arg, int code = CODE); \
CLS(const std::string& msg, const Poco::Exception& exc, int code = CODE); \
CLS(const CLS& exc); \
~CLS() throw(); \
~CLS() noexcept; \
CLS& operator = (const CLS& exc); \
const char* name() const throw(); \
const char* className() const throw(); \
const char* name() const noexcept; \
const char* className() const noexcept; \
Poco::Exception* clone() const; \
void rethrow() const; \
};
@ -173,7 +173,7 @@ inline int Exception::code() const
CLS::CLS(const CLS& exc): BASE(exc) \
{ \
} \
CLS::~CLS() throw() \
CLS::~CLS() noexcept \
{ \
} \
CLS& CLS::operator = (const CLS& exc) \
@ -181,11 +181,11 @@ inline int Exception::code() const
BASE::operator = (exc); \
return *this; \
} \
const char* CLS::name() const throw() \
const char* CLS::name() const noexcept \
{ \
return NAME; \
} \
const char* CLS::className() const throw() \
const char* CLS::className() const noexcept \
{ \
return typeid(*this).name(); \
} \

View File

@ -39,7 +39,7 @@ class ExpireLRUCache: public AbstractCache<TKey, TValue, StrategyCollection<TKey
/// but also limits the size of the cache (per default: 1024).
{
public:
ExpireLRUCache(long cacheSize = 1024, Timestamp::TimeDiff expire = 600000):
ExpireLRUCache(std::size_t cacheSize = 1024, Timestamp::TimeDiff expire = 600000):
AbstractCache<TKey, TValue, StrategyCollection<TKey, TValue>, TMutex, TEventMutex>(StrategyCollection<TKey, TValue>())
{
this->_strategy.pushBack(new LRUStrategy<TKey, TValue>(cacheSize));

View File

@ -23,14 +23,12 @@
#include <vector>
#if defined(POCO_OS_FAMILY_WINDOWS) && defined(POCO_WIN32_UTF8)
#if defined(POCO_OS_FAMILY_WINDOWS)
#if defined(_WIN32_WCE)
#include "File_WINCE.h"
#else
#include "Poco/File_WIN32U.h"
#endif
#elif defined(POCO_OS_FAMILY_WINDOWS)
#include "Poco/File_WIN32.h"
#elif defined(POCO_VXWORKS)
#include "Poco/File_VX.h"
#elif defined(POCO_OS_FAMILY_UNIX)
@ -51,8 +49,7 @@ class Foundation_API File: private FileImpl
/// platform-specific limitations regarding maximum length
/// of the entire path and its components apply.
///
/// On Windows, if compiled with UTF-8 support (POCO_WIN32_UTF8)
/// the implementation tries to work around the rather low
/// On Windows, the implementation tries to work around the rather low
/// 260 characters MAX_PATH limit by adding the "\\?\" prefix if
/// a path is absolute and exceeds MAX_PATH characters in length.
/// Note that various limitations regarding usage of the "\\?\"

View File

@ -44,8 +44,7 @@ class Foundation_API FileIOS: public virtual std::ios
/// Use an InputLineEndingConverter or OutputLineEndingConverter
/// if you require CR-LF translation.
///
/// On Windows platforms, if POCO_WIN32_UTF8 is #define'd,
/// UTF-8 encoded Unicode paths are correctly handled.
/// On Windows platforms, UTF-8 encoded Unicode paths are correctly handled.
{
public:
FileIOS(std::ios::openmode defaultMode);
@ -86,8 +85,7 @@ class Foundation_API FileInputStream: public FileIOS, public std::istream
/// was specified.
/// Use an InputLineEndingConverter if you require CR-LF translation.
///
/// On Windows platforms, if POCO_WIN32_UTF8 is #define'd,
/// UTF-8 encoded Unicode paths are correctly handled.
/// On Windows platforms, UTF-8 encoded Unicode paths are correctly handled.
{
public:
FileInputStream();
@ -117,8 +115,7 @@ class Foundation_API FileOutputStream: public FileIOS, public std::ostream
/// was specified.
/// Use an OutputLineEndingConverter if you require CR-LF translation.
///
/// On Windows platforms, if POCO_WIN32_UTF8 is #define'd,
/// UTF-8 encoded Unicode paths are correctly handled.
/// On Windows platforms, UTF-8 encoded Unicode paths are correctly handled.
{
public:
FileOutputStream();
@ -154,8 +151,7 @@ class Foundation_API FileStream: public FileIOS, public std::iostream
/// read position and the write position simultaneously to the
/// same value.
///
/// On Windows platforms, if POCO_WIN32_UTF8 is #define'd,
/// UTF-8 encoded Unicode paths are correctly handled.
/// On Windows platforms, UTF-8 encoded Unicode paths are correctly handled.
{
public:
FileStream();

View File

@ -27,8 +27,8 @@ namespace Poco {
class FileImpl
{
protected:
enum Options {
enum Options
{
OPT_FAIL_ON_OVERWRITE_IMPL = 0x01
};

View File

@ -28,8 +28,8 @@ namespace Poco {
class Foundation_API FileImpl
{
protected:
enum Options {
enum Options
{
OPT_FAIL_ON_OVERWRITE_IMPL = 0x01
};

View File

@ -28,8 +28,8 @@ namespace Poco {
class Foundation_API FileImpl
{
protected:
enum Options {
enum Options
{
OPT_FAIL_ON_OVERWRITE_IMPL = 0x01
};

View File

@ -21,6 +21,7 @@
#include "Poco/Foundation.h"
#include "Poco/Any.h"
#include <vector>
#include <type_traits>
namespace Poco {
@ -80,11 +81,13 @@ std::string Foundation_API format(const std::string& fmt, const Any& value);
/// * h argument is short (d, i), unsigned short (o, u, x, X) or float (e, E, f, g, G)
/// * ? argument is any signed or unsigned int, short, long, or 64-bit integer (d, i, o, x, X)
///
/// The width argument is a nonnegative decimal integer controlling the minimum number of characters printed.
/// The width argument is a nonnegative decimal integer or '*' with an additional nonnegative integer value
/// preceding the value to be formated, controlling the minimum number of characters printed.
/// If the number of characters in the output value is less than the specified width, blanks or
/// leading zeros are added, according to the specified flags (-, +, 0).
///
/// Precision is a nonnegative decimal integer, preceded by a period (.), which specifies the number of characters
/// Precision is a nonnegative decimal integer or '*' with an additional nonnegative integer value preceding
/// the value to be formated, preceded by a period (.), which specifies the number of characters
/// to be printed, the number of decimal places, or the number of significant digits.
///
/// Throws an InvalidArgumentException if an argument index is out of range.
@ -102,36 +105,47 @@ std::string Foundation_API format(const std::string& fmt, const Any& value);
/// std::string s1 = format("The answer to life, the universe, and everything is %d", 42);
/// std::string s2 = format("second: %[1]d, first: %[0]d", 1, 2);
std::string Foundation_API format(const std::string& fmt, const Any& value1, const Any& value2);
std::string Foundation_API format(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3);
std::string Foundation_API format(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4);
std::string Foundation_API format(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5);
std::string Foundation_API format(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6);
std::string Foundation_API format(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7);
std::string Foundation_API format(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8);
std::string Foundation_API format(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9);
std::string Foundation_API format(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9, const Any& value10);
void Foundation_API format(std::string& result, const std::string& fmt, const Any& value);
/// Appends the formatted string to result.
void Foundation_API format(std::string& result, const std::string& fmt, const Any& value1, const Any& value2);
void Foundation_API format(std::string& result, const std::string& fmt, const Any& value1, const Any& value2, const Any& value3);
void Foundation_API format(std::string& result, const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4);
void Foundation_API format(std::string& result, const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5);
void Foundation_API format(std::string& result, const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6);
void Foundation_API format(std::string& result, const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7);
void Foundation_API format(std::string& result, const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8);
void Foundation_API format(std::string& result, const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9);
void Foundation_API format(std::string& result, const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9, const Any& value10);
void Foundation_API format(std::string& result, const char *fmt, const std::vector<Any>& values);
/// Supports a variable number of arguments and is used by
/// all other variants of format().
void Foundation_API format(std::string& result, const std::string& fmt, const std::vector<Any>& values);
/// Supports a variable number of arguments and is used by
/// all other variants of format().
template <
typename T,
typename... Args>
void format(std::string &result, const std::string &fmt, T arg1, Args... args)
/// Appends the formatted string to result.
{
std::vector<Any> values;
values.reserve(sizeof...(Args) + 1);
values.emplace_back(arg1);
values.insert(values.end(), { args... });
format(result, fmt, values);
}
template <
typename FMT,
typename T,
typename... Args,
typename std::enable_if<std::is_const<typename std::remove_reference<FMT>::type>::value, int>::type = 0>
std::string format(FMT &fmt, T arg1, Args... args)
/// Returns the formatted string.
{
std::vector<Any> values;
values.reserve(sizeof...(Args) + 1);
values.emplace_back(arg1);
values.insert(values.end(), { args... });
std::string result;
format(result, fmt, values);
return result;
}
} // namespace Poco

View File

@ -20,6 +20,7 @@
#include "Poco/Foundation.h"
#include "Poco/Configurable.h"
#include "Poco/AutoPtr.h"
#include "Poco/RefCountedObject.h"
@ -40,9 +41,9 @@ class Foundation_API Formatter: public Configurable, public RefCountedObject
/// A useful implementation should at least take the Message's
/// Time, Priority and Text fields and put them into a string.
///
/// The Formatter class supports the Configurable
/// interface, so the behaviour of certain formatters
/// is configurable.
/// The Formatter class supports the Configurable interface,
/// so the behaviour of certain formatters is configurable.
/// It also supports reference counting based garbage collection.
///
/// Trivial implementations of of getProperty() and
/// setProperty() are provided.
@ -50,6 +51,8 @@ class Foundation_API Formatter: public Configurable, public RefCountedObject
/// Subclasses must at least provide a format() method.
{
public:
using Ptr = AutoPtr<Formatter>;
Formatter();
/// Creates the formatter.

View File

@ -20,6 +20,8 @@
#include "Poco/Foundation.h"
#include "Poco/Channel.h"
#include "Poco/Formatter.h"
#include "Poco/AutoPtr.h"
namespace Poco {
@ -34,30 +36,32 @@ class Foundation_API FormattingChannel: public Channel
/// to the destination channel.
{
public:
using Ptr = AutoPtr<FormattingChannel>;
FormattingChannel();
/// Creates a FormattingChannel.
FormattingChannel(Formatter* pFormatter);
FormattingChannel(Formatter::Ptr pFormatter);
/// Creates a FormattingChannel and attaches a Formatter.
FormattingChannel(Formatter* pFormatter, Channel* pChannel);
FormattingChannel(Formatter::Ptr pFormatter, Channel::Ptr pChannel);
/// Creates a FormattingChannel and attaches a Formatter
/// and a Channel.
void setFormatter(Formatter* pFormatter);
void setFormatter(Formatter::Ptr pFormatter);
/// Sets the Formatter used to format the messages
/// before they are passed on. If null, the message
/// is passed on unmodified.
Formatter* getFormatter() const;
Formatter::Ptr getFormatter() const;
/// Returns the Formatter used to format messages,
/// which may be null.
void setChannel(Channel* pChannel);
void setChannel(Channel::Ptr pChannel);
/// Sets the destination channel to which the formatted
/// messages are passed on.
Channel* getChannel() const;
Channel::Ptr getChannel() const;
/// Returns the channel to which the formatted
/// messages are passed on.
@ -85,8 +89,8 @@ protected:
~FormattingChannel();
private:
Formatter* _pFormatter;
Channel* _pChannel;
Formatter::Ptr _pFormatter;
Channel::Ptr _pChannel;
};

View File

@ -114,12 +114,8 @@
// Cleanup inconsistencies
//
#ifdef POCO_OS_FAMILY_WINDOWS
#if defined(POCO_WIN32_UTF8) && defined(POCO_NO_WSTRING)
#error POCO_WIN32_UTF8 and POCO_NO_WSTRING are mutually exclusive.
#endif
#else
#ifdef POCO_WIN32_UTF8
#undef POCO_WIN32_UTF8
#if defined(POCO_NO_WSTRING)
#error POCO_NO_WSTRING is not supported on Windows.
#endif
#endif

View File

@ -78,7 +78,7 @@ public:
static void glob(const std::string& pathPattern, std::set<std::string>& files, int options = 0);
/// Creates a set of files that match the given pathPattern.
///
/// The path may be give in either Unix, Windows or VMS syntax and
/// The path may be give in either Unix or Windows syntax and
/// is automatically expanded by calling Path::expand().
///
/// The pattern may contain wildcard expressions even in intermediate
@ -93,7 +93,7 @@ public:
static void glob(const char* pathPattern, std::set<std::string>& files, int options = 0);
/// Creates a set of files that match the given pathPattern.
///
/// The path may be give in either Unix, Windows or VMS syntax and
/// The path may be give in either Unix or Windows syntax and
/// is automatically expanded by calling Path::expand().
///
/// The pattern may contain wildcard expressions even in intermediate

View File

@ -28,7 +28,7 @@ namespace Poco {
template <class Engine>
class HMACEngine: public DigestEngine
/// This class implementes the HMAC message
/// This class implements the HMAC message
/// authentication code algorithm, as specified
/// in RFC 2104. The underlying DigestEngine
/// (MD5Engine, SHA1Engine, etc.) must be given as
@ -80,8 +80,7 @@ public:
const DigestEngine::Digest& d = _engine.digest();
char db[DIGEST_SIZE];
char* pdb = db;
for (DigestEngine::Digest::const_iterator it = d.begin(); it != d.end(); ++it)
*pdb++ = *it;
for (auto v: d) *pdb++ = v;
_engine.reset();
_engine.update(_opad, BLOCK_SIZE);
_engine.update(db, DIGEST_SIZE);

View File

@ -35,7 +35,7 @@ class LRUCache: public AbstractCache<TKey, TValue, LRUStrategy<TKey, TValue>, TM
/// An LRUCache implements Least Recently Used caching. The default size for a cache is 1024 entries.
{
public:
LRUCache(long size = 1024):
LRUCache(std::size_t size = 1024):
AbstractCache<TKey, TValue, LRUStrategy<TKey, TValue>, TMutex, TEventMutex>(LRUStrategy<TKey, TValue>(size))
{
}

View File

@ -35,7 +35,7 @@ class LinearHashTable
/// This class implements a linear hash table.
///
/// In a linear hash table, the available address space
/// grows or shrinks dynamically. A linar hash table thus
/// grows or shrinks dynamically. A linear hash table thus
/// supports any number of insertions or deletions without
/// lookup or insertion performance deterioration.
///
@ -279,15 +279,15 @@ public:
/// Returns an iterator pointing to the first entry, if one exists.
{
BucketVecIterator it(_buckets.begin());
BucketVecIterator end(_buckets.end());
while (it != end && it->empty())
BucketVecIterator itEnd(_buckets.end());
while (it != itEnd && it->empty())
{
++it;
}
if (it == end)
return this->end();
if (it == itEnd)
return end();
else
return ConstIterator(it, end, it->begin());
return ConstIterator(it, itEnd, it->begin());
}
ConstIterator end() const
@ -300,15 +300,15 @@ public:
/// Returns an iterator pointing to the first entry, if one exists.
{
BucketVecIterator it(_buckets.begin());
BucketVecIterator end(_buckets.end());
while (it != end && it->empty())
BucketVecIterator itEnd(_buckets.end());
while (it != itEnd && it->empty())
{
++it;
}
if (it == end)
return this->end();
if (it == itEnd)
return end();
else
return Iterator(it, end, it->begin());
return Iterator(it, itEnd, it->begin());
}
Iterator end()
@ -398,8 +398,8 @@ public:
void clear()
/// Erases all elements.
{
LinearHashTable empty;
swap(empty);
LinearHashTable emptyTable;
swap(emptyTable);
}
std::size_t size() const

View File

@ -2,7 +2,7 @@
// ListMap.h
//
// Library: Foundation
// Package: Hashing
// Package: Core
// Module: ListMap
//
// Definition of the ListMap class.
@ -21,14 +21,14 @@
#include "Poco/Foundation.h"
#include "Poco/String.h"
#include "Poco/Exception.h"
#include <list>
#include <vector>
#include <utility>
namespace Poco {
template <class Key, class Mapped, class Container = std::list<std::pair<Key, Mapped> >, bool CaseSensitive = false >
template <class Key, class Mapped, class Container = std::vector<std::pair<Key, Mapped>>, bool CaseSensitive = false>
class ListMap
/// This class implements a multimap in terms of a sequential container.
/// The use for this type of associative container is wherever automatic
@ -39,29 +39,39 @@ class ListMap
/// header entry reordering.
{
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 typename Container::value_type ValueType;
typedef typename Container::size_type SizeType;
typedef typename Container::iterator Iterator;
typedef typename Container::const_iterator ConstIterator;
using ValueType = typename Container::value_type;
using SizeType = typename Container::size_type;
using Iterator = typename Container::iterator;
using ConstIterator = typename Container::const_iterator;
ListMap()
/// Creates an empty ListMap.
{
}
ListMap(std::size_t initialReserve):
_list(initialReserve)
explicit ListMap(std::size_t initialReserve):
_container(initialReserve)
/// Creates the ListMap with room for initialReserve entries.
{
}
ListMap(const ListMap& other):
_container(other._container)
{
}
ListMap(ListMap&& other) noexcept:
_container(std::move(other._container))
{
}
ListMap& operator = (const ListMap& map)
/// Assigns another ListMap.
{
@ -70,34 +80,41 @@ public:
return *this;
}
ListMap& operator = (ListMap&& map) noexcept
/// Assigns another ListMap.
{
_container = std::move(map._container);
return *this;
}
void swap(ListMap& map)
/// Swaps the ListMap with another one.
{
_list.swap(map._list);
_container.swap(map._container);
}
ConstIterator begin() const
/// Returns the beginning of the map.
{
return _list.begin();
return _container.begin();
}
ConstIterator end() const
/// Returns the end of the map.
{
return _list.end();
return _container.end();
}
Iterator begin()
/// Returns the beginning of the map.
{
return _list.begin();
return _container.begin();
}
Iterator end()
/// Returns the end of the map.
{
return _list.end();
return _container.end();
}
ConstIterator find(const KeyType& key) const
@ -106,8 +123,8 @@ public:
/// or iterator pointing to the end if entry is
/// not found.
{
typename Container::const_iterator it = _list.begin();
typename Container::const_iterator itEnd = _list.end();
typename Container::const_iterator it = _container.begin();
typename Container::const_iterator itEnd = _container.end();
for(; it != itEnd; ++it)
{
if (isEqual(it->first, key)) return it;
@ -121,8 +138,8 @@ public:
/// or iterator pointing to the end if entry is
/// not found.
{
typename Container::iterator it = _list.begin();
typename Container::iterator itEnd = _list.end();
typename Container::iterator it = _container.begin();
typename Container::iterator itEnd = _container.end();
for(; it != itEnd; ++it)
{
if (isEqual(it->first, key)) return it;
@ -138,13 +155,13 @@ public:
/// Returns iterator pointing to the newly inserted value
{
Iterator it = find(val.first);
while (it != _list.end() && isEqual(it->first, val.first)) ++it;
return _list.insert(it, val);
while (it != _container.end() && isEqual(it->first, val.first)) ++it;
return _container.insert(it, val);
}
void erase(Iterator it)
{
_list.erase(it);
_container.erase(it);
}
SizeType erase(const KeyType& key)
@ -152,12 +169,12 @@ public:
SizeType count = 0;
Iterator it = find(key);
bool removed = false;
while (it != _list.end())
while (it != _container.end())
{
if (isEqual(it->first, key))
{
++count;
it = _list.erase(it);
it = _container.erase(it);
removed = true;
}
else
@ -171,23 +188,23 @@ public:
void clear()
{
_list.clear();
_container.clear();
}
std::size_t size() const
{
return _list.size();
return _container.size();
}
bool empty() const
{
return _list.empty();
return _container.empty();
}
ConstReference operator [] (const KeyType& key) const
{
ConstIterator it = find(key);
if (it != _list.end())
if (it != _container.end())
return it->second;
else
throw NotFoundException();
@ -196,8 +213,10 @@ public:
Reference operator [] (const KeyType& key)
{
Iterator it = find(key);
if (it != _list.end())
if (it != _container.end())
{
return it->second;
}
else
{
ValueType value(key, Mapped());
@ -236,7 +255,7 @@ private:
return isEqual(std::string(s1), std::string(s2));
}
Container _list;
Container _container;
};

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