diff --git a/Data/MySQL/include/Poco/Data/MySQL/Binder.h b/Data/MySQL/include/Poco/Data/MySQL/Binder.h index 9ed275d30..3ef63f9d2 100644 --- a/Data/MySQL/include/Poco/Data/MySQL/Binder.h +++ b/Data/MySQL/include/Poco/Data/MySQL/Binder.h @@ -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. diff --git a/Data/MySQL/include/Poco/Data/MySQL/Extractor.h b/Data/MySQL/include/Poco/Data/MySQL/Extractor.h index 374c15939..bbda23337 100644 --- a/Data/MySQL/include/Poco/Data/MySQL/Extractor.h +++ b/Data/MySQL/include/Poco/Data/MySQL/Extractor.h @@ -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& val); /// Extracts an UInt64 list. +#ifndef POCO_INT64_IS_LONG virtual bool extract(std::size_t pos, std::vector& val); /// Extracts a long vector. @@ -204,6 +207,7 @@ public: virtual bool extract(std::size_t pos, std::list& val); /// Extracts a long list. +#endif virtual bool extract(std::size_t pos, std::vector& val); /// Extracts a boolean vector. diff --git a/Data/MySQL/src/Binder.cpp b/Data/MySQL/src/Binder.cpp index 1bfb31c6c..5315238ff 100644 --- a/Data/MySQL/src/Binder.cpp +++ b/Data/MySQL/src/Binder.cpp @@ -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) diff --git a/Data/MySQL/src/Extractor.cpp b/Data/MySQL/src/Extractor.cpp index f801ffa25..13554f96f 100644 --- a/Data/MySQL/src/Extractor.cpp +++ b/Data/MySQL/src/Extractor.cpp @@ -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& ) } +#ifndef POCO_INT64_IS_LONG bool Extractor::extract(std::size_t , std::vector& ) { throw NotImplementedException("std::vector extractor must be implemented."); @@ -415,6 +418,7 @@ bool Extractor::extract(std::size_t , std::list& ) { throw NotImplementedException("std::list extractor must be implemented."); } +#endif bool Extractor::extract(std::size_t , std::vector& ) diff --git a/Data/ODBC/include/Poco/Data/ODBC/Binder.h b/Data/ODBC/include/Poco/Data/ODBC/Binder.h index c38cd06ff..a81d2973f 100644 --- a/Data/ODBC/include/Poco/Data/ODBC/Binder.h +++ b/Data/ODBC/include/Poco/Data/ODBC/Binder.h @@ -173,6 +173,7 @@ public: void bind(std::size_t pos, const std::list& 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& 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& 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& val, Direction { bindImplContainer(pos, val, SQL_C_SLONG, dir); } +#endif inline void Binder::bind(std::size_t pos, const float& val, Direction dir) diff --git a/Data/ODBC/include/Poco/Data/ODBC/Extractor.h b/Data/ODBC/include/Poco/Data/ODBC/Extractor.h index cb22e0dfc..3dc4c3fd7 100644 --- a/Data/ODBC/include/Poco/Data/ODBC/Extractor.h +++ b/Data/ODBC/include/Poco/Data/ODBC/Extractor.h @@ -155,6 +155,7 @@ public: bool extract(std::size_t pos, std::list& 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& val); /// Extracts a long list. +#endif bool extract(std::size_t pos, bool& val); /// Extracts a boolean. diff --git a/Data/ODBC/include/Poco/Data/ODBC/Preparator.h b/Data/ODBC/include/Poco/Data/ODBC/Preparator.h index 80f4b762f..214583693 100644 --- a/Data/ODBC/include/Poco/Data/ODBC/Preparator.h +++ b/Data/ODBC/include/Poco/Data/ODBC/Preparator.h @@ -204,6 +204,7 @@ public: void prepare(std::size_t pos, const std::list& 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& 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& } +#ifndef POCO_INT64_IS_LONG inline void Preparator::prepare(std::size_t pos, const long&) { prepareFixedSize(pos, SQL_C_SLONG); @@ -903,6 +906,7 @@ inline void Preparator::prepare(std::size_t pos, const std::list& val) { prepareFixedSize(pos, SQL_C_SLONG, val.size()); } +#endif inline void Preparator::prepare(std::size_t pos, const bool&) diff --git a/Data/ODBC/src/Extractor.cpp b/Data/ODBC/src/Extractor.cpp index c4cbb9fed..9ffc10444 100644 --- a/Data/ODBC/src/Extractor.cpp +++ b/Data/ODBC/src/Extractor.cpp @@ -575,6 +575,7 @@ bool Extractor::extract(std::size_t pos, std::list& 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& val) else throw InvalidAccessException("Direct container extraction only allowed for bound mode."); } +#endif bool Extractor::extract(std::size_t pos, double& val) diff --git a/Data/PostgreSQL/include/Poco/Data/PostgreSQL/Binder.h b/Data/PostgreSQL/include/Poco/Data/PostgreSQL/Binder.h index c96e35a19..3ad3fcc91 100644 --- a/Data/PostgreSQL/include/Poco/Data/PostgreSQL/Binder.h +++ b/Data/PostgreSQL/include/Poco/Data/PostgreSQL/Binder.h @@ -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. diff --git a/Data/PostgreSQL/include/Poco/Data/PostgreSQL/Extractor.h b/Data/PostgreSQL/include/Poco/Data/PostgreSQL/Extractor.h index 9a6e2e04b..4b520d857 100644 --- a/Data/PostgreSQL/include/Poco/Data/PostgreSQL/Extractor.h +++ b/Data/PostgreSQL/include/Poco/Data/PostgreSQL/Extractor.h @@ -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& 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& val); /// Extracts a long vector. diff --git a/Data/PostgreSQL/src/Binder.cpp b/Data/PostgreSQL/src/Binder.cpp index 58d5896cd..3d50983d8 100644 --- a/Data/PostgreSQL/src/Binder.cpp +++ b/Data/PostgreSQL/src/Binder.cpp @@ -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) diff --git a/Data/PostgreSQL/src/Extractor.cpp b/Data/PostgreSQL/src/Extractor.cpp index cde91b6af..35d999b0d 100644 --- a/Data/PostgreSQL/src/Extractor.cpp +++ b/Data/PostgreSQL/src/Extractor.cpp @@ -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&) } -#ifndef POCO_LONG_IS_64_BIT +#ifndef POCO_INT64_IS_LONG bool Extractor::extract(std::size_t , std::vector&) { throw NotImplementedException("std::vector extractor must be implemented."); diff --git a/Data/SQLite/include/Poco/Data/SQLite/Binder.h b/Data/SQLite/include/Poco/Data/SQLite/Binder.h index 75c514258..fa10f2144 100644 --- a/Data/SQLite/include/Poco/Data/SQLite/Binder.h +++ b/Data/SQLite/include/Poco/Data/SQLite/Binder.h @@ -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. diff --git a/Data/SQLite/include/Poco/Data/SQLite/Extractor.h b/Data/SQLite/include/Poco/Data/SQLite/Extractor.h index 8ae1ccc27..ba7d76d42 100644 --- a/Data/SQLite/include/Poco/Data/SQLite/Extractor.h +++ b/Data/SQLite/include/Poco/Data/SQLite/Extractor.h @@ -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. diff --git a/Data/SQLite/src/Binder.cpp b/Data/SQLite/src/Binder.cpp index 71e612661..4d745637b 100644 --- a/Data/SQLite/src/Binder.cpp +++ b/Data/SQLite/src/Binder.cpp @@ -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(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) diff --git a/Data/SQLite/src/Extractor.cpp b/Data/SQLite/src/Extractor.cpp index 3915ac1a3..d5162a244 100644 --- a/Data/SQLite/src/Extractor.cpp +++ b/Data/SQLite/src/Extractor.cpp @@ -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) diff --git a/Data/include/Poco/Data/AbstractBinder.h b/Data/include/Poco/Data/AbstractBinder.h index 20c690b8e..68fe6c14c 100644 --- a/Data/include/Poco/Data/AbstractBinder.h +++ b/Data/include/Poco/Data/AbstractBinder.h @@ -165,6 +165,7 @@ public: virtual void bind(std::size_t pos, const std::list& 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& 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. diff --git a/Data/include/Poco/Data/AbstractExtractor.h b/Data/include/Poco/Data/AbstractExtractor.h index 9b4bf0a55..8c08b30a2 100644 --- a/Data/include/Poco/Data/AbstractExtractor.h +++ b/Data/include/Poco/Data/AbstractExtractor.h @@ -155,6 +155,7 @@ public: virtual bool extract(std::size_t pos, std::list& 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& 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. diff --git a/Data/include/Poco/Data/AbstractPreparator.h b/Data/include/Poco/Data/AbstractPreparator.h index 433b78d21..5c0631979 100644 --- a/Data/include/Poco/Data/AbstractPreparator.h +++ b/Data/include/Poco/Data/AbstractPreparator.h @@ -161,6 +161,7 @@ public: virtual void prepare(std::size_t pos, const std::list& 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& val); /// Prepares a long list. +#endif virtual void prepare(std::size_t pos, const bool&) = 0; /// Prepares a boolean. diff --git a/Data/include/Poco/Data/AbstractSessionImpl.h b/Data/include/Poco/Data/AbstractSessionImpl.h index c4d5232cd..d01f73d47 100644 --- a/Data/include/Poco/Data/AbstractSessionImpl.h +++ b/Data/include/Poco/Data/AbstractSessionImpl.h @@ -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 diff --git a/Data/include/Poco/Data/Statement.h b/Data/include/Poco/Data/Statement.h index 13a9b74d4..610eead67 100644 --- a/Data/include/Poco/Data/Statement.h +++ b/Data/include/Poco/Data/Statement.h @@ -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) diff --git a/Data/include/Poco/Data/StatementImpl.h b/Data/include/Poco/Data/StatementImpl.h index 39d06f745..531511656 100644 --- a/Data/include/Poco/Data/StatementImpl.h +++ b/Data/include/Poco/Data/StatementImpl.h @@ -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(); diff --git a/Data/src/AbstractBinder.cpp b/Data/src/AbstractBinder.cpp index 63201647c..01f7aca44 100644 --- a/Data/src/AbstractBinder.cpp +++ b/Data/src/AbstractBinder.cpp @@ -180,6 +180,7 @@ void AbstractBinder::bind(std::size_t pos, const std::list& val, D } +#ifndef POCO_INT64_IS_LONG void AbstractBinder::bind(std::size_t pos, const std::vector& 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& val, Direction { throw NotImplementedException("std::list binder must be implemented."); } +#endif void AbstractBinder::bind(std::size_t pos, const std::vector& val, Direction dir) @@ -462,7 +464,7 @@ void AbstractBinder::bind(std::size_t pos, const Any& val, Direction dir) bind(pos, RefAnyCast(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(val), dir); else throw UnknownTypeException(std::string(val.type().name())); diff --git a/Foundation/include/Poco/BinaryReader.h b/Foundation/include/Poco/BinaryReader.h index 2ff319f63..5b5e7bee4 100644 --- a/Foundation/include/Poco/BinaryReader.h +++ b/Foundation/include/Poco/BinaryReader.h @@ -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); diff --git a/Foundation/include/Poco/BinaryWriter.h b/Foundation/include/Poco/BinaryWriter.h index ae8b67ab3..985384295 100644 --- a/Foundation/include/Poco/BinaryWriter.h +++ b/Foundation/include/Poco/BinaryWriter.h @@ -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); diff --git a/Foundation/include/Poco/Dynamic/Var.h b/Foundation/include/Poco/Dynamic/Var.h index 43bc4e958..71ffb4eee 100644 --- a/Foundation/include/Poco/Dynamic/Var.h +++ b/Foundation/include/Poco/Dynamic/Var.h @@ -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 diff --git a/Foundation/include/Poco/Dynamic/VarHolder.h b/Foundation/include/Poco/Dynamic/VarHolder.h index 06d4b476b..c8f04ef8e 100644 --- a/Foundation/include/Poco/Dynamic/VarHolder.h +++ b/Foundation/include/Poco/Dynamic/VarHolder.h @@ -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(_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(_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(_val ? 1 : 0); } +#ifdef POCO_INT64_IS_LONG + + void convert(long long& val) const + { + val = static_cast(_val ? 1 : 0); + } + + void convert(unsigned long long& val) const + { + val = static_cast(_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::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::min() && @@ -2325,6 +2508,20 @@ public: val = static_cast(_val); } +#ifdef POCO_INT64_IS_LONG + + void convert(long long& val) const + { + val = static_cast(_val); + } + + void convert(unsigned long long& val) const + { + val = static_cast(_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: public VarHolder { @@ -3046,6 +3274,308 @@ private: }; +#else // if defined (POCO_INT64_IS_LONG) + + +template <> +class VarHolderImpl: 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(_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(_val); + } + + void convert(double& val) const + { + val = static_cast(_val); + } + + void convert(char& val) const + { + UInt8 tmp; + convert(tmp); + val = static_cast(tmp); + } + + void convert(std::string& val) const + { + val = NumberFormatter::format(_val); + } + + VarHolder* clone(Placeholder* 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::is_integer; + } + + bool isSigned() const + { + return std::numeric_limits::is_signed; + } + + bool isNumeric() const + { + return std::numeric_limits::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: 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(_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(_val); + } + + void convert(double& val) const + { + val = static_cast(_val); + } + + void convert(char& val) const + { + UInt8 tmp; + convert(tmp); + val = static_cast(tmp); + } + + void convert(std::string& val) const + { + val = NumberFormatter::format(_val); + } + + VarHolder* clone(Placeholder* 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::is_integer; + } + + bool isSigned() const + { + return std::numeric_limits::is_signed; + } + + bool isNumeric() const + { + return std::numeric_limits::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 class VarHolderImpl>: 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); diff --git a/Foundation/include/Poco/Dynamic/VarIterator.h b/Foundation/include/Poco/Dynamic/VarIterator.h index a91bb3a6a..038dfdb5c 100644 --- a/Foundation/include/Poco/Dynamic/VarIterator.h +++ b/Foundation/include/Poco/Dynamic/VarIterator.h @@ -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& s1, - Poco::Dynamic::VarIterator& s2) + inline void swap(Poco::Dynamic::VarIterator& s1, Poco::Dynamic::VarIterator& s2) noexcept /// Full template specialization of std:::swap for VarIterator { s1.swap(s2); diff --git a/Foundation/include/Poco/NumberFormatter.h b/Foundation/include/Poco/NumberFormatter.h index 50395dbbb..6207f13d3 100644 --- a/Foundation/include/Poco/NumberFormatter.h +++ b/Foundation/include/Poco/NumberFormatter.h @@ -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(value), 0x10, result, prefix); + return result; +} + + +inline std::string NumberFormatter::formatHex(long long value, int width, bool prefix) +{ + std::string result; + uIntToStr(static_cast(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 diff --git a/Foundation/include/Poco/Types.h b/Foundation/include/Poco/Types.h index ed7be1473..d0de71779 100644 --- a/Foundation/include/Poco/Types.h +++ b/Foundation/include/Poco/Types.h @@ -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 diff --git a/Foundation/src/BinaryReader.cpp b/Foundation/src/BinaryReader.cpp index a22b62ce3..6218dfdd6 100644 --- a/Foundation/src/BinaryReader.cpp +++ b/Foundation/src/BinaryReader.cpp @@ -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); diff --git a/Foundation/src/BinaryWriter.cpp b/Foundation/src/BinaryWriter.cpp index ca67a6e42..7e5b0a567 100644 --- a/Foundation/src/BinaryWriter.cpp +++ b/Foundation/src/BinaryWriter.cpp @@ -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(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(value)); _ostr.write((const char*) &fValue, sizeof(fValue)); } else diff --git a/Foundation/src/NumberFormatter.cpp b/Foundation/src/NumberFormatter.cpp index 6b0548bd3..d72b4c111 100644 --- a/Foundation/src/NumberFormatter.cpp +++ b/Foundation/src/NumberFormatter.cpp @@ -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(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(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 diff --git a/Foundation/src/VarIterator.cpp b/Foundation/src/VarIterator.cpp index 1667ae51c..d26a99854 100644 --- a/Foundation/src/VarIterator.cpp +++ b/Foundation/src/VarIterator.cpp @@ -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;