mirror of
https://github.com/pocoproject/poco.git
synced 2025-03-26 16:32:45 +01:00
fixed type overloads
This commit is contained in:
parent
c111fc89f6
commit
aa46e9b6e4
Data
MySQL
ODBC
PostgreSQL
SQLite
include/Poco/Data
AbstractBinder.hAbstractExtractor.hAbstractPreparator.hAbstractSessionImpl.hStatement.hStatementImpl.h
src
Foundation
@ -64,11 +64,13 @@ public:
|
||||
virtual void bind(std::size_t pos, const Poco::UInt64& val, Direction dir);
|
||||
/// Binds an UInt64.
|
||||
|
||||
#ifndef POCO_INT64_IS_LONG
|
||||
virtual void bind(std::size_t pos, const long& val, Direction dir = PD_IN);
|
||||
/// Binds a long.
|
||||
|
||||
virtual void bind(std::size_t pos, const unsigned long& val, Direction dir = PD_IN);
|
||||
/// Binds an unsigned long.
|
||||
#endif
|
||||
|
||||
virtual void bind(std::size_t pos, const bool& val, Direction dir);
|
||||
/// Binds a boolean.
|
||||
|
@ -72,11 +72,13 @@ public:
|
||||
virtual bool extract(std::size_t pos, Poco::UInt64& val);
|
||||
/// Extracts an UInt64.
|
||||
|
||||
#ifndef POCO_INT64_IS_LONG
|
||||
virtual bool extract(std::size_t pos, long& val);
|
||||
/// Extracts a long. Returns false if null was received.
|
||||
|
||||
virtual bool extract(std::size_t pos, unsigned long& val);
|
||||
/// Extracts an unsigned long. Returns false if null was received.
|
||||
#endif
|
||||
|
||||
virtual bool extract(std::size_t pos, bool& val);
|
||||
/// Extracts a boolean.
|
||||
@ -196,6 +198,7 @@ public:
|
||||
virtual bool extract(std::size_t pos, std::list<Poco::UInt64>& val);
|
||||
/// Extracts an UInt64 list.
|
||||
|
||||
#ifndef POCO_INT64_IS_LONG
|
||||
virtual bool extract(std::size_t pos, std::vector<long>& val);
|
||||
/// Extracts a long vector.
|
||||
|
||||
@ -204,6 +207,7 @@ public:
|
||||
|
||||
virtual bool extract(std::size_t pos, std::list<long>& val);
|
||||
/// Extracts a long list.
|
||||
#endif
|
||||
|
||||
virtual bool extract(std::size_t pos, std::vector<bool>& val);
|
||||
/// Extracts a boolean vector.
|
||||
|
@ -91,6 +91,7 @@ void Binder::bind(std::size_t pos, const Poco::UInt64& val, Direction dir)
|
||||
}
|
||||
|
||||
|
||||
#ifndef POCO_INT64_IS_LONG
|
||||
void Binder::bind(std::size_t pos, const long& val, Direction dir)
|
||||
{
|
||||
poco_assert(dir == PD_IN);
|
||||
@ -103,6 +104,7 @@ void Binder::bind(std::size_t pos, const unsigned long& val, Direction dir)
|
||||
poco_assert(dir == PD_IN);
|
||||
realBind(pos, MYSQL_TYPE_LONG, &val, 0, true);
|
||||
}
|
||||
#endif // POCO_LONG_IS_64_BIT
|
||||
|
||||
|
||||
void Binder::bind(std::size_t pos, const bool& val, Direction dir)
|
||||
|
@ -80,6 +80,7 @@ bool Extractor::extract(std::size_t pos, Poco::UInt64& val)
|
||||
}
|
||||
|
||||
|
||||
#ifndef POCO_INT64_IS_LONG
|
||||
bool Extractor::extract(std::size_t pos, long& val)
|
||||
{
|
||||
return realExtractFixed(pos, MYSQL_TYPE_LONG, &val);
|
||||
@ -90,6 +91,7 @@ bool Extractor::extract(std::size_t pos, unsigned long& val)
|
||||
{
|
||||
return realExtractFixed(pos, MYSQL_TYPE_LONG, &val, true);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, bool& val)
|
||||
@ -399,6 +401,7 @@ bool Extractor::extract(std::size_t , std::list<Poco::UInt64>& )
|
||||
}
|
||||
|
||||
|
||||
#ifndef POCO_INT64_IS_LONG
|
||||
bool Extractor::extract(std::size_t , std::vector<long>& )
|
||||
{
|
||||
throw NotImplementedException("std::vector extractor must be implemented.");
|
||||
@ -415,6 +418,7 @@ bool Extractor::extract(std::size_t , std::list<long>& )
|
||||
{
|
||||
throw NotImplementedException("std::list extractor must be implemented.");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t , std::vector<bool>& )
|
||||
|
@ -173,6 +173,7 @@ public:
|
||||
void bind(std::size_t pos, const std::list<Poco::UInt64>& val, Direction dir);
|
||||
/// Binds an UInt64 list.
|
||||
|
||||
#ifndef POCO_INT64_IS_LONG
|
||||
void bind(std::size_t pos, const long& val, Direction dir);
|
||||
/// Binds a long.
|
||||
|
||||
@ -187,6 +188,7 @@ public:
|
||||
|
||||
void bind(std::size_t pos, const std::list<long>& val, Direction dir);
|
||||
/// Binds a long list.
|
||||
#endif
|
||||
|
||||
void bind(std::size_t pos, const bool& val, Direction dir);
|
||||
/// Binds a boolean.
|
||||
@ -1213,6 +1215,7 @@ inline void Binder::bind(std::size_t pos, const std::list<Poco::UInt64>& val, Di
|
||||
}
|
||||
|
||||
|
||||
#ifndef POCO_INT64_IS_LONG
|
||||
inline void Binder::bind(std::size_t pos, const long& val, Direction dir)
|
||||
{
|
||||
bindImpl(pos, val, SQL_C_SLONG, dir);
|
||||
@ -1241,6 +1244,7 @@ inline void Binder::bind(std::size_t pos, const std::list<long>& val, Direction
|
||||
{
|
||||
bindImplContainer(pos, val, SQL_C_SLONG, dir);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
inline void Binder::bind(std::size_t pos, const float& val, Direction dir)
|
||||
|
@ -155,6 +155,7 @@ public:
|
||||
bool extract(std::size_t pos, std::list<Poco::UInt64>& val);
|
||||
/// Extracts an UInt64 list.
|
||||
|
||||
#ifndef POCO_INT64_IS_LONG
|
||||
bool extract(std::size_t pos, long& val);
|
||||
/// Extracts a long.
|
||||
|
||||
@ -169,6 +170,7 @@ public:
|
||||
|
||||
bool extract(std::size_t pos, std::list<long>& val);
|
||||
/// Extracts a long list.
|
||||
#endif
|
||||
|
||||
bool extract(std::size_t pos, bool& val);
|
||||
/// Extracts a boolean.
|
||||
|
@ -204,6 +204,7 @@ public:
|
||||
void prepare(std::size_t pos, const std::list<Poco::UInt64>& val);
|
||||
/// Prepares an UInt64 list.
|
||||
|
||||
#ifndef POCO_INT64_IS_LONG
|
||||
void prepare(std::size_t pos, const long& val);
|
||||
/// Prepares a long.
|
||||
|
||||
@ -218,6 +219,7 @@ public:
|
||||
|
||||
void prepare(std::size_t pos, const std::list<long>& val);
|
||||
/// Prepares a long list.
|
||||
#endif
|
||||
|
||||
void prepare(std::size_t pos, const bool& val);
|
||||
/// Prepares a boolean.
|
||||
@ -875,6 +877,7 @@ inline void Preparator::prepare(std::size_t pos, const std::list<Poco::UInt64>&
|
||||
}
|
||||
|
||||
|
||||
#ifndef POCO_INT64_IS_LONG
|
||||
inline void Preparator::prepare(std::size_t pos, const long&)
|
||||
{
|
||||
prepareFixedSize<long>(pos, SQL_C_SLONG);
|
||||
@ -903,6 +906,7 @@ inline void Preparator::prepare(std::size_t pos, const std::list<long>& val)
|
||||
{
|
||||
prepareFixedSize<long>(pos, SQL_C_SLONG, val.size());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
inline void Preparator::prepare(std::size_t pos, const bool&)
|
||||
|
@ -575,6 +575,7 @@ bool Extractor::extract(std::size_t pos, std::list<Poco::Int64>& val)
|
||||
}
|
||||
|
||||
|
||||
#ifndef POCO_INT64_IS_LONG
|
||||
bool Extractor::extract(std::size_t pos, long& val)
|
||||
{
|
||||
if (Preparator::DE_MANUAL == _dataExtraction)
|
||||
@ -618,6 +619,7 @@ bool Extractor::extract(std::size_t pos, std::list<long>& val)
|
||||
else
|
||||
throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, double& val)
|
||||
|
@ -70,15 +70,13 @@ public:
|
||||
virtual void bind(std::size_t pos, const Poco::UInt64& val, Direction dir = PD_IN);
|
||||
/// Binds an UInt64.
|
||||
|
||||
#ifndef POCO_LONG_IS_64_BIT
|
||||
|
||||
#ifndef POCO_INT64_IS_LONG
|
||||
virtual void bind(std::size_t pos, const long& val, Direction dir = PD_IN);
|
||||
/// Binds a long.
|
||||
|
||||
virtual void bind(std::size_t pos, const unsigned long& val, Direction dir = PD_IN);
|
||||
/// Binds an unsigned long.
|
||||
|
||||
#endif // POCO_LONG_IS_64_BIT
|
||||
#endif
|
||||
|
||||
virtual void bind(std::size_t pos, const bool& val, Direction dir = PD_IN);
|
||||
/// Binds a boolean.
|
||||
|
@ -78,11 +78,10 @@ public:
|
||||
virtual bool extract(std::size_t pos, Poco::UInt64& val);
|
||||
/// Extracts an UInt64.
|
||||
|
||||
#ifndef POCO_LONG_IS_64_BIT
|
||||
#ifndef POCO_INT64_IS_LONG
|
||||
virtual bool extract(std::size_t pos, long& val);
|
||||
/// Extracts a long. Returns false if null was received.
|
||||
|
||||
|
||||
virtual bool extract(std::size_t pos, unsigned long& val);
|
||||
/// Extracts an unsigned long. Returns false if null was received.
|
||||
#endif
|
||||
@ -205,7 +204,7 @@ public:
|
||||
virtual bool extract(std::size_t pos, std::list<Poco::UInt64>& val);
|
||||
/// Extracts an UInt64 list.
|
||||
|
||||
#ifndef POCO_LONG_IS_64_BIT
|
||||
#ifndef POCO_INT64_IS_LONG
|
||||
virtual bool extract(std::size_t pos, std::vector<long>& val);
|
||||
/// Extracts a long vector.
|
||||
|
||||
|
@ -88,8 +88,7 @@ void Binder::bind(std::size_t pos, const Poco::UInt64& val, Direction dir)
|
||||
}
|
||||
|
||||
|
||||
#ifndef POCO_LONG_IS_64_BIT
|
||||
|
||||
#ifndef POCO_INT64_IS_LONG
|
||||
void Binder::bind(std::size_t pos, const long& val, Direction dir)
|
||||
{
|
||||
poco_assert(dir == PD_IN);
|
||||
@ -102,8 +101,7 @@ void Binder::bind(std::size_t pos, const unsigned long& val, Direction dir)
|
||||
poco_assert(dir == PD_IN);
|
||||
realBind(pos, Poco::Data::MetaColumn::FDT_UINT64, &val, sizeof(Poco::UInt64));
|
||||
}
|
||||
|
||||
#endif // POCO_LONG_IS_64_BIT
|
||||
#endif
|
||||
|
||||
|
||||
void Binder::bind(std::size_t pos, const bool& val, Direction dir)
|
||||
|
@ -173,7 +173,7 @@ bool Extractor::extract(std::size_t pos, Poco::UInt64& val)
|
||||
}
|
||||
|
||||
|
||||
#ifndef POCO_LONG_IS_64_BIT
|
||||
#ifndef POCO_INT64_IS_LONG
|
||||
bool Extractor::extract(std::size_t pos, long& val)
|
||||
{
|
||||
OutputParameter outputParameter = extractPreamble(pos);
|
||||
@ -630,7 +630,7 @@ bool Extractor::extract(std::size_t , std::list<Poco::UInt64>&)
|
||||
}
|
||||
|
||||
|
||||
#ifndef POCO_LONG_IS_64_BIT
|
||||
#ifndef POCO_INT64_IS_LONG
|
||||
bool Extractor::extract(std::size_t , std::vector<long>&)
|
||||
{
|
||||
throw NotImplementedException("std::vector extractor must be implemented.");
|
||||
|
@ -65,11 +65,13 @@ public:
|
||||
void bind(std::size_t pos, const Poco::UInt64 &val, Direction dir);
|
||||
/// Binds an UInt64.
|
||||
|
||||
#ifndef POCO_INT64_IS_LONG
|
||||
void bind(std::size_t pos, const long &val, Direction dir);
|
||||
/// Binds a long
|
||||
|
||||
void bind(std::size_t pos, const unsigned long &val, Direction dir);
|
||||
/// Binds an unsigned long
|
||||
#endif
|
||||
|
||||
void bind(std::size_t pos, const bool &val, Direction dir);
|
||||
/// Binds a boolean.
|
||||
|
@ -78,11 +78,13 @@ public:
|
||||
bool extract(std::size_t pos, Poco::UInt64& val);
|
||||
/// Extracts an UInt64.
|
||||
|
||||
#ifndef POCO_INT64_IS_LONG
|
||||
bool extract(std::size_t pos, long& val);
|
||||
/// Extracts a long.
|
||||
|
||||
bool extract(std::size_t pos, unsigned long& val);
|
||||
/// Extracts an unsigned long.
|
||||
#endif
|
||||
|
||||
bool extract(std::size_t pos, bool& val);
|
||||
/// Extracts a boolean.
|
||||
|
@ -56,6 +56,7 @@ void Binder::bind(std::size_t pos, const Poco::Int64 &val, Direction dir)
|
||||
}
|
||||
|
||||
|
||||
#ifndef POCO_INT64_IS_LONG
|
||||
void Binder::bind(std::size_t pos, const long &val, Direction dir)
|
||||
{
|
||||
long tmp = static_cast<long>(val);
|
||||
@ -69,6 +70,7 @@ void Binder::bind(std::size_t pos, const unsigned long &val, Direction dir)
|
||||
int rc = sqlite3_bind_int(_pStmt, (int) pos, tmp);
|
||||
checkReturn(rc);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void Binder::bind(std::size_t pos, const double &val, Direction dir)
|
||||
|
@ -63,6 +63,7 @@ bool Extractor::extract(std::size_t pos, Poco::Int64& val)
|
||||
}
|
||||
|
||||
|
||||
#ifndef POCO_INT64_IS_LONG
|
||||
bool Extractor::extract(std::size_t pos, long& val)
|
||||
{
|
||||
if (isNull(pos)) return false;
|
||||
@ -77,6 +78,7 @@ bool Extractor::extract(std::size_t pos, unsigned long& val)
|
||||
val = sqlite3_column_int(_pStmt, (int) pos);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, double& val)
|
||||
|
@ -165,6 +165,7 @@ public:
|
||||
virtual void bind(std::size_t pos, const std::list<Poco::UInt64>& val, Direction dir = PD_IN);
|
||||
/// Binds an UInt64 list.
|
||||
|
||||
#ifndef POCO_INT64_IS_LONG
|
||||
virtual void bind(std::size_t pos, const long& val, Direction dir = PD_IN) = 0;
|
||||
/// Binds a long.
|
||||
|
||||
@ -179,6 +180,7 @@ public:
|
||||
|
||||
virtual void bind(std::size_t pos, const std::list<long>& val, Direction dir = PD_IN);
|
||||
/// Binds a long list.
|
||||
#endif
|
||||
|
||||
virtual void bind(std::size_t pos, const bool& val, Direction dir = PD_IN) = 0;
|
||||
/// Binds a boolean.
|
||||
|
@ -155,6 +155,7 @@ public:
|
||||
virtual bool extract(std::size_t pos, std::list<Poco::UInt64>& val);
|
||||
/// Extracts an UInt64 list.
|
||||
|
||||
#ifndef POCO_INT64_IS_LONG
|
||||
virtual bool extract(std::size_t pos, long& val) = 0;
|
||||
/// Extracts a long. Returns false if null was received.
|
||||
|
||||
@ -169,6 +170,7 @@ public:
|
||||
|
||||
virtual bool extract(std::size_t pos, std::list<long>& val);
|
||||
/// Extracts a long list.
|
||||
#endif
|
||||
|
||||
virtual bool extract(std::size_t pos, bool& val) = 0;
|
||||
/// Extracts a boolean. Returns false if null was received.
|
||||
|
@ -161,6 +161,7 @@ public:
|
||||
virtual void prepare(std::size_t pos, const std::list<Poco::UInt64>& val);
|
||||
/// Prepares an UInt64 list.
|
||||
|
||||
#ifndef POCO_INT64_IS_LONG
|
||||
virtual void prepare(std::size_t pos, const long&) = 0;
|
||||
/// Prepares a long.
|
||||
|
||||
@ -175,6 +176,7 @@ public:
|
||||
|
||||
virtual void prepare(std::size_t pos, const std::list<long>& val);
|
||||
/// Prepares a long list.
|
||||
#endif
|
||||
|
||||
virtual void prepare(std::size_t pos, const bool&) = 0;
|
||||
/// Prepares a boolean.
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
/// Creates the AbstractSessionImpl.
|
||||
///
|
||||
/// Adds "storage" property and sets the default internal storage container
|
||||
/// type to std::vector.
|
||||
/// type to std::deque.
|
||||
/// 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
|
||||
|
@ -258,11 +258,13 @@ public:
|
||||
Statement& operator , (Poco::Int32 value);
|
||||
/// Adds the value to the list of values to be supplied to the SQL string formatting function.
|
||||
|
||||
#ifndef POCO_INT64_IS_LONG
|
||||
Statement& operator , (long value);
|
||||
/// Adds the value to the list of values to be supplied to the SQL string formatting function.
|
||||
|
||||
Statement& operator , (unsigned long value);
|
||||
/// Adds the value to the list of values to be supplied to the SQL string formatting function.
|
||||
#endif
|
||||
|
||||
Statement& operator , (Poco::UInt64 value);
|
||||
/// Adds the value to the list of values to be supplied to the SQL string formatting function.
|
||||
@ -572,6 +574,7 @@ inline Statement& Statement::operator , (Poco::Int32 value)
|
||||
}
|
||||
|
||||
|
||||
#ifndef POCO_INT64_IS_LONG
|
||||
inline Statement& Statement::operator , (long value)
|
||||
{
|
||||
return commaPODImpl(value);
|
||||
@ -582,6 +585,7 @@ inline Statement& Statement::operator , (unsigned long value)
|
||||
{
|
||||
return commaPODImpl(value);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
inline Statement& Statement::operator , (Poco::UInt64 value)
|
||||
|
@ -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::vector is used.
|
||||
/// container type set, std::deque is used.
|
||||
///
|
||||
/// Supported internal extraction container types are:
|
||||
/// - std::vector (default)
|
||||
/// - std::deque
|
||||
/// - std::deque (default)
|
||||
/// - std::vector
|
||||
/// - std::list
|
||||
|
||||
SessionImpl& session();
|
||||
|
@ -180,6 +180,7 @@ void AbstractBinder::bind(std::size_t pos, const std::list<Poco::UInt64>& val, D
|
||||
}
|
||||
|
||||
|
||||
#ifndef POCO_INT64_IS_LONG
|
||||
void AbstractBinder::bind(std::size_t pos, const std::vector<long>& val, Direction dir)
|
||||
{
|
||||
throw NotImplementedException("std::vector binder must be implemented.");
|
||||
@ -196,6 +197,7 @@ void AbstractBinder::bind(std::size_t pos, const std::list<long>& val, Direction
|
||||
{
|
||||
throw NotImplementedException("std::list binder must be implemented.");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void AbstractBinder::bind(std::size_t pos, const std::vector<bool>& val, Direction dir)
|
||||
@ -462,7 +464,7 @@ void AbstractBinder::bind(std::size_t pos, const Any& val, Direction dir)
|
||||
bind(pos, RefAnyCast<BLOB>(val), dir);
|
||||
else if (type == typeid(void))
|
||||
bind(pos, Keywords::null, dir);
|
||||
else if (type == typeid(long))
|
||||
else if(type == typeid(long))
|
||||
bind(pos, RefAnyCast<long>(val), dir);
|
||||
else
|
||||
throw UnknownTypeException(std::string(val.type().name()));
|
||||
|
@ -76,8 +76,8 @@ public:
|
||||
BinaryReader& operator >> (double& value);
|
||||
|
||||
#if defined(POCO_HAVE_INT64)
|
||||
BinaryReader& operator >> (Int64& value);
|
||||
BinaryReader& operator >> (UInt64& value);
|
||||
BinaryReader& operator >> (long long& value);
|
||||
BinaryReader& operator >> (unsigned long long& value);
|
||||
#endif
|
||||
|
||||
BinaryReader& operator >> (std::string& value);
|
||||
|
@ -81,8 +81,8 @@ public:
|
||||
BinaryWriter& operator << (double value);
|
||||
|
||||
#if defined(POCO_HAVE_INT64)
|
||||
BinaryWriter& operator << (Int64 value);
|
||||
BinaryWriter& operator << (UInt64 value);
|
||||
BinaryWriter& operator << (long long value);
|
||||
BinaryWriter& operator << (unsigned long long value);
|
||||
#endif
|
||||
|
||||
BinaryWriter& operator << (const std::string& value);
|
||||
|
@ -2123,6 +2123,9 @@ inline bool operator != (const char* other, const Var& da)
|
||||
}
|
||||
|
||||
|
||||
#ifndef POCO_INT64_IS_LONG
|
||||
|
||||
|
||||
inline long operator + (const long& other, const Var& da)
|
||||
/// Addition operator for adding Var to long
|
||||
{
|
||||
@ -2331,6 +2334,9 @@ inline bool operator >= (const unsigned long& other, const Var& da)
|
||||
}
|
||||
|
||||
|
||||
#endif // POCO_INT64_IS_LONG
|
||||
|
||||
|
||||
} // namespace Dynamic
|
||||
|
||||
|
||||
|
@ -178,12 +178,26 @@ public:
|
||||
/// Throws BadCastException. Must be overriden in a type
|
||||
/// specialization in order to support the conversion.
|
||||
|
||||
#ifndef POCO_INT64_IS_LONG
|
||||
|
||||
void convert(long& val) const;
|
||||
/// Calls convert(Int32).
|
||||
|
||||
void convert(unsigned long& val) const;
|
||||
/// Calls convert(UInt32).
|
||||
|
||||
#else
|
||||
|
||||
virtual void convert(long long& val) const;
|
||||
/// Throws BadCastException. Must be overriden in a type
|
||||
/// specialization in order to suport the conversion.
|
||||
|
||||
virtual void convert(unsigned long long & val) const;
|
||||
/// Throws BadCastException. Must be overriden in a type
|
||||
/// specialization in order to suport the conversion.
|
||||
|
||||
#endif
|
||||
|
||||
virtual void convert(bool& val) const;
|
||||
/// Throws BadCastException. Must be overriden in a type
|
||||
/// specialization in order to support the conversion.
|
||||
@ -505,6 +519,7 @@ inline void VarHolder::convert(Timestamp& /*val*/) const
|
||||
throw BadCastException("Can not convert to Timestamp");
|
||||
}
|
||||
|
||||
#ifndef POCO_INT64_IS_LONG
|
||||
|
||||
inline void VarHolder::convert(long& val) const
|
||||
{
|
||||
@ -521,6 +536,20 @@ inline void VarHolder::convert(unsigned long& val) const
|
||||
val = tmp;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
inline void VarHolder::convert(long long& /*val*/) const
|
||||
{
|
||||
throw BadCastException("Can not convert to long long");
|
||||
}
|
||||
|
||||
|
||||
inline void VarHolder::convert(unsigned long long& /*val*/) const
|
||||
{
|
||||
throw BadCastException("Can not convert to unsigned long long");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
inline void VarHolder::convert(bool& /*val*/) const
|
||||
{
|
||||
@ -759,6 +788,20 @@ public:
|
||||
convertSignedToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
void convert(long long& val) const
|
||||
{
|
||||
val = _val;
|
||||
}
|
||||
|
||||
void convert(unsigned long long& val) const
|
||||
{
|
||||
convertSignedToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void convert(bool& val) const
|
||||
{
|
||||
val = (_val != 0);
|
||||
@ -901,6 +944,20 @@ public:
|
||||
convertSignedToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
void convert(long long& val) const
|
||||
{
|
||||
val = _val;
|
||||
}
|
||||
|
||||
void convert(unsigned long long& val) const
|
||||
{
|
||||
convertSignedToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void convert(bool& val) const
|
||||
{
|
||||
val = (_val != 0);
|
||||
@ -1041,6 +1098,20 @@ public:
|
||||
convertSignedToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
void convert(long long& val) const
|
||||
{
|
||||
val = _val;
|
||||
}
|
||||
|
||||
void convert(unsigned long long& val) const
|
||||
{
|
||||
convertSignedToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void convert(bool& val) const
|
||||
{
|
||||
val = (_val != 0);
|
||||
@ -1179,6 +1250,20 @@ public:
|
||||
convertSignedToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
void convert(long long& val) const
|
||||
{
|
||||
val = _val;
|
||||
}
|
||||
|
||||
void convert(unsigned long long& val) const
|
||||
{
|
||||
convertSignedToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void convert(bool& val) const
|
||||
{
|
||||
val = (_val != 0);
|
||||
@ -1332,6 +1417,20 @@ public:
|
||||
val = _val;
|
||||
}
|
||||
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
void convert(long long& val) const
|
||||
{
|
||||
val = static_cast<long long>(_val);
|
||||
}
|
||||
|
||||
void convert(unsigned long long& val) const
|
||||
{
|
||||
val = _val;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void convert(bool& val) const
|
||||
{
|
||||
val = (_val != 0);
|
||||
@ -1470,6 +1569,20 @@ public:
|
||||
val = _val;
|
||||
}
|
||||
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
void convert(long long& val) const
|
||||
{
|
||||
val = static_cast<long long>(_val);
|
||||
}
|
||||
|
||||
void convert(unsigned long long& val) const
|
||||
{
|
||||
val = _val;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void convert(bool& val) const
|
||||
{
|
||||
val = (_val != 0);
|
||||
@ -1608,6 +1721,20 @@ public:
|
||||
val = _val;
|
||||
}
|
||||
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
void convert(long long& val) const
|
||||
{
|
||||
convertUnsignedToSigned(_val, val);
|
||||
}
|
||||
|
||||
void convert(unsigned long long& val) const
|
||||
{
|
||||
val = _val;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void convert(bool& val) const
|
||||
{
|
||||
val = (_val != 0);
|
||||
@ -1746,6 +1873,20 @@ public:
|
||||
val = _val;
|
||||
}
|
||||
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
void convert(long long& val) const
|
||||
{
|
||||
convertUnsignedToSigned(_val, val);
|
||||
}
|
||||
|
||||
void convert(unsigned long long& val) const
|
||||
{
|
||||
val = _val;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void convert(bool& val) const
|
||||
{
|
||||
val = (_val != 0);
|
||||
@ -1905,6 +2046,20 @@ public:
|
||||
val = static_cast<UInt64>(_val ? 1 : 0);
|
||||
}
|
||||
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
void convert(long long& val) const
|
||||
{
|
||||
val = static_cast<long long>(_val ? 1 : 0);
|
||||
}
|
||||
|
||||
void convert(unsigned long long& val) const
|
||||
{
|
||||
val = static_cast<unsigned long long>(_val ? 1 : 0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void convert(bool& val) const
|
||||
{
|
||||
val = _val;
|
||||
@ -2041,6 +2196,20 @@ public:
|
||||
convertSignedFloatToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
void convert(long long& val) const
|
||||
{
|
||||
convertToSmaller(_val, val);
|
||||
}
|
||||
|
||||
void convert(unsigned long long& val) const
|
||||
{
|
||||
convertSignedFloatToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void convert(bool& val) const
|
||||
{
|
||||
val = !(_val <= std::numeric_limits<float>::min() &&
|
||||
@ -2180,6 +2349,20 @@ public:
|
||||
convertSignedFloatToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
void convert(long long& val) const
|
||||
{
|
||||
convertToSmaller(_val, val);
|
||||
}
|
||||
|
||||
void convert(unsigned long long& val) const
|
||||
{
|
||||
convertSignedFloatToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void convert(bool& val) const
|
||||
{
|
||||
val = !(_val <= std::numeric_limits<double>::min() &&
|
||||
@ -2325,6 +2508,20 @@ public:
|
||||
val = static_cast<UInt8>(_val);
|
||||
}
|
||||
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
void convert(long long& val) const
|
||||
{
|
||||
val = static_cast<long long>(_val);
|
||||
}
|
||||
|
||||
void convert(unsigned long long& val) const
|
||||
{
|
||||
val = static_cast<unsigned long long>(_val);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void convert(bool& val) const
|
||||
{
|
||||
val = (_val != '\0');
|
||||
@ -2469,6 +2666,20 @@ public:
|
||||
val = NumberParser::parseUnsigned64(_val);
|
||||
}
|
||||
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
void convert(long long& val) const
|
||||
{
|
||||
val = NumberParser::parse64(_val);
|
||||
}
|
||||
|
||||
void convert(unsigned long long& val) const
|
||||
{
|
||||
val = NumberParser::parseUnsigned64(_val);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void convert(bool& val) const
|
||||
{
|
||||
if (_val.empty())
|
||||
@ -2647,6 +2858,20 @@ public:
|
||||
val = NumberParser::parseUnsigned64(toStdString());
|
||||
}
|
||||
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
void convert(long long& val) const
|
||||
{
|
||||
val = NumberParser::parse64(toStdString());
|
||||
}
|
||||
|
||||
void convert(unsigned long long& val) const
|
||||
{
|
||||
val = NumberParser::parseUnsigned64(toStdString());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void convert(bool& val) const
|
||||
{
|
||||
static const std::string VAL_FALSE("false");
|
||||
@ -2770,6 +2995,9 @@ private:
|
||||
};
|
||||
|
||||
|
||||
#ifndef POCO_INT64_IS_LONG
|
||||
|
||||
|
||||
template <>
|
||||
class VarHolderImpl<long>: public VarHolder
|
||||
{
|
||||
@ -3046,6 +3274,308 @@ private:
|
||||
};
|
||||
|
||||
|
||||
#else // if defined (POCO_INT64_IS_LONG)
|
||||
|
||||
|
||||
template <>
|
||||
class VarHolderImpl<long long>: public VarHolder
|
||||
{
|
||||
public:
|
||||
VarHolderImpl(long long val): _val(val)
|
||||
{
|
||||
}
|
||||
|
||||
~VarHolderImpl()
|
||||
{
|
||||
}
|
||||
|
||||
const std::type_info& type() const
|
||||
{
|
||||
return typeid(long long);
|
||||
}
|
||||
|
||||
void convert(Int8& val) const
|
||||
{
|
||||
convertToSmaller(_val, val);
|
||||
}
|
||||
|
||||
void convert(Int16& val) const
|
||||
{
|
||||
convertToSmaller(_val, val);
|
||||
}
|
||||
|
||||
void convert(Int32& val) const
|
||||
{
|
||||
convertToSmaller(_val, val);
|
||||
}
|
||||
|
||||
void convert(Int64& val) const
|
||||
{
|
||||
val = static_cast<Int64>(_val);
|
||||
}
|
||||
|
||||
void convert(UInt8& val) const
|
||||
{
|
||||
convertSignedToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
void convert(UInt16& val) const
|
||||
{
|
||||
convertSignedToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
void convert(UInt32& val) const
|
||||
{
|
||||
convertSignedToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
void convert(UInt64& val) const
|
||||
{
|
||||
convertSignedToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
void convert(long long& val) const
|
||||
{
|
||||
val = _val;
|
||||
}
|
||||
|
||||
void convert(unsigned long long& val) const
|
||||
{
|
||||
convertSignedToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
void convert(bool& val) const
|
||||
{
|
||||
val = (_val != 0);
|
||||
}
|
||||
|
||||
void convert(float& val) const
|
||||
{
|
||||
val = static_cast<float>(_val);
|
||||
}
|
||||
|
||||
void convert(double& val) const
|
||||
{
|
||||
val = static_cast<double>(_val);
|
||||
}
|
||||
|
||||
void convert(char& val) const
|
||||
{
|
||||
UInt8 tmp;
|
||||
convert(tmp);
|
||||
val = static_cast<char>(tmp);
|
||||
}
|
||||
|
||||
void convert(std::string& val) const
|
||||
{
|
||||
val = NumberFormatter::format(_val);
|
||||
}
|
||||
|
||||
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
|
||||
{
|
||||
return cloneHolder(pVarHolder, _val);
|
||||
}
|
||||
|
||||
const long long& value() const
|
||||
{
|
||||
return _val;
|
||||
}
|
||||
|
||||
bool isArray() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isStruct() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isInteger() const
|
||||
{
|
||||
return std::numeric_limits<long long>::is_integer;
|
||||
}
|
||||
|
||||
bool isSigned() const
|
||||
{
|
||||
return std::numeric_limits<long long>::is_signed;
|
||||
}
|
||||
|
||||
bool isNumeric() const
|
||||
{
|
||||
return std::numeric_limits<long long>::is_specialized;
|
||||
}
|
||||
|
||||
bool isBoolean() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isString() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
VarHolderImpl();
|
||||
VarHolderImpl(const VarHolderImpl&);
|
||||
VarHolderImpl& operator = (const VarHolderImpl&);
|
||||
|
||||
long long _val;
|
||||
};
|
||||
|
||||
|
||||
template <>
|
||||
class VarHolderImpl<unsigned long long>: public VarHolder
|
||||
{
|
||||
public:
|
||||
VarHolderImpl(unsigned long long val): _val(val)
|
||||
{
|
||||
}
|
||||
|
||||
~VarHolderImpl()
|
||||
{
|
||||
}
|
||||
|
||||
const std::type_info& type() const
|
||||
{
|
||||
return typeid(unsigned long long);
|
||||
}
|
||||
|
||||
void convert(Int8& val) const
|
||||
{
|
||||
convertUnsignedToSigned(_val, val);
|
||||
}
|
||||
|
||||
void convert(Int16& val) const
|
||||
{
|
||||
convertUnsignedToSigned(_val, val);
|
||||
}
|
||||
|
||||
void convert(Int32& val) const
|
||||
{
|
||||
convertUnsignedToSigned(_val, val);
|
||||
}
|
||||
|
||||
void convert(Int64& val) const
|
||||
{
|
||||
convertUnsignedToSigned(_val, val);
|
||||
}
|
||||
|
||||
void convert(UInt8& val) const
|
||||
{
|
||||
convertToSmallerUnsigned(_val, val);
|
||||
}
|
||||
|
||||
void convert(UInt16& val) const
|
||||
{
|
||||
convertToSmallerUnsigned(_val, val);
|
||||
}
|
||||
|
||||
void convert(UInt32& val) const
|
||||
{
|
||||
convertToSmallerUnsigned(_val, val);
|
||||
}
|
||||
|
||||
void convert(UInt64& val) const
|
||||
{
|
||||
val = static_cast<UInt64>(_val);
|
||||
}
|
||||
|
||||
void convert(long long& val) const
|
||||
{
|
||||
convertUnsignedToSigned(_val, val);
|
||||
}
|
||||
|
||||
void convert(unsigned long long& val) const
|
||||
{
|
||||
val = _val;
|
||||
}
|
||||
|
||||
void convert(bool& val) const
|
||||
{
|
||||
val = (_val != 0);
|
||||
}
|
||||
|
||||
void convert(float& val) const
|
||||
{
|
||||
val = static_cast<float>(_val);
|
||||
}
|
||||
|
||||
void convert(double& val) const
|
||||
{
|
||||
val = static_cast<double>(_val);
|
||||
}
|
||||
|
||||
void convert(char& val) const
|
||||
{
|
||||
UInt8 tmp;
|
||||
convert(tmp);
|
||||
val = static_cast<char>(tmp);
|
||||
}
|
||||
|
||||
void convert(std::string& val) const
|
||||
{
|
||||
val = NumberFormatter::format(_val);
|
||||
}
|
||||
|
||||
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
|
||||
{
|
||||
return cloneHolder(pVarHolder, _val);
|
||||
}
|
||||
|
||||
const unsigned long long& value() const
|
||||
{
|
||||
return _val;
|
||||
}
|
||||
|
||||
bool isArray() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isStruct() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isInteger() const
|
||||
{
|
||||
return std::numeric_limits<unsigned long long>::is_integer;
|
||||
}
|
||||
|
||||
bool isSigned() const
|
||||
{
|
||||
return std::numeric_limits<unsigned long long>::is_signed;
|
||||
}
|
||||
|
||||
bool isNumeric() const
|
||||
{
|
||||
return std::numeric_limits<unsigned long long>::is_specialized;
|
||||
}
|
||||
|
||||
bool isBoolean() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isString() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
VarHolderImpl();
|
||||
VarHolderImpl(const VarHolderImpl&);
|
||||
VarHolderImpl& operator = (const VarHolderImpl&);
|
||||
|
||||
unsigned long long _val;
|
||||
};
|
||||
|
||||
|
||||
#endif // POCO_INT64_IS_LONG
|
||||
|
||||
|
||||
template <typename T>
|
||||
class VarHolderImpl<std::vector<T>>: public VarHolder
|
||||
{
|
||||
@ -3293,6 +3823,20 @@ public:
|
||||
val = _val.timestamp().epochMicroseconds();
|
||||
}
|
||||
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
void convert(long long& val) const
|
||||
{
|
||||
val = _val.timestamp().epochMicroseconds();
|
||||
}
|
||||
|
||||
void convert(unsigned long long& val) const
|
||||
{
|
||||
val = _val.timestamp().epochMicroseconds();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void convert(std::string& val) const
|
||||
{
|
||||
val = DateTimeFormatter::format(_val, Poco::DateTimeFormat::ISO8601_FORMAT);
|
||||
@ -3409,6 +3953,20 @@ public:
|
||||
val = _val.timestamp().epochMicroseconds();
|
||||
}
|
||||
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
void convert(long long& val) const
|
||||
{
|
||||
val = _val.timestamp().epochMicroseconds();
|
||||
}
|
||||
|
||||
void convert(unsigned long long& val) const
|
||||
{
|
||||
val = _val.timestamp().epochMicroseconds();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void convert(std::string& val) const
|
||||
{
|
||||
val = DateTimeFormatter::format(_val, Poco::DateTimeFormat::ISO8601_FORMAT);
|
||||
@ -3525,6 +4083,20 @@ public:
|
||||
val = _val.epochMicroseconds();
|
||||
}
|
||||
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
void convert(long long& val) const
|
||||
{
|
||||
val = _val.epochMicroseconds();
|
||||
}
|
||||
|
||||
void convert(unsigned long long& val) const
|
||||
{
|
||||
val = _val.epochMicroseconds();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void convert(std::string& val) const
|
||||
{
|
||||
val = DateTimeFormatter::format(_val, Poco::DateTimeFormat::ISO8601_FORMAT);
|
||||
|
@ -51,12 +51,18 @@ public:
|
||||
VarIterator(const VarIterator& other);
|
||||
/// Creates a copy of other VarIterator.
|
||||
|
||||
VarIterator(VarIterator&& other) noexcept;
|
||||
/// Moves another VarIterator.
|
||||
|
||||
~VarIterator();
|
||||
/// Destroys the VarIterator.
|
||||
|
||||
VarIterator& operator = (const VarIterator& other);
|
||||
/// Assigns the other VarIterator.
|
||||
|
||||
VarIterator& operator = (VarIterator&& other) noexcept;
|
||||
/// Assigns the other VarIterator.
|
||||
|
||||
bool operator == (const VarIterator& other) const;
|
||||
/// Equality operator.
|
||||
|
||||
@ -138,8 +144,7 @@ inline bool VarIterator::operator != (const VarIterator& other) const
|
||||
namespace std
|
||||
{
|
||||
template<>
|
||||
inline void swap<Poco::Dynamic::VarIterator>(Poco::Dynamic::VarIterator& s1,
|
||||
Poco::Dynamic::VarIterator& s2)
|
||||
inline void swap<Poco::Dynamic::VarIterator>(Poco::Dynamic::VarIterator& s1, Poco::Dynamic::VarIterator& s2) noexcept
|
||||
/// Full template specialization of std:::swap for VarIterator
|
||||
{
|
||||
s1.swap(s2);
|
||||
|
@ -151,6 +151,57 @@ public:
|
||||
/// resulting string.
|
||||
|
||||
#ifdef POCO_HAVE_INT64
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
static std::string format(long long value);
|
||||
/// Formats a 64-bit integer value in decimal notation.
|
||||
|
||||
static std::string format(long long value, int width);
|
||||
/// Formats a 64-bit integer value in decimal notation,
|
||||
/// right justified in a field having at least the specified width.
|
||||
|
||||
static std::string format0(long long value, int width);
|
||||
/// Formats a 64-bit integer value in decimal notation,
|
||||
/// right justified and zero-padded in a field having at least
|
||||
/// the specified width.
|
||||
|
||||
static std::string formatHex(long long value, bool prefix = false);
|
||||
/// Formats a 64-bit integer value in hexadecimal notation.
|
||||
/// If prefix is true, "0x" prefix is prepended to the
|
||||
/// resulting string.
|
||||
/// The value is treated as unsigned.
|
||||
|
||||
static std::string formatHex(long long value, int width, bool prefix = false);
|
||||
/// Formats a 64-bit integer value in hexadecimal notation,
|
||||
/// right justified and zero-padded in a field having at least
|
||||
/// the specified width.
|
||||
/// The value is treated as unsigned.
|
||||
/// If prefix is true, "0x" prefix is prepended to the resulting string.
|
||||
|
||||
static std::string format(unsigned long long value);
|
||||
/// Formats an unsigned 64-bit integer value in decimal notation.
|
||||
|
||||
static std::string format(unsigned long long value, int width);
|
||||
/// Formats an unsigned 64-bit integer value in decimal notation,
|
||||
/// right justified in a field having at least the specified width.
|
||||
|
||||
static std::string format0(unsigned long long value, int width);
|
||||
/// Formats an unsigned 64-bit integer value in decimal notation,
|
||||
/// right justified and zero-padded in a field having at least the
|
||||
/// specified width.
|
||||
|
||||
static std::string formatHex(unsigned long long value, bool prefix = false);
|
||||
/// Formats a 64-bit integer value in hexadecimal notation.
|
||||
/// If prefix is true, "0x" prefix is prepended to the
|
||||
/// resulting string.
|
||||
|
||||
static std::string formatHex(unsigned long long value, int width, bool prefix = false);
|
||||
/// Formats a 64-bit integer value in hexadecimal notation,
|
||||
/// right justified and zero-padded in a field having at least
|
||||
/// the specified width. If prefix is true, "0x" prefix is
|
||||
/// prepended to the resulting string.
|
||||
|
||||
#else // ifndef POCO_INT64_IS_LONG
|
||||
|
||||
static std::string format(Int64 value);
|
||||
/// Formats a 64-bit integer value in decimal notation.
|
||||
@ -166,7 +217,7 @@ public:
|
||||
|
||||
static std::string formatHex(Int64 value, bool prefix = false);
|
||||
/// Formats a 64-bit integer value in hexadecimal notation.
|
||||
/// If prefix is true, "0x" prefix is prepended to the
|
||||
/// If prefix is true, "0x" prefix is prepended to the
|
||||
/// resulting string.
|
||||
/// The value is treated as unsigned.
|
||||
|
||||
@ -200,6 +251,7 @@ public:
|
||||
/// the specified width. If prefix is true, "0x" prefix is
|
||||
/// prepended to the resulting string.
|
||||
|
||||
#endif // ifdef POCO_INT64_IS_LONG
|
||||
#endif // ifdef POCO_HAVE_INT64
|
||||
|
||||
static std::string format(float value);
|
||||
@ -326,6 +378,51 @@ public:
|
||||
/// specified width.
|
||||
|
||||
#ifdef POCO_HAVE_INT64
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
static void append(std::string& str, long long value);
|
||||
/// Formats a 64-bit integer value in decimal notation.
|
||||
|
||||
static void append(std::string& str, long long value, int width);
|
||||
/// Formats a 64-bit integer value in decimal notation,
|
||||
/// right justified in a field having at least the specified width.
|
||||
|
||||
static void append0(std::string& str, long long value, int width);
|
||||
/// Formats a 64-bit integer value in decimal notation,
|
||||
/// right justified and zero-padded in a field having at least
|
||||
/// the specified width.
|
||||
|
||||
static void appendHex(std::string& str, long long value);
|
||||
/// Formats a 64-bit integer value in hexadecimal notation.
|
||||
/// The value is treated as unsigned.
|
||||
|
||||
static void appendHex(std::string& str, long long value, int width);
|
||||
/// Formats a 64-bit integer value in hexadecimal notation,
|
||||
/// right justified and zero-padded in a field having at least
|
||||
/// the specified width.
|
||||
/// The value is treated as unsigned.
|
||||
|
||||
static void append(std::string& str, unsigned long long value);
|
||||
/// Formats an unsigned 64-bit integer value in decimal notation.
|
||||
|
||||
static void append(std::string& str, unsigned long long value, int width);
|
||||
/// Formats an unsigned 64-bit integer value in decimal notation,
|
||||
/// right justified in a field having at least the specified width.
|
||||
|
||||
static void append0(std::string& str, unsigned long long value, int width);
|
||||
/// Formats an unsigned 64-bit integer value in decimal notation,
|
||||
/// right justified and zero-padded in a field having at least the
|
||||
/// specified width.
|
||||
|
||||
static void appendHex(std::string& str, unsigned long long value);
|
||||
/// Formats a 64-bit integer value in hexadecimal notation.
|
||||
|
||||
static void appendHex(std::string& str, unsigned long long value, int width);
|
||||
/// Formats a 64-bit integer value in hexadecimal notation,
|
||||
/// right justified and zero-padded in a field having at least
|
||||
/// the specified width.
|
||||
|
||||
#else // ifndef POCO_INT64_IS_LONG
|
||||
|
||||
static void append(std::string& str, Int64 value);
|
||||
/// Formats a 64-bit integer value in decimal notation.
|
||||
@ -369,6 +466,7 @@ public:
|
||||
/// right justified and zero-padded in a field having at least
|
||||
/// the specified width.
|
||||
|
||||
#endif // ifdef POCO_INT64_IS_LONG
|
||||
#endif // ifdef POCO_HAVE_INT64
|
||||
|
||||
static void append(std::string& str, float value);
|
||||
@ -571,6 +669,90 @@ inline std::string NumberFormatter::formatHex(unsigned long value, int width, bo
|
||||
|
||||
|
||||
#ifdef POCO_HAVE_INT64
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
|
||||
inline std::string NumberFormatter::format(long long value)
|
||||
{
|
||||
std::string result;
|
||||
intToStr(value, 10, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
inline std::string NumberFormatter::format(long long value, int width)
|
||||
{
|
||||
std::string result;
|
||||
intToStr(value, 10, result, false, width, ' ');
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
inline std::string NumberFormatter::format0(long long value, int width)
|
||||
{
|
||||
std::string result;
|
||||
intToStr(value, 10, result, false, width, '0');
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
inline std::string NumberFormatter::formatHex(long long value, bool prefix)
|
||||
{
|
||||
std::string result;
|
||||
uIntToStr(static_cast<unsigned long long>(value), 0x10, result, prefix);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
inline std::string NumberFormatter::formatHex(long long value, int width, bool prefix)
|
||||
{
|
||||
std::string result;
|
||||
uIntToStr(static_cast<unsigned long long>(value), 0x10, result, prefix, width, '0');
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
inline std::string NumberFormatter::format(unsigned long long value)
|
||||
{
|
||||
std::string result;
|
||||
uIntToStr(value, 10, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
inline std::string NumberFormatter::format(unsigned long long value, int width)
|
||||
{
|
||||
std::string result;
|
||||
uIntToStr(value, 10, result, false, width, ' ');
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
inline std::string NumberFormatter::format0(unsigned long long value, int width)
|
||||
{
|
||||
std::string result;
|
||||
uIntToStr(value, 10, result, false, width, '0');
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
inline std::string NumberFormatter::formatHex(unsigned long long value, bool prefix)
|
||||
{
|
||||
std::string result;
|
||||
uIntToStr(value, 0x10, result, prefix);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
inline std::string NumberFormatter::formatHex(unsigned long long value, int width, bool prefix)
|
||||
{
|
||||
std::string result;
|
||||
uIntToStr(value, 0x10, result, prefix, width, '0');
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
#else // ifndef POCO_LONG_IS_64_BIT
|
||||
|
||||
|
||||
inline std::string NumberFormatter::format(Int64 value)
|
||||
@ -653,6 +835,7 @@ inline std::string NumberFormatter::formatHex(UInt64 value, int width, bool pref
|
||||
}
|
||||
|
||||
|
||||
#endif // ifdef POCO_INT64_IS_LONG
|
||||
#endif // ifdef POCO_HAVE_INT64
|
||||
|
||||
|
||||
|
@ -25,15 +25,15 @@
|
||||
namespace Poco {
|
||||
|
||||
|
||||
using Int8 = std::int8_t;
|
||||
using UInt8 = std::uint8_t;
|
||||
using Int16 = std::int16_t;
|
||||
using UInt16 = std::uint16_t;
|
||||
using Int32 = std::int32_t;
|
||||
using UInt32 = std::uint32_t;
|
||||
using Int64 = std::int64_t;
|
||||
using UInt64 = std::uint64_t;
|
||||
using IntPtr = std::intptr_t;
|
||||
using Int8 = std::int8_t;
|
||||
using UInt8 = std::uint8_t;
|
||||
using Int16 = std::int16_t;
|
||||
using UInt16 = std::uint16_t;
|
||||
using Int32 = std::int32_t;
|
||||
using UInt32 = std::uint32_t;
|
||||
using Int64 = std::int64_t;
|
||||
using UInt64 = std::uint64_t;
|
||||
using IntPtr = std::intptr_t;
|
||||
using UIntPtr = std::uintptr_t;
|
||||
|
||||
|
||||
@ -49,19 +49,12 @@ using UIntPtr = std::uintptr_t;
|
||||
#if defined(__LP64__)
|
||||
#define POCO_PTR_IS_64_BIT 1
|
||||
#define POCO_LONG_IS_64_BIT 1
|
||||
#if POCO_OS == POCO_OS_LINUX
|
||||
#define POCO_INT64_IS_LONG 1
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#define POCO_HAVE_INT64 1
|
||||
#elif defined(__DECCXX)
|
||||
#define POCO_PTR_IS_64_BIT 1
|
||||
#define POCO_LONG_IS_64_BIT 1
|
||||
#define POCO_HAVE_INT64 1
|
||||
#elif defined(__HP_aCC)
|
||||
#if defined(__LP64__)
|
||||
#define POCO_PTR_IS_64_BIT 1
|
||||
#define POCO_LONG_IS_64_BIT 1
|
||||
#endif
|
||||
#define POCO_HAVE_INT64 1
|
||||
#elif defined(__SUNPRO_CC)
|
||||
#if defined(__sparcv9)
|
||||
#define POCO_PTR_IS_64_BIT 1
|
||||
|
@ -173,7 +173,7 @@ BinaryReader& BinaryReader::operator >> (double& value)
|
||||
#if defined(POCO_HAVE_INT64)
|
||||
|
||||
|
||||
BinaryReader& BinaryReader::operator >> (Int64& value)
|
||||
BinaryReader& BinaryReader::operator >> (long long& value)
|
||||
{
|
||||
_istr.read((char*) &value, sizeof(value));
|
||||
if (_flipBytes) value = ByteOrder::flipBytes(value);
|
||||
@ -181,7 +181,7 @@ BinaryReader& BinaryReader::operator >> (Int64& value)
|
||||
}
|
||||
|
||||
|
||||
BinaryReader& BinaryReader::operator >> (UInt64& value)
|
||||
BinaryReader& BinaryReader::operator >> (unsigned long long& value)
|
||||
{
|
||||
_istr.read((char*) &value, sizeof(value));
|
||||
if (_flipBytes) value = ByteOrder::flipBytes(value);
|
||||
|
@ -215,11 +215,11 @@ BinaryWriter& BinaryWriter::operator << (double value)
|
||||
#if defined(POCO_HAVE_INT64)
|
||||
|
||||
|
||||
BinaryWriter& BinaryWriter::operator << (Int64 value)
|
||||
BinaryWriter& BinaryWriter::operator << (long long value)
|
||||
{
|
||||
if (_flipBytes)
|
||||
{
|
||||
Int64 fValue = ByteOrder::flipBytes(value);
|
||||
Int64 fValue = ByteOrder::flipBytes(static_cast<Int64>(value));
|
||||
_ostr.write((const char*) &fValue, sizeof(fValue));
|
||||
}
|
||||
else
|
||||
@ -230,11 +230,11 @@ BinaryWriter& BinaryWriter::operator << (Int64 value)
|
||||
}
|
||||
|
||||
|
||||
BinaryWriter& BinaryWriter::operator << (UInt64 value)
|
||||
BinaryWriter& BinaryWriter::operator << (unsigned long long value)
|
||||
{
|
||||
if (_flipBytes)
|
||||
{
|
||||
UInt64 fValue = ByteOrder::flipBytes(value);
|
||||
UInt64 fValue = ByteOrder::flipBytes(static_cast<UInt64>(value));
|
||||
_ostr.write((const char*) &fValue, sizeof(fValue));
|
||||
}
|
||||
else
|
||||
|
@ -235,6 +235,100 @@ void NumberFormatter::appendHex(std::string& str, unsigned long value, int width
|
||||
|
||||
|
||||
#ifdef POCO_HAVE_INT64
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
|
||||
void NumberFormatter::append(std::string& str, long long value)
|
||||
{
|
||||
char result[NF_MAX_INT_STRING_LEN];
|
||||
std::size_t sz = NF_MAX_INT_STRING_LEN;
|
||||
intToStr(value, 10, result, sz);
|
||||
str.append(result, sz);
|
||||
}
|
||||
|
||||
|
||||
void NumberFormatter::append(std::string& str, long long value, int width)
|
||||
{
|
||||
char result[NF_MAX_INT_STRING_LEN];
|
||||
std::size_t sz = NF_MAX_INT_STRING_LEN;
|
||||
intToStr(value, 10, result, sz, false, width, '0');
|
||||
str.append(result, sz);
|
||||
}
|
||||
|
||||
|
||||
void NumberFormatter::append0(std::string& str, long long value, int width)
|
||||
{
|
||||
char result[NF_MAX_INT_STRING_LEN];
|
||||
std::size_t sz = NF_MAX_INT_STRING_LEN;
|
||||
intToStr(value, 10, result, sz, false, width, '0');
|
||||
str.append(result, sz);
|
||||
}
|
||||
|
||||
|
||||
void NumberFormatter::appendHex(std::string& str, long long value)
|
||||
{
|
||||
char result[NF_MAX_INT_STRING_LEN];
|
||||
std::size_t sz = NF_MAX_INT_STRING_LEN;
|
||||
uIntToStr(static_cast<unsigned long long>(value), 0x10, result, sz);
|
||||
str.append(result, sz);
|
||||
}
|
||||
|
||||
|
||||
void NumberFormatter::appendHex(std::string& str, long long value, int width)
|
||||
{
|
||||
char result[NF_MAX_INT_STRING_LEN];
|
||||
std::size_t sz = NF_MAX_INT_STRING_LEN;
|
||||
uIntToStr(static_cast<unsigned long long>(value), 0x10, result, sz, false, width, '0');
|
||||
str.append(result, sz);
|
||||
}
|
||||
|
||||
|
||||
void NumberFormatter::append(std::string& str, unsigned long long value)
|
||||
{
|
||||
char result[NF_MAX_INT_STRING_LEN];
|
||||
std::size_t sz = NF_MAX_INT_STRING_LEN;
|
||||
uIntToStr(value, 10, result, sz);
|
||||
str.append(result, sz);
|
||||
}
|
||||
|
||||
|
||||
void NumberFormatter::append(std::string& str, unsigned long long value, int width)
|
||||
{
|
||||
char result[NF_MAX_INT_STRING_LEN];
|
||||
std::size_t sz = NF_MAX_INT_STRING_LEN;
|
||||
uIntToStr(value, 10, result, sz, false, width, '0');
|
||||
str.append(result, sz);
|
||||
}
|
||||
|
||||
|
||||
void NumberFormatter::append0(std::string& str, unsigned long long value, int width)
|
||||
{
|
||||
char result[NF_MAX_INT_STRING_LEN];
|
||||
std::size_t sz = NF_MAX_INT_STRING_LEN;
|
||||
uIntToStr(value, 10, result, sz, false, width, '0');
|
||||
str.append(result, sz);
|
||||
}
|
||||
|
||||
|
||||
void NumberFormatter::appendHex(std::string& str, unsigned long long value)
|
||||
{
|
||||
char result[NF_MAX_INT_STRING_LEN];
|
||||
std::size_t sz = NF_MAX_INT_STRING_LEN;
|
||||
uIntToStr(value, 0x10, result, sz);
|
||||
str.append(result, sz);
|
||||
}
|
||||
|
||||
|
||||
void NumberFormatter::appendHex(std::string& str, unsigned long long value, int width)
|
||||
{
|
||||
char result[NF_MAX_INT_STRING_LEN];
|
||||
std::size_t sz = NF_MAX_INT_STRING_LEN;
|
||||
uIntToStr(value, 0x10, result, sz, false, width, '0');
|
||||
str.append(result, sz);
|
||||
}
|
||||
|
||||
|
||||
#else // ifndef POCO_LONG_IS_64_BIT
|
||||
|
||||
|
||||
void NumberFormatter::append(std::string& str, Int64 value)
|
||||
@ -327,6 +421,7 @@ void NumberFormatter::appendHex(std::string& str, UInt64 value, int width)
|
||||
}
|
||||
|
||||
|
||||
#endif // ifdef POCO_INT64_IS_LONG
|
||||
#endif // ifdef POCO_HAVE_INT64
|
||||
|
||||
|
||||
|
@ -41,6 +41,13 @@ VarIterator::VarIterator(const VarIterator& other):
|
||||
}
|
||||
|
||||
|
||||
VarIterator::VarIterator(VarIterator&& other) noexcept:
|
||||
_pVar(std::move(other._pVar)),
|
||||
_position(std::move(other._position))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
VarIterator::~VarIterator()
|
||||
{
|
||||
}
|
||||
@ -54,6 +61,14 @@ VarIterator& VarIterator::operator = (const VarIterator& other)
|
||||
}
|
||||
|
||||
|
||||
VarIterator& VarIterator::operator = (VarIterator&& other) noexcept
|
||||
{
|
||||
_pVar = std::move(other._pVar);
|
||||
_position = std::move(other._position);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
void VarIterator::swap(VarIterator& other)
|
||||
{
|
||||
using std::swap;
|
||||
|
Loading…
x
Reference in New Issue
Block a user