fixed type overloads

This commit is contained in:
Günter Obiltschnig 2020-01-09 18:02:29 +01:00
parent c111fc89f6
commit aa46e9b6e4
34 changed files with 958 additions and 50 deletions

View File

@ -64,11 +64,13 @@ public:
virtual void bind(std::size_t pos, const Poco::UInt64& val, Direction dir); virtual void bind(std::size_t pos, const Poco::UInt64& val, Direction dir);
/// Binds an UInt64. /// Binds an UInt64.
#ifndef POCO_INT64_IS_LONG
virtual void bind(std::size_t pos, const long& val, Direction dir = PD_IN); virtual void bind(std::size_t pos, const long& val, Direction dir = PD_IN);
/// Binds a long. /// Binds a long.
virtual void bind(std::size_t pos, const unsigned long& val, Direction dir = PD_IN); virtual void bind(std::size_t pos, const unsigned long& val, Direction dir = PD_IN);
/// Binds an unsigned long. /// Binds an unsigned long.
#endif
virtual void bind(std::size_t pos, const bool& val, Direction dir); virtual void bind(std::size_t pos, const bool& val, Direction dir);
/// Binds a boolean. /// Binds a boolean.

View File

@ -72,11 +72,13 @@ public:
virtual bool extract(std::size_t pos, Poco::UInt64& val); virtual bool extract(std::size_t pos, Poco::UInt64& val);
/// Extracts an UInt64. /// Extracts an UInt64.
#ifndef POCO_INT64_IS_LONG
virtual bool extract(std::size_t pos, long& val); virtual bool extract(std::size_t pos, long& val);
/// Extracts a long. Returns false if null was received. /// Extracts a long. Returns false if null was received.
virtual bool extract(std::size_t pos, unsigned long& val); virtual bool extract(std::size_t pos, unsigned long& val);
/// Extracts an unsigned long. Returns false if null was received. /// Extracts an unsigned long. Returns false if null was received.
#endif
virtual bool extract(std::size_t pos, bool& val); virtual bool extract(std::size_t pos, bool& val);
/// Extracts a boolean. /// Extracts a boolean.
@ -196,6 +198,7 @@ public:
virtual bool extract(std::size_t pos, std::list<Poco::UInt64>& val); virtual bool extract(std::size_t pos, std::list<Poco::UInt64>& val);
/// Extracts an UInt64 list. /// Extracts an UInt64 list.
#ifndef POCO_INT64_IS_LONG
virtual bool extract(std::size_t pos, std::vector<long>& val); virtual bool extract(std::size_t pos, std::vector<long>& val);
/// Extracts a long vector. /// Extracts a long vector.
@ -204,6 +207,7 @@ public:
virtual bool extract(std::size_t pos, std::list<long>& val); virtual bool extract(std::size_t pos, std::list<long>& val);
/// Extracts a long list. /// Extracts a long list.
#endif
virtual bool extract(std::size_t pos, std::vector<bool>& val); virtual bool extract(std::size_t pos, std::vector<bool>& val);
/// Extracts a boolean vector. /// Extracts a boolean vector.

View File

@ -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) void Binder::bind(std::size_t pos, const long& val, Direction dir)
{ {
poco_assert(dir == PD_IN); 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); poco_assert(dir == PD_IN);
realBind(pos, MYSQL_TYPE_LONG, &val, 0, true); 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) void Binder::bind(std::size_t pos, const bool& val, Direction dir)

View File

@ -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) bool Extractor::extract(std::size_t pos, long& val)
{ {
return realExtractFixed(pos, MYSQL_TYPE_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); return realExtractFixed(pos, MYSQL_TYPE_LONG, &val, true);
} }
#endif
bool Extractor::extract(std::size_t pos, bool& val) 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>& ) bool Extractor::extract(std::size_t , std::vector<long>& )
{ {
throw NotImplementedException("std::vector extractor must be implemented."); 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."); throw NotImplementedException("std::list extractor must be implemented.");
} }
#endif
bool Extractor::extract(std::size_t , std::vector<bool>& ) bool Extractor::extract(std::size_t , std::vector<bool>& )

View File

@ -173,6 +173,7 @@ public:
void bind(std::size_t pos, const std::list<Poco::UInt64>& val, Direction dir); void bind(std::size_t pos, const std::list<Poco::UInt64>& val, Direction dir);
/// Binds an UInt64 list. /// Binds an UInt64 list.
#ifndef POCO_INT64_IS_LONG
void bind(std::size_t pos, const long& val, Direction dir); void bind(std::size_t pos, const long& val, Direction dir);
/// Binds a long. /// Binds a long.
@ -187,6 +188,7 @@ public:
void bind(std::size_t pos, const std::list<long>& val, Direction dir); void bind(std::size_t pos, const std::list<long>& val, Direction dir);
/// Binds a long list. /// Binds a long list.
#endif
void bind(std::size_t pos, const bool& val, Direction dir); void bind(std::size_t pos, const bool& val, Direction dir);
/// Binds a boolean. /// 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) inline void Binder::bind(std::size_t pos, const long& val, Direction dir)
{ {
bindImpl(pos, val, SQL_C_SLONG, 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); bindImplContainer(pos, val, SQL_C_SLONG, dir);
} }
#endif
inline void Binder::bind(std::size_t pos, const float& val, Direction dir) inline void Binder::bind(std::size_t pos, const float& val, Direction dir)

View File

@ -155,6 +155,7 @@ public:
bool extract(std::size_t pos, std::list<Poco::UInt64>& val); bool extract(std::size_t pos, std::list<Poco::UInt64>& val);
/// Extracts an UInt64 list. /// Extracts an UInt64 list.
#ifndef POCO_INT64_IS_LONG
bool extract(std::size_t pos, long& val); bool extract(std::size_t pos, long& val);
/// Extracts a long. /// Extracts a long.
@ -169,6 +170,7 @@ public:
bool extract(std::size_t pos, std::list<long>& val); bool extract(std::size_t pos, std::list<long>& val);
/// Extracts a long list. /// Extracts a long list.
#endif
bool extract(std::size_t pos, bool& val); bool extract(std::size_t pos, bool& val);
/// Extracts a boolean. /// Extracts a boolean.

View File

@ -204,6 +204,7 @@ public:
void prepare(std::size_t pos, const std::list<Poco::UInt64>& val); void prepare(std::size_t pos, const std::list<Poco::UInt64>& val);
/// Prepares an UInt64 list. /// Prepares an UInt64 list.
#ifndef POCO_INT64_IS_LONG
void prepare(std::size_t pos, const long& val); void prepare(std::size_t pos, const long& val);
/// Prepares a long. /// Prepares a long.
@ -218,6 +219,7 @@ public:
void prepare(std::size_t pos, const std::list<long>& val); void prepare(std::size_t pos, const std::list<long>& val);
/// Prepares a long list. /// Prepares a long list.
#endif
void prepare(std::size_t pos, const bool& val); void prepare(std::size_t pos, const bool& val);
/// Prepares a boolean. /// 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&) inline void Preparator::prepare(std::size_t pos, const long&)
{ {
prepareFixedSize<long>(pos, SQL_C_SLONG); 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()); prepareFixedSize<long>(pos, SQL_C_SLONG, val.size());
} }
#endif
inline void Preparator::prepare(std::size_t pos, const bool&) inline void Preparator::prepare(std::size_t pos, const bool&)

View File

@ -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) bool Extractor::extract(std::size_t pos, long& val)
{ {
if (Preparator::DE_MANUAL == _dataExtraction) if (Preparator::DE_MANUAL == _dataExtraction)
@ -618,6 +619,7 @@ bool Extractor::extract(std::size_t pos, std::list<long>& val)
else else
throw InvalidAccessException("Direct container extraction only allowed for bound mode."); throw InvalidAccessException("Direct container extraction only allowed for bound mode.");
} }
#endif
bool Extractor::extract(std::size_t pos, double& val) bool Extractor::extract(std::size_t pos, double& val)

View File

@ -70,15 +70,13 @@ public:
virtual void bind(std::size_t pos, const Poco::UInt64& val, Direction dir = PD_IN); virtual void bind(std::size_t pos, const Poco::UInt64& val, Direction dir = PD_IN);
/// Binds an UInt64. /// 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); virtual void bind(std::size_t pos, const long& val, Direction dir = PD_IN);
/// Binds a long. /// Binds a long.
virtual void bind(std::size_t pos, const unsigned long& val, Direction dir = PD_IN); virtual void bind(std::size_t pos, const unsigned long& val, Direction dir = PD_IN);
/// Binds an unsigned long. /// Binds an unsigned long.
#endif
#endif // POCO_LONG_IS_64_BIT
virtual void bind(std::size_t pos, const bool& val, Direction dir = PD_IN); virtual void bind(std::size_t pos, const bool& val, Direction dir = PD_IN);
/// Binds a boolean. /// Binds a boolean.

View File

@ -78,11 +78,10 @@ public:
virtual bool extract(std::size_t pos, Poco::UInt64& val); virtual bool extract(std::size_t pos, Poco::UInt64& val);
/// Extracts an UInt64. /// Extracts an UInt64.
#ifndef POCO_LONG_IS_64_BIT #ifndef POCO_INT64_IS_LONG
virtual bool extract(std::size_t pos, long& val); virtual bool extract(std::size_t pos, long& val);
/// Extracts a long. Returns false if null was received. /// Extracts a long. Returns false if null was received.
virtual bool extract(std::size_t pos, unsigned long& val); virtual bool extract(std::size_t pos, unsigned long& val);
/// Extracts an unsigned long. Returns false if null was received. /// Extracts an unsigned long. Returns false if null was received.
#endif #endif
@ -205,7 +204,7 @@ public:
virtual bool extract(std::size_t pos, std::list<Poco::UInt64>& val); virtual bool extract(std::size_t pos, std::list<Poco::UInt64>& val);
/// Extracts an UInt64 list. /// 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); virtual bool extract(std::size_t pos, std::vector<long>& val);
/// Extracts a long vector. /// Extracts a long vector.

View File

@ -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) void Binder::bind(std::size_t pos, const long& val, Direction dir)
{ {
poco_assert(dir == PD_IN); 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); poco_assert(dir == PD_IN);
realBind(pos, Poco::Data::MetaColumn::FDT_UINT64, &val, sizeof(Poco::UInt64)); realBind(pos, Poco::Data::MetaColumn::FDT_UINT64, &val, sizeof(Poco::UInt64));
} }
#endif
#endif // POCO_LONG_IS_64_BIT
void Binder::bind(std::size_t pos, const bool& val, Direction dir) void Binder::bind(std::size_t pos, const bool& val, Direction dir)

View File

@ -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) bool Extractor::extract(std::size_t pos, long& val)
{ {
OutputParameter outputParameter = extractPreamble(pos); 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>&) bool Extractor::extract(std::size_t , std::vector<long>&)
{ {
throw NotImplementedException("std::vector extractor must be implemented."); throw NotImplementedException("std::vector extractor must be implemented.");

View File

@ -65,11 +65,13 @@ public:
void bind(std::size_t pos, const Poco::UInt64 &val, Direction dir); void bind(std::size_t pos, const Poco::UInt64 &val, Direction dir);
/// Binds an UInt64. /// Binds an UInt64.
#ifndef POCO_INT64_IS_LONG
void bind(std::size_t pos, const long &val, Direction dir); void bind(std::size_t pos, const long &val, Direction dir);
/// Binds a long /// Binds a long
void bind(std::size_t pos, const unsigned long &val, Direction dir); void bind(std::size_t pos, const unsigned long &val, Direction dir);
/// Binds an unsigned long /// Binds an unsigned long
#endif
void bind(std::size_t pos, const bool &val, Direction dir); void bind(std::size_t pos, const bool &val, Direction dir);
/// Binds a boolean. /// Binds a boolean.

View File

@ -78,11 +78,13 @@ public:
bool extract(std::size_t pos, Poco::UInt64& val); bool extract(std::size_t pos, Poco::UInt64& val);
/// Extracts an UInt64. /// Extracts an UInt64.
#ifndef POCO_INT64_IS_LONG
bool extract(std::size_t pos, long& val); bool extract(std::size_t pos, long& val);
/// Extracts a long. /// Extracts a long.
bool extract(std::size_t pos, unsigned long& val); bool extract(std::size_t pos, unsigned long& val);
/// Extracts an unsigned long. /// Extracts an unsigned long.
#endif
bool extract(std::size_t pos, bool& val); bool extract(std::size_t pos, bool& val);
/// Extracts a boolean. /// Extracts a boolean.

View File

@ -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) void Binder::bind(std::size_t pos, const long &val, Direction dir)
{ {
long tmp = static_cast<long>(val); 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); int rc = sqlite3_bind_int(_pStmt, (int) pos, tmp);
checkReturn(rc); checkReturn(rc);
} }
#endif
void Binder::bind(std::size_t pos, const double &val, Direction dir) void Binder::bind(std::size_t pos, const double &val, Direction dir)

View File

@ -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) bool Extractor::extract(std::size_t pos, long& val)
{ {
if (isNull(pos)) return false; 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); val = sqlite3_column_int(_pStmt, (int) pos);
return true; return true;
} }
#endif
bool Extractor::extract(std::size_t pos, double& val) bool Extractor::extract(std::size_t pos, double& val)

View File

@ -165,6 +165,7 @@ public:
virtual void bind(std::size_t pos, const std::list<Poco::UInt64>& val, Direction dir = PD_IN); virtual void bind(std::size_t pos, const std::list<Poco::UInt64>& val, Direction dir = PD_IN);
/// Binds an UInt64 list. /// Binds an UInt64 list.
#ifndef POCO_INT64_IS_LONG
virtual void bind(std::size_t pos, const long& val, Direction dir = PD_IN) = 0; virtual void bind(std::size_t pos, const long& val, Direction dir = PD_IN) = 0;
/// Binds a long. /// Binds a long.
@ -179,6 +180,7 @@ public:
virtual void bind(std::size_t pos, const std::list<long>& val, Direction dir = PD_IN); virtual void bind(std::size_t pos, const std::list<long>& val, Direction dir = PD_IN);
/// Binds a long list. /// Binds a long list.
#endif
virtual void bind(std::size_t pos, const bool& val, Direction dir = PD_IN) = 0; virtual void bind(std::size_t pos, const bool& val, Direction dir = PD_IN) = 0;
/// Binds a boolean. /// Binds a boolean.

View File

@ -155,6 +155,7 @@ public:
virtual bool extract(std::size_t pos, std::list<Poco::UInt64>& val); virtual bool extract(std::size_t pos, std::list<Poco::UInt64>& val);
/// Extracts an UInt64 list. /// Extracts an UInt64 list.
#ifndef POCO_INT64_IS_LONG
virtual bool extract(std::size_t pos, long& val) = 0; virtual bool extract(std::size_t pos, long& val) = 0;
/// Extracts a long. Returns false if null was received. /// 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); virtual bool extract(std::size_t pos, std::list<long>& val);
/// Extracts a long list. /// Extracts a long list.
#endif
virtual bool extract(std::size_t pos, bool& val) = 0; virtual bool extract(std::size_t pos, bool& val) = 0;
/// Extracts a boolean. Returns false if null was received. /// Extracts a boolean. Returns false if null was received.

View File

@ -161,6 +161,7 @@ public:
virtual void prepare(std::size_t pos, const std::list<Poco::UInt64>& val); virtual void prepare(std::size_t pos, const std::list<Poco::UInt64>& val);
/// Prepares an UInt64 list. /// Prepares an UInt64 list.
#ifndef POCO_INT64_IS_LONG
virtual void prepare(std::size_t pos, const long&) = 0; virtual void prepare(std::size_t pos, const long&) = 0;
/// Prepares a long. /// Prepares a long.
@ -175,6 +176,7 @@ public:
virtual void prepare(std::size_t pos, const std::list<long>& val); virtual void prepare(std::size_t pos, const std::list<long>& val);
/// Prepares a long list. /// Prepares a long list.
#endif
virtual void prepare(std::size_t pos, const bool&) = 0; virtual void prepare(std::size_t pos, const bool&) = 0;
/// Prepares a boolean. /// Prepares a boolean.

View File

@ -59,7 +59,7 @@ public:
/// Creates the AbstractSessionImpl. /// Creates the AbstractSessionImpl.
/// ///
/// Adds "storage" property and sets the default internal storage container /// 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 /// The storage is created by statements automatically whenever a query
/// returning results is executed but external storage is provided by the user. /// returning results is executed but external storage is provided by the user.
/// Storage type can be reconfigured at runtime both globally (for the /// Storage type can be reconfigured at runtime both globally (for the

View File

@ -258,11 +258,13 @@ public:
Statement& operator , (Poco::Int32 value); Statement& operator , (Poco::Int32 value);
/// Adds the value to the list of values to be supplied to the SQL string formatting function. /// 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); Statement& operator , (long value);
/// Adds the value to the list of values to be supplied to the SQL string formatting function. /// Adds the value to the list of values to be supplied to the SQL string formatting function.
Statement& operator , (unsigned long value); Statement& operator , (unsigned long value);
/// Adds the value to the list of values to be supplied to the SQL string formatting function. /// Adds the value to the list of values to be supplied to the SQL string formatting function.
#endif
Statement& operator , (Poco::UInt64 value); Statement& operator , (Poco::UInt64 value);
/// Adds the value to the list of values to be supplied to the SQL string formatting function. /// 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) inline Statement& Statement::operator , (long value)
{ {
return commaPODImpl(value); return commaPODImpl(value);
@ -582,6 +585,7 @@ inline Statement& Statement::operator , (unsigned long value)
{ {
return commaPODImpl(value); return commaPODImpl(value);
} }
#endif
inline Statement& Statement::operator , (Poco::UInt64 value) inline Statement& Statement::operator , (Poco::UInt64 value)

View File

@ -243,11 +243,11 @@ protected:
/// session is queried for container type setting. If the /// session is queried for container type setting. If the
/// session container type setting is found, it is used. /// session container type setting is found, it is used.
/// 3. If neither session nor statement have the internal /// 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: /// Supported internal extraction container types are:
/// - std::vector (default) /// - std::deque (default)
/// - std::deque /// - std::vector
/// - std::list /// - std::list
SessionImpl& session(); SessionImpl& session();

View File

@ -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) void AbstractBinder::bind(std::size_t pos, const std::vector<long>& val, Direction dir)
{ {
throw NotImplementedException("std::vector binder must be implemented."); 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."); throw NotImplementedException("std::list binder must be implemented.");
} }
#endif
void AbstractBinder::bind(std::size_t pos, const std::vector<bool>& val, Direction dir) 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); bind(pos, RefAnyCast<BLOB>(val), dir);
else if (type == typeid(void)) else if (type == typeid(void))
bind(pos, Keywords::null, dir); bind(pos, Keywords::null, dir);
else if (type == typeid(long)) else if(type == typeid(long))
bind(pos, RefAnyCast<long>(val), dir); bind(pos, RefAnyCast<long>(val), dir);
else else
throw UnknownTypeException(std::string(val.type().name())); throw UnknownTypeException(std::string(val.type().name()));

View File

@ -76,8 +76,8 @@ public:
BinaryReader& operator >> (double& value); BinaryReader& operator >> (double& value);
#if defined(POCO_HAVE_INT64) #if defined(POCO_HAVE_INT64)
BinaryReader& operator >> (Int64& value); BinaryReader& operator >> (long long& value);
BinaryReader& operator >> (UInt64& value); BinaryReader& operator >> (unsigned long long& value);
#endif #endif
BinaryReader& operator >> (std::string& value); BinaryReader& operator >> (std::string& value);

View File

@ -81,8 +81,8 @@ public:
BinaryWriter& operator << (double value); BinaryWriter& operator << (double value);
#if defined(POCO_HAVE_INT64) #if defined(POCO_HAVE_INT64)
BinaryWriter& operator << (Int64 value); BinaryWriter& operator << (long long value);
BinaryWriter& operator << (UInt64 value); BinaryWriter& operator << (unsigned long long value);
#endif #endif
BinaryWriter& operator << (const std::string& value); BinaryWriter& operator << (const std::string& value);

View File

@ -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) inline long operator + (const long& other, const Var& da)
/// Addition operator for adding Var to long /// 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 } // namespace Dynamic

View File

@ -178,12 +178,26 @@ public:
/// Throws BadCastException. Must be overriden in a type /// Throws BadCastException. Must be overriden in a type
/// specialization in order to support the conversion. /// specialization in order to support the conversion.
#ifndef POCO_INT64_IS_LONG
void convert(long& val) const; void convert(long& val) const;
/// Calls convert(Int32). /// Calls convert(Int32).
void convert(unsigned long& val) const; void convert(unsigned long& val) const;
/// Calls convert(UInt32). /// 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; virtual void convert(bool& val) const;
/// Throws BadCastException. Must be overriden in a type /// Throws BadCastException. Must be overriden in a type
/// specialization in order to support the conversion. /// 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"); throw BadCastException("Can not convert to Timestamp");
} }
#ifndef POCO_INT64_IS_LONG
inline void VarHolder::convert(long& val) const inline void VarHolder::convert(long& val) const
{ {
@ -521,6 +536,20 @@ inline void VarHolder::convert(unsigned long& val) const
val = tmp; 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 inline void VarHolder::convert(bool& /*val*/) const
{ {
@ -759,6 +788,20 @@ public:
convertSignedToUnsigned(_val, val); 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 void convert(bool& val) const
{ {
val = (_val != 0); val = (_val != 0);
@ -901,6 +944,20 @@ public:
convertSignedToUnsigned(_val, val); 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 void convert(bool& val) const
{ {
val = (_val != 0); val = (_val != 0);
@ -1041,6 +1098,20 @@ public:
convertSignedToUnsigned(_val, val); 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 void convert(bool& val) const
{ {
val = (_val != 0); val = (_val != 0);
@ -1179,6 +1250,20 @@ public:
convertSignedToUnsigned(_val, val); 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 void convert(bool& val) const
{ {
val = (_val != 0); val = (_val != 0);
@ -1332,6 +1417,20 @@ public:
val = _val; 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 void convert(bool& val) const
{ {
val = (_val != 0); val = (_val != 0);
@ -1470,6 +1569,20 @@ public:
val = _val; 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 void convert(bool& val) const
{ {
val = (_val != 0); val = (_val != 0);
@ -1608,6 +1721,20 @@ public:
val = _val; 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 void convert(bool& val) const
{ {
val = (_val != 0); val = (_val != 0);
@ -1746,6 +1873,20 @@ public:
val = _val; 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 void convert(bool& val) const
{ {
val = (_val != 0); val = (_val != 0);
@ -1905,6 +2046,20 @@ public:
val = static_cast<UInt64>(_val ? 1 : 0); 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 void convert(bool& val) const
{ {
val = _val; val = _val;
@ -2041,6 +2196,20 @@ public:
convertSignedFloatToUnsigned(_val, val); 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 void convert(bool& val) const
{ {
val = !(_val <= std::numeric_limits<float>::min() && val = !(_val <= std::numeric_limits<float>::min() &&
@ -2180,6 +2349,20 @@ public:
convertSignedFloatToUnsigned(_val, val); 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 void convert(bool& val) const
{ {
val = !(_val <= std::numeric_limits<double>::min() && val = !(_val <= std::numeric_limits<double>::min() &&
@ -2325,6 +2508,20 @@ public:
val = static_cast<UInt8>(_val); 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 void convert(bool& val) const
{ {
val = (_val != '\0'); val = (_val != '\0');
@ -2469,6 +2666,20 @@ public:
val = NumberParser::parseUnsigned64(_val); 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 void convert(bool& val) const
{ {
if (_val.empty()) if (_val.empty())
@ -2647,6 +2858,20 @@ public:
val = NumberParser::parseUnsigned64(toStdString()); 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 void convert(bool& val) const
{ {
static const std::string VAL_FALSE("false"); static const std::string VAL_FALSE("false");
@ -2770,6 +2995,9 @@ private:
}; };
#ifndef POCO_INT64_IS_LONG
template <> template <>
class VarHolderImpl<long>: public VarHolder 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> template <typename T>
class VarHolderImpl<std::vector<T>>: public VarHolder class VarHolderImpl<std::vector<T>>: public VarHolder
{ {
@ -3293,6 +3823,20 @@ public:
val = _val.timestamp().epochMicroseconds(); 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 void convert(std::string& val) const
{ {
val = DateTimeFormatter::format(_val, Poco::DateTimeFormat::ISO8601_FORMAT); val = DateTimeFormatter::format(_val, Poco::DateTimeFormat::ISO8601_FORMAT);
@ -3409,6 +3953,20 @@ public:
val = _val.timestamp().epochMicroseconds(); 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 void convert(std::string& val) const
{ {
val = DateTimeFormatter::format(_val, Poco::DateTimeFormat::ISO8601_FORMAT); val = DateTimeFormatter::format(_val, Poco::DateTimeFormat::ISO8601_FORMAT);
@ -3525,6 +4083,20 @@ public:
val = _val.epochMicroseconds(); 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 void convert(std::string& val) const
{ {
val = DateTimeFormatter::format(_val, Poco::DateTimeFormat::ISO8601_FORMAT); val = DateTimeFormatter::format(_val, Poco::DateTimeFormat::ISO8601_FORMAT);

View File

@ -51,12 +51,18 @@ public:
VarIterator(const VarIterator& other); VarIterator(const VarIterator& other);
/// Creates a copy of other VarIterator. /// Creates a copy of other VarIterator.
VarIterator(VarIterator&& other) noexcept;
/// Moves another VarIterator.
~VarIterator(); ~VarIterator();
/// Destroys the VarIterator. /// Destroys the VarIterator.
VarIterator& operator = (const VarIterator& other); VarIterator& operator = (const VarIterator& other);
/// Assigns the other VarIterator. /// Assigns the other VarIterator.
VarIterator& operator = (VarIterator&& other) noexcept;
/// Assigns the other VarIterator.
bool operator == (const VarIterator& other) const; bool operator == (const VarIterator& other) const;
/// Equality operator. /// Equality operator.
@ -138,8 +144,7 @@ inline bool VarIterator::operator != (const VarIterator& other) const
namespace std namespace std
{ {
template<> template<>
inline void swap<Poco::Dynamic::VarIterator>(Poco::Dynamic::VarIterator& s1, inline void swap<Poco::Dynamic::VarIterator>(Poco::Dynamic::VarIterator& s1, Poco::Dynamic::VarIterator& s2) noexcept
Poco::Dynamic::VarIterator& s2)
/// Full template specialization of std:::swap for VarIterator /// Full template specialization of std:::swap for VarIterator
{ {
s1.swap(s2); s1.swap(s2);

View File

@ -151,6 +151,57 @@ public:
/// resulting string. /// resulting string.
#ifdef POCO_HAVE_INT64 #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); static std::string format(Int64 value);
/// Formats a 64-bit integer value in decimal notation. /// Formats a 64-bit integer value in decimal notation.
@ -200,6 +251,7 @@ public:
/// the specified width. If prefix is true, "0x" prefix is /// the specified width. If prefix is true, "0x" prefix is
/// prepended to the resulting string. /// prepended to the resulting string.
#endif // ifdef POCO_INT64_IS_LONG
#endif // ifdef POCO_HAVE_INT64 #endif // ifdef POCO_HAVE_INT64
static std::string format(float value); static std::string format(float value);
@ -326,6 +378,51 @@ public:
/// specified width. /// specified width.
#ifdef POCO_HAVE_INT64 #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); static void append(std::string& str, Int64 value);
/// Formats a 64-bit integer value in decimal notation. /// 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 /// right justified and zero-padded in a field having at least
/// the specified width. /// the specified width.
#endif // ifdef POCO_INT64_IS_LONG
#endif // ifdef POCO_HAVE_INT64 #endif // ifdef POCO_HAVE_INT64
static void append(std::string& str, float value); 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_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) 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 #endif // ifdef POCO_HAVE_INT64

View File

@ -49,17 +49,10 @@ using UIntPtr = std::uintptr_t;
#if defined(__LP64__) #if defined(__LP64__)
#define POCO_PTR_IS_64_BIT 1 #define POCO_PTR_IS_64_BIT 1
#define POCO_LONG_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 #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 #endif
#define POCO_HAVE_INT64 1 #define POCO_HAVE_INT64 1
#elif defined(__SUNPRO_CC) #elif defined(__SUNPRO_CC)

View File

@ -173,7 +173,7 @@ BinaryReader& BinaryReader::operator >> (double& value)
#if defined(POCO_HAVE_INT64) #if defined(POCO_HAVE_INT64)
BinaryReader& BinaryReader::operator >> (Int64& value) BinaryReader& BinaryReader::operator >> (long long& value)
{ {
_istr.read((char*) &value, sizeof(value)); _istr.read((char*) &value, sizeof(value));
if (_flipBytes) value = ByteOrder::flipBytes(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)); _istr.read((char*) &value, sizeof(value));
if (_flipBytes) value = ByteOrder::flipBytes(value); if (_flipBytes) value = ByteOrder::flipBytes(value);

View File

@ -215,11 +215,11 @@ BinaryWriter& BinaryWriter::operator << (double value)
#if defined(POCO_HAVE_INT64) #if defined(POCO_HAVE_INT64)
BinaryWriter& BinaryWriter::operator << (Int64 value) BinaryWriter& BinaryWriter::operator << (long long value)
{ {
if (_flipBytes) if (_flipBytes)
{ {
Int64 fValue = ByteOrder::flipBytes(value); Int64 fValue = ByteOrder::flipBytes(static_cast<Int64>(value));
_ostr.write((const char*) &fValue, sizeof(fValue)); _ostr.write((const char*) &fValue, sizeof(fValue));
} }
else else
@ -230,11 +230,11 @@ BinaryWriter& BinaryWriter::operator << (Int64 value)
} }
BinaryWriter& BinaryWriter::operator << (UInt64 value) BinaryWriter& BinaryWriter::operator << (unsigned long long value)
{ {
if (_flipBytes) if (_flipBytes)
{ {
UInt64 fValue = ByteOrder::flipBytes(value); UInt64 fValue = ByteOrder::flipBytes(static_cast<UInt64>(value));
_ostr.write((const char*) &fValue, sizeof(fValue)); _ostr.write((const char*) &fValue, sizeof(fValue));
} }
else else

View File

@ -235,6 +235,100 @@ void NumberFormatter::appendHex(std::string& str, unsigned long value, int width
#ifdef POCO_HAVE_INT64 #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) 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 #endif // ifdef POCO_HAVE_INT64

View File

@ -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() 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) void VarIterator::swap(VarIterator& other)
{ {
using std::swap; using std::swap;