AbstractCache.h | AbstractCache.h | |||
---|---|---|---|---|
// | // | |||
// AbstractCache.h | // AbstractCache.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/AbstractCache.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/AbstractCache.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Cache | // Package: Cache | |||
// Module: AbstractCache | // Module: AbstractCache | |||
// | // | |||
// Definition of the AbstractCache class. | // Definition of the AbstractCache class. | |||
// | // | |||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 83 | skipping to change at line 83 | |||
initialize(); | initialize(); | |||
} | } | |||
AbstractCache(const TStrategy& strat): _strategy(strat) | AbstractCache(const TStrategy& strat): _strategy(strat) | |||
{ | { | |||
initialize(); | initialize(); | |||
} | } | |||
virtual ~AbstractCache() | virtual ~AbstractCache() | |||
{ | { | |||
try | uninitialize(); | |||
{ | ||||
uninitialize(); | ||||
} | ||||
catch (...) | ||||
{ | ||||
poco_unexpected(); | ||||
} | ||||
} | } | |||
void add(const TKey& key, const TValue& val) | void add(const TKey& key, const TValue& val) | |||
/// Adds the key value pair to the cache. | /// Adds the key value pair to the cache. | |||
/// If for the key already an entry exists, it will be overw ritten. | /// If for the key already an entry exists, it will be overw ritten. | |||
{ | { | |||
typename TMutex::ScopedLock lock(_mutex); | typename TMutex::ScopedLock lock(_mutex); | |||
doAdd(key, val); | doAdd(key, val); | |||
} | } | |||
End of changes. 2 change blocks. | ||||
9 lines changed or deleted | 2 lines changed or added | |||
AbstractConfiguration.h | AbstractConfiguration.h | |||
---|---|---|---|---|
skipping to change at line 172 | skipping to change at line 172 | |||
int getInt(const std::string& key) const; | int getInt(const std::string& key) const; | |||
/// Returns the int value of the property with the given nam e. | /// Returns the int value of the property with the given nam e. | |||
/// Throws a NotFoundException if the key does not exist. | /// Throws a NotFoundException if the key does not exist. | |||
/// Throws a SyntaxException if the property can not be conv erted | /// Throws a SyntaxException if the property can not be conv erted | |||
/// to an int. | /// to an int. | |||
/// Numbers starting with 0x are treated as hexadecimal. | /// Numbers starting with 0x are treated as hexadecimal. | |||
/// If the value contains references to other properties (${ <property>}), these | /// If the value contains references to other properties (${ <property>}), these | |||
/// are expanded. | /// are expanded. | |||
unsigned int getUInt(const std::string& key) const; | ||||
/// Returns the unsigned int value of the property with the | ||||
given name. | ||||
/// Throws a NotFoundException if the key does not exist. | ||||
/// Throws a SyntaxException if the property can not be conv | ||||
erted | ||||
/// to an unsigned int. | ||||
/// Numbers starting with 0x are treated as hexadecimal. | ||||
/// If the value contains references to other properties (${ | ||||
<property>}), these | ||||
/// are expanded. | ||||
int getInt(const std::string& key, int defaultValue) const; | int getInt(const std::string& key, int defaultValue) const; | |||
/// If a property with the given key exists, returns the pro perty's int value, | /// If a property with the given key exists, returns the pro perty's int value, | |||
/// otherwise returns the given default value. | /// otherwise returns the given default value. | |||
/// Throws a SyntaxException if the property can not be conv erted | /// Throws a SyntaxException if the property can not be conv erted | |||
/// to an int. | /// to an int. | |||
/// Numbers starting with 0x are treated as hexadecimal. | /// Numbers starting with 0x are treated as hexadecimal. | |||
/// If the value contains references to other properties (${ <property>}), these | /// If the value contains references to other properties (${ <property>}), these | |||
/// are expanded. | /// are expanded. | |||
unsigned int getUInt(const std::string& key, unsigned int defaultVal | ||||
ue) const; | ||||
/// If a property with the given key exists, returns the pro | ||||
perty's unsigned int | ||||
/// value, otherwise returns the given default value. | ||||
/// Throws a SyntaxException if the property can not be conv | ||||
erted | ||||
/// to an unsigned int. | ||||
/// Numbers starting with 0x are treated as hexadecimal. | ||||
/// If the value contains references to other properties (${ | ||||
<property>}), these | ||||
/// are expanded. | ||||
#if defined(POCO_HAVE_INT64) | ||||
Int64 getInt64(const std::string& key) const; | ||||
/// Returns the Int64 value of the property with the given n | ||||
ame. | ||||
/// Throws a NotFoundException if the key does not exist. | ||||
/// Throws a SyntaxException if the property can not be conv | ||||
erted | ||||
/// to an Int64. | ||||
/// Numbers starting with 0x are treated as hexadecimal. | ||||
/// If the value contains references to other properties (${ | ||||
<property>}), these | ||||
/// are expanded. | ||||
UInt64 getUInt64(const std::string& key) const; | ||||
/// Returns the UInt64 value of the property with the given | ||||
name. | ||||
/// Throws a NotFoundException if the key does not exist. | ||||
/// Throws a SyntaxException if the property can not be conv | ||||
erted | ||||
/// to an UInt64. | ||||
/// Numbers starting with 0x are treated as hexadecimal. | ||||
/// If the value contains references to other properties (${ | ||||
<property>}), these | ||||
/// are expanded. | ||||
Int64 getInt64(const std::string& key, Int64 defaultValue) const; | ||||
/// If a property with the given key exists, returns the pro | ||||
perty's Int64 value, | ||||
/// otherwise returns the given default value. | ||||
/// Throws a SyntaxException if the property can not be conv | ||||
erted | ||||
/// to an Int64. | ||||
/// Numbers starting with 0x are treated as hexadecimal. | ||||
/// If the value contains references to other properties (${ | ||||
<property>}), these | ||||
/// are expanded. | ||||
UInt64 getUInt64(const std::string& key, UInt64 defaultValue) const; | ||||
/// If a property with the given key exists, returns the pro | ||||
perty's UInt64 | ||||
/// value, otherwise returns the given default value. | ||||
/// Throws a SyntaxException if the property can not be conv | ||||
erted | ||||
/// to an UInt64. | ||||
/// Numbers starting with 0x are treated as hexadecimal. | ||||
/// If the value contains references to other properties (${ | ||||
<property>}), these | ||||
/// are expanded. | ||||
#endif // defined(POCO_HAVE_INT64) | ||||
double getDouble(const std::string& key) const; | double getDouble(const std::string& key) const; | |||
/// Returns the double value of the property with the given name. | /// Returns the double value of the property with the given name. | |||
/// Throws a NotFoundException if the key does not exist. | /// Throws a NotFoundException if the key does not exist. | |||
/// Throws a SyntaxException if the property can not be conv erted | /// Throws a SyntaxException if the property can not be conv erted | |||
/// to a double. | /// to a double. | |||
/// If the value contains references to other properties (${ <property>}), these | /// If the value contains references to other properties (${ <property>}), these | |||
/// are expanded. | /// are expanded. | |||
double getDouble(const std::string& key, double defaultValue) const; | double getDouble(const std::string& key, double defaultValue) const; | |||
/// If a property with the given key exists, returns the pro perty's double value, | /// If a property with the given key exists, returns the pro perty's double value, | |||
skipping to change at line 217 | skipping to change at line 275 | |||
/// otherwise returns the given default value. | /// otherwise returns the given default value. | |||
/// Throws a SyntaxException if the property can not be conv erted | /// Throws a SyntaxException if the property can not be conv erted | |||
/// to a boolean. | /// to a boolean. | |||
/// The following string values can be converted into a bool ean: | /// The following string values can be converted into a bool ean: | |||
/// - numerical values: non zero becomes true, zero become s false | /// - numerical values: non zero becomes true, zero become s false | |||
/// - strings: true, yes, on become true, false, no, off b ecome false | /// - strings: true, yes, on become true, false, no, off b ecome false | |||
/// Case does not matter. | /// Case does not matter. | |||
/// If the value contains references to other properties (${ <property>}), these | /// If the value contains references to other properties (${ <property>}), these | |||
/// are expanded. | /// are expanded. | |||
void setString(const std::string& key, const std::string& value); | virtual void setString(const std::string& key, const std::string& va lue); | |||
/// Sets the property with the given key to the given value. | /// Sets the property with the given key to the given value. | |||
/// An already existing value for the key is overwritten. | /// An already existing value for the key is overwritten. | |||
void setInt(const std::string& key, int value); | virtual void setInt(const std::string& key, int value); | |||
/// Sets the property with the given key to the given value. | /// Sets the property with the given key to the given value. | |||
/// An already existing value for the key is overwritten. | /// An already existing value for the key is overwritten. | |||
void setDouble(const std::string& key, double value); | virtual void setUInt(const std::string& key, unsigned int value); | |||
/// Sets the property with the given key to the given value. | /// Sets the property with the given key to the given value. | |||
/// An already existing value for the key is overwritten. | /// An already existing value for the key is overwritten. | |||
void setBool(const std::string& key, bool value); | #if defined(POCO_HAVE_INT64) | |||
virtual void setInt64(const std::string& key, Int64 value); | ||||
/// Sets the property with the given key to the given value. | ||||
/// An already existing value for the key is overwritten. | ||||
virtual void setUInt64(const std::string& key, UInt64 value); | ||||
/// Sets the property with the given key to the given value. | ||||
/// An already existing value for the key is overwritten. | ||||
#endif // defined(POCO_HAVE_INT64) | ||||
virtual void setDouble(const std::string& key, double value); | ||||
/// Sets the property with the given key to the given value. | ||||
/// An already existing value for the key is overwritten. | ||||
virtual void setBool(const std::string& key, bool value); | ||||
/// Sets the property with the given key to the given value. | /// Sets the property with the given key to the given value. | |||
/// An already existing value for the key is overwritten. | /// An already existing value for the key is overwritten. | |||
void keys(Keys& range) const; | void keys(Keys& range) const; | |||
/// Returns in range the names of all keys at root level. | /// Returns in range the names of all keys at root level. | |||
void keys(const std::string& key, Keys& range) const; | void keys(const std::string& key, Keys& range) const; | |||
/// Returns in range the names of all subkeys under the give n key. | /// Returns in range the names of all subkeys under the give n key. | |||
/// If an empty key is passed, all root level keys are retur ned. | /// If an empty key is passed, all root level keys are retur ned. | |||
skipping to change at line 291 | skipping to change at line 365 | |||
virtual void removeRaw(const std::string& key); | virtual void removeRaw(const std::string& key); | |||
/// Removes the property with the given key. | /// Removes the property with the given key. | |||
/// | /// | |||
/// Does nothing if the key does not exist. | /// Does nothing if the key does not exist. | |||
/// | /// | |||
/// Should be overridden by subclasses; the default | /// Should be overridden by subclasses; the default | |||
/// implementation throws a Poco::NotImplementedException. | /// implementation throws a Poco::NotImplementedException. | |||
static int parseInt(const std::string& value); | static int parseInt(const std::string& value); | |||
static int parseUInt(const std::string& value); | ||||
#if defined(POCO_HAVE_INT64) | ||||
static Int64 parseInt64(const std::string& value); | ||||
static UInt64 parseUInt64(const std::string& value); | ||||
#endif // defined(POCO_HAVE_INT64) | ||||
static bool parseBool(const std::string& value); | static bool parseBool(const std::string& value); | |||
void setRawWithEvent(const std::string& key, std::string value); | void setRawWithEvent(const std::string& key, std::string value); | |||
virtual ~AbstractConfiguration(); | virtual ~AbstractConfiguration(); | |||
private: | private: | |||
std::string internalExpand(const std::string& value) const; | std::string internalExpand(const std::string& value) const; | |||
std::string uncheckedExpand(const std::string& value) const; | std::string uncheckedExpand(const std::string& value) const; | |||
AbstractConfiguration(const AbstractConfiguration&); | AbstractConfiguration(const AbstractConfiguration&); | |||
AbstractConfiguration& operator = (const AbstractConfiguration&); | AbstractConfiguration& operator = (const AbstractConfiguration&); | |||
mutable int _depth; | mutable int _depth; | |||
bool _eventsEnabled; | bool _eventsEnabled; | |||
mutable Poco::FastMutex _mutex; | mutable Poco::Mutex _mutex; | |||
friend class LayeredConfiguration; | friend class LayeredConfiguration; | |||
friend class ConfigurationView; | friend class ConfigurationView; | |||
friend class ConfigurationMapper; | friend class ConfigurationMapper; | |||
}; | }; | |||
} } // namespace Poco::Util | } } // namespace Poco::Util | |||
#endif // Util_AbstractConfiguration_INCLUDED | #endif // Util_AbstractConfiguration_INCLUDED | |||
End of changes. 8 change blocks. | ||||
5 lines changed or deleted | 107 lines changed or added | |||
AbstractEvent.h | AbstractEvent.h | |||
---|---|---|---|---|
// | // | |||
// AbstractEvent.h | // AbstractEvent.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/AbstractEvent.h#4 $ | // $Id: //poco/1.4/Foundation/include/Poco/AbstractEvent.h#3 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Events | // Package: Events | |||
// Module: AbstractEvent | // Module: AbstractEvent | |||
// | // | |||
// Definition of the AbstractEvent class. | // Definition of the AbstractEvent class. | |||
// | // | |||
// Copyright (c) 2006-2011, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2006-2011, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
ActiveDispatcher.h | ActiveDispatcher.h | |||
---|---|---|---|---|
// | // | |||
// ActiveDispatcher.h | // ActiveDispatcher.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/ActiveDispatcher.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/ActiveDispatcher.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Threading | // Package: Threading | |||
// Module: ActiveObjects | // Module: ActiveObjects | |||
// | // | |||
// Definition of the ActiveDispatcher class. | // Definition of the ActiveDispatcher class. | |||
// | // | |||
// Copyright (c) 2006-2007, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2006-2007, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 54 | skipping to change at line 54 | |||
#include "Poco/ActiveStarter.h" | #include "Poco/ActiveStarter.h" | |||
#include "Poco/ActiveRunnable.h" | #include "Poco/ActiveRunnable.h" | |||
#include "Poco/NotificationQueue.h" | #include "Poco/NotificationQueue.h" | |||
namespace Poco { | namespace Poco { | |||
class Foundation_API ActiveDispatcher: protected Runnable | class Foundation_API ActiveDispatcher: protected Runnable | |||
/// This class is used to implement an active object | /// This class is used to implement an active object | |||
/// with strictly serialized method execution. | /// with strictly serialized method execution. | |||
/// | /// | |||
/// An active object, which is an ordinary object | /// An active object, with is an ordinary object | |||
/// containing ActiveMethod members, executes all | /// containing ActiveMethod members, executes all | |||
/// active methods in their own thread. | /// active methods in their own thread. | |||
/// This behavior does not fit the "classic" | /// This behavior does not fit the "classic" | |||
/// definition of an active object, which serializes | /// definition of an active object, which serializes | |||
/// the execution of active methods (in other words, | /// the execution of active methods (in other words, | |||
/// only one active method can be running at any given | /// only one active method can be running at any given | |||
/// time). | /// time). | |||
/// | /// | |||
/// Using this class as a base class, the serializing | /// Using this class as a base class, the serializing | |||
/// behavior for active objects can be implemented. | /// behavior for active objects can be implemented. | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
Activity.h | Activity.h | |||
---|---|---|---|---|
// | // | |||
// Activity.h | // Activity.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Activity.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/Activity.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Threading | // Package: Threading | |||
// Module: ActiveObjects | // Module: ActiveObjects | |||
// | // | |||
// Definition of the Activity template class. | // Definition of the Activity template class. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 113 | skipping to change at line 113 | |||
_done(false) | _done(false) | |||
/// Creates the activity. Call start() to | /// Creates the activity. Call start() to | |||
/// start it. | /// start it. | |||
{ | { | |||
poco_check_ptr (pOwner); | poco_check_ptr (pOwner); | |||
} | } | |||
~Activity() | ~Activity() | |||
/// Stops and destroys the activity. | /// Stops and destroys the activity. | |||
{ | { | |||
try | stop(); | |||
{ | wait(); | |||
stop(); | ||||
wait(); | ||||
} | ||||
catch (...) | ||||
{ | ||||
poco_unexpected(); | ||||
} | ||||
} | } | |||
void start() | void start() | |||
/// Starts the activity by acquiring a | /// Starts the activity by acquiring a | |||
/// thread for it from the default thread pool. | /// thread for it from the default thread pool. | |||
{ | { | |||
FastMutex::ScopedLock lock(_mutex); | FastMutex::ScopedLock lock(_mutex); | |||
if (!_running) | if (!_running) | |||
{ | { | |||
End of changes. 2 change blocks. | ||||
10 lines changed or deleted | 3 lines changed or added | |||
Any.h | Any.h | |||
---|---|---|---|---|
skipping to change at line 53 | skipping to change at line 53 | |||
namespace Poco { | namespace Poco { | |||
class Any | class Any | |||
/// An Any class represents a general type and is capable of storing any type, supporting type-safe extraction | /// An Any class represents a general type and is capable of storing any type, supporting type-safe extraction | |||
/// of the internally stored data. | /// of the internally stored data. | |||
/// | /// | |||
/// Code taken from the Boost 1.33.1 library. Original copyright by Kevlin Henney. Modified for Poco | /// Code taken from the Boost 1.33.1 library. Original copyright by Kevlin Henney. Modified for Poco | |||
/// by Applied Informatics. | /// by Applied Informatics. | |||
{ | { | |||
public: | public: | |||
Any(): | Any(): | |||
_content(0) | _content(0) | |||
/// Creates an empty any type. | /// Creates an empty any type. | |||
{ | { | |||
} | } | |||
template <typename ValueType> | template <typename ValueType> | |||
Any(const ValueType& value): | Any(const ValueType& value): | |||
_content(new Holder<ValueType>(value)) | _content(new Holder<ValueType>(value)) | |||
/// Creates an any which stores the init parameter inside. | /// Creates an any which stores the init parameter inside. | |||
/// | /// | |||
/// Example: | /// Example: | |||
/// Any a(13); | /// Any a(13); | |||
/// Any a(string("12345")); | /// Any a(string("12345")); | |||
{ | { | |||
} | } | |||
Any(const Any& other): | Any(const Any& other): | |||
_content(other._content ? other._content->clone() : 0) | _content(other._content ? other._content->clone() : 0) | |||
/// Copy constructor, works with empty Anys and initialized Any values. | /// Copy constructor, works with empty Anys and initialized Any values. | |||
{ | { | |||
} | } | |||
~Any() | ~Any() | |||
{ | { | |||
delete _content; | delete _content; | |||
} | } | |||
Any& swap(Any& rhs) | Any& swap(Any& rhs) | |||
/// Swaps the content of the two Anys. | /// Swaps the content of the two Anys. | |||
{ | { | |||
std::swap(_content, rhs._content); | std::swap(_content, rhs._content); | |||
return *this; | return *this; | |||
} | } | |||
template <typename ValueType> | template <typename ValueType> | |||
Any& operator = (const ValueType& rhs) | Any& operator = (const ValueType& rhs) | |||
/// Assignment operator for all types != Any. | /// Assignment operator for all types != Any. | |||
/// | /// | |||
/// Example: | /// Example: | |||
/// Any a = 13; | /// Any a = 13; | |||
/// Any a = string("12345"); | /// Any a = string("12345"); | |||
{ | { | |||
Any(rhs).swap(*this); | Any(rhs).swap(*this); | |||
return *this; | return *this; | |||
} | } | |||
Any& operator = (const Any& rhs) | Any& operator = (const Any& rhs) | |||
/// Assignment operator for Any. | /// Assignment operator for Any. | |||
{ | { | |||
Any(rhs).swap(*this); | Any(rhs).swap(*this); | |||
return *this; | return *this; | |||
} | } | |||
bool empty() const | bool empty() const | |||
/// returns true if the Any is empty | /// returns true if the Any is empty | |||
{ | { | |||
return !_content; | return !_content; | |||
} | } | |||
const std::type_info& type() const | const std::type_info& type() const | |||
/// Returns the type information of the stored content. | /// Returns the type information of the stored content. | |||
/// If the Any is empty typeid(void) is returned. | /// If the Any is empty typeid(void) is returned. | |||
/// It is suggested to always query an Any for its type info before trying to extract | /// It is suggested to always query an Any for its type info before trying to extract | |||
/// data via an AnyCast/RefAnyCast. | /// data via an AnyCast/RefAnyCast. | |||
{ | { | |||
return _content ? _content->type() : typeid(void); | return _content ? _content->type() : typeid(void); | |||
} | } | |||
private: | private: | |||
class Placeholder | class Placeholder | |||
{ | { | |||
public: | public: | |||
virtual ~Placeholder() | virtual ~Placeholder() | |||
{ | { | |||
} | } | |||
virtual const std::type_info& type() const = 0; | virtual const std::type_info& type() const = 0; | |||
virtual Placeholder* clone() const = 0; | virtual Placeholder* clone() const = 0; | |||
}; | }; | |||
template <typename ValueType> | template <typename ValueType> | |||
class Holder: public Placeholder | class Holder: public Placeholder | |||
{ | { | |||
public: | public: | |||
Holder(const ValueType& value): | Holder(const ValueType& value): | |||
_held(value) | _held(value) | |||
{ | { | |||
} | } | |||
virtual const std::type_info& type() const | virtual const std::type_info& type() const | |||
{ | { | |||
return typeid(ValueType); | return typeid(ValueType); | |||
} | } | |||
virtual Placeholder* clone() const | virtual Placeholder* clone() const | |||
{ | { | |||
return new Holder(_held); | return new Holder(_held); | |||
} | } | |||
ValueType _held; | ValueType _held; | |||
}; | }; | |||
private: | private: | |||
template <typename ValueType> | template <typename ValueType> | |||
friend ValueType* AnyCast(Any*); | friend ValueType* AnyCast(Any*); | |||
template <typename ValueType> | template <typename ValueType> | |||
friend ValueType* UnsafeAnyCast(Any*); | friend ValueType* UnsafeAnyCast(Any*); | |||
Placeholder* _content; | Placeholder* _content; | |||
}; | }; | |||
template <typename ValueType> | template <typename ValueType> | |||
ValueType* AnyCast(Any* operand) | ValueType* AnyCast(Any* operand) | |||
/// AnyCast operator used to extract the ValueType from an Any*. Wil l return a pointer | /// AnyCast operator used to extract the ValueType from an Any*. Wil l return a pointer | |||
/// to the stored value. | /// to the stored value. | |||
/// | /// | |||
/// Example Usage: | /// Example Usage: | |||
/// MyType* pTmp = AnyCast<MyType*>(pAny). | /// MyType* pTmp = AnyCast<MyType*>(pAny). | |||
/// Will return NULL if the cast fails, i.e. types don't match. | /// Will return NULL if the cast fails, i.e. types don't match. | |||
{ | { | |||
return operand && operand->type() == typeid(ValueType) | return operand && operand->type() == typeid(ValueType) | |||
? &static_cast<Any::Holder<ValueType>*>(operand->_content)- | ? &static_cast<Any::Holder<ValueType>*>(oper | |||
>_held | and->_content)->_held | |||
: 0; | : 0; | |||
} | } | |||
template <typename ValueType> | template <typename ValueType> | |||
const ValueType* AnyCast(const Any* operand) | const ValueType* AnyCast(const Any* operand) | |||
/// AnyCast operator used to extract a const ValueType pointer from an const Any*. Will return a const pointer | /// AnyCast operator used to extract a const ValueType pointer from an const Any*. Will return a const pointer | |||
/// to the stored value. | /// to the stored value. | |||
/// | /// | |||
/// Example Usage: | /// Example Usage: | |||
/// const MyType* pTmp = AnyCast<MyType*>(pAny). | /// const MyType* pTmp = AnyCast<MyType*>(pAny). | |||
/// Will return NULL if the cast fails, i.e. types don't match. | /// Will return NULL if the cast fails, i.e. types don't match. | |||
{ | { | |||
return AnyCast<ValueType>(const_cast<Any*>(operand)); | return AnyCast<ValueType>(const_cast<Any*>(operand)); | |||
} | } | |||
template <typename ValueType> | template <typename ValueType> | |||
ValueType AnyCast(const Any& operand) | ValueType AnyCast(const Any& operand) | |||
/// AnyCast operator used to extract a copy of the ValueType from an const Any&. | /// AnyCast operator used to extract a copy of the ValueType from an const Any&. | |||
/// | /// | |||
/// Example Usage: | /// Example Usage: | |||
/// MyType tmp = AnyCast<MyType>(anAny). | /// MyType tmp = AnyCast<MyType>(anAny). | |||
/// Will throw a BadCastException if the cast fails. | /// Will throw a BadCastException if the cast fails. | |||
/// Dont use an AnyCast in combination with references, i.e. MyType& tmp = ... or const MyType& = ... | /// Dont use an AnyCast in combination with references, i.e. MyType& tmp = ... or const MyType& = ... | |||
/// Some compilers will accept this code although a copy is returned . Use the RefAnyCast in | /// Some compilers will accept this code although a copy is returned . Use the RefAnyCast in | |||
/// these cases. | /// these cases. | |||
{ | { | |||
ValueType* result = AnyCast<ValueType>(const_cast<Any*>(&operand)); | ValueType* result = AnyCast<ValueType>(const_cast<Any*>(&operand)); | |||
if (!result) throw BadCastException("Failed to convert between const An | if (!result) throw BadCastException("Failed to convert between const | |||
y types"); | Any types"); | |||
return *result; | return *result; | |||
} | } | |||
template <typename ValueType> | template <typename ValueType> | |||
ValueType AnyCast(Any& operand) | ValueType AnyCast(Any& operand) | |||
/// AnyCast operator used to extract a copy of the ValueType from an Any&. | /// AnyCast operator used to extract a copy of the ValueType from an Any&. | |||
/// | /// | |||
/// Example Usage: | /// Example Usage: | |||
/// MyType tmp = AnyCast<MyType>(anAny). | /// MyType tmp = AnyCast<MyType>(anAny). | |||
/// Will throw a BadCastException if the cast fails. | /// Will throw a BadCastException if the cast fails. | |||
/// Dont use an AnyCast in combination with references, i.e. MyType& tmp = ... or const MyType& tmp = ... | /// Dont use an AnyCast in combination with references, i.e. MyType& tmp = ... or const MyType& tmp = ... | |||
/// Some compilers will accept this code although a copy is returned . Use the RefAnyCast in | /// Some compilers will accept this code although a copy is returned . Use the RefAnyCast in | |||
/// these cases. | /// these cases. | |||
{ | { | |||
ValueType* result = AnyCast<ValueType>(&operand); | ValueType* result = AnyCast<ValueType>(&operand); | |||
if (!result) throw BadCastException("Failed to convert between Any type | if (!result) throw BadCastException("Failed to convert between Any t | |||
s"); | ypes"); | |||
return *result; | return *result; | |||
} | } | |||
template <typename ValueType> | template <typename ValueType> | |||
const ValueType& RefAnyCast(const Any & operand) | const ValueType& RefAnyCast(const Any & operand) | |||
/// AnyCast operator used to return a const reference to the interna l data. | /// AnyCast operator used to return a const reference to the interna l data. | |||
/// | /// | |||
/// Example Usage: | /// Example Usage: | |||
/// const MyType& tmp = RefAnyCast<MyType>(anAny); | /// const MyType& tmp = RefAnyCast<MyType>(anAny); | |||
{ | { | |||
ValueType* result = AnyCast<ValueType>(const_cast<Any*>(&operand)); | ValueType* result = AnyCast<ValueType>(const_cast<Any*>(&operand)); | |||
if (!result) throw BadCastException("RefAnyCast: Failed to convert betw | if (!result) throw BadCastException("RefAnyCast: Failed to convert b | |||
een const Any types"); | etween const Any types"); | |||
return *result; | return *result; | |||
} | } | |||
template <typename ValueType> | template <typename ValueType> | |||
ValueType& RefAnyCast(Any& operand) | ValueType& RefAnyCast(Any& operand) | |||
/// AnyCast operator used to return a reference to the internal data . | /// AnyCast operator used to return a reference to the internal data . | |||
/// | /// | |||
/// Example Usage: | /// Example Usage: | |||
/// MyType& tmp = RefAnyCast<MyType>(anAny); | /// MyType& tmp = RefAnyCast<MyType>(anAny); | |||
{ | { | |||
ValueType* result = AnyCast<ValueType>(&operand); | ValueType* result = AnyCast<ValueType>(&operand); | |||
if (!result) throw BadCastException("RefAnyCast: Failed to convert betw | if (!result) throw BadCastException("RefAnyCast: Failed to convert b | |||
een Any types"); | etween Any types"); | |||
return *result; | return *result; | |||
} | } | |||
template <typename ValueType> | template <typename ValueType> | |||
ValueType* UnsafeAnyCast(Any* operand) | ValueType* UnsafeAnyCast(Any* operand) | |||
/// The "unsafe" versions of AnyCast are not part of the | /// The "unsafe" versions of AnyCast are not part of the | |||
/// public interface and may be removed at any time. They are | /// public interface and may be removed at any time. They are | |||
/// required where we know what type is stored in the any and can't | /// required where we know what type is stored in the any and can't | |||
/// use typeid() comparison, e.g., when our types may travel across | /// use typeid() comparison, e.g., when our types may travel across | |||
/// different shared libraries. | /// different shared libraries. | |||
{ | { | |||
return &static_cast<Any::Holder<ValueType>*>(operand->_content)->_held; | return &static_cast<Any::Holder<ValueType>*>(operand->_content)->_he ld; | |||
} | } | |||
template <typename ValueType> | template <typename ValueType> | |||
const ValueType* UnsafeAnyCast(const Any* operand) | const ValueType* UnsafeAnyCast(const Any* operand) | |||
/// The "unsafe" versions of AnyCast are not part of the | /// The "unsafe" versions of AnyCast are not part of the | |||
/// public interface and may be removed at any time. They are | /// public interface and may be removed at any time. They are | |||
/// required where we know what type is stored in the any and can't | /// required where we know what type is stored in the any and can't | |||
/// use typeid() comparison, e.g., when our types may travel across | /// use typeid() comparison, e.g., when our types may travel across | |||
/// different shared libraries. | /// different shared libraries. | |||
{ | { | |||
return AnyCast<ValueType>(const_cast<Any*>(operand)); | return AnyCast<ValueType>(const_cast<Any*>(operand)); | |||
} | } | |||
} // namespace Poco | } // namespace Poco | |||
#endif | #endif | |||
End of changes. 38 change blocks. | ||||
105 lines changed or deleted | 105 lines changed or added | |||
AtomicCounter.h | AtomicCounter.h | |||
---|---|---|---|---|
// | // | |||
// AtomicCounter.h | // AtomicCounter.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/AtomicCounter.h#8 $ | // $Id: //poco/1.4/Foundation/include/Poco/AtomicCounter.h#4 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: AtomicCounter | // Module: AtomicCounter | |||
// | // | |||
// Definition of the AtomicCounter class. | // Definition of the AtomicCounter class. | |||
// | // | |||
// Copyright (c) 2009, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2009, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 43 | skipping to change at line 43 | |||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Foundation_AtomicCounter_INCLUDED | #ifndef Foundation_AtomicCounter_INCLUDED | |||
#define Foundation_AtomicCounter_INCLUDED | #define Foundation_AtomicCounter_INCLUDED | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
#if POCO_OS == POCO_OS_WINDOWS_NT | #if POCO_OS == POCO_OS_WINDOWS_NT | |||
#include "Poco/UnWindows.h" | #include "Poco/UnWindows.h" | |||
#elif POCO_OS == POCO_OS_MAC_OS_X | #elif POCO_OS == POCO_OS_MAC_OS_X | |||
#include <libkern/OSAtomic.h> | #include <libkern/OSAtomic.h> | |||
#elif ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2) || __GNUC__ > 4) && (define d(__x86_64__) || defined(__i386__)) | #elif ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2) || __GNUC__ > 4) && (define d(__x86_64__) || defined(__i386__)) | |||
#if !defined(POCO_HAVE_GCC_ATOMICS) && !defined(POCO_NO_GCC_ATOMICS) | #if !defined(POCO_HAVE_GCC_ATOMICS) && !defined(POCO_NO_GCC_ATOMICS) | |||
#define POCO_HAVE_GCC_ATOMICS | #define POCO_HAVE_GCC_ATOMICS | |||
#endif | #endif | |||
#elif ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3) || __GNUC__ > 4) | #elif ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3) || __GNUC__ > 4) | |||
#if !defined(POCO_HAVE_GCC_ATOMICS) && !defined(POCO_NO_GCC_ATOMICS) | #if !defined(POCO_HAVE_GCC_ATOMICS) && !defined(POCO_NO_GCC_ATOMICS) | |||
#define POCO_HAVE_GCC_ATOMICS | #define POCO_HAVE_GCC_ATOMICS | |||
#endif | #endif | |||
#endif // POCO_OS | #endif // POCO_OS | |||
#include "Poco/Mutex.h" | #include "Poco/Mutex.h" | |||
namespace Poco { | namespace Poco { | |||
class Foundation_API AtomicCounter | class Foundation_API AtomicCounter | |||
/// This class implements a simple counter, which | /// This class implements a simple counter, which | |||
/// provides atomic operations that are safe to | /// provides atomic operations that are safe to | |||
/// use in a multithreaded environment. | /// use in a multithreaded environment. | |||
/// | /// | |||
End of changes. 5 change blocks. | ||||
9 lines changed or deleted | 9 lines changed or added | |||
BinaryReader.h | BinaryReader.h | |||
---|---|---|---|---|
skipping to change at line 42 | skipping to change at line 42 | |||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | |||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Foundation_BinaryReader_INCLUDED | #ifndef Foundation_BinaryReader_INCLUDED | |||
#define Foundation_BinaryReader_INCLUDED | #define Foundation_BinaryReader_INCLUDED | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
#include "Poco/Buffer.h" | ||||
#include "Poco/MemoryStream.h" | ||||
#include <vector> | #include <vector> | |||
#include <istream> | #include <istream> | |||
namespace Poco { | namespace Poco { | |||
class TextEncoding; | class TextEncoding; | |||
class TextConverter; | class TextConverter; | |||
class Foundation_API BinaryReader | class Foundation_API BinaryReader | |||
/// This class reads basic types (and std::vectors thereof) | /// This class reads basic types (and std::vectors thereof) | |||
skipping to change at line 160 | skipping to change at line 162 | |||
bool eof(); | bool eof(); | |||
/// Returns _istr.eof(); | /// Returns _istr.eof(); | |||
std::istream& stream() const; | std::istream& stream() const; | |||
/// Returns the underlying stream. | /// Returns the underlying stream. | |||
StreamByteOrder byteOrder() const; | StreamByteOrder byteOrder() const; | |||
/// Returns the byte-order used by the reader, which is | /// Returns the byte-order used by the reader, which is | |||
/// either BIG_ENDIAN_BYTE_ORDER or LITTLE_ENDIAN_BYTE_ORDER . | /// either BIG_ENDIAN_BYTE_ORDER or LITTLE_ENDIAN_BYTE_ORDER . | |||
void setExceptions(std::ios_base::iostate st = (std::istream::failbi | ||||
t | std::istream::badbit)); | ||||
/// Sets the stream to throw exception on specified state (d | ||||
efault failbit and badbit); | ||||
std::streamsize available() const; | ||||
/// Returns the number of available bytes in the stream. | ||||
private: | private: | |||
std::istream& _istr; | std::istream& _istr; | |||
bool _flipBytes; | bool _flipBytes; | |||
TextConverter* _pTextConverter; | TextConverter* _pTextConverter; | |||
}; | }; | |||
template <typename T> | ||||
class BasicMemoryBinaryReader : public BinaryReader | ||||
/// A convenient wrapper for using Buffer and MemoryStream with Bina | ||||
ryReader. | ||||
{ | ||||
public: | ||||
BasicMemoryBinaryReader(const Buffer<T>& data, StreamByteOrder byteO | ||||
rder = NATIVE_BYTE_ORDER): | ||||
BinaryReader(_istr, byteOrder), | ||||
_data(data), | ||||
_istr(data.begin(), data.capacity()) | ||||
{ | ||||
} | ||||
BasicMemoryBinaryReader(const Buffer<T>& data, TextEncoding& encodin | ||||
g, StreamByteOrder byteOrder = NATIVE_BYTE_ORDER): | ||||
BinaryReader(_istr, encoding, byteOrder), | ||||
_data(data), | ||||
_istr(data.begin(), data.capacity()) | ||||
{ | ||||
} | ||||
~BasicMemoryBinaryReader() | ||||
{ | ||||
} | ||||
const Buffer<T>& data() const | ||||
{ | ||||
return _data; | ||||
} | ||||
const MemoryInputStream& stream() const | ||||
{ | ||||
return _istr; | ||||
} | ||||
MemoryInputStream& stream() | ||||
{ | ||||
return _istr; | ||||
} | ||||
private: | ||||
const Buffer<T>& _data; | ||||
MemoryInputStream _istr; | ||||
}; | ||||
typedef BasicMemoryBinaryReader<char> MemoryBinaryReader; | ||||
// | // | |||
// inlines | // inlines | |||
// | // | |||
inline bool BinaryReader::good() | inline bool BinaryReader::good() | |||
{ | { | |||
return _istr.good(); | return _istr.good(); | |||
} | } | |||
inline bool BinaryReader::fail() | inline bool BinaryReader::fail() | |||
skipping to change at line 204 | skipping to change at line 257 | |||
inline BinaryReader::StreamByteOrder BinaryReader::byteOrder() const | inline BinaryReader::StreamByteOrder BinaryReader::byteOrder() const | |||
{ | { | |||
#if defined(POCO_ARCH_BIG_ENDIAN) | #if defined(POCO_ARCH_BIG_ENDIAN) | |||
return _flipBytes ? LITTLE_ENDIAN_BYTE_ORDER : BIG_ENDIAN_BYTE_ORDER ; | return _flipBytes ? LITTLE_ENDIAN_BYTE_ORDER : BIG_ENDIAN_BYTE_ORDER ; | |||
#else | #else | |||
return _flipBytes ? BIG_ENDIAN_BYTE_ORDER : LITTLE_ENDIAN_BYTE_ORDER ; | return _flipBytes ? BIG_ENDIAN_BYTE_ORDER : LITTLE_ENDIAN_BYTE_ORDER ; | |||
#endif | #endif | |||
} | } | |||
inline void BinaryReader::setExceptions(std::ios_base::iostate st) | ||||
{ | ||||
_istr.exceptions(st); | ||||
} | ||||
inline std::streamsize BinaryReader::available() const | ||||
{ | ||||
return _istr.rdbuf()->in_avail(); | ||||
} | ||||
} // namespace Poco | } // namespace Poco | |||
#endif // Foundation_BinaryReader_INCLUDED | #endif // Foundation_BinaryReader_INCLUDED | |||
End of changes. 4 change blocks. | ||||
0 lines changed or deleted | 68 lines changed or added | |||
BinaryWriter.h | BinaryWriter.h | |||
---|---|---|---|---|
skipping to change at line 42 | skipping to change at line 42 | |||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | |||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Foundation_BinaryWriter_INCLUDED | #ifndef Foundation_BinaryWriter_INCLUDED | |||
#define Foundation_BinaryWriter_INCLUDED | #define Foundation_BinaryWriter_INCLUDED | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
#include "Poco/Buffer.h" | ||||
#include "Poco/MemoryStream.h" | ||||
#include <vector> | #include <vector> | |||
#include <ostream> | #include <ostream> | |||
namespace Poco { | namespace Poco { | |||
class TextEncoding; | class TextEncoding; | |||
class TextConverter; | class TextConverter; | |||
class Foundation_API BinaryWriter | class Foundation_API BinaryWriter | |||
/// This class writes basic types (and std::vectors of these) | /// This class writes basic types (and std::vectors of these) | |||
skipping to change at line 181 | skipping to change at line 183 | |||
StreamByteOrder byteOrder() const; | StreamByteOrder byteOrder() const; | |||
/// Returns the byte ordering used by the writer, which is | /// Returns the byte ordering used by the writer, which is | |||
/// either BIG_ENDIAN_BYTE_ORDER or LITTLE_ENDIAN_BYTE_ORDER . | /// either BIG_ENDIAN_BYTE_ORDER or LITTLE_ENDIAN_BYTE_ORDER . | |||
private: | private: | |||
std::ostream& _ostr; | std::ostream& _ostr; | |||
bool _flipBytes; | bool _flipBytes; | |||
TextConverter* _pTextConverter; | TextConverter* _pTextConverter; | |||
}; | }; | |||
template <typename T> | ||||
class BasicMemoryBinaryWriter : public BinaryWriter | ||||
/// A convenient wrapper for using Buffer and MemoryStream with Bina | ||||
rWriter. | ||||
{ | ||||
public: | ||||
BasicMemoryBinaryWriter(Buffer<T>& data, StreamByteOrder byteOrder = | ||||
NATIVE_BYTE_ORDER): | ||||
BinaryWriter(_ostr, byteOrder), | ||||
_data(data), | ||||
_ostr(data.begin(), data.capacity()) | ||||
{ | ||||
} | ||||
BasicMemoryBinaryWriter(Buffer<T>& data, TextEncoding& encoding, Str | ||||
eamByteOrder byteOrder = NATIVE_BYTE_ORDER): | ||||
BinaryWriter(_ostr, encoding, byteOrder), | ||||
_data(data), | ||||
_ostr(data.begin(), data.capacity()) | ||||
{ | ||||
} | ||||
~BasicMemoryBinaryWriter() | ||||
{ | ||||
flush(); | ||||
} | ||||
Buffer<T>& data() | ||||
{ | ||||
return _data; | ||||
} | ||||
const Buffer<T>& data() const | ||||
{ | ||||
return _data; | ||||
} | ||||
const MemoryOutputStream& stream() const | ||||
{ | ||||
return _ostr; | ||||
} | ||||
MemoryOutputStream& stream() | ||||
{ | ||||
return _ostr; | ||||
} | ||||
private: | ||||
Buffer<T>& _data; | ||||
MemoryOutputStream _ostr; | ||||
}; | ||||
typedef BasicMemoryBinaryWriter<char> MemoryBinaryWriter; | ||||
// | // | |||
// inlines | // inlines | |||
// | // | |||
inline std::ostream& BinaryWriter::stream() const | inline std::ostream& BinaryWriter::stream() const | |||
{ | { | |||
return _ostr; | return _ostr; | |||
} | } | |||
inline bool BinaryWriter::good() | inline bool BinaryWriter::good() | |||
End of changes. 2 change blocks. | ||||
0 lines changed or deleted | 56 lines changed or added | |||
Buffer.h | Buffer.h | |||
---|---|---|---|---|
// | // | |||
// Buffer.h | // Buffer.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Buffer.h#3 $ | // $Id: //poco/1.4/Foundation/include/Poco/Buffer.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: Buffer | // Module: Buffer | |||
// | // | |||
// Definition of the Buffer class. | // Definition of the Buffer class. | |||
// | // | |||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2012, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
// Permission is hereby granted, free of charge, to any person or organizat ion | // Permission is hereby granted, free of charge, to any person or organizat ion | |||
// obtaining a copy of the software and accompanying documentation covered by | // obtaining a copy of the software and accompanying documentation covered by | |||
// this license (the "Software") to use, reproduce, display, distribute, | // this license (the "Software") to use, reproduce, display, distribute, | |||
// execute, and transmit the Software, and to prepare derivative works of t he | // execute, and transmit the Software, and to prepare derivative works of t he | |||
// Software, and to permit third-parties to whom the Software is furnished to | // Software, and to permit third-parties to whom the Software is furnished to | |||
// do so, all subject to the following: | // do so, all subject to the following: | |||
// | // | |||
// The copyright notices in the Software and this entire statement, includi ng | // The copyright notices in the Software and this entire statement, includi ng | |||
skipping to change at line 42 | skipping to change at line 42 | |||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | |||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Foundation_Buffer_INCLUDED | #ifndef Foundation_Buffer_INCLUDED | |||
#define Foundation_Buffer_INCLUDED | #define Foundation_Buffer_INCLUDED | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
#include "Poco/Exception.h" | ||||
#include <cstring> | #include <cstring> | |||
#include <cstddef> | #include <cstddef> | |||
namespace Poco { | namespace Poco { | |||
template <class T> | template <class T> | |||
class Buffer | class Buffer | |||
/// A very simple buffer class that allocates a buffer of | /// A very simple buffer class that allocates a buffer of | |||
/// a given type and size in the constructor and | /// a given type and size in the constructor and | |||
/// deallocates the buffer in the destructor. | /// deallocates the buffer in the destructor. | |||
/// | /// | |||
/// This class is useful everywhere where a temporary buffer | /// This class is useful everywhere where a temporary buffer | |||
/// is needed. | /// is needed. | |||
{ | { | |||
public: | public: | |||
Buffer(std::size_t size): | Buffer(std::size_t capacity): | |||
_size(size), | _capacity(capacity), | |||
_ptr(new T[size]) | _used(capacity), | |||
_ptr(new T[capacity]), | ||||
_ownMem(true) | ||||
/// Creates and allocates the Buffer. | /// Creates and allocates the Buffer. | |||
{ | { | |||
} | } | |||
explicit Buffer(T* pMem, std::size_t length): | ||||
_capacity(length), | ||||
_used(length), | ||||
_ptr(pMem), | ||||
_ownMem(false) | ||||
/// Creates the Buffer. Length argument specifies the length | ||||
/// of the supplied memory pointed to by pMem in the number | ||||
/// of elements of type T. Supplied pointer is considered | ||||
/// blank and not owned by Buffer, so in this case Buffer | ||||
/// only acts as a wrapper around externally supplied | ||||
/// (and lifetime-managed) memory. | ||||
{ | ||||
} | ||||
explicit Buffer(const T* pMem, std::size_t length): | ||||
_capacity(length), | ||||
_used(length), | ||||
_ptr(new T[length]), | ||||
_ownMem(true) | ||||
/// Creates and allocates the Buffer; copies the contents of | ||||
/// the supplied memory into the buffer. Length argument spe | ||||
cifies | ||||
/// the length of the supplied memory pointed to by pMem in | ||||
the | ||||
/// number of elements of type T. | ||||
{ | ||||
if (_used) | ||||
std::memcpy(_ptr, pMem, _used * sizeof(T)); | ||||
} | ||||
Buffer(const Buffer& other): | ||||
/// Copy constructor. | ||||
_capacity(other._used), | ||||
_used(other._used), | ||||
_ptr(new T[other._used]), | ||||
_ownMem(true) | ||||
{ | ||||
if (_used) | ||||
std::memcpy(_ptr, other._ptr, _used * sizeof(T)); | ||||
} | ||||
Buffer& operator =(const Buffer& other) | ||||
/// Assignment operator. | ||||
{ | ||||
if (this != &other) | ||||
{ | ||||
Buffer tmp(other); | ||||
swap(tmp); | ||||
} | ||||
return *this; | ||||
} | ||||
~Buffer() | ~Buffer() | |||
/// Destroys the Buffer. | /// Destroys the Buffer. | |||
{ | { | |||
delete [] _ptr; | if (_ownMem) delete [] _ptr; | |||
} | } | |||
void resize(std::size_t newSize, bool preserveContent = true) | void resize(std::size_t newCapacity, bool preserveContent = true) | |||
/// Resizes the buffer. If preserveContent is true, | /// Resizes the buffer capacity and size. If preserveContent | |||
is true, | ||||
/// the content of the old buffer is copied over to the | /// the content of the old buffer is copied over to the | |||
/// new buffer. NewSize can be larger or smaller than | /// new buffer. The new capacity can be larger or smaller th | |||
/// the current size, but it must not be 0. | an | |||
/// the current one; if it is smaller, capacity will remain | ||||
intact. | ||||
/// Size will always be set to the new capacity. | ||||
/// | ||||
/// Buffers only wrapping externally owned storage can not b | ||||
e | ||||
/// resized. If resize is attempted on those, IllegalAccessE | ||||
xception | ||||
/// is thrown. | ||||
{ | ||||
if (!_ownMem) | ||||
throw Poco::InvalidAccessException("Cannot resize bu | ||||
ffer which does not own its storage."); | ||||
if (newCapacity > _capacity) | ||||
{ | ||||
T* ptr = new T[newCapacity]; | ||||
if (preserveContent) | ||||
std::memcpy(ptr, _ptr, newCapacity); | ||||
delete [] _ptr; | ||||
_ptr = ptr; | ||||
_capacity = newCapacity; | ||||
} | ||||
_used = newCapacity; | ||||
} | ||||
void assign(const T* buf, std::size_t sz) | ||||
/// Assigns the argument buffer to this buffer. | ||||
/// If necessary, resizes the buffer. | ||||
{ | ||||
if (0 == sz) return; | ||||
if (sz > _capacity) resize(sz, false); | ||||
std::memcpy(_ptr, buf, sz); | ||||
_used = sz; | ||||
} | ||||
void append(const T* buf, std::size_t sz) | ||||
/// Resizes this buffer and appends the argument buffer. | ||||
{ | ||||
if (0 == sz) return; | ||||
std::size_t oldSize = _used; | ||||
resize(_used + sz, true); | ||||
std::memcpy(_ptr + oldSize, buf, sz); | ||||
} | ||||
void append(const Buffer& buf) | ||||
/// Resizes this buffer and appends the argument buffer. | ||||
{ | ||||
append(buf.begin(), buf.size()); | ||||
} | ||||
std::size_t capacity() const | ||||
/// Returns the allocated memory size. | ||||
{ | ||||
return _capacity; | ||||
} | ||||
void swap(Buffer& other) | ||||
/// Swaps the buffer with another one. | ||||
{ | ||||
using std::swap; | ||||
swap(_ptr, other._ptr); | ||||
swap(_capacity, other._capacity); | ||||
swap(_used, other._used); | ||||
} | ||||
bool operator ==(const Buffer& other) const | ||||
/// Compare operator. | ||||
{ | { | |||
T* ptr = new T[newSize]; | if (this != &other) | |||
if (preserveContent) | ||||
{ | { | |||
std::size_t n = newSize > _size ? _size : newSize; | if (_used == other._used) | |||
std::memcpy(ptr, _ptr, n*sizeof(T)); | { | |||
if (std::memcmp(_ptr, other._ptr, _used) == | ||||
0) | ||||
{ | ||||
return true; | ||||
} | ||||
} | ||||
return false; | ||||
} | } | |||
delete [] _ptr; | ||||
_ptr = ptr; | return true; | |||
_size = newSize; | } | |||
bool operator !=(const Buffer& other) const | ||||
/// Compare operator. | ||||
{ | ||||
return !(*this == other); | ||||
} | ||||
void clear() | ||||
/// Sets the contents of the bufer to zero. | ||||
{ | ||||
std::memset(_ptr, 0, _used * sizeof(T)); | ||||
} | } | |||
std::size_t size() const | std::size_t size() const | |||
/// Returns the size of the buffer. | /// Returns the used size of the buffer. | |||
{ | { | |||
return _size; | return _used; | |||
} | } | |||
T* begin() | T* begin() | |||
/// Returns a pointer to the beginning of the buffer. | /// Returns a pointer to the beginning of the buffer. | |||
{ | { | |||
return _ptr; | return _ptr; | |||
} | } | |||
const T* begin() const | const T* begin() const | |||
/// Returns a pointer to the beginning of the buffer. | /// Returns a pointer to the beginning of the buffer. | |||
{ | { | |||
return _ptr; | return _ptr; | |||
} | } | |||
T* end() | T* end() | |||
/// Returns a pointer to end of the buffer. | /// Returns a pointer to end of the buffer. | |||
{ | { | |||
return _ptr + _size; | return _ptr + _used; | |||
} | } | |||
const T* end() const | const T* end() const | |||
/// Returns a pointer to the end of the buffer. | /// Returns a pointer to the end of the buffer. | |||
{ | { | |||
return _ptr + _size; | return _ptr + _used; | |||
} | ||||
bool empty() const | ||||
/// Return true if buffer is empty. | ||||
{ | ||||
return 0 == _used; | ||||
} | } | |||
T& operator [] (std::size_t index) | T& operator [] (std::size_t index) | |||
{ | { | |||
poco_assert (index < _size); | poco_assert (index < _used); | |||
return _ptr[index]; | return _ptr[index]; | |||
} | } | |||
const T& operator [] (std::size_t index) const | const T& operator [] (std::size_t index) const | |||
{ | { | |||
poco_assert (index < _size); | poco_assert (index < _used); | |||
return _ptr[index]; | return _ptr[index]; | |||
} | } | |||
private: | private: | |||
Buffer(); | Buffer(); | |||
Buffer(const Buffer&); | ||||
Buffer& operator = (const Buffer&); | ||||
std::size_t _size; | std::size_t _capacity; | |||
T* _ptr; | std::size_t _used; | |||
T* _ptr; | ||||
bool _ownMem; | ||||
}; | }; | |||
} // namespace Poco | } // namespace Poco | |||
#endif // Foundation_Buffer_INCLUDED | #endif // Foundation_Buffer_INCLUDED | |||
End of changes. 19 change blocks. | ||||
27 lines changed or deleted | 178 lines changed or added | |||
BufferAllocator.h | BufferAllocator.h | |||
---|---|---|---|---|
// | // | |||
// BufferAllocator.h | // BufferAllocator.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/BufferAllocator.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/BufferAllocator.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Streams | // Package: Streams | |||
// Module: BufferAllocator | // Module: BufferAllocator | |||
// | // | |||
// Definition of the BufferAllocator class. | // Definition of the BufferAllocator class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 60 | skipping to change at line 60 | |||
/// BufferAllocator has been specified. | /// BufferAllocator has been specified. | |||
{ | { | |||
public: | public: | |||
typedef ch char_type; | typedef ch char_type; | |||
static char_type* allocate(std::streamsize size) | static char_type* allocate(std::streamsize size) | |||
{ | { | |||
return new char_type[static_cast<std::size_t>(size)]; | return new char_type[static_cast<std::size_t>(size)]; | |||
} | } | |||
static void deallocate(char_type* ptr, std::streamsize /*size*/) | static void deallocate(char_type* ptr, std::streamsize size) | |||
{ | { | |||
delete [] ptr; | delete [] ptr; | |||
} | } | |||
}; | }; | |||
} // namespace Poco | } // namespace Poco | |||
#endif // Foundation_BufferAllocator_INCLUDED | #endif // Foundation_BufferAllocator_INCLUDED | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
BufferedBidirectionalStreamBuf.h | BufferedBidirectionalStreamBuf.h | |||
---|---|---|---|---|
// | // | |||
// BufferedBidirectionalStreamBuf.h | // BufferedBidirectionalStreamBuf.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/BufferedBidirectionalStreamBuf.h #2 $ | // $Id: //poco/1.4/Foundation/include/Poco/BufferedBidirectionalStreamBuf.h #1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Streams | // Package: Streams | |||
// Module: StreamBuf | // Module: StreamBuf | |||
// | // | |||
// Definition of template BasicBufferedBidirectionalStreamBuf and class Buf feredBidirectionalStreamBuf. | // Definition of template BasicBufferedBidirectionalStreamBuf and class Buf feredBidirectionalStreamBuf. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 152 | skipping to change at line 152 | |||
return _mode; | return _mode; | |||
} | } | |||
void resetBuffers() | void resetBuffers() | |||
{ | { | |||
this->setg(_pReadBuffer + 4, _pReadBuffer + 4, _pReadBuffer + 4); | this->setg(_pReadBuffer + 4, _pReadBuffer + 4, _pReadBuffer + 4); | |||
this->setp(_pWriteBuffer, _pWriteBuffer + (_bufsize - 1)); | this->setp(_pWriteBuffer, _pWriteBuffer + (_bufsize - 1)); | |||
} | } | |||
private: | private: | |||
virtual int readFromDevice(char_type* /*buffer*/, std::streamsize /* length*/) | virtual int readFromDevice(char_type* buffer, std::streamsize length ) | |||
{ | { | |||
return 0; | return 0; | |||
} | } | |||
virtual int writeToDevice(const char_type* /*buffer*/, std::streamsi ze /*length*/) | virtual int writeToDevice(const char_type* buffer, std::streamsize l ength) | |||
{ | { | |||
return 0; | return 0; | |||
} | } | |||
int flushBuffer() | int flushBuffer() | |||
{ | { | |||
int n = int(this->pptr() - this->pbase()); | int n = int(this->pptr() - this->pbase()); | |||
if (writeToDevice(this->pbase(), n) == n) | if (writeToDevice(this->pbase(), n) == n) | |||
{ | { | |||
this->pbump(-n); | this->pbump(-n); | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
BufferedStreamBuf.h | BufferedStreamBuf.h | |||
---|---|---|---|---|
// | // | |||
// BufferedStreamBuf.h | // BufferedStreamBuf.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/BufferedStreamBuf.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/BufferedStreamBuf.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Streams | // Package: Streams | |||
// Module: StreamBuf | // Module: StreamBuf | |||
// | // | |||
// Definition of template BasicBufferedStreamBuf and class BufferedStreamBu f. | // Definition of template BasicBufferedStreamBuf and class BufferedStreamBu f. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 145 | skipping to change at line 145 | |||
{ | { | |||
_mode = mode; | _mode = mode; | |||
} | } | |||
openmode getMode() const | openmode getMode() const | |||
{ | { | |||
return _mode; | return _mode; | |||
} | } | |||
private: | private: | |||
virtual int readFromDevice(char_type* /*buffer*/, std::streamsize /* length*/) | virtual int readFromDevice(char_type* buffer, std::streamsize length ) | |||
{ | { | |||
return 0; | return 0; | |||
} | } | |||
virtual int writeToDevice(const char_type* /*buffer*/, std::streamsi ze /*length*/) | virtual int writeToDevice(const char_type* buffer, std::streamsize l ength) | |||
{ | { | |||
return 0; | return 0; | |||
} | } | |||
int flushBuffer() | int flushBuffer() | |||
{ | { | |||
int n = int(this->pptr() - this->pbase()); | int n = int(this->pptr() - this->pbase()); | |||
if (writeToDevice(this->pbase(), n) == n) | if (writeToDevice(this->pbase(), n) == n) | |||
{ | { | |||
this->pbump(-n); | this->pbump(-n); | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
Bugcheck.h | Bugcheck.h | |||
---|---|---|---|---|
// | // | |||
// Bugcheck.h | // Bugcheck.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Bugcheck.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/Bugcheck.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: Bugcheck | // Module: Bugcheck | |||
// | // | |||
// Definition of the Bugcheck class and the self-testing macros. | // Definition of the Bugcheck class and the self-testing macros. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 75 | skipping to change at line 75 | |||
/// possible, then throw an NullPointerException. | /// possible, then throw an NullPointerException. | |||
static void bugcheck(const char* file, int line); | static void bugcheck(const char* file, int line); | |||
/// An internal error was encountered. Break into the debugg er, if | /// An internal error was encountered. Break into the debugg er, if | |||
/// possible, then throw an BugcheckException. | /// possible, then throw an BugcheckException. | |||
static void bugcheck(const char* msg, const char* file, int line); | static void bugcheck(const char* msg, const char* file, int line); | |||
/// An internal error was encountered. Break into the debugg er, if | /// An internal error was encountered. Break into the debugg er, if | |||
/// possible, then throw an BugcheckException. | /// possible, then throw an BugcheckException. | |||
static void unexpected(const char* file, int line); | ||||
/// An exception was caught in a destructor. Break into debu | ||||
gger, | ||||
/// if possible and report exception. Must only be called fr | ||||
om | ||||
/// within a catch () block as it rethrows the exception to | ||||
/// determine its class. | ||||
static void debugger(const char* file, int line); | static void debugger(const char* file, int line); | |||
/// An internal error was encountered. Break into the debugg er, if | /// An internal error was encountered. Break into the debugg er, if | |||
/// possible. | /// possible. | |||
static void debugger(const char* msg, const char* file, int line); | static void debugger(const char* msg, const char* file, int line); | |||
/// An internal error was encountered. Break into the debugg er, if | /// An internal error was encountered. Break into the debugg er, if | |||
/// possible. | /// possible. | |||
protected: | protected: | |||
static std::string what(const char* msg, const char* file, int line) ; | static std::string what(const char* msg, const char* file, int line) ; | |||
skipping to change at line 117 | skipping to change at line 111 | |||
#define poco_check_ptr(ptr) \ | #define poco_check_ptr(ptr) \ | |||
if (!(ptr)) Poco::Bugcheck::nullPointer(#ptr, __FILE__, __LINE__); e lse (void) 0 | if (!(ptr)) Poco::Bugcheck::nullPointer(#ptr, __FILE__, __LINE__); e lse (void) 0 | |||
#define poco_bugcheck() \ | #define poco_bugcheck() \ | |||
Poco::Bugcheck::bugcheck(__FILE__, __LINE__) | Poco::Bugcheck::bugcheck(__FILE__, __LINE__) | |||
#define poco_bugcheck_msg(msg) \ | #define poco_bugcheck_msg(msg) \ | |||
Poco::Bugcheck::bugcheck(msg, __FILE__, __LINE__) | Poco::Bugcheck::bugcheck(msg, __FILE__, __LINE__) | |||
#define poco_unexpected() \ | ||||
Poco::Bugcheck::unexpected(__FILE__, __LINE__); | ||||
#define poco_debugger() \ | #define poco_debugger() \ | |||
Poco::Bugcheck::debugger(__FILE__, __LINE__) | Poco::Bugcheck::debugger(__FILE__, __LINE__) | |||
#define poco_debugger_msg(msg) \ | #define poco_debugger_msg(msg) \ | |||
Poco::Bugcheck::debugger(msg, __FILE__, __LINE__) | Poco::Bugcheck::debugger(msg, __FILE__, __LINE__) | |||
#if defined(_DEBUG) | #if defined(_DEBUG) | |||
# define poco_stdout_dbg(outstr) \ | # define poco_stdout_dbg(outstr) \ | |||
std::cout << __FILE__ << '(' << std::dec << __LINE__ << "):" << outs tr << std::endl; | std::cout << __FILE__ << '(' << std::dec << __LINE__ << "):" << outs tr << std::endl; | |||
#else | #else | |||
End of changes. 3 change blocks. | ||||
12 lines changed or deleted | 1 lines changed or added | |||
ByteOrder.h | ByteOrder.h | |||
---|---|---|---|---|
// | // | |||
// ByteOrder.h | // ByteOrder.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/ByteOrder.h#5 $ | // $Id: //poco/1.4/Foundation/include/Poco/ByteOrder.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: ByteOrder | // Module: ByteOrder | |||
// | // | |||
// Copyright (c) 2004-2014, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
// Permission is hereby granted, free of charge, to any person or organizat ion | // Permission is hereby granted, free of charge, to any person or organizat ion | |||
// obtaining a copy of the software and accompanying documentation covered by | // obtaining a copy of the software and accompanying documentation covered by | |||
// this license (the "Software") to use, reproduce, display, distribute, | // this license (the "Software") to use, reproduce, display, distribute, | |||
// execute, and transmit the Software, and to prepare derivative works of t he | // execute, and transmit the Software, and to prepare derivative works of t he | |||
// Software, and to permit third-parties to whom the Software is furnished to | // Software, and to permit third-parties to whom the Software is furnished to | |||
// do so, all subject to the following: | // do so, all subject to the following: | |||
// | // | |||
// The copyright notices in the Software and this entire statement, includi ng | // The copyright notices in the Software and this entire statement, includi ng | |||
skipping to change at line 41 | skipping to change at line 41 | |||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Foundation_ByteOrder_INCLUDED | #ifndef Foundation_ByteOrder_INCLUDED | |||
#define Foundation_ByteOrder_INCLUDED | #define Foundation_ByteOrder_INCLUDED | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
#include "Poco/Types.h" | #include "Poco/Types.h" | |||
#if defined(_MSC_VER) | ||||
#include <stdlib.h> // builtins | ||||
#endif | ||||
namespace Poco { | namespace Poco { | |||
class Foundation_API ByteOrder | class Foundation_API ByteOrder | |||
/// This class contains a number of static methods | /// This class contains a number of static methods | |||
/// to convert between big-endian and little-endian | /// to convert between big-endian and little-endian | |||
/// integers of various sizes. | /// integers of various sizes. | |||
{ | { | |||
public: | public: | |||
static Int16 flipBytes(Int16 value); | static Int16 flipBytes(Int16 value); | |||
skipping to change at line 117 | skipping to change at line 114 | |||
static Int16 fromNetwork(Int16 value); | static Int16 fromNetwork(Int16 value); | |||
static UInt16 fromNetwork (UInt16 value); | static UInt16 fromNetwork (UInt16 value); | |||
static Int32 fromNetwork(Int32 value); | static Int32 fromNetwork(Int32 value); | |||
static UInt32 fromNetwork (UInt32 value); | static UInt32 fromNetwork (UInt32 value); | |||
#if defined(POCO_HAVE_INT64) | #if defined(POCO_HAVE_INT64) | |||
static Int64 fromNetwork(Int64 value); | static Int64 fromNetwork(Int64 value); | |||
static UInt64 fromNetwork (UInt64 value); | static UInt64 fromNetwork (UInt64 value); | |||
#endif | #endif | |||
}; | }; | |||
#if !defined(POCO_NO_BYTESWAP_BUILTINS) | ||||
#if defined(_MSC_VER) | ||||
#define POCO_HAVE_MSC_BYTESWAP 1 | ||||
#elif defined(__clang__) | ||||
#if __has_builtin(__builtin_bswap32) | ||||
#define POCO_HAVE_GCC_BYTESWAP 1 | ||||
#endif | ||||
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR_ | ||||
_ >= 3)) | ||||
#define POCO_HAVE_GCC_BYTESWAP 1 | ||||
#endif | ||||
#endif | ||||
// | // | |||
// inlines | // inlines | |||
// | // | |||
inline UInt16 ByteOrder::flipBytes(UInt16 value) | inline UInt16 ByteOrder::flipBytes(UInt16 value) | |||
{ | { | |||
#if defined(POCO_HAVE_MSC_BYTESWAP) | ||||
return _byteswap_ushort(value); | ||||
#else | ||||
return ((value >> 8) & 0x00FF) | ((value << 8) & 0xFF00); | return ((value >> 8) & 0x00FF) | ((value << 8) & 0xFF00); | |||
#endif | ||||
} | } | |||
inline Int16 ByteOrder::flipBytes(Int16 value) | inline Int16 ByteOrder::flipBytes(Int16 value) | |||
{ | { | |||
return Int16(flipBytes(UInt16(value))); | return Int16(flipBytes(UInt16(value))); | |||
} | } | |||
inline UInt32 ByteOrder::flipBytes(UInt32 value) | inline UInt32 ByteOrder::flipBytes(UInt32 value) | |||
{ | { | |||
#if defined(POCO_HAVE_MSC_BYTESWAP) | ||||
return _byteswap_ulong(value); | ||||
#elif defined(POCO_HAVE_GCC_BYTESWAP) | ||||
return __builtin_bswap32(value); | ||||
#else | ||||
return ((value >> 24) & 0x000000FF) | ((value >> 8) & 0x0000FF00) | return ((value >> 24) & 0x000000FF) | ((value >> 8) & 0x0000FF00) | |||
| ((value << 8) & 0x00FF0000) | ((value << 24) & 0xFF000000); | | ((value << 8) & 0x00FF0000) | ((value << 24) & 0xFF000000); | |||
#endif | ||||
} | } | |||
inline Int32 ByteOrder::flipBytes(Int32 value) | inline Int32 ByteOrder::flipBytes(Int32 value) | |||
{ | { | |||
return Int32(flipBytes(UInt32(value))); | return Int32(flipBytes(UInt32(value))); | |||
} | } | |||
#if defined(POCO_HAVE_INT64) | #if defined(POCO_HAVE_INT64) | |||
inline UInt64 ByteOrder::flipBytes(UInt64 value) | inline UInt64 ByteOrder::flipBytes(UInt64 value) | |||
{ | { | |||
#if defined(POCO_HAVE_MSC_BYTESWAP) | ||||
return _byteswap_uint64(value); | ||||
#elif defined(POCO_HAVE_GCC_BYTESWAP) | ||||
return __builtin_bswap64(value); | ||||
#else | ||||
UInt32 hi = UInt32(value >> 32); | UInt32 hi = UInt32(value >> 32); | |||
UInt32 lo = UInt32(value & 0xFFFFFFFF); | UInt32 lo = UInt32(value & 0xFFFFFFFF); | |||
return UInt64(flipBytes(hi)) | (UInt64(flipBytes(lo)) << 32); | return UInt64(flipBytes(hi)) | (UInt64(flipBytes(lo)) << 32); | |||
#endif | ||||
} | } | |||
inline Int64 ByteOrder::flipBytes(Int64 value) | inline Int64 ByteOrder::flipBytes(Int64 value) | |||
{ | { | |||
return Int64(flipBytes(UInt64(value))); | return Int64(flipBytes(UInt64(value))); | |||
} | } | |||
#endif // POCO_HAVE_INT64 | #endif // POCO_HAVE_INT64 | |||
// | // | |||
// some macro trickery to automate the method implementation | // some macro trickery to automate the method implementation | |||
End of changes. 10 change blocks. | ||||
34 lines changed or deleted | 2 lines changed or added | |||
Config.h | Config.h | |||
---|---|---|---|---|
skipping to change at line 44 | skipping to change at line 44 | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Foundation_Config_INCLUDED | #ifndef Foundation_Config_INCLUDED | |||
#define Foundation_Config_INCLUDED | #define Foundation_Config_INCLUDED | |||
// Define to enable Windows Unicode (UTF-8) support | // Define to enable Windows Unicode (UTF-8) support | |||
#define POCO_WIN32_UTF8 | #define POCO_WIN32_UTF8 | |||
// Define to enable C++11 support | ||||
//#define POCO_ENABLE_CPP11 | ||||
// Define to disable implicit linking | // Define to disable implicit linking | |||
// #define POCO_NO_AUTOMATIC_LIBS | // #define POCO_NO_AUTOMATIC_LIBS | |||
// Define to disable FPEnvironment support | // Define to disable FPEnvironment support | |||
// #define POCO_NO_FPENVIRONMENT | // #define POCO_NO_FPENVIRONMENT | |||
// Define if std::wstring is not available | // Define if std::wstring is not available | |||
// #define POCO_NO_WSTRING | // #define POCO_NO_WSTRING | |||
// Define to disable shared memory | // Define to disable shared memory | |||
// #define POCO_NO_SHAREDMEMORY | // #define POCO_NO_SHAREDMEMORY | |||
// Define if no <locale> header is available (such as on WinCE) | // Define if no <locale> header is available (such as on WinCE) | |||
// #define POCO_NO_LOCALE | // #define POCO_NO_LOCALE | |||
// Define to desired default thread stack size | // Define to desired default thread stack size | |||
// Zero means OS default | // Zero means OS default | |||
#ifndef POCO_THREAD_STACK_SIZE | #ifndef POCO_THREAD_STACK_SIZE | |||
#define POCO_THREAD_STACK_SIZE 0 | #define POCO_THREAD_STACK_SIZE 0 | |||
#endif | #endif | |||
// Define to override system-provided | // Define to override system-provided | |||
// minimum thread priority value on POSIX | // minimum thread priority value on POSIX | |||
// platforms (returned by Poco::Thread::getMinOSPriority()). | // platforms (returned by Poco::Thread::getMinOSPriority()). | |||
// #define POCO_THREAD_PRIORITY_MIN 0 | // #define POCO_THREAD_PRIORITY_MIN 0 | |||
// Define to override system-provided | // Define to override system-provided | |||
// maximum thread priority value on POSIX | // maximum thread priority value on POSIX | |||
// platforms (returned by Poco::Thread::getMaxOSPriority()). | // platforms (returned by Poco::Thread::getMaxOSPriority()). | |||
skipping to change at line 96 | skipping to change at line 99 | |||
// No automatic registration of SplitterChannel in | // No automatic registration of SplitterChannel in | |||
// LoggingFactory - avoids SplitterChannel being | // LoggingFactory - avoids SplitterChannel being | |||
// linked to executable. | // linked to executable. | |||
// #define POCO_NO_SPLITTERCHANNEL | // #define POCO_NO_SPLITTERCHANNEL | |||
// No automatic registration of SyslogChannel in | // No automatic registration of SyslogChannel in | |||
// LoggingFactory - avoids SyslogChannel being | // LoggingFactory - avoids SyslogChannel being | |||
// linked to executable on Unix/Linux systems. | // linked to executable on Unix/Linux systems. | |||
// #define POCO_NO_SYSLOGCHANNEL | // #define POCO_NO_SYSLOGCHANNEL | |||
// Define to enable MSVC secure warnings | ||||
// #define POCO_MSVC_SECURE_WARNINGS | ||||
// No support for INI file configurations in | // No support for INI file configurations in | |||
// Poco::Util::Application. | // Poco::Util::Application. | |||
// #define POCO_UTIL_NO_INIFILECONFIGURATION | // #define POCO_UTIL_NO_INIFILECONFIGURATION | |||
// No support for XML configuration in | // No support for XML configuration in | |||
// Poco::Util::Application. Avoids linking of XML | // Poco::Util::Application. Avoids linking of XML | |||
// library and saves a few 100 Kbytes. | // library and saves a few 100 Kbytes. | |||
// #define POCO_UTIL_NO_XMLCONFIGURATION | // #define POCO_UTIL_NO_XMLCONFIGURATION | |||
// No IPv6 support | ||||
// Define to disable IPv6 | ||||
// #define POCO_NET_NO_IPv6 | ||||
// Windows CE has no locale support | ||||
#if defined(_WIN32_WCE) | ||||
#define POCO_NO_LOCALE | ||||
#endif | ||||
#endif // Foundation_Config_INCLUDED | #endif // Foundation_Config_INCLUDED | |||
End of changes. 4 change blocks. | ||||
1 lines changed or deleted | 16 lines changed or added | |||
ConsoleChannel.h | ConsoleChannel.h | |||
---|---|---|---|---|
// | // | |||
// ConsoleChannel.h | // ConsoleChannel.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/ConsoleChannel.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/ConsoleChannel.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Logging | // Package: Logging | |||
// Module: ConsoleChannel | // Module: ConsoleChannel | |||
// | // | |||
// Definition of the ConsoleChannel class. | // Definition of the ConsoleChannel class. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 65 | skipping to change at line 65 | |||
/// appropriate Formatter to control what is contained | /// appropriate Formatter to control what is contained | |||
/// in the text. | /// in the text. | |||
/// | /// | |||
/// Similar to StreamChannel, except that a static | /// Similar to StreamChannel, except that a static | |||
/// mutex is used to protect against multiple | /// mutex is used to protect against multiple | |||
/// console channels concurrently writing to the | /// console channels concurrently writing to the | |||
/// same stream. | /// same stream. | |||
{ | { | |||
public: | public: | |||
ConsoleChannel(); | ConsoleChannel(); | |||
/// Creates the channel and attaches std::clog. | /// Creates the channel and attached std::clog. | |||
ConsoleChannel(std::ostream& str); | ConsoleChannel(std::ostream& str); | |||
/// Creates the channel using the given stream. | /// Creates the channel. | |||
void log(const Message& msg); | void log(const Message& msg); | |||
/// Logs the given message to the channel's stream. | /// Logs the given message to the channel's stream. | |||
protected: | protected: | |||
~ConsoleChannel(); | ~ConsoleChannel(); | |||
private: | private: | |||
std::ostream& _str; | std::ostream& _str; | |||
static FastMutex _mutex; | static FastMutex _mutex; | |||
}; | }; | |||
class Foundation_API ColorConsoleChannel: public Channel | ||||
/// A channel that writes to an ostream. | ||||
/// | ||||
/// Only the message's text is written, followed | ||||
/// by a newline. | ||||
/// | ||||
/// Messages can be colored depending on priority. | ||||
/// The console device must support ANSI escape codes | ||||
/// in order to display colored messages. | ||||
/// | ||||
/// To enable message coloring, set the "enableColors" | ||||
/// property to true (default). Furthermore, colors can be | ||||
/// configured by setting the following properties | ||||
/// (default values are given in parenthesis): | ||||
/// | ||||
/// * traceColor (gray) | ||||
/// * debugColor (gray) | ||||
/// * informationColor (default) | ||||
/// * noticeColor (default) | ||||
/// * warningColor (yellow) | ||||
/// * errorColor (lightRed) | ||||
/// * criticalColor (lightRed) | ||||
/// * fatalColor (lightRed) | ||||
/// | ||||
/// The following color values are supported: | ||||
/// | ||||
/// * default | ||||
/// * black | ||||
/// * red | ||||
/// * green | ||||
/// * brown | ||||
/// * blue | ||||
/// * magenta | ||||
/// * cyan | ||||
/// * gray | ||||
/// * darkgray | ||||
/// * lightRed | ||||
/// * lightGreen | ||||
/// * yellow | ||||
/// * lightBlue | ||||
/// * lightMagenta | ||||
/// * lightCyan | ||||
/// * white | ||||
/// | ||||
/// Chain this channel to a FormattingChannel with an | ||||
/// appropriate Formatter to control what is contained | ||||
/// in the text. | ||||
/// | ||||
/// Similar to StreamChannel, except that a static | ||||
/// mutex is used to protect against multiple | ||||
/// console channels concurrently writing to the | ||||
/// same stream. | ||||
{ | ||||
public: | ||||
ColorConsoleChannel(); | ||||
/// Creates the channel and attaches std::clog. | ||||
ColorConsoleChannel(std::ostream& str); | ||||
/// Creates the channel using the given stream. | ||||
void log(const Message& msg); | ||||
/// Logs the given message to the channel's stream. | ||||
void setProperty(const std::string& name, const std::string& value); | ||||
/// Sets the property with the given name. | ||||
/// | ||||
/// The following properties are supported: | ||||
/// * enableColors: Enable or disable colors. | ||||
/// * traceColor: Specify color for trace messages. | ||||
/// * debugColor: Specify color for debug messages. | ||||
/// * informationColor: Specify color for information mes | ||||
sages. | ||||
/// * noticeColor: Specify color for notice messages | ||||
. | ||||
/// * warningColor: Specify color for warning message | ||||
s. | ||||
/// * errorColor: Specify color for error messages. | ||||
/// * criticalColor: Specify color for critical messag | ||||
es. | ||||
/// * fatalColor: Specify color for fatal messages. | ||||
/// | ||||
/// See the class documentation for a list of supported colo | ||||
r values. | ||||
std::string getProperty(const std::string& name) const; | ||||
/// Returns the value of the property with the given name. | ||||
/// See setProperty() for a description of the supported | ||||
/// properties. | ||||
protected: | ||||
enum Color | ||||
{ | ||||
CC_DEFAULT = 0x0027, | ||||
CC_BLACK = 0x001e, | ||||
CC_RED = 0x001f, | ||||
CC_GREEN = 0x0020, | ||||
CC_BROWN = 0x0021, | ||||
CC_BLUE = 0x0022, | ||||
CC_MAGENTA = 0x0023, | ||||
CC_CYAN = 0x0024, | ||||
CC_GRAY = 0x0025, | ||||
CC_DARKGRAY = 0x011e, | ||||
CC_LIGHTRED = 0x011f, | ||||
CC_LIGHTGREEN = 0x0120, | ||||
CC_YELLOW = 0x0121, | ||||
CC_LIGHTBLUE = 0x0122, | ||||
CC_LIGHTMAGENTA = 0x0123, | ||||
CC_LIGHTCYAN = 0x0124, | ||||
CC_WHITE = 0x0125 | ||||
}; | ||||
~ColorConsoleChannel(); | ||||
Color parseColor(const std::string& color) const; | ||||
std::string formatColor(Color color) const; | ||||
void initColors(); | ||||
private: | ||||
std::ostream& _str; | ||||
bool _enableColors; | ||||
Color _colors[9]; | ||||
static FastMutex _mutex; | ||||
static const std::string CSI; | ||||
}; | ||||
} // namespace Poco | } // namespace Poco | |||
#endif // Foundation_ConsoleChannel_INCLUDED | #endif // Foundation_ConsoleChannel_INCLUDED | |||
End of changes. 4 change blocks. | ||||
127 lines changed or deleted | 3 lines changed or added | |||
CountingStream.h | CountingStream.h | |||
---|---|---|---|---|
// | // | |||
// CountingStream.h | // CountingStream.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/CountingStream.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/CountingStream.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Streams | // Package: Streams | |||
// Module: CountingStream | // Module: CountingStream | |||
// | // | |||
// Definition of the CountingStreamBuf, CountingInputStream and CountingOut putStream classes. | // Definition of the CountingStreamBuf, CountingInputStream and CountingOut putStream classes. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 173 | skipping to change at line 173 | |||
class Foundation_API CountingOutputStream: public CountingIOS, public std:: ostream | class Foundation_API CountingOutputStream: public CountingIOS, public std:: ostream | |||
/// This stream counts all characters and lines | /// This stream counts all characters and lines | |||
/// going through it. | /// going through it. | |||
{ | { | |||
public: | public: | |||
CountingOutputStream(); | CountingOutputStream(); | |||
/// Creates an unconnected CountingOutputStream. | /// Creates an unconnected CountingOutputStream. | |||
CountingOutputStream(std::ostream& ostr); | CountingOutputStream(std::ostream& ostr); | |||
/// Creates the CountingOutputStream and connects it | /// Creates the CountingOutputStream and connects it | |||
/// to the given output stream. | /// to the given input stream. | |||
~CountingOutputStream(); | ~CountingOutputStream(); | |||
/// Destroys the CountingOutputStream. | /// Destroys the CountingOutputStream. | |||
}; | }; | |||
// | // | |||
// inlines | // inlines | |||
// | // | |||
inline int CountingStreamBuf::chars() const | inline int CountingStreamBuf::chars() const | |||
{ | { | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
DNS.h | DNS.h | |||
---|---|---|---|---|
// | // | |||
// DNS.h | // DNS.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/DNS.h#3 $ | // $Id: //poco/1.4/Net/include/Poco/Net/DNS.h#2 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: NetCore | // Package: NetCore | |||
// Module: DNS | // Module: DNS | |||
// | // | |||
// Definition of the DNS class. | // Definition of the DNS class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 45 | skipping to change at line 45 | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Net_DNS_INCLUDED | #ifndef Net_DNS_INCLUDED | |||
#define Net_DNS_INCLUDED | #define Net_DNS_INCLUDED | |||
#include "Poco/Net/Net.h" | #include "Poco/Net/Net.h" | |||
#include "Poco/Net/SocketDefs.h" | #include "Poco/Net/SocketDefs.h" | |||
#include "Poco/Net/IPAddress.h" | #include "Poco/Net/IPAddress.h" | |||
#include "Poco/Net/HostEntry.h" | #include "Poco/Net/HostEntry.h" | |||
#include "Poco/Mutex.h" | ||||
namespace Poco { | namespace Poco { | |||
namespace Net { | namespace Net { | |||
class Net_API DNS | class Net_API DNS | |||
/// This class provides an interface to the | /// This class provides an interface to the | |||
/// domain name service. | /// domain name service. | |||
/// | /// | |||
/// An internal DNS cache is used to speed up name lookups. | /// An internal DNS cache is used to speed up name lookups. | |||
{ | { | |||
skipping to change at line 113 | skipping to change at line 114 | |||
/// Throws a HostNotFoundException if DNS information | /// Throws a HostNotFoundException if DNS information | |||
/// for this host cannot be found. | /// for this host cannot be found. | |||
/// | /// | |||
/// Throws a NoAddressFoundException if no address can be | /// Throws a NoAddressFoundException if no address can be | |||
/// found for this host. | /// found for this host. | |||
/// | /// | |||
/// Throws a DNSException in case of a general DNS error. | /// Throws a DNSException in case of a general DNS error. | |||
/// | /// | |||
/// Throws an IOException in case of any other error. | /// Throws an IOException in case of any other error. | |||
static void reload(); | ||||
/// Reloads the resolver configuration. | ||||
/// | ||||
/// This method will call res_init() if the Net library | ||||
/// has been compiled with -DPOCO_HAVE_LIBRESOLV. Otherwise | ||||
/// it will do nothing. | ||||
//@ deprecated | //@ deprecated | |||
static void flushCache(); | static void flushCache(); | |||
/// Flushes the internal DNS cache. | /// Flushes the internal DNS cache. | |||
/// | /// | |||
/// As of 1.4.2, the DNS cache is no longer used | /// As of 1.4.2, the DNS cache is no longer used | |||
/// and this method does not do anything. | /// and this method does not do anything. | |||
static std::string hostName(); | static std::string hostName(); | |||
/// Returns the host name of this host. | /// Returns the host name of this host. | |||
End of changes. 3 change blocks. | ||||
8 lines changed or deleted | 2 lines changed or added | |||
DatagramSocketImpl.h | DatagramSocketImpl.h | |||
---|---|---|---|---|
// | // | |||
// DatagramSocketImpl.h | // DatagramSocketImpl.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/DatagramSocketImpl.h#2 $ | // $Id: //poco/1.4/Net/include/Poco/Net/DatagramSocketImpl.h#1 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: Sockets | // Package: Sockets | |||
// Module: DatagramSocketImpl | // Module: DatagramSocketImpl | |||
// | // | |||
// Definition of the DatagramSocketImpl class. | // Definition of the DatagramSocketImpl class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
DigestEngine.h | DigestEngine.h | |||
---|---|---|---|---|
skipping to change at line 62 | skipping to change at line 62 | |||
/// compute the digest from. When done, | /// compute the digest from. When done, | |||
/// call digest() to obtain the message | /// call digest() to obtain the message | |||
/// digest. | /// digest. | |||
{ | { | |||
public: | public: | |||
typedef std::vector<unsigned char> Digest; | typedef std::vector<unsigned char> Digest; | |||
DigestEngine(); | DigestEngine(); | |||
virtual ~DigestEngine(); | virtual ~DigestEngine(); | |||
void update(const void* data, unsigned length); | void update(const void* data, std::size_t length); | |||
void update(char data); | void update(char data); | |||
void update(const std::string& data); | void update(const std::string& data); | |||
/// Updates the digest with the given data. | /// Updates the digest with the given data. | |||
virtual unsigned digestLength() const = 0; | virtual std::size_t digestLength() const = 0; | |||
/// Returns the length of the digest in bytes. | /// Returns the length of the digest in bytes. | |||
virtual void reset() = 0; | virtual void reset() = 0; | |||
/// Resets the engine so that a new | /// Resets the engine so that a new | |||
/// digest can be computed. | /// digest can be computed. | |||
virtual const Digest& digest() = 0; | virtual const Digest& digest() = 0; | |||
/// Finishes the computation of the digest and | /// Finishes the computation of the digest and | |||
/// returns the message digest. Resets the engine | /// returns the message digest. Resets the engine | |||
/// and can thus only be called once for every digest. | /// and can thus only be called once for every digest. | |||
/// The returned reference is valid until the next | /// The returned reference is valid until the next | |||
/// time digest() is called, or the engine object is destroy ed. | /// time digest() is called, or the engine object is destroy ed. | |||
static std::string digestToHex(const Digest& bytes); | static std::string digestToHex(const Digest& bytes); | |||
/// Converts a message digest into a string of hexadecimal n | /// Converts a message digest into a string of hexadecimal | |||
umbers. | numbers. | |||
static Digest digestFromHex(const std::string& digest); | ||||
/// Converts a string created by digestToHex back to its Di | ||||
gest presentation | ||||
protected: | protected: | |||
virtual void updateImpl(const void* data, unsigned length) = 0; | virtual void updateImpl(const void* data, std::size_t length) = 0; | |||
/// Updates the digest with the given data. Must be implemen | /// Updates the digest with the given data. Must be impleme | |||
ted | nted | |||
/// by subclasses. | /// by subclasses. | |||
private: | private: | |||
DigestEngine(const DigestEngine&); | DigestEngine(const DigestEngine&); | |||
DigestEngine& operator = (const DigestEngine&); | DigestEngine& operator = (const DigestEngine&); | |||
}; | }; | |||
// | // | |||
// inlines | // inlines | |||
// | // | |||
inline void DigestEngine::update(const void* data, unsigned length) | inline void DigestEngine::update(const void* data, std::size_t length) | |||
{ | { | |||
updateImpl(data, length); | updateImpl(data, length); | |||
} | } | |||
inline void DigestEngine::update(char data) | inline void DigestEngine::update(char data) | |||
{ | { | |||
updateImpl(&data, 1); | updateImpl(&data, 1); | |||
} | } | |||
inline void DigestEngine::update(const std::string& data) | inline void DigestEngine::update(const std::string& data) | |||
{ | { | |||
updateImpl(data.data(), (unsigned) data.size()); | updateImpl(data.data(), data.size()); | |||
} | } | |||
} // namespace Poco | } // namespace Poco | |||
#endif // Foundation_DigestEngine_INCLUDED | #endif // Foundation_DigestEngine_INCLUDED | |||
End of changes. 6 change blocks. | ||||
10 lines changed or deleted | 14 lines changed or added | |||
DirectoryWatcher.h | DirectoryWatcher.h | |||
---|---|---|---|---|
// | // | |||
// DirectoryWatcher.h | // DirectoryWatcher.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/DirectoryWatcher.h#4 $ | // $Id: //poco/1.4/Foundation/include/Poco/DirectoryWatcher.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Filesystem | // Package: Filesystem | |||
// Module: DirectoryWatcher | // Module: DirectoryWatcher | |||
// | // | |||
// Definition of the DirectoryWatcher class. | // Definition of the DirectoryWatcher class. | |||
// | // | |||
// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2012, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
DynamicAny.h | DynamicAny.h | |||
---|---|---|---|---|
// | // | |||
// DynamicAny.h | // DynamicAny.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/DynamicAny.h#1 $ | // $Id: //poco/svn/Foundation/include/Poco/DynamicAny.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Dynamic | |||
// Module: DynamicAny | // Module: Var | |||
// | // | |||
// Definition of the DynamicAny class. | // Forward header for Var class to maintain backward compatibility. | |||
// | // | |||
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2007, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
// Permission is hereby granted, free of charge, to any person or organizat ion | // Permission is hereby granted, free of charge, to any person or organizat ion | |||
// obtaining a copy of the software and accompanying documentation covered by | // obtaining a copy of the software and accompanying documentation covered by | |||
// this license (the "Software") to use, reproduce, display, distribute, | // this license (the "Software") to use, reproduce, display, distribute, | |||
// execute, and transmit the Software, and to prepare derivative works of t he | // execute, and transmit the Software, and to prepare derivative works of t he | |||
// Software, and to permit third-parties to whom the Software is furnished to | // Software, and to permit third-parties to whom the Software is furnished to | |||
// do so, all subject to the following: | // do so, all subject to the following: | |||
skipping to change at line 41 | skipping to change at line 41 | |||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVEN T | // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVEN T | |||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | |||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Foundation_DynamicAny_INCLUDED | #ifndef Foundation_DynamicAny_INCLUDED | |||
#define Foundation_DynamicAny_INCLUDED | #define Foundation_DynamicAny_INCLUDED | |||
#include "Poco/Foundation.h" | //@ deprecated | |||
#include "Poco/DynamicAnyHolder.h" | #include "Poco/Dynamic/Var.h" | |||
#include "Poco/Format.h" | ||||
#include <typeinfo> | ||||
namespace Poco { | ||||
class Foundation_API DynamicAny | ||||
/// DynamicAny allows to store data of different types and to conver | ||||
t between these types transparently. | ||||
/// DynamicAny puts forth the best effort to provide intuitive and r | ||||
easonable conversion semantics and prevent | ||||
/// unexpected data loss, particularly when performing narrowing or | ||||
signedness conversions of numeric data types. | ||||
/// | ||||
/// An attempt to convert or extract from a non-initialized (empty) | ||||
DynamicAny variable shall result | ||||
/// in an exception being thrown. | ||||
/// | ||||
/// Loss of signedness is not allowed for numeric values. This means | ||||
that if an attempt is made to convert | ||||
/// the internal value which is a negative signed integer to an unsi | ||||
gned integer type storage, a RangeException is thrown. | ||||
/// Overflow is not allowed, so if the internal value is a larger nu | ||||
mber than the target numeric type size can accomodate, | ||||
/// a RangeException is thrown. | ||||
/// | ||||
/// Precision loss, such as in conversion from floating-point types | ||||
to integers or from double to float on platforms | ||||
/// where they differ in size (provided internal actual value fits i | ||||
n float min/max range), is allowed. | ||||
/// | ||||
/// String truncation is allowed -- it is possible to convert betwee | ||||
n string and character when string length is | ||||
/// greater than 1. An empty string gets converted to the char '\0', | ||||
a non-empty string is truncated to the first character. | ||||
/// | ||||
/// Boolean conversion is performed as follows: | ||||
/// | ||||
/// A string value "false" (not case sensitive), "0" or "" (empty st | ||||
ring) can be converted to a boolean value false, | ||||
/// any other string not being false by the above criteria evaluates | ||||
to true (e.g: "hi" -> true). | ||||
/// Integer 0 values are false, everything else is true. | ||||
/// Floating point values equal to the minimal FP representation on | ||||
a given platform are false, everything else is true. | ||||
/// | ||||
/// Arithmetic operations with POD types as well as between DynamicA | ||||
ny's are supported, subject to following | ||||
/// limitations: | ||||
/// | ||||
/// - for std::string and const char* values, only '+' and '+=' | ||||
operations are supported | ||||
/// | ||||
/// - for integral and floating point numeric values, following | ||||
operations are supported: | ||||
/// '+', '+=', '-', '-=', '*', '*=' , '/' and '/=' | ||||
/// | ||||
/// - for integral values, following operations are supported: | ||||
/// prefix and postfix increment (++) and decement (-- | ||||
) | ||||
/// | ||||
/// - for all other types, InvalidArgumentException is thrown up | ||||
on attempt of an arithmetic operation | ||||
/// | ||||
/// A DynamicAny can be created from and converted to a value of any | ||||
type for which a specialization of | ||||
/// DynamicAnyHolderImpl is available. For supported types, see Dyna | ||||
micAnyHolder documentation. | ||||
{ | ||||
public: | ||||
DynamicAny(); | ||||
/// Creates an empty DynamicAny. | ||||
template <typename T> | ||||
DynamicAny(const T& val): | ||||
_pHolder(new DynamicAnyHolderImpl<T>(val)) | ||||
/// Creates the DynamicAny from the given value. | ||||
{ | ||||
} | ||||
DynamicAny(const char* pVal); | ||||
// Convenience constructor for const char* which gets mapped | ||||
to a std::string internally, i.e. pVal is deep-copied. | ||||
DynamicAny(const DynamicAny& other); | ||||
/// Copy constructor. | ||||
~DynamicAny(); | ||||
/// Destroys the DynamicAny. | ||||
void swap(DynamicAny& other); | ||||
/// Swaps the content of the this DynamicAny with the other | ||||
DynamicAny. | ||||
template <typename T> | ||||
void convert(T& val) const | ||||
/// Invoke this method to perform a safe conversion. | ||||
/// | ||||
/// Example usage: | ||||
/// DynamicAny any("42"); | ||||
/// int i; | ||||
/// any.convert(i); | ||||
/// | ||||
/// Throws a RangeException if the value does not fit | ||||
/// into the result variable. | ||||
/// Throws a NotImplementedException if conversion is | ||||
/// not available for the given type. | ||||
/// Throws InvalidAccessException if DynamicAny is empty. | ||||
{ | ||||
if (!_pHolder) | ||||
throw InvalidAccessException("Can not convert empty | ||||
value."); | ||||
_pHolder->convert(val); | ||||
} | ||||
template <typename T> | ||||
T convert() const | ||||
/// Invoke this method to perform a safe conversion. | ||||
/// | ||||
/// Example usage: | ||||
/// DynamicAny any("42"); | ||||
/// int i = any.convert<int>(); | ||||
/// | ||||
/// Throws a RangeException if the value does not fit | ||||
/// into the result variable. | ||||
/// Throws a NotImplementedException if conversion is | ||||
/// not available for the given type. | ||||
/// Throws InvalidAccessException if DynamicAny is empty. | ||||
{ | ||||
if (!_pHolder) | ||||
throw InvalidAccessException("Can not convert empty | ||||
value."); | ||||
T result; | ||||
_pHolder->convert(result); | ||||
return result; | ||||
} | ||||
template <typename T> | ||||
operator T () const | ||||
/// Safe conversion operator for implicit type | ||||
/// conversions. If the requested type T is same as the | ||||
/// type being held, the operation performed is direct | ||||
/// extraction, otherwise it is the conversion of the value | ||||
/// from type currently held to the one requested. | ||||
/// | ||||
/// Throws a RangeException if the value does not fit | ||||
/// into the result variable. | ||||
/// Throws a NotImplementedException if conversion is | ||||
/// not available for the given type. | ||||
/// Throws InvalidAccessException if DynamicAny is empty. | ||||
{ | ||||
if (!_pHolder) | ||||
throw InvalidAccessException("Can not conver | ||||
t empty value."); | ||||
if (typeid(T) == _pHolder->type()) | ||||
return extract<T>(); | ||||
else | ||||
{ | ||||
T result; | ||||
_pHolder->convert(result); | ||||
return result; | ||||
} | ||||
} | ||||
template <typename T> | ||||
const T& extract() const | ||||
/// Returns a const reference to the actual value. | ||||
/// | ||||
/// Must be instantiated with the exact type of | ||||
/// the stored value, otherwise a BadCastException | ||||
/// is thrown. | ||||
/// Throws InvalidAccessException if DynamicAny is empty. | ||||
{ | ||||
if (_pHolder && _pHolder->type() == typeid(T)) | ||||
{ | ||||
DynamicAnyHolderImpl<T>* pHolderImpl = static_cast<D | ||||
ynamicAnyHolderImpl<T>*>(_pHolder); | ||||
return pHolderImpl->value(); | ||||
} | ||||
else if (!_pHolder) | ||||
throw InvalidAccessException("Can not extract empty | ||||
value."); | ||||
else | ||||
throw BadCastException(format("Can not convert %s to | ||||
%s.", | ||||
_pHolder->type().name(), | ||||
typeid(T).name())); | ||||
} | ||||
template <typename T> | ||||
DynamicAny& operator = (const T& other) | ||||
/// Assignment operator for assigning POD to DynamicAny | ||||
{ | ||||
DynamicAny tmp(other); | ||||
swap(tmp); | ||||
return *this; | ||||
} | ||||
bool operator ! () const; | ||||
/// Logical NOT operator. | ||||
DynamicAny& operator = (const DynamicAny& other); | ||||
/// Assignment operator specialization for DynamicAny | ||||
template <typename T> | ||||
const DynamicAny operator + (const T& other) const | ||||
/// Addition operator for adding POD to DynamicAny | ||||
{ | ||||
return convert<T>() + other; | ||||
} | ||||
const DynamicAny operator + (const DynamicAny& other) const; | ||||
/// Addition operator specialization for DynamicAny | ||||
const DynamicAny operator + (const char* other) const; | ||||
/// Addition operator specialization for adding const char* | ||||
to DynamicAny | ||||
DynamicAny& operator ++ (); | ||||
/// Pre-increment operator | ||||
const DynamicAny operator ++ (int); | ||||
/// Post-increment operator | ||||
DynamicAny& operator -- (); | ||||
/// Pre-decrement operator | ||||
const DynamicAny operator -- (int); | ||||
/// Post-decrement operator | ||||
template <typename T> | ||||
DynamicAny& operator += (const T& other) | ||||
/// Addition assignment operator for addition/assignment of | ||||
POD to DynamicAny. | ||||
{ | ||||
return *this = convert<T>() + other; | ||||
} | ||||
DynamicAny& operator += (const DynamicAny& other); | ||||
/// Addition assignment operator overload for DynamicAny | ||||
DynamicAny& operator += (const char* other); | ||||
/// Addition assignment operator overload for const char* | ||||
template <typename T> | ||||
const DynamicAny operator - (const T& other) const | ||||
/// Subtraction operator for subtracting POD from DynamicAny | ||||
{ | ||||
return convert<T>() - other; | ||||
} | ||||
const DynamicAny operator - (const DynamicAny& other) const; | ||||
/// Subtraction operator overload for DynamicAny | ||||
template <typename T> | ||||
DynamicAny& operator -= (const T& other) | ||||
/// Subtraction assignment operator | ||||
{ | ||||
return *this = convert<T>() - other; | ||||
} | ||||
DynamicAny& operator -= (const DynamicAny& other); | ||||
/// Subtraction assignment operator overload for DynamicAny | ||||
template <typename T> | ||||
const DynamicAny operator * (const T& other) const | ||||
/// Multiplication operator for multiplying DynamicAny with | ||||
POD | ||||
{ | ||||
return convert<T>() * other; | ||||
} | ||||
const DynamicAny operator * (const DynamicAny& other) const; | ||||
/// Multiplication operator overload for DynamicAny | ||||
template <typename T> | ||||
DynamicAny& operator *= (const T& other) | ||||
/// Multiplication assignment operator | ||||
{ | ||||
return *this = convert<T>() * other; | ||||
} | ||||
DynamicAny& operator *= (const DynamicAny& other); | ||||
/// Multiplication assignment operator overload for DynamicA | ||||
ny | ||||
template <typename T> | ||||
const DynamicAny operator / (const T& other) const | ||||
/// Division operator for dividing DynamicAny with POD | ||||
{ | ||||
return convert<T>() / other; | ||||
} | ||||
const DynamicAny operator / (const DynamicAny& other) const; | ||||
/// Division operator overload for DynamicAny | ||||
template <typename T> | ||||
DynamicAny& operator /= (const T& other) | ||||
/// Division assignment operator | ||||
{ | ||||
return *this = convert<T>() / other; | ||||
} | ||||
DynamicAny& operator /= (const DynamicAny& other); | ||||
/// Division assignment operator specialization for DynamicA | ||||
ny | ||||
template <typename T> | ||||
bool operator == (const T& other) const | ||||
/// Equality operator | ||||
{ | ||||
if (isEmpty()) return false; | ||||
return convert<T>() == other; | ||||
} | ||||
bool operator == (const char* other) const; | ||||
/// Equality operator overload for const char* | ||||
bool operator == (const DynamicAny& other) const; | ||||
/// Equality operator overload for DynamicAny | ||||
template <typename T> | ||||
bool operator != (const T& other) const | ||||
/// Inequality operator | ||||
{ | ||||
if (isEmpty()) return true; | ||||
return convert<T>() != other; | ||||
} | ||||
bool operator != (const DynamicAny& other) const; | ||||
/// Inequality operator overload for DynamicAny | ||||
bool operator != (const char* other) const; | ||||
/// Inequality operator overload for const char* | ||||
template <typename T> | ||||
bool operator < (const T& other) const | ||||
/// Less than operator | ||||
{ | ||||
if (isEmpty()) return false; | ||||
return convert<T>() < other; | ||||
} | ||||
bool operator < (const DynamicAny& other) const; | ||||
/// Less than operator overload for DynamicAny | ||||
template <typename T> | ||||
bool operator <= (const T& other) const | ||||
/// Less than or equal operator | ||||
{ | ||||
if (isEmpty()) return false; | ||||
return convert<T>() <= other; | ||||
} | ||||
bool operator <= (const DynamicAny& other) const; | ||||
/// Less than or equal operator overload for DynamicAny | ||||
template <typename T> | ||||
bool operator > (const T& other) const | ||||
/// Greater than operator | ||||
{ | ||||
if (isEmpty()) return false; | ||||
return convert<T>() > other; | ||||
} | ||||
bool operator > (const DynamicAny& other) const; | ||||
/// Greater than operator overload for DynamicAny | ||||
template <typename T> | ||||
bool operator >= (const T& other) const | ||||
/// Greater than or equal operator | ||||
{ | ||||
if (isEmpty()) return false; | ||||
return convert<T>() >= other; | ||||
} | ||||
bool operator >= (const DynamicAny& other) const; | ||||
/// Greater than or equal operator overload for DynamicAny | ||||
template <typename T> | ||||
bool operator || (const T& other) const | ||||
/// Logical OR operator | ||||
{ | ||||
if (isEmpty()) return false; | ||||
return convert<bool>() || other; | ||||
} | ||||
bool operator || (const DynamicAny& other) const; | ||||
/// Logical OR operator operator overload for DynamicAny | ||||
template <typename T> | ||||
bool operator && (const T& other) const | ||||
/// Logical AND operator | ||||
{ | ||||
if (isEmpty()) return false; | ||||
return convert<bool>() && other; | ||||
} | ||||
bool operator && (const DynamicAny& other) const; | ||||
/// Logical AND operator operator overload for DynamicAny | ||||
bool isArray() const; | ||||
/// Returns true if DynamicAny represents a vector | ||||
template <typename T> | ||||
DynamicAny& operator [] (T n) | ||||
/// Index operator, only use on DynamicAnys where isArray | ||||
/// returns true! In all other cases InvalidAccessException | ||||
is thrown. | ||||
{ | ||||
return holderImpl<std::vector<DynamicAny>, | ||||
InvalidAccessException>("Not an array.")->operator[] | ||||
(n); | ||||
} | ||||
template <typename T> | ||||
const DynamicAny& operator [] (T n) const | ||||
/// const Index operator, only use on DynamicAnys where isAr | ||||
ray | ||||
/// returns true! In all other cases InvalidAccessException | ||||
is thrown. | ||||
{ | ||||
return const_cast<const DynamicAny&>(holderImpl<std::vector< | ||||
DynamicAny>, | ||||
InvalidAccessException>("Not an array.")->operator[] | ||||
(n)); | ||||
} | ||||
const std::type_info& type() const; | ||||
/// Returns the type information of the stored content. | ||||
void empty(); | ||||
/// Empties DynamicAny. | ||||
bool isEmpty() const; | ||||
/// Returns true if empty. | ||||
bool isInteger() const; | ||||
/// Returns true if stored value is integer. | ||||
bool isSigned() const; | ||||
/// Returns true if stored value is signed. | ||||
bool isNumeric() const; | ||||
/// Returns true if stored value is numeric. | ||||
/// Returns false for numeric strings (e.g. "123" is string, | ||||
not number) | ||||
bool isString() const; | ||||
/// Returns true if stored value is std::string. | ||||
private: | ||||
template <typename T> | ||||
T add(const DynamicAny& other) const | ||||
{ | ||||
return convert<T>() + other.convert<T>(); | ||||
} | ||||
template <typename T> | ||||
T subtract(const DynamicAny& other) const | ||||
{ | ||||
return convert<T>() - other.convert<T>(); | ||||
} | ||||
template <typename T> | ||||
T multiply(const DynamicAny& other) const | ||||
{ | ||||
return convert<T>() * other.convert<T>(); | ||||
} | ||||
template <typename T> | ||||
T divide(const DynamicAny& other) const | ||||
{ | ||||
return convert<T>() / other.convert<T>(); | ||||
} | ||||
template <typename T, typename E> | ||||
DynamicAnyHolderImpl<T>* holderImpl(const std::string errorMessage = | ||||
"") const | ||||
{ | ||||
if (_pHolder && _pHolder->type() == typeid(T)) | ||||
return static_cast<DynamicAnyHolderImpl<T>*>(_pHolde | ||||
r); | ||||
else if (!_pHolder) | ||||
throw InvalidAccessException("Can not access empty v | ||||
alue."); | ||||
else | ||||
throw E(errorMessage); | ||||
} | ||||
DynamicAnyHolder* _pHolder; | ||||
}; | ||||
/// | ||||
/// inlines | ||||
/// | ||||
/// | ||||
/// DynamicAny members | ||||
/// | ||||
inline void DynamicAny::swap(DynamicAny& ptr) | ||||
{ | ||||
std::swap(_pHolder, ptr._pHolder); | ||||
} | ||||
inline const std::type_info& DynamicAny::type() const | ||||
{ | ||||
return _pHolder ? _pHolder->type() : typeid(void); | ||||
} | ||||
inline const DynamicAny DynamicAny::operator + (const char* other) const | ||||
{ | ||||
return convert<std::string>() + other; | ||||
} | ||||
inline DynamicAny& DynamicAny::operator += (const char*other) | ||||
{ | ||||
return *this = convert<std::string>() + other; | ||||
} | ||||
inline bool DynamicAny::operator ! () const | ||||
{ | ||||
return !convert<bool>(); | ||||
} | ||||
inline bool DynamicAny::isEmpty() const | ||||
{ | ||||
return 0 == _pHolder; | ||||
} | ||||
inline bool DynamicAny::isArray() const | ||||
{ | ||||
return _pHolder ? _pHolder->isArray() : false; | ||||
} | ||||
inline bool DynamicAny::isInteger() const | ||||
{ | ||||
return _pHolder ? _pHolder->isInteger() : false; | ||||
} | ||||
inline bool DynamicAny::isSigned() const | ||||
{ | ||||
return _pHolder ? _pHolder->isSigned() : false; | ||||
} | ||||
inline bool DynamicAny::isNumeric() const | ||||
{ | ||||
return _pHolder ? _pHolder->isNumeric() : false; | ||||
} | ||||
inline bool DynamicAny::isString() const | ||||
{ | ||||
return _pHolder ? _pHolder->isString() : false; | ||||
} | ||||
/// | ||||
/// DynamicAny non-member functions | ||||
/// | ||||
inline const DynamicAny operator + (const char* other, const DynamicAny& da | ||||
) | ||||
/// Addition operator for adding DynamicAny to const char* | ||||
{ | ||||
std::string tmp = other; | ||||
return tmp + da.convert<std::string>(); | ||||
} | ||||
inline char operator + (const char& other, const DynamicAny& da) | ||||
/// Addition operator for adding DynamicAny to char | ||||
{ | ||||
return other + da.convert<char>(); | ||||
} | ||||
inline char operator - (const char& other, const DynamicAny& da) | ||||
/// Subtraction operator for subtracting DynamicAny from char | ||||
{ | ||||
return other - da.convert<char>(); | ||||
} | ||||
inline char operator * (const char& other, const DynamicAny& da) | ||||
/// Multiplication operator for multiplying DynamicAny with char | ||||
{ | ||||
return other * da.convert<char>(); | ||||
} | ||||
inline char operator / (const char& other, const DynamicAny& da) | ||||
/// Division operator for dividing DynamicAny with char | ||||
{ | ||||
return other / da.convert<char>(); | ||||
} | ||||
inline char operator += (char& other, const DynamicAny& da) | ||||
/// Addition assignment operator for adding DynamicAny to char | ||||
{ | ||||
return other += da.convert<char>(); | ||||
} | ||||
inline char operator -= (char& other, const DynamicAny& da) | ||||
/// Subtraction assignment operator for subtracting DynamicAny from | ||||
char | ||||
{ | ||||
return other -= da.convert<char>(); | ||||
} | ||||
inline char operator *= (char& other, const DynamicAny& da) | ||||
/// Multiplication assignment operator for multiplying DynamicAny wi | ||||
th char | ||||
{ | ||||
return other *= da.convert<char>(); | ||||
} | ||||
inline char operator /= (char& other, const DynamicAny& da) | ||||
/// Division assignment operator for dividing DynamicAny with char | ||||
{ | ||||
return other /= da.convert<char>(); | ||||
} | ||||
inline bool operator == (const char& other, const DynamicAny& da) | ||||
/// Equality operator for comparing DynamicAny with char | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other == da.convert<char>(); | ||||
} | ||||
inline bool operator != (const char& other, const DynamicAny& da) | ||||
/// Inequality operator for comparing DynamicAny with char | ||||
{ | ||||
if (da.isEmpty()) return true; | ||||
return other != da.convert<char>(); | ||||
} | ||||
inline bool operator < (const char& other, const DynamicAny& da) | ||||
/// Less than operator for comparing DynamicAny with char | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other < da.convert<char>(); | ||||
} | ||||
inline bool operator <= (const char& other, const DynamicAny& da) | ||||
/// Less than or equal operator for comparing DynamicAny with char | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other <= da.convert<char>(); | ||||
} | ||||
inline bool operator > (const char& other, const DynamicAny& da) | ||||
/// Greater than operator for comparing DynamicAny with char | ||||
{ | ||||
if (da.isEmpty())return false; | ||||
return other > da.convert<char>(); | ||||
} | ||||
inline bool operator >= (const char& other, const DynamicAny& da) | ||||
/// Greater than or equal operator for comparing DynamicAny with cha | ||||
r | ||||
{ | ||||
if (da.isEmpty())return false; | ||||
return other >= da.convert<char>(); | ||||
} | ||||
inline Poco::Int8 operator + (const Poco::Int8& other, const DynamicAny& da | ||||
) | ||||
/// Addition operator for adding DynamicAny to Poco::Int8 | ||||
{ | ||||
return other + da.convert<Poco::Int8>(); | ||||
} | ||||
inline Poco::Int8 operator - (const Poco::Int8& other, const DynamicAny& da | ||||
) | ||||
/// Subtraction operator for subtracting DynamicAny from Poco::Int8 | ||||
{ | ||||
return other - da.convert<Poco::Int8>(); | ||||
} | ||||
inline Poco::Int8 operator * (const Poco::Int8& other, const DynamicAny& da | ||||
) | ||||
/// Multiplication operator for multiplying DynamicAny with Poco::In | ||||
t8 | ||||
{ | ||||
return other * da.convert<Poco::Int8>(); | ||||
} | ||||
inline Poco::Int8 operator / (const Poco::Int8& other, const DynamicAny& da | ||||
) | ||||
/// Division operator for dividing DynamicAny with Poco::Int8 | ||||
{ | ||||
return other / da.convert<Poco::Int8>(); | ||||
} | ||||
inline Poco::Int8 operator += (Poco::Int8& other, const DynamicAny& da) | ||||
/// Addition assignment operator for adding DynamicAny to Poco::Int8 | ||||
{ | ||||
return other += da.convert<Poco::Int8>(); | ||||
} | ||||
inline Poco::Int8 operator -= (Poco::Int8& other, const DynamicAny& da) | ||||
/// Subtraction assignment operator for subtracting DynamicAny from | ||||
Poco::Int8 | ||||
{ | ||||
return other -= da.convert<Poco::Int8>(); | ||||
} | ||||
inline Poco::Int8 operator *= (Poco::Int8& other, const DynamicAny& da) | ||||
/// Multiplication assignment operator for multiplying DynamicAny wi | ||||
th Poco::Int8 | ||||
{ | ||||
return other *= da.convert<Poco::Int8>(); | ||||
} | ||||
inline Poco::Int8 operator /= (Poco::Int8& other, const DynamicAny& da) | ||||
/// Division assignment operator for dividing DynamicAny with Poco:: | ||||
Int8 | ||||
{ | ||||
return other /= da.convert<Poco::Int8>(); | ||||
} | ||||
inline bool operator == (const Poco::Int8& other, const DynamicAny& da) | ||||
/// Equality operator for comparing DynamicAny with Poco::Int8 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other == da.convert<Poco::Int8>(); | ||||
} | ||||
inline bool operator != (const Poco::Int8& other, const DynamicAny& da) | ||||
/// Inequality operator for comparing DynamicAny with Poco::Int8 | ||||
{ | ||||
if (da.isEmpty()) return true; | ||||
return other != da.convert<Poco::Int8>(); | ||||
} | ||||
inline bool operator < (const Poco::Int8& other, const DynamicAny& da) | ||||
/// Less than operator for comparing DynamicAny with Poco::Int8 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other < da.convert<Poco::Int8>(); | ||||
} | ||||
inline bool operator <= (const Poco::Int8& other, const DynamicAny& da) | ||||
/// Less than or equal operator for comparing DynamicAny with Poco:: | ||||
Int8 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other <= da.convert<Poco::Int8>(); | ||||
} | ||||
inline bool operator > (const Poco::Int8& other, const DynamicAny& da) | ||||
/// Greater than operator for comparing DynamicAny with Poco::Int8 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other > da.convert<Poco::Int8>(); | ||||
} | ||||
inline bool operator >= (const Poco::Int8& other, const DynamicAny& da) | ||||
/// Greater than or equal operator for comparing DynamicAny with Poc | ||||
o::Int8 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other >= da.convert<Poco::Int8>(); | ||||
} | ||||
inline Poco::UInt8 operator + (const Poco::UInt8& other, const DynamicAny& | ||||
da) | ||||
/// Addition operator for adding DynamicAny to Poco::UInt8 | ||||
{ | ||||
return other + da.convert<Poco::UInt8>(); | ||||
} | ||||
inline Poco::UInt8 operator - (const Poco::UInt8& other, const DynamicAny& | ||||
da) | ||||
/// Subtraction operator for subtracting DynamicAny from Poco::UInt8 | ||||
{ | ||||
return other - da.convert<Poco::UInt8>(); | ||||
} | ||||
inline Poco::UInt8 operator * (const Poco::UInt8& other, const DynamicAny& | ||||
da) | ||||
/// Multiplication operator for multiplying DynamicAny with Poco::UI | ||||
nt8 | ||||
{ | ||||
return other * da.convert<Poco::UInt8>(); | ||||
} | ||||
inline Poco::UInt8 operator / (const Poco::UInt8& other, const DynamicAny& | ||||
da) | ||||
/// Division operator for dividing DynamicAny with Poco::UInt8 | ||||
{ | ||||
return other / da.convert<Poco::UInt8>(); | ||||
} | ||||
inline Poco::UInt8 operator += (Poco::UInt8& other, const DynamicAny& da) | ||||
/// Addition assignment operator for adding DynamicAny to Poco::UInt | ||||
8 | ||||
{ | ||||
return other += da.convert<Poco::UInt8>(); | ||||
} | ||||
inline Poco::UInt8 operator -= (Poco::UInt8& other, const DynamicAny& da) | ||||
/// Subtraction assignment operator for subtracting DynamicAny from | ||||
Poco::UInt8 | ||||
{ | ||||
return other -= da.convert<Poco::UInt8>(); | ||||
} | ||||
inline Poco::UInt8 operator *= (Poco::UInt8& other, const DynamicAny& da) | ||||
/// Multiplication assignment operator for multiplying DynamicAny wi | ||||
th Poco::UInt8 | ||||
{ | ||||
return other *= da.convert<Poco::UInt8>(); | ||||
} | ||||
inline Poco::UInt8 operator /= (Poco::UInt8& other, const DynamicAny& da) | ||||
/// Division assignment operator for dividing DynamicAny with Poco:: | ||||
UInt8 | ||||
{ | ||||
return other /= da.convert<Poco::UInt8>(); | ||||
} | ||||
inline bool operator == (const Poco::UInt8& other, const DynamicAny& da) | ||||
/// Equality operator for comparing DynamicAny with Poco::UInt8 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other == da.convert<Poco::UInt8>(); | ||||
} | ||||
inline bool operator != (const Poco::UInt8& other, const DynamicAny& da) | ||||
/// Inequality operator for comparing DynamicAny with Poco::UInt8 | ||||
{ | ||||
if (da.isEmpty()) return true; | ||||
return other != da.convert<Poco::UInt8>(); | ||||
} | ||||
inline bool operator < (const Poco::UInt8& other, const DynamicAny& da) | ||||
/// Less than operator for comparing DynamicAny with Poco::UInt8 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other < da.convert<Poco::UInt8>(); | ||||
} | ||||
inline bool operator <= (const Poco::UInt8& other, const DynamicAny& da) | ||||
/// Less than or equal operator for comparing DynamicAny with Poco:: | ||||
UInt8 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other <= da.convert<Poco::UInt8>(); | ||||
} | ||||
inline bool operator > (const Poco::UInt8& other, const DynamicAny& da) | ||||
/// Greater than operator for comparing DynamicAny with Poco::UInt8 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other > da.convert<Poco::UInt8>(); | ||||
} | ||||
inline bool operator >= (const Poco::UInt8& other, const DynamicAny& da) | ||||
/// Greater than or equal operator for comparing DynamicAny with Poc | ||||
o::UInt8 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other >= da.convert<Poco::UInt8>(); | ||||
} | ||||
inline Poco::Int16 operator + (const Poco::Int16& other, const DynamicAny& | ||||
da) | ||||
/// Addition operator for adding DynamicAny to Poco::Int16 | ||||
{ | ||||
return other + da.convert<Poco::Int16>(); | ||||
} | ||||
inline Poco::Int16 operator - (const Poco::Int16& other, const DynamicAny& | ||||
da) | ||||
/// Subtraction operator for subtracting DynamicAny from Poco::Int16 | ||||
{ | ||||
return other - da.convert<Poco::Int16>(); | ||||
} | ||||
inline Poco::Int16 operator * (const Poco::Int16& other, const DynamicAny& | ||||
da) | ||||
/// Multiplication operator for multiplying DynamicAny with Poco::In | ||||
t16 | ||||
{ | ||||
return other * da.convert<Poco::Int16>(); | ||||
} | ||||
inline Poco::Int16 operator / (const Poco::Int16& other, const DynamicAny& | ||||
da) | ||||
/// Division operator for dividing DynamicAny with Poco::Int16 | ||||
{ | ||||
return other / da.convert<Poco::Int16>(); | ||||
} | ||||
inline Poco::Int16 operator += (Poco::Int16& other, const DynamicAny& da) | ||||
/// Addition assignment operator for adding DynamicAny to Poco::Int1 | ||||
6 | ||||
{ | ||||
return other += da.convert<Poco::Int16>(); | ||||
} | ||||
inline Poco::Int16 operator -= (Poco::Int16& other, const DynamicAny& da) | ||||
/// Subtraction assignment operator for subtracting DynamicAny from | ||||
Poco::Int16 | ||||
{ | ||||
return other -= da.convert<Poco::Int16>(); | ||||
} | ||||
inline Poco::Int16 operator *= (Poco::Int16& other, const DynamicAny& da) | ||||
/// Multiplication assignment operator for multiplying DynamicAny wi | ||||
th Poco::Int16 | ||||
{ | ||||
return other *= da.convert<Poco::Int16>(); | ||||
} | ||||
inline Poco::Int16 operator /= (Poco::Int16& other, const DynamicAny& da) | ||||
/// Division assignment operator for dividing DynamicAny with Poco:: | ||||
Int16 | ||||
{ | ||||
return other /= da.convert<Poco::Int16>(); | ||||
} | ||||
inline bool operator == (const Poco::Int16& other, const DynamicAny& da) | ||||
/// Equality operator for comparing DynamicAny with Poco::Int16 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other == da.convert<Poco::Int16>(); | ||||
} | ||||
inline bool operator != (const Poco::Int16& other, const DynamicAny& da) | ||||
/// Inequality operator for comparing DynamicAny with Poco::Int16 | ||||
{ | ||||
if (da.isEmpty()) return true; | ||||
return other != da.convert<Poco::Int16>(); | ||||
} | ||||
inline bool operator < (const Poco::Int16& other, const DynamicAny& da) | ||||
/// Less than operator for comparing DynamicAny with Poco::Int16 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other < da.convert<Poco::Int16>(); | ||||
} | ||||
inline bool operator <= (const Poco::Int16& other, const DynamicAny& da) | ||||
/// Less than or equal operator for comparing DynamicAny with Poco:: | ||||
Int16 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other <= da.convert<Poco::Int16>(); | ||||
} | ||||
inline bool operator > (const Poco::Int16& other, const DynamicAny& da) | ||||
/// Greater than operator for comparing DynamicAny with Poco::Int16 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other > da.convert<Poco::Int16>(); | ||||
} | ||||
inline bool operator >= (const Poco::Int16& other, const DynamicAny& da) | ||||
/// Greater than or equal operator for comparing DynamicAny with Poc | ||||
o::Int16 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other >= da.convert<Poco::Int16>(); | ||||
} | ||||
inline Poco::UInt16 operator + (const Poco::UInt16& other, const DynamicAny | ||||
& da) | ||||
/// Addition operator for adding DynamicAny to Poco::UInt16 | ||||
{ | ||||
return other + da.convert<Poco::UInt16>(); | ||||
} | ||||
inline Poco::UInt16 operator - (const Poco::UInt16& other, const DynamicAny | ||||
& da) | ||||
/// Subtraction operator for subtracting DynamicAny from Poco::UInt1 | ||||
6 | ||||
{ | ||||
return other - da.convert<Poco::UInt16>(); | ||||
} | ||||
inline Poco::UInt16 operator * (const Poco::UInt16& other, const DynamicAny | ||||
& da) | ||||
/// Multiplication operator for multiplying DynamicAny with Poco::UI | ||||
nt16 | ||||
{ | ||||
return other * da.convert<Poco::UInt16>(); | ||||
} | ||||
inline Poco::UInt16 operator / (const Poco::UInt16& other, const DynamicAny | ||||
& da) | ||||
/// Division operator for dividing DynamicAny with Poco::UInt16 | ||||
{ | ||||
return other / da.convert<Poco::UInt16>(); | ||||
} | ||||
inline Poco::UInt16 operator += (Poco::UInt16& other, const DynamicAny& da) | ||||
/// Addition assignment operator for adding DynamicAny to Poco::UInt | ||||
16 | ||||
{ | ||||
return other += da.convert<Poco::UInt16>(); | ||||
} | ||||
inline Poco::UInt16 operator -= (Poco::UInt16& other, const DynamicAny& da) | ||||
/// Subtraction assignment operator for subtracting DynamicAny from | ||||
Poco::UInt16 | ||||
{ | ||||
return other -= da.convert<Poco::UInt16>(); | ||||
} | ||||
inline Poco::UInt16 operator *= (Poco::UInt16& other, const DynamicAny& da) | ||||
/// Multiplication assignment operator for multiplying DynamicAny wi | ||||
th Poco::UInt16 | ||||
{ | ||||
return other *= da.convert<Poco::UInt16>(); | ||||
} | ||||
inline Poco::UInt16 operator /= (Poco::UInt16& other, const DynamicAny& da) | ||||
/// Division assignment operator for dividing DynamicAny with Poco:: | ||||
UInt16 | ||||
{ | ||||
return other /= da.convert<Poco::UInt16>(); | ||||
} | ||||
inline bool operator == (const Poco::UInt16& other, const DynamicAny& da) | ||||
/// Equality operator for comparing DynamicAny with Poco::UInt16 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other == da.convert<Poco::UInt16>(); | ||||
} | ||||
inline bool operator != (const Poco::UInt16& other, const DynamicAny& da) | ||||
/// Inequality operator for comparing DynamicAny with Poco::UInt16 | ||||
{ | ||||
if (da.isEmpty()) return true; | ||||
return other != da.convert<Poco::UInt16>(); | ||||
} | ||||
inline bool operator < (const Poco::UInt16& other, const DynamicAny& da) | ||||
/// Less than operator for comparing DynamicAny with Poco::UInt16 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other < da.convert<Poco::UInt16>(); | ||||
} | ||||
inline bool operator <= (const Poco::UInt16& other, const DynamicAny& da) | ||||
/// Less than or equal operator for comparing DynamicAny with Poco:: | ||||
UInt16 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other <= da.convert<Poco::UInt16>(); | ||||
} | ||||
inline bool operator > (const Poco::UInt16& other, const DynamicAny& da) | ||||
/// Greater than operator for comparing DynamicAny with Poco::UInt16 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other > da.convert<Poco::UInt16>(); | ||||
} | ||||
inline bool operator >= (const Poco::UInt16& other, const DynamicAny& da) | ||||
/// Greater than or equal operator for comparing DynamicAny with Poc | ||||
o::UInt16 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other >= da.convert<Poco::UInt16>(); | ||||
} | ||||
inline Poco::Int32 operator + (const Poco::Int32& other, const DynamicAny& | ||||
da) | ||||
/// Addition operator for adding DynamicAny to Poco::Int32 | ||||
{ | ||||
return other + da.convert<Poco::Int32>(); | ||||
} | ||||
inline Poco::Int32 operator - (const Poco::Int32& other, const DynamicAny& | ||||
da) | ||||
/// Subtraction operator for subtracting DynamicAny from Poco::Int32 | ||||
{ | ||||
return other - da.convert<Poco::Int32>(); | ||||
} | ||||
inline Poco::Int32 operator * (const Poco::Int32& other, const DynamicAny& | ||||
da) | ||||
/// Multiplication operator for multiplying DynamicAny with Poco::In | ||||
t32 | ||||
{ | ||||
return other * da.convert<Poco::Int32>(); | ||||
} | ||||
inline Poco::Int32 operator / (const Poco::Int32& other, const DynamicAny& | ||||
da) | ||||
/// Division operator for dividing DynamicAny with Poco::Int32 | ||||
{ | ||||
return other / da.convert<Poco::Int32>(); | ||||
} | ||||
inline Poco::Int32 operator += (Poco::Int32& other, const DynamicAny& da) | ||||
/// Addition assignment operator for adding DynamicAny to Poco::Int3 | ||||
2 | ||||
{ | ||||
return other += da.convert<Poco::Int32>(); | ||||
} | ||||
inline Poco::Int32 operator -= (Poco::Int32& other, const DynamicAny& da) | ||||
/// Subtraction assignment operator for subtracting DynamicAny from | ||||
Poco::Int32 | ||||
{ | ||||
return other -= da.convert<Poco::Int32>(); | ||||
} | ||||
inline Poco::Int32 operator *= (Poco::Int32& other, const DynamicAny& da) | ||||
/// Multiplication assignment operator for multiplying DynamicAny wi | ||||
th Poco::Int32 | ||||
{ | ||||
return other *= da.convert<Poco::Int32>(); | ||||
} | ||||
inline Poco::Int32 operator /= (Poco::Int32& other, const DynamicAny& da) | ||||
/// Division assignment operator for dividing DynamicAny with Poco:: | ||||
Int32 | ||||
{ | ||||
return other /= da.convert<Poco::Int32>(); | ||||
} | ||||
inline bool operator == (const Poco::Int32& other, const DynamicAny& da) | ||||
/// Equality operator for comparing DynamicAny with Poco::Int32 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other == da.convert<Poco::Int32>(); | ||||
} | ||||
inline bool operator != (const Poco::Int32& other, const DynamicAny& da) | ||||
/// Inequality operator for comparing DynamicAny with Poco::Int32 | ||||
{ | ||||
if (da.isEmpty()) return true; | ||||
return other != da.convert<Poco::Int32>(); | ||||
} | ||||
inline bool operator < (const Poco::Int32& other, const DynamicAny& da) | ||||
/// Less than operator for comparing DynamicAny with Poco::Int32 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other < da.convert<Poco::Int32>(); | ||||
} | ||||
inline bool operator <= (const Poco::Int32& other, const DynamicAny& da) | ||||
/// Less than or equal operator for comparing DynamicAny with Poco:: | ||||
Int32 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other <= da.convert<Poco::Int32>(); | ||||
} | ||||
inline bool operator > (const Poco::Int32& other, const DynamicAny& da) | ||||
/// Greater than operator for comparing DynamicAny with Poco::Int32 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other > da.convert<Poco::Int32>(); | ||||
} | ||||
inline bool operator >= (const Poco::Int32& other, const DynamicAny& da) | ||||
/// Greater than or equal operator for comparing DynamicAny with Poc | ||||
o::Int32 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other >= da.convert<Poco::Int32>(); | ||||
} | ||||
inline Poco::UInt32 operator + (const Poco::UInt32& other, const DynamicAny | ||||
& da) | ||||
/// Addition operator for adding DynamicAny to Poco::UInt32 | ||||
{ | ||||
return other + da.convert<Poco::UInt32>(); | ||||
} | ||||
inline Poco::UInt32 operator - (const Poco::UInt32& other, const DynamicAny | ||||
& da) | ||||
/// Subtraction operator for subtracting DynamicAny from Poco::UInt3 | ||||
2 | ||||
{ | ||||
return other - da.convert<Poco::UInt32>(); | ||||
} | ||||
inline Poco::UInt32 operator * (const Poco::UInt32& other, const DynamicAny | ||||
& da) | ||||
/// Multiplication operator for multiplying DynamicAny with Poco::UI | ||||
nt32 | ||||
{ | ||||
return other * da.convert<Poco::UInt32>(); | ||||
} | ||||
inline Poco::UInt32 operator / (const Poco::UInt32& other, const DynamicAny | ||||
& da) | ||||
/// Division operator for dividing DynamicAny with Poco::UInt32 | ||||
{ | ||||
return other / da.convert<Poco::UInt32>(); | ||||
} | ||||
inline Poco::UInt32 operator += (Poco::UInt32& other, const DynamicAny& da) | ||||
/// Addition assignment operator for adding DynamicAny to Poco::UInt | ||||
32 | ||||
{ | ||||
return other += da.convert<Poco::UInt32>(); | ||||
} | ||||
inline Poco::UInt32 operator -= (Poco::UInt32& other, const DynamicAny& da) | ||||
/// Subtraction assignment operator for subtracting DynamicAny from | ||||
Poco::UInt32 | ||||
{ | ||||
return other -= da.convert<Poco::UInt32>(); | ||||
} | ||||
inline Poco::UInt32 operator *= (Poco::UInt32& other, const DynamicAny& da) | ||||
/// Multiplication assignment operator for multiplying DynamicAny wi | ||||
th Poco::UInt32 | ||||
{ | ||||
return other *= da.convert<Poco::UInt32>(); | ||||
} | ||||
inline Poco::UInt32 operator /= (Poco::UInt32& other, const DynamicAny& da) | ||||
/// Division assignment operator for dividing DynamicAny with Poco:: | ||||
UInt32 | ||||
{ | ||||
return other /= da.convert<Poco::UInt32>(); | ||||
} | ||||
inline bool operator == (const Poco::UInt32& other, const DynamicAny& da) | ||||
/// Equality operator for comparing DynamicAny with Poco::UInt32 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other == da.convert<Poco::UInt32>(); | ||||
} | ||||
inline bool operator != (const Poco::UInt32& other, const DynamicAny& da) | ||||
/// Inequality operator for comparing DynamicAny with Poco::UInt32 | ||||
{ | ||||
if (da.isEmpty()) return true; | ||||
return other != da.convert<Poco::UInt32>(); | ||||
} | ||||
inline bool operator < (const Poco::UInt32& other, const DynamicAny& da) | ||||
/// Less than operator for comparing DynamicAny with Poco::UInt32 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other < da.convert<Poco::UInt32>(); | ||||
} | ||||
inline bool operator <= (const Poco::UInt32& other, const DynamicAny& da) | ||||
/// Less than or equal operator for comparing DynamicAny with Poco:: | ||||
UInt32 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other <= da.convert<Poco::UInt32>(); | ||||
} | ||||
inline bool operator > (const Poco::UInt32& other, const DynamicAny& da) | ||||
/// Greater than operator for comparing DynamicAny with Poco::UInt32 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other > da.convert<Poco::UInt32>(); | ||||
} | ||||
inline bool operator >= (const Poco::UInt32& other, const DynamicAny& da) | ||||
/// Greater than or equal operator for comparing DynamicAny with Poc | ||||
o::UInt32 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other >= da.convert<Poco::UInt32>(); | ||||
} | ||||
inline Poco::Int64 operator + (const Poco::Int64& other, const DynamicAny& | ||||
da) | ||||
/// Addition operator for adding DynamicAny to Poco::Int64 | ||||
{ | ||||
return other + da.convert<Poco::Int64>(); | ||||
} | ||||
inline Poco::Int64 operator - (const Poco::Int64& other, const DynamicAny& | ||||
da) | ||||
/// Subtraction operator for subtracting DynamicAny from Poco::Int64 | ||||
{ | ||||
return other - da.convert<Poco::Int64>(); | ||||
} | ||||
inline Poco::Int64 operator * (const Poco::Int64& other, const DynamicAny& | ||||
da) | ||||
/// Multiplication operator for multiplying DynamicAny with Poco::In | ||||
t64 | ||||
{ | ||||
return other * da.convert<Poco::Int64>(); | ||||
} | ||||
inline Poco::Int64 operator / (const Poco::Int64& other, const DynamicAny& | ||||
da) | ||||
/// Division operator for dividing DynamicAny with Poco::Int64 | ||||
{ | ||||
return other / da.convert<Poco::Int64>(); | ||||
} | ||||
inline Poco::Int64 operator += (Poco::Int64& other, const DynamicAny& da) | ||||
/// Addition assignment operator for adding DynamicAny to Poco::Int6 | ||||
4 | ||||
{ | ||||
return other += da.convert<Poco::Int64>(); | ||||
} | ||||
inline Poco::Int64 operator -= (Poco::Int64& other, const DynamicAny& da) | ||||
/// Subtraction assignment operator for subtracting DynamicAny from | ||||
Poco::Int64 | ||||
{ | ||||
return other -= da.convert<Poco::Int64>(); | ||||
} | ||||
inline Poco::Int64 operator *= (Poco::Int64& other, const DynamicAny& da) | ||||
/// Multiplication assignment operator for multiplying DynamicAny wi | ||||
th Poco::Int64 | ||||
{ | ||||
return other *= da.convert<Poco::Int64>(); | ||||
} | ||||
inline Poco::Int64 operator /= (Poco::Int64& other, const DynamicAny& da) | ||||
/// Division assignment operator for dividing DynamicAny with Poco:: | ||||
Int64 | ||||
{ | ||||
return other /= da.convert<Poco::Int64>(); | ||||
} | ||||
inline bool operator == (const Poco::Int64& other, const DynamicAny& da) | ||||
/// Equality operator for comparing DynamicAny with Poco::Int64 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other == da.convert<Poco::Int64>(); | ||||
} | ||||
inline bool operator != (const Poco::Int64& other, const DynamicAny& da) | ||||
/// Inequality operator for comparing DynamicAny with Poco::Int64 | ||||
{ | ||||
if (da.isEmpty()) return true; | ||||
return other != da.convert<Poco::Int64>(); | ||||
} | ||||
inline bool operator < (const Poco::Int64& other, const DynamicAny& da) | ||||
/// Less than operator for comparing DynamicAny with Poco::Int64 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other < da.convert<Poco::Int64>(); | ||||
} | ||||
inline bool operator <= (const Poco::Int64& other, const DynamicAny& da) | ||||
/// Less than or equal operator for comparing DynamicAny with Poco:: | ||||
Int64 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other <= da.convert<Poco::Int64>(); | ||||
} | ||||
inline bool operator > (const Poco::Int64& other, const DynamicAny& da) | ||||
/// Greater than operator for comparing DynamicAny with Poco::Int64 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other > da.convert<Poco::Int64>(); | ||||
} | ||||
inline bool operator >= (const Poco::Int64& other, const DynamicAny& da) | ||||
/// Greater than or equal operator for comparing DynamicAny with Poc | ||||
o::Int64 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other >= da.convert<Poco::Int64>(); | ||||
} | ||||
inline Poco::UInt64 operator + (const Poco::UInt64& other, const DynamicAny | ||||
& da) | ||||
/// Addition operator for adding DynamicAny to Poco::UInt64 | ||||
{ | ||||
return other + da.convert<Poco::UInt64>(); | ||||
} | ||||
inline Poco::UInt64 operator - (const Poco::UInt64& other, const DynamicAny | ||||
& da) | ||||
/// Subtraction operator for subtracting DynamicAny from Poco::UInt6 | ||||
4 | ||||
{ | ||||
return other - da.convert<Poco::UInt64>(); | ||||
} | ||||
inline Poco::UInt64 operator * (const Poco::UInt64& other, const DynamicAny | ||||
& da) | ||||
/// Multiplication operator for multiplying DynamicAny with Poco::UI | ||||
nt64 | ||||
{ | ||||
return other * da.convert<Poco::UInt64>(); | ||||
} | ||||
inline Poco::UInt64 operator / (const Poco::UInt64& other, const DynamicAny | ||||
& da) | ||||
/// Division operator for dividing DynamicAny with Poco::UInt64 | ||||
{ | ||||
return other / da.convert<Poco::UInt64>(); | ||||
} | ||||
inline Poco::UInt64 operator += (Poco::UInt64& other, const DynamicAny& da) | ||||
/// Addition assignment operator for adding DynamicAny to Poco::UInt | ||||
64 | ||||
{ | ||||
return other += da.convert<Poco::UInt64>(); | ||||
} | ||||
inline Poco::UInt64 operator -= (Poco::UInt64& other, const DynamicAny& da) | ||||
/// Subtraction assignment operator for subtracting DynamicAny from | ||||
Poco::UInt64 | ||||
{ | ||||
return other -= da.convert<Poco::UInt64>(); | ||||
} | ||||
inline Poco::UInt64 operator *= (Poco::UInt64& other, const DynamicAny& da) | ||||
/// Multiplication assignment operator for multiplying DynamicAny wi | ||||
th Poco::UInt64 | ||||
{ | ||||
return other *= da.convert<Poco::UInt64>(); | ||||
} | ||||
inline Poco::UInt64 operator /= (Poco::UInt64& other, const DynamicAny& da) | ||||
/// Division assignment operator for dividing DynamicAny with Poco:: | ||||
UInt64 | ||||
{ | ||||
return other /= da.convert<Poco::UInt64>(); | ||||
} | ||||
inline bool operator == (const Poco::UInt64& other, const DynamicAny& da) | ||||
/// Equality operator for comparing DynamicAny with Poco::UInt64 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other == da.convert<Poco::UInt64>(); | ||||
} | ||||
inline bool operator != (const Poco::UInt64& other, const DynamicAny& da) | ||||
/// Inequality operator for comparing DynamicAny with Poco::UInt64 | ||||
{ | ||||
if (da.isEmpty()) return true; | ||||
return other != da.convert<Poco::UInt64>(); | ||||
} | ||||
inline bool operator < (const Poco::UInt64& other, const DynamicAny& da) | ||||
/// Less than operator for comparing DynamicAny with Poco::UInt64 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other < da.convert<Poco::UInt64>(); | ||||
} | ||||
inline bool operator <= (const Poco::UInt64& other, const DynamicAny& da) | ||||
/// Less than or equal operator for comparing DynamicAny with Poco:: | ||||
UInt64 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other <= da.convert<Poco::UInt64>(); | ||||
} | ||||
inline bool operator > (const Poco::UInt64& other, const DynamicAny& da) | ||||
/// Greater than operator for comparing DynamicAny with Poco::UInt64 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other > da.convert<Poco::UInt64>(); | ||||
} | ||||
inline bool operator >= (const Poco::UInt64& other, const DynamicAny& da) | ||||
/// Greater than or equal operator for comparing DynamicAny with Poc | ||||
o::UInt64 | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other >= da.convert<Poco::UInt64>(); | ||||
} | ||||
inline float operator + (const float& other, const DynamicAny& da) | ||||
/// Addition operator for adding DynamicAny to float | ||||
{ | ||||
return other + da.convert<float>(); | ||||
} | ||||
inline float operator - (const float& other, const DynamicAny& da) | ||||
/// Subtraction operator for subtracting DynamicAny from float | ||||
{ | ||||
return other - da.convert<float>(); | ||||
} | ||||
inline float operator * (const float& other, const DynamicAny& da) | ||||
/// Multiplication operator for multiplying DynamicAny with float | ||||
{ | ||||
return other * da.convert<float>(); | ||||
} | ||||
inline float operator / (const float& other, const DynamicAny& da) | ||||
/// Division operator for dividing DynamicAny with float | ||||
{ | ||||
return other / da.convert<float>(); | ||||
} | ||||
inline float operator += (float& other, const DynamicAny& da) | ||||
/// Addition assignment operator for adding DynamicAny to float | ||||
{ | ||||
return other += da.convert<float>(); | ||||
} | ||||
inline float operator -= (float& other, const DynamicAny& da) | ||||
/// Subtraction assignment operator for subtracting DynamicAny from | ||||
float | ||||
{ | ||||
return other -= da.convert<float>(); | ||||
} | ||||
inline float operator *= (float& other, const DynamicAny& da) | ||||
/// Multiplication assignment operator for multiplying DynamicAny wi | ||||
th float | ||||
{ | ||||
return other *= da.convert<float>(); | ||||
} | ||||
inline float operator /= (float& other, const DynamicAny& da) | ||||
/// Division assignment operator for dividing DynamicAny with float | ||||
{ | ||||
return other /= da.convert<float>(); | ||||
} | ||||
inline bool operator == (const float& other, const DynamicAny& da) | ||||
/// Equality operator for comparing DynamicAny with float | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other == da.convert<float>(); | ||||
} | ||||
inline bool operator != (const float& other, const DynamicAny& da) | ||||
/// Inequality operator for comparing DynamicAny with float | ||||
{ | ||||
if (da.isEmpty()) return true; | ||||
return other != da.convert<float>(); | ||||
} | ||||
inline bool operator < (const float& other, const DynamicAny& da) | ||||
/// Less than operator for comparing DynamicAny with float | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other < da.convert<float>(); | ||||
} | ||||
inline bool operator <= (const float& other, const DynamicAny& da) | ||||
/// Less than or equal operator for comparing DynamicAny with float | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other <= da.convert<float>(); | ||||
} | ||||
inline bool operator > (const float& other, const DynamicAny& da) | ||||
/// Greater than operator for comparing DynamicAny with float | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other > da.convert<float>(); | ||||
} | ||||
inline bool operator >= (const float& other, const DynamicAny& da) | ||||
/// Greater than or equal operator for comparing DynamicAny with flo | ||||
at | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other >= da.convert<float>(); | ||||
} | ||||
inline double operator + (const double& other, const DynamicAny& da) | ||||
/// Addition operator for adding DynamicAny to double | ||||
{ | ||||
return other + da.convert<double>(); | ||||
} | ||||
inline double operator - (const double& other, const DynamicAny& da) | ||||
/// Subtraction operator for subtracting DynamicAny from double | ||||
{ | ||||
return other - da.convert<double>(); | ||||
} | ||||
inline double operator * (const double& other, const DynamicAny& da) | ||||
/// Multiplication operator for multiplying DynamicAny with double | ||||
{ | ||||
return other * da.convert<double>(); | ||||
} | ||||
inline double operator / (const double& other, const DynamicAny& da) | ||||
/// Division operator for dividing DynamicAny with double | ||||
{ | ||||
return other / da.convert<double>(); | ||||
} | ||||
inline double operator += (double& other, const DynamicAny& da) | ||||
/// Addition assignment operator for adding DynamicAny to double | ||||
{ | ||||
return other += da.convert<double>(); | ||||
} | ||||
inline double operator -= (double& other, const DynamicAny& da) | ||||
/// Subtraction assignment operator for subtracting DynamicAny from | ||||
double | ||||
{ | ||||
return other -= da.convert<double>(); | ||||
} | ||||
inline double operator *= (double& other, const DynamicAny& da) | ||||
/// Multiplication assignment operator for multiplying DynamicAny wi | ||||
th double | ||||
{ | ||||
return other *= da.convert<double>(); | ||||
} | ||||
inline double operator /= (double& other, const DynamicAny& da) | ||||
/// Division assignment operator for dividing DynamicAny with double | ||||
{ | ||||
return other /= da.convert<double>(); | ||||
} | ||||
inline bool operator == (const double& other, const DynamicAny& da) | ||||
/// Equality operator for comparing DynamicAny with double | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other == da.convert<double>(); | ||||
} | ||||
inline bool operator != (const double& other, const DynamicAny& da) | ||||
/// Inequality operator for comparing DynamicAny with double | ||||
{ | ||||
if (da.isEmpty()) return true; | ||||
return other != da.convert<double>(); | ||||
} | ||||
inline bool operator < (const double& other, const DynamicAny& da) | ||||
/// Less than operator for comparing DynamicAny with double | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other < da.convert<double>(); | ||||
} | ||||
inline bool operator <= (const double& other, const DynamicAny& da) | ||||
/// Less than or equal operator for comparing DynamicAny with double | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other <= da.convert<double>(); | ||||
} | ||||
inline bool operator > (const double& other, const DynamicAny& da) | ||||
/// Greater than operator for comparing DynamicAny with double | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other > da.convert<double>(); | ||||
} | ||||
inline bool operator >= (const double& other, const DynamicAny& da) | ||||
/// Greater than or equal operator for comparing DynamicAny with dou | ||||
ble | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other >= da.convert<double>(); | ||||
} | ||||
inline bool operator == (const bool& other, const DynamicAny& da) | ||||
/// Equality operator for comparing DynamicAny with bool | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other == da.convert<bool>(); | ||||
} | ||||
inline bool operator != (const bool& other, const DynamicAny& da) | ||||
/// Inequality operator for comparing DynamicAny with bool | ||||
{ | ||||
if (da.isEmpty()) return true; | ||||
return other != da.convert<bool>(); | ||||
} | ||||
inline bool operator == (const std::string& other, const DynamicAny& da) | ||||
/// Equality operator for comparing DynamicAny with std::string | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other == da.convert<std::string>(); | ||||
} | ||||
inline bool operator != (const std::string& other, const DynamicAny& da) | ||||
/// Inequality operator for comparing DynamicAny with std::string | ||||
{ | ||||
if (da.isEmpty()) return true; | ||||
return other != da.convert<std::string>(); | ||||
} | ||||
inline bool operator == (const char* other, const DynamicAny& da) | ||||
/// Equality operator for comparing DynamicAny with const char* | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return da.convert<std::string>() == other; | ||||
} | ||||
inline bool operator != (const char* other, const DynamicAny& da) | ||||
/// Inequality operator for comparing DynamicAny with const char* | ||||
{ | ||||
if (da.isEmpty()) return true; | ||||
return da.convert<std::string>() != other; | ||||
} | ||||
#ifndef POCO_LONG_IS_64_BIT | ||||
inline long operator + (const long& other, const DynamicAny& da) | ||||
/// Addition operator for adding DynamicAny to long | ||||
{ | ||||
return other + da.convert<long>(); | ||||
} | ||||
inline long operator - (const long& other, const DynamicAny& da) | ||||
/// Subtraction operator for subtracting DynamicAny from long | ||||
{ | ||||
return other - da.convert<long>(); | ||||
} | ||||
inline long operator * (const long& other, const DynamicAny& da) | ||||
/// Multiplication operator for multiplying DynamicAny with long | ||||
{ | ||||
return other * da.convert<long>(); | ||||
} | ||||
inline long operator / (const long& other, const DynamicAny& da) | ||||
/// Division operator for dividing DynamicAny with long | ||||
{ | ||||
return other / da.convert<long>(); | ||||
} | ||||
inline long operator += (long& other, const DynamicAny& da) | ||||
/// Addition assignment operator for adding DynamicAny to long | ||||
{ | ||||
return other += da.convert<long>(); | ||||
} | ||||
inline long operator -= (long& other, const DynamicAny& da) | ||||
/// Subtraction assignment operator for subtracting DynamicAny from | ||||
long | ||||
{ | ||||
return other -= da.convert<long>(); | ||||
} | ||||
inline long operator *= (long& other, const DynamicAny& da) | ||||
/// Multiplication assignment operator for multiplying DynamicAny wi | ||||
th long | ||||
{ | ||||
return other *= da.convert<long>(); | ||||
} | ||||
inline long operator /= (long& other, const DynamicAny& da) | ||||
/// Division assignment operator for dividing DynamicAny with long | ||||
{ | ||||
return other /= da.convert<long>(); | ||||
} | ||||
inline bool operator == (const long& other, const DynamicAny& da) | ||||
/// Equality operator for comparing DynamicAny with long | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other == da.convert<long>(); | ||||
} | ||||
inline bool operator != (const long& other, const DynamicAny& da) | ||||
/// Inequality operator for comparing DynamicAny with long | ||||
{ | ||||
if (da.isEmpty()) return true; | ||||
return other != da.convert<long>(); | ||||
} | ||||
inline bool operator < (const long& other, const DynamicAny& da) | ||||
/// Less than operator for comparing DynamicAny with long | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other < da.convert<long>(); | ||||
} | ||||
inline bool operator <= (const long& other, const DynamicAny& da) | ||||
/// Less than or equal operator for comparing DynamicAny with long | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other <= da.convert<long>(); | ||||
} | ||||
inline bool operator > (const long& other, const DynamicAny& da) | ||||
/// Greater than operator for comparing DynamicAny with long | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other > da.convert<long>(); | ||||
} | ||||
inline bool operator >= (const long& other, const DynamicAny& da) | ||||
/// Greater than or equal operator for comparing DynamicAny with lon | ||||
g | ||||
{ | ||||
if (da.isEmpty()) return false; | ||||
return other >= da.convert<long>(); | ||||
} | ||||
#endif // POCO_LONG_IS_64_BIT | ||||
} // namespace Poco | ||||
#endif // Foundation_DynamicAny_INCLUDED | #endif // Foundation_DynamicAny_INCLUDED | |||
End of changes. 4 change blocks. | ||||
1803 lines changed or deleted | 6 lines changed or added | |||
DynamicAnyHolder.h | DynamicAnyHolder.h | |||
---|---|---|---|---|
// | // | |||
// DynamicAnyHolder.h | // DynamicAnyHolder.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/DynamicAnyHolder.h#2 $ | // $Id: //poco/svn/Foundation/include/Poco/DynamicAnyHolder.h#3 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Dynamic | |||
// Module: DynamicAnyHolder | // Module: VarHolder | |||
// | // | |||
// Definition of the DynamicAnyHolder class. | // Forward header for VarHolder class to maintain backward compatibility | |||
// | // | |||
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2007, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
// Permission is hereby granted, free of charge, to any person or organizat ion | // Permission is hereby granted, free of charge, to any person or organizat ion | |||
// obtaining a copy of the software and accompanying documentation covered by | // obtaining a copy of the software and accompanying documentation covered by | |||
// this license (the "Software") to use, reproduce, display, distribute, | // this license (the "Software") to use, reproduce, display, distribute, | |||
// execute, and transmit the Software, and to prepare derivative works of t he | // execute, and transmit the Software, and to prepare derivative works of t he | |||
// Software, and to permit third-parties to whom the Software is furnished to | // Software, and to permit third-parties to whom the Software is furnished to | |||
// do so, all subject to the following: | // do so, all subject to the following: | |||
skipping to change at line 41 | skipping to change at line 41 | |||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVEN T | // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVEN T | |||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | |||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Foundation_DynamicAnyHolder_INCLUDED | #ifndef Foundation_DynamicAnyHolder_INCLUDED | |||
#define Foundation_DynamicAnyHolder_INCLUDED | #define Foundation_DynamicAnyHolder_INCLUDED | |||
#include "Poco/Foundation.h" | //@ deprecated | |||
#include "Poco/NumberFormatter.h" | #include "Poco/Dynamic/VarHolder.h" | |||
#include "Poco/NumberParser.h" | ||||
#include "Poco/DateTime.h" | ||||
#include "Poco/Timestamp.h" | ||||
#include "Poco/LocalDateTime.h" | ||||
#include "Poco/DateTimeFormat.h" | ||||
#include "Poco/DateTimeFormatter.h" | ||||
#include "Poco/DateTimeParser.h" | ||||
#include "Poco/String.h" | ||||
#include "Poco/Exception.h" | ||||
#include <vector> | ||||
#include <typeinfo> | ||||
#undef min | ||||
#undef max | ||||
#include <limits> | ||||
namespace Poco { | ||||
class DynamicAny; | ||||
class Foundation_API DynamicAnyHolder | ||||
/// Interface for a data holder used by the DynamicAny class. | ||||
/// Provides methods to convert between data types. | ||||
/// Only data types for which a convert method exists are supported, | ||||
which are | ||||
/// all C++ built-in types with addition of std::string, DateTime, L | ||||
ocalDateTime, Timestamp, | ||||
/// and std::vector<DynamicAny>. | ||||
{ | ||||
public: | ||||
DynamicAnyHolder(); | ||||
/// Creates the DynamicAnyHolder. | ||||
virtual ~DynamicAnyHolder(); | ||||
/// Destroys the DynamicAnyHolder. | ||||
virtual DynamicAnyHolder* clone() const = 0; | ||||
/// Deep-copies the DynamicAnyHolder. | ||||
virtual const std::type_info& type() const = 0; | ||||
/// Returns the type information of the stored content. | ||||
virtual void convert(Int8& val) const = 0; | ||||
virtual void convert(Int16& val) const = 0; | ||||
virtual void convert(Int32& val) const = 0; | ||||
virtual void convert(Int64& val) const = 0; | ||||
virtual void convert(UInt8& val) const = 0; | ||||
virtual void convert(UInt16& val) const = 0; | ||||
virtual void convert(UInt32& val) const = 0; | ||||
virtual void convert(UInt64& val) const = 0; | ||||
virtual void convert(DateTime& val) const = 0; | ||||
virtual void convert(LocalDateTime& val) const = 0; | ||||
virtual void convert(Timestamp& val) const = 0; | ||||
virtual bool isArray() const = 0; | ||||
virtual bool isInteger() const = 0; | ||||
virtual bool isSigned() const = 0; | ||||
virtual bool isNumeric() const = 0; | ||||
virtual bool isString() const = 0; | ||||
#ifndef POCO_LONG_IS_64_BIT | ||||
void convert(long& val) const; | ||||
void convert(unsigned long& val) const; | ||||
#endif | ||||
virtual void convert(bool& val) const = 0; | ||||
virtual void convert(float& val) const = 0; | ||||
virtual void convert(double& val) const = 0; | ||||
virtual void convert(char& val) const = 0; | ||||
virtual void convert(std::string& val) const = 0; | ||||
protected: | ||||
template <typename F, typename T> | ||||
void convertToSmaller(const F& from, T& to) const | ||||
/// This function is meant to convert signed numeric values | ||||
from | ||||
/// larger to smaller type. It checks the upper and lower bo | ||||
und and | ||||
/// if from value is within limits of type T (i.e. check cal | ||||
ls do not throw), | ||||
/// it is converted. | ||||
{ | ||||
poco_static_assert (std::numeric_limits<F>::is_specialized); | ||||
poco_static_assert (std::numeric_limits<T>::is_specialized); | ||||
poco_static_assert (std::numeric_limits<F>::is_signed); | ||||
poco_static_assert (std::numeric_limits<T>::is_signed); | ||||
if (std::numeric_limits<F>::is_integer) | ||||
{ | ||||
checkUpperLimit(from, to); | ||||
checkLowerLimit(from, to); | ||||
} | ||||
else | ||||
{ | ||||
checkUpperLimitFloat(from, to); | ||||
checkLowerLimitFloat(from, to); | ||||
} | ||||
to = static_cast<T>(from); | ||||
} | ||||
template <typename F, typename T> | ||||
void convertToSmallerUnsigned(const F& from, T& to) const | ||||
/// This function is meant for converting unsigned integral | ||||
data types, | ||||
/// from larger to smaller type. Since lower limit is always | ||||
0 for unigned types, | ||||
/// only the upper limit is checked, thus saving some cycles | ||||
compared to the signed | ||||
/// version of the function. If the value to be converted is | ||||
smaller than | ||||
/// the maximum value for the target type, the conversion is | ||||
performed. | ||||
{ | ||||
poco_static_assert (std::numeric_limits<F>::is_specialized); | ||||
poco_static_assert (std::numeric_limits<T>::is_specialized); | ||||
poco_static_assert (!std::numeric_limits<F>::is_signed); | ||||
poco_static_assert (!std::numeric_limits<T>::is_signed); | ||||
checkUpperLimit(from, to); | ||||
to = static_cast<T>(from); | ||||
} | ||||
template <typename F, typename T> | ||||
void convertSignedToUnsigned(const F& from, T& to) const | ||||
/// This function is meant for converting signed integral da | ||||
ta types to | ||||
/// unsigned data types. Negative values can not be converte | ||||
d and if one is | ||||
/// encountered, RangeException is thrown. | ||||
/// If upper limit is within the target data type limits, th | ||||
e conversion is performed. | ||||
{ | ||||
poco_static_assert (std::numeric_limits<F>::is_specialized); | ||||
poco_static_assert (std::numeric_limits<T>::is_specialized); | ||||
poco_static_assert (std::numeric_limits<F>::is_signed); | ||||
poco_static_assert (!std::numeric_limits<T>::is_signed); | ||||
if (from < 0) | ||||
throw RangeException("Value too small."); | ||||
checkUpperLimit(from, to); | ||||
to = static_cast<T>(from); | ||||
} | ||||
template <typename F, typename T> | ||||
void convertSignedFloatToUnsigned(const F& from, T& to) const | ||||
/// This function is meant for converting floating point dat | ||||
a types to | ||||
/// unsigned integral data types. Negative values can not be | ||||
converted and if one is | ||||
/// encountered, RangeException is thrown. | ||||
/// If uper limit is within the target data type limits, the | ||||
conversion is performed. | ||||
{ | ||||
poco_static_assert (std::numeric_limits<F>::is_specialized); | ||||
poco_static_assert (std::numeric_limits<T>::is_specialized); | ||||
poco_static_assert (!std::numeric_limits<F>::is_integer); | ||||
poco_static_assert (std::numeric_limits<T>::is_integer); | ||||
poco_static_assert (!std::numeric_limits<T>::is_signed); | ||||
if (from < 0) | ||||
throw RangeException("Value too small."); | ||||
checkUpperLimitFloat(from, to); | ||||
to = static_cast<T>(from); | ||||
} | ||||
template <typename F, typename T> | ||||
void convertUnsignedToSigned(const F& from, T& to) const | ||||
/// This function is meant for converting unsigned integral | ||||
data types to | ||||
/// unsigned data types. Negative values can not be converte | ||||
d and if one is | ||||
/// encountered, RangeException is thrown. | ||||
/// If upper limit is within the target data type limits, th | ||||
e converiosn is performed. | ||||
{ | ||||
poco_static_assert (std::numeric_limits<F>::is_specialized); | ||||
poco_static_assert (std::numeric_limits<T>::is_specialized); | ||||
poco_static_assert (!std::numeric_limits<F>::is_signed); | ||||
poco_static_assert (std::numeric_limits<T>::is_signed); | ||||
checkUpperLimit(from, to); | ||||
to = static_cast<T>(from); | ||||
} | ||||
private: | ||||
template <typename F, typename T> | ||||
void checkUpperLimit(const F& from, T&) const | ||||
{ | ||||
if ((sizeof(T) < sizeof(F)) && | ||||
(from > static_cast<F>(std::numeric_limits<T>::max() | ||||
))) | ||||
{ | ||||
throw RangeException("Value too large."); | ||||
} | ||||
else | ||||
if (static_cast<T>(from) > std::numeric_limits<T>::max()) | ||||
{ | ||||
throw RangeException("Value too large."); | ||||
} | ||||
} | ||||
template <typename F, typename T> | ||||
void checkUpperLimitFloat(const F& from, T&) const | ||||
{ | ||||
if (from > std::numeric_limits<T>::max()) | ||||
throw RangeException("Value too large."); | ||||
} | ||||
template <typename F, typename T> | ||||
void checkLowerLimitFloat(const F& from, T&) const | ||||
{ | ||||
if (from < -std::numeric_limits<T>::max()) | ||||
throw RangeException("Value too small."); | ||||
} | ||||
template <typename F, typename T> | ||||
void checkLowerLimit(const F& from, T&) const | ||||
{ | ||||
if (from < std::numeric_limits<T>::min()) | ||||
throw RangeException("Value too small."); | ||||
} | ||||
}; | ||||
// | ||||
// inlines | ||||
// | ||||
#ifndef POCO_LONG_IS_64_BIT | ||||
inline void DynamicAnyHolder::convert(long& val) const | ||||
{ | ||||
Int32 tmp; | ||||
convert(tmp); | ||||
val = tmp; | ||||
} | ||||
inline void DynamicAnyHolder::convert(unsigned long& val) const | ||||
{ | ||||
UInt32 tmp; | ||||
convert(tmp); | ||||
val = tmp; | ||||
} | ||||
#endif | ||||
template <typename T> | ||||
class DynamicAnyHolderImpl: public DynamicAnyHolder | ||||
/// Template based implementation of a DynamicAnyHolder. | ||||
/// Conversion work happens in the template specializations of this | ||||
class. | ||||
/// | ||||
/// DynamicAny can be used for any type for which a specialization f | ||||
or | ||||
/// DynamicAnyHolderImpl is available. | ||||
/// | ||||
/// DynamicAnyHolderImpl throws following exceptions: | ||||
/// NotImplementedException (if the specialization for a | ||||
type does not exist) | ||||
/// RangeException (if an attempt is made to assign a nu | ||||
meric value outside of the target min/max limits | ||||
/// SyntaxException (if an attempt is made to convert a | ||||
string containing non-numeric characters to number) | ||||
/// | ||||
/// All specializations must additionally implement a public member | ||||
function: | ||||
/// const T& value() const | ||||
/// returning a const reference to the actual stored value. | ||||
{ | ||||
public: | ||||
DynamicAnyHolderImpl() | ||||
{ | ||||
} | ||||
~DynamicAnyHolderImpl() | ||||
{ | ||||
} | ||||
const std::type_info& type() const | ||||
{ | ||||
return typeid(T); | ||||
} | ||||
bool isInteger() const | ||||
{ | ||||
return std::numeric_limits<T>::is_integer; | ||||
} | ||||
bool isSigned() const | ||||
{ | ||||
return std::numeric_limits<T>::is_signed; | ||||
} | ||||
bool isNumeric() const | ||||
{ | ||||
return std::numeric_limits<T>::is_specialized; | ||||
} | ||||
bool isString() const | ||||
{ | ||||
return type() == typeid(std::string); | ||||
} | ||||
void convert(Int8&) const | ||||
{ | ||||
throw NotImplementedException("No DynamicAnyHolder specializ | ||||
ation for type", typeid(T).name()); | ||||
} | ||||
void convert(Int16&) const | ||||
{ | ||||
throw NotImplementedException("No DynamicAnyHolder specializ | ||||
ation for type", typeid(T).name()); | ||||
} | ||||
void convert(Int32&) const | ||||
{ | ||||
throw NotImplementedException("No DynamicAnyHolder specializ | ||||
ation for type", typeid(T).name()); | ||||
} | ||||
void convert(Int64&) const | ||||
{ | ||||
throw NotImplementedException("No DynamicAnyHolder specializ | ||||
ation for type", typeid(T).name()); | ||||
} | ||||
void convert(UInt8&) const | ||||
{ | ||||
throw NotImplementedException("No DynamicAnyHolder specializ | ||||
ation for type", typeid(T).name()); | ||||
} | ||||
void convert(UInt16&) const | ||||
{ | ||||
throw NotImplementedException("No DynamicAnyHolder specializ | ||||
ation for type", typeid(T).name()); | ||||
} | ||||
void convert(UInt32&) const | ||||
{ | ||||
throw NotImplementedException("No DynamicAnyHolder specializ | ||||
ation for type", typeid(T).name()); | ||||
} | ||||
void convert(UInt64&) const | ||||
{ | ||||
throw NotImplementedException("No DynamicAnyHolder specializ | ||||
ation for type", typeid(T).name()); | ||||
} | ||||
void convert(bool&) const | ||||
{ | ||||
throw NotImplementedException("No DynamicAnyHolder specializ | ||||
ation for type", typeid(T).name()); | ||||
} | ||||
void convert(float&) const | ||||
{ | ||||
throw NotImplementedException("No DynamicAnyHolder specializ | ||||
ation for type", typeid(T).name()); | ||||
} | ||||
void convert(double&) const | ||||
{ | ||||
throw NotImplementedException("No DynamicAnyHolder specializ | ||||
ation for type", typeid(T).name()); | ||||
} | ||||
void convert(char&) const | ||||
{ | ||||
throw NotImplementedException("No DynamicAnyHolder specializ | ||||
ation for type", typeid(T).name()); | ||||
} | ||||
void convert(std::string&) const | ||||
{ | ||||
throw NotImplementedException("No DynamicAnyHolder specializ | ||||
ation for type", typeid(T).name()); | ||||
} | ||||
void convert(DateTime&) const | ||||
{ | ||||
throw NotImplementedException("No DynamicAnyHolder specializ | ||||
ation for type", typeid(T).name()); | ||||
} | ||||
void convert(LocalDateTime&) const | ||||
{ | ||||
throw NotImplementedException("No DynamicAnyHolder specializ | ||||
ation for type", typeid(T).name()); | ||||
} | ||||
void convert(Timestamp&) const | ||||
{ | ||||
throw NotImplementedException("No DynamicAnyHolder specializ | ||||
ation for type", typeid(T).name()); | ||||
} | ||||
DynamicAnyHolder* clone() const | ||||
{ | ||||
throw NotImplementedException("No DynamicAnyHolder specializ | ||||
ation for type", typeid(T).name()); | ||||
} | ||||
bool isArray() const | ||||
{ | ||||
throw NotImplementedException("No DynamicAnyHolder specializ | ||||
ation for type", typeid(T).name()); | ||||
} | ||||
}; | ||||
template <> | ||||
class DynamicAnyHolderImpl<Int8>: public DynamicAnyHolder | ||||
{ | ||||
public: | ||||
DynamicAnyHolderImpl(Int8 val): _val(val) | ||||
{ | ||||
} | ||||
~DynamicAnyHolderImpl() | ||||
{ | ||||
} | ||||
const std::type_info& type() const | ||||
{ | ||||
return typeid(Int8); | ||||
} | ||||
void convert(Int8& val) const | ||||
{ | ||||
val = _val; | ||||
} | ||||
void convert(Int16& val) const | ||||
{ | ||||
val = _val; | ||||
} | ||||
void convert(Int32& val) const | ||||
{ | ||||
val = _val; | ||||
} | ||||
void convert(Int64& val) const | ||||
{ | ||||
val = _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(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 | ||||
{ | ||||
val = static_cast<char>(_val); | ||||
} | ||||
void convert(std::string& val) const | ||||
{ | ||||
val = NumberFormatter::format(_val); | ||||
} | ||||
void convert(DateTime&) const | ||||
{ | ||||
throw BadCastException("Int8 -> DateTime"); | ||||
} | ||||
void convert(LocalDateTime&) const | ||||
{ | ||||
throw BadCastException("Int8 -> LocalDateTime"); | ||||
} | ||||
void convert(Timestamp&) const | ||||
{ | ||||
throw BadCastException("Int8 -> Timestamp"); | ||||
} | ||||
DynamicAnyHolder* clone() const | ||||
{ | ||||
return new DynamicAnyHolderImpl(_val); | ||||
} | ||||
const Int8& value() const | ||||
{ | ||||
return _val; | ||||
} | ||||
bool isArray() const | ||||
{ | ||||
return false; | ||||
} | ||||
bool isInteger() const | ||||
{ | ||||
return std::numeric_limits<Int8>::is_integer; | ||||
} | ||||
bool isSigned() const | ||||
{ | ||||
return std::numeric_limits<Int8>::is_signed; | ||||
} | ||||
bool isNumeric() const | ||||
{ | ||||
return std::numeric_limits<Int8>::is_specialized; | ||||
} | ||||
bool isString() const | ||||
{ | ||||
return false; | ||||
} | ||||
private: | ||||
Int8 _val; | ||||
}; | ||||
template <> | ||||
class DynamicAnyHolderImpl<Int16>: public DynamicAnyHolder | ||||
{ | ||||
public: | ||||
DynamicAnyHolderImpl(Int16 val): _val(val) | ||||
{ | ||||
} | ||||
~DynamicAnyHolderImpl() | ||||
{ | ||||
} | ||||
const std::type_info& type() const | ||||
{ | ||||
return typeid(Int16); | ||||
} | ||||
void convert(Int8& val) const | ||||
{ | ||||
convertToSmaller(_val, val); | ||||
} | ||||
void convert(Int16& val) const | ||||
{ | ||||
val = _val; | ||||
} | ||||
void convert(Int32& val) const | ||||
{ | ||||
val = _val; | ||||
} | ||||
void convert(Int64& val) const | ||||
{ | ||||
val = _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(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); | ||||
} | ||||
void convert(DateTime&) const | ||||
{ | ||||
throw BadCastException("Int16 -> DateTime"); | ||||
} | ||||
void convert(LocalDateTime&) const | ||||
{ | ||||
throw BadCastException("Int16 -> LocalDateTime"); | ||||
} | ||||
void convert(Timestamp&) const | ||||
{ | ||||
throw BadCastException("Int16 -> Timestamp"); | ||||
} | ||||
DynamicAnyHolder* clone() const | ||||
{ | ||||
return new DynamicAnyHolderImpl(_val); | ||||
} | ||||
const Int16& value() const | ||||
{ | ||||
return _val; | ||||
} | ||||
bool isArray() const | ||||
{ | ||||
return false; | ||||
} | ||||
bool isInteger() const | ||||
{ | ||||
return std::numeric_limits<Int16>::is_integer; | ||||
} | ||||
bool isSigned() const | ||||
{ | ||||
return std::numeric_limits<Int16>::is_signed; | ||||
} | ||||
bool isNumeric() const | ||||
{ | ||||
return std::numeric_limits<Int16>::is_specialized; | ||||
} | ||||
bool isString() const | ||||
{ | ||||
return false; | ||||
} | ||||
private: | ||||
Int16 _val; | ||||
}; | ||||
template <> | ||||
class DynamicAnyHolderImpl<Int32>: public DynamicAnyHolder | ||||
{ | ||||
public: | ||||
DynamicAnyHolderImpl(Int32 val): _val(val) | ||||
{ | ||||
} | ||||
~DynamicAnyHolderImpl() | ||||
{ | ||||
} | ||||
const std::type_info& type() const | ||||
{ | ||||
return typeid(Int32); | ||||
} | ||||
void convert(Int8& val) const | ||||
{ | ||||
convertToSmaller(_val, val); | ||||
} | ||||
void convert(Int16& val) const | ||||
{ | ||||
convertToSmaller(_val, val); | ||||
} | ||||
void convert(Int32& val) const | ||||
{ | ||||
val = _val; | ||||
} | ||||
void convert(Int64& val) const | ||||
{ | ||||
val = _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(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); | ||||
} | ||||
void convert(DateTime&) const | ||||
{ | ||||
throw BadCastException("Int32 -> DateTime"); | ||||
} | ||||
void convert(LocalDateTime&) const | ||||
{ | ||||
throw BadCastException("Int32 -> LocalDateTime"); | ||||
} | ||||
void convert(Timestamp&) const | ||||
{ | ||||
throw BadCastException("Int32 -> Timestamp"); | ||||
} | ||||
DynamicAnyHolder* clone() const | ||||
{ | ||||
return new DynamicAnyHolderImpl(_val); | ||||
} | ||||
const Int32& value() const | ||||
{ | ||||
return _val; | ||||
} | ||||
bool isArray() const | ||||
{ | ||||
return false; | ||||
} | ||||
bool isInteger() const | ||||
{ | ||||
return std::numeric_limits<Int32>::is_integer; | ||||
} | ||||
bool isSigned() const | ||||
{ | ||||
return std::numeric_limits<Int32>::is_signed; | ||||
} | ||||
bool isNumeric() const | ||||
{ | ||||
return std::numeric_limits<Int32>::is_specialized; | ||||
} | ||||
bool isString() const | ||||
{ | ||||
return false; | ||||
} | ||||
private: | ||||
Int32 _val; | ||||
}; | ||||
template <> | ||||
class DynamicAnyHolderImpl<Int64>: public DynamicAnyHolder | ||||
{ | ||||
public: | ||||
DynamicAnyHolderImpl(Int64 val): _val(val) | ||||
{ | ||||
} | ||||
~DynamicAnyHolderImpl() | ||||
{ | ||||
} | ||||
const std::type_info& type() const | ||||
{ | ||||
return typeid(Int64); | ||||
} | ||||
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 = _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(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); | ||||
} | ||||
void convert(DateTime& dt) const | ||||
{ | ||||
dt = Timestamp(_val); | ||||
} | ||||
void convert(LocalDateTime& ldt) const | ||||
{ | ||||
ldt = Timestamp(_val); | ||||
} | ||||
void convert(Timestamp& val) const | ||||
{ | ||||
val = Timestamp(_val); | ||||
} | ||||
DynamicAnyHolder* clone() const | ||||
{ | ||||
return new DynamicAnyHolderImpl(_val); | ||||
} | ||||
const Int64& value() const | ||||
{ | ||||
return _val; | ||||
} | ||||
bool isArray() const | ||||
{ | ||||
return false; | ||||
} | ||||
bool isInteger() const | ||||
{ | ||||
return std::numeric_limits<Int64>::is_integer; | ||||
} | ||||
bool isSigned() const | ||||
{ | ||||
return std::numeric_limits<Int64>::is_signed; | ||||
} | ||||
bool isNumeric() const | ||||
{ | ||||
return std::numeric_limits<Int64>::is_specialized; | ||||
} | ||||
bool isString() const | ||||
{ | ||||
return false; | ||||
} | ||||
private: | ||||
Int64 _val; | ||||
}; | ||||
template <> | ||||
class DynamicAnyHolderImpl<UInt8>: public DynamicAnyHolder | ||||
{ | ||||
public: | ||||
DynamicAnyHolderImpl(UInt8 val): _val(val) | ||||
{ | ||||
} | ||||
~DynamicAnyHolderImpl() | ||||
{ | ||||
} | ||||
const std::type_info& type() const | ||||
{ | ||||
return typeid(UInt8); | ||||
} | ||||
void convert(Int8& val) const | ||||
{ | ||||
convertUnsignedToSigned(_val, val); | ||||
} | ||||
void convert(Int16& val) const | ||||
{ | ||||
convertUnsignedToSigned(_val, val); | ||||
} | ||||
void convert(Int32& val) const | ||||
{ | ||||
val = static_cast<Int32>(_val); | ||||
} | ||||
void convert(Int64& val) const | ||||
{ | ||||
val = static_cast<Int64>(_val); | ||||
} | ||||
void convert(UInt8& val) const | ||||
{ | ||||
val = _val; | ||||
} | ||||
void convert(UInt16& val) const | ||||
{ | ||||
val = _val; | ||||
} | ||||
void convert(UInt32& val) const | ||||
{ | ||||
val = _val; | ||||
} | ||||
void convert(UInt64& 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); | ||||
} | ||||
void convert(DateTime&) const | ||||
{ | ||||
throw BadCastException("UInt8 -> DateTime"); | ||||
} | ||||
void convert(LocalDateTime&) const | ||||
{ | ||||
throw BadCastException("Unt8 -> LocalDateTime"); | ||||
} | ||||
void convert(Timestamp&) const | ||||
{ | ||||
throw BadCastException("UInt8 -> Timestamp"); | ||||
} | ||||
DynamicAnyHolder* clone() const | ||||
{ | ||||
return new DynamicAnyHolderImpl(_val); | ||||
} | ||||
const UInt8& value() const | ||||
{ | ||||
return _val; | ||||
} | ||||
bool isArray() const | ||||
{ | ||||
return false; | ||||
} | ||||
bool isInteger() const | ||||
{ | ||||
return std::numeric_limits<UInt8>::is_integer; | ||||
} | ||||
bool isSigned() const | ||||
{ | ||||
return std::numeric_limits<UInt8>::is_signed; | ||||
} | ||||
bool isNumeric() const | ||||
{ | ||||
return std::numeric_limits<UInt8>::is_specialized; | ||||
} | ||||
bool isString() const | ||||
{ | ||||
return false; | ||||
} | ||||
private: | ||||
UInt8 _val; | ||||
}; | ||||
template <> | ||||
class DynamicAnyHolderImpl<UInt16>: public DynamicAnyHolder | ||||
{ | ||||
public: | ||||
DynamicAnyHolderImpl(UInt16 val): _val(val) | ||||
{ | ||||
} | ||||
~DynamicAnyHolderImpl() | ||||
{ | ||||
} | ||||
const std::type_info& type() const | ||||
{ | ||||
return typeid(UInt16); | ||||
} | ||||
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 | ||||
{ | ||||
val = static_cast<Int64>(_val); | ||||
} | ||||
void convert(UInt8& val) const | ||||
{ | ||||
convertToSmallerUnsigned(_val, val); | ||||
} | ||||
void convert(UInt16& val) const | ||||
{ | ||||
val = _val; | ||||
} | ||||
void convert(UInt32& val) const | ||||
{ | ||||
val = _val; | ||||
} | ||||
void convert(UInt64& 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); | ||||
} | ||||
void convert(DateTime&) const | ||||
{ | ||||
throw BadCastException("UInt16 -> DateTime"); | ||||
} | ||||
void convert(LocalDateTime&) const | ||||
{ | ||||
throw BadCastException("UInt16 -> LocalDateTime"); | ||||
} | ||||
void convert(Timestamp&) const | ||||
{ | ||||
throw BadCastException("UInt16 -> Timestamp"); | ||||
} | ||||
DynamicAnyHolder* clone() const | ||||
{ | ||||
return new DynamicAnyHolderImpl(_val); | ||||
} | ||||
const UInt16& value() const | ||||
{ | ||||
return _val; | ||||
} | ||||
bool isArray() const | ||||
{ | ||||
return false; | ||||
} | ||||
bool isInteger() const | ||||
{ | ||||
return std::numeric_limits<UInt16>::is_integer; | ||||
} | ||||
bool isSigned() const | ||||
{ | ||||
return std::numeric_limits<UInt16>::is_signed; | ||||
} | ||||
bool isNumeric() const | ||||
{ | ||||
return std::numeric_limits<UInt16>::is_specialized; | ||||
} | ||||
bool isString() const | ||||
{ | ||||
return false; | ||||
} | ||||
private: | ||||
UInt16 _val; | ||||
}; | ||||
template <> | ||||
class DynamicAnyHolderImpl<UInt32>: public DynamicAnyHolder | ||||
{ | ||||
public: | ||||
DynamicAnyHolderImpl(UInt32 val): _val(val) | ||||
{ | ||||
} | ||||
~DynamicAnyHolderImpl() | ||||
{ | ||||
} | ||||
const std::type_info& type() const | ||||
{ | ||||
return typeid(UInt32); | ||||
} | ||||
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 | ||||
{ | ||||
val = _val; | ||||
} | ||||
void convert(UInt64& 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); | ||||
} | ||||
void convert(DateTime&) const | ||||
{ | ||||
throw BadCastException("UInt32 -> DateTime"); | ||||
} | ||||
void convert(LocalDateTime&) const | ||||
{ | ||||
throw BadCastException("UInt32 -> LocalDateTime"); | ||||
} | ||||
void convert(Timestamp&) const | ||||
{ | ||||
throw BadCastException("UInt32 -> Timestamp"); | ||||
} | ||||
DynamicAnyHolder* clone() const | ||||
{ | ||||
return new DynamicAnyHolderImpl(_val); | ||||
} | ||||
const UInt32& value() const | ||||
{ | ||||
return _val; | ||||
} | ||||
bool isArray() const | ||||
{ | ||||
return false; | ||||
} | ||||
bool isInteger() const | ||||
{ | ||||
return std::numeric_limits<UInt32>::is_integer; | ||||
} | ||||
bool isSigned() const | ||||
{ | ||||
return std::numeric_limits<UInt32>::is_signed; | ||||
} | ||||
bool isNumeric() const | ||||
{ | ||||
return std::numeric_limits<UInt32>::is_specialized; | ||||
} | ||||
bool isString() const | ||||
{ | ||||
return false; | ||||
} | ||||
private: | ||||
UInt32 _val; | ||||
}; | ||||
template <> | ||||
class DynamicAnyHolderImpl<UInt64>: public DynamicAnyHolder | ||||
{ | ||||
public: | ||||
DynamicAnyHolderImpl(UInt64 val): _val(val) | ||||
{ | ||||
} | ||||
~DynamicAnyHolderImpl() | ||||
{ | ||||
} | ||||
const std::type_info& type() const | ||||
{ | ||||
return typeid(UInt64); | ||||
} | ||||
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 = _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); | ||||
} | ||||
void convert(DateTime& dt) const | ||||
{ | ||||
Int64 val; | ||||
convertUnsignedToSigned(_val, val); | ||||
dt = Timestamp(val); | ||||
} | ||||
void convert(LocalDateTime& ldt) const | ||||
{ | ||||
Int64 val; | ||||
convertUnsignedToSigned(_val, val); | ||||
ldt = Timestamp(val); | ||||
} | ||||
void convert(Timestamp& val) const | ||||
{ | ||||
Int64 tmp; | ||||
convertUnsignedToSigned(_val, tmp); | ||||
val = Timestamp(tmp); | ||||
} | ||||
DynamicAnyHolder* clone() const | ||||
{ | ||||
return new DynamicAnyHolderImpl(_val); | ||||
} | ||||
const UInt64& value() const | ||||
{ | ||||
return _val; | ||||
} | ||||
bool isArray() const | ||||
{ | ||||
return false; | ||||
} | ||||
bool isInteger() const | ||||
{ | ||||
return std::numeric_limits<UInt64>::is_integer; | ||||
} | ||||
bool isSigned() const | ||||
{ | ||||
return std::numeric_limits<UInt64>::is_signed; | ||||
} | ||||
bool isNumeric() const | ||||
{ | ||||
return std::numeric_limits<UInt64>::is_specialized; | ||||
} | ||||
bool isString() const | ||||
{ | ||||
return false; | ||||
} | ||||
private: | ||||
UInt64 _val; | ||||
}; | ||||
template <> | ||||
class DynamicAnyHolderImpl<bool>: public DynamicAnyHolder | ||||
{ | ||||
public: | ||||
DynamicAnyHolderImpl(bool val): _val(val) | ||||
{ | ||||
} | ||||
~DynamicAnyHolderImpl() | ||||
{ | ||||
} | ||||
const std::type_info& type() const | ||||
{ | ||||
return typeid(bool); | ||||
} | ||||
void convert(Int8& val) const | ||||
{ | ||||
val = static_cast<Int8>(_val ? 1 : 0); | ||||
} | ||||
void convert(Int16& val) const | ||||
{ | ||||
val = static_cast<Int16>(_val ? 1 : 0); | ||||
} | ||||
void convert(Int32& val) const | ||||
{ | ||||
val = static_cast<Int32>(_val ? 1 : 0); | ||||
} | ||||
void convert(Int64& val) const | ||||
{ | ||||
val = static_cast<Int64>(_val ? 1 : 0); | ||||
} | ||||
void convert(UInt8& val) const | ||||
{ | ||||
val = static_cast<UInt8>(_val ? 1 : 0); | ||||
} | ||||
void convert(UInt16& val) const | ||||
{ | ||||
val = static_cast<UInt16>(_val ? 1 : 0); | ||||
} | ||||
void convert(UInt32& val) const | ||||
{ | ||||
val = static_cast<UInt32>(_val ? 1 : 0); | ||||
} | ||||
void convert(UInt64& val) const | ||||
{ | ||||
val = static_cast<UInt64>(_val ? 1 : 0); | ||||
} | ||||
void convert(bool& val) const | ||||
{ | ||||
val = _val; | ||||
} | ||||
void convert(float& val) const | ||||
{ | ||||
val = (_val ? 1.0f : 0.0f); | ||||
} | ||||
void convert(double& val) const | ||||
{ | ||||
val = (_val ? 1.0 : 0.0); | ||||
} | ||||
void convert(char& val) const | ||||
{ | ||||
val = static_cast<char>(_val ? 1 : 0); | ||||
} | ||||
void convert(std::string& val) const | ||||
{ | ||||
val = (_val ? "true" : "false"); | ||||
} | ||||
void convert(DateTime&) const | ||||
{ | ||||
throw BadCastException("bool -> DateTime"); | ||||
} | ||||
void convert(LocalDateTime&) const | ||||
{ | ||||
throw BadCastException("bool -> LocalDateTime"); | ||||
} | ||||
void convert(Timestamp&) const | ||||
{ | ||||
throw BadCastException("bool -> Timestamp"); | ||||
} | ||||
DynamicAnyHolder* clone() const | ||||
{ | ||||
return new DynamicAnyHolderImpl(_val); | ||||
} | ||||
const bool& value() const | ||||
{ | ||||
return _val; | ||||
} | ||||
bool isArray() const | ||||
{ | ||||
return false; | ||||
} | ||||
bool isInteger() const | ||||
{ | ||||
return std::numeric_limits<bool>::is_integer; | ||||
} | ||||
bool isSigned() const | ||||
{ | ||||
return std::numeric_limits<bool>::is_signed; | ||||
} | ||||
bool isNumeric() const | ||||
{ | ||||
return std::numeric_limits<bool>::is_specialized; | ||||
} | ||||
bool isString() const | ||||
{ | ||||
return false; | ||||
} | ||||
private: | ||||
bool _val; | ||||
}; | ||||
template <> | ||||
class DynamicAnyHolderImpl<float>: public DynamicAnyHolder | ||||
{ | ||||
public: | ||||
DynamicAnyHolderImpl(float val): _val(val) | ||||
{ | ||||
} | ||||
~DynamicAnyHolderImpl() | ||||
{ | ||||
} | ||||
const std::type_info& type() const | ||||
{ | ||||
return typeid(float); | ||||
} | ||||
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 | ||||
{ | ||||
convertToSmaller(_val, val); | ||||
} | ||||
void convert(UInt8& val) const | ||||
{ | ||||
convertSignedFloatToUnsigned(_val, val); | ||||
} | ||||
void convert(UInt16& val) const | ||||
{ | ||||
convertSignedFloatToUnsigned(_val, val); | ||||
} | ||||
void convert(UInt32& val) const | ||||
{ | ||||
convertSignedFloatToUnsigned(_val, val); | ||||
} | ||||
void convert(UInt64& val) const | ||||
{ | ||||
convertSignedFloatToUnsigned(_val, val); | ||||
} | ||||
void convert(bool& val) const | ||||
{ | ||||
val = !(_val <= std::numeric_limits<float>::min() && | ||||
_val >= -1 * std::numeric_limits<float>::min()); | ||||
} | ||||
void convert(float& val) const | ||||
{ | ||||
val = _val; | ||||
} | ||||
void convert(double& val) const | ||||
{ | ||||
val = _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); | ||||
} | ||||
void convert(DateTime&) const | ||||
{ | ||||
throw BadCastException("float -> DateTime"); | ||||
} | ||||
void convert(LocalDateTime&) const | ||||
{ | ||||
throw BadCastException("float -> LocalDateTime"); | ||||
} | ||||
void convert(Timestamp&) const | ||||
{ | ||||
throw BadCastException("float -> Timestamp"); | ||||
} | ||||
DynamicAnyHolder* clone() const | ||||
{ | ||||
return new DynamicAnyHolderImpl(_val); | ||||
} | ||||
const float& value() const | ||||
{ | ||||
return _val; | ||||
} | ||||
bool isArray() const | ||||
{ | ||||
return false; | ||||
} | ||||
bool isInteger() const | ||||
{ | ||||
return std::numeric_limits<float>::is_integer; | ||||
} | ||||
bool isSigned() const | ||||
{ | ||||
return std::numeric_limits<float>::is_signed; | ||||
} | ||||
bool isNumeric() const | ||||
{ | ||||
return std::numeric_limits<float>::is_specialized; | ||||
} | ||||
bool isString() const | ||||
{ | ||||
return false; | ||||
} | ||||
private: | ||||
float _val; | ||||
}; | ||||
template <> | ||||
class DynamicAnyHolderImpl<double>: public DynamicAnyHolder | ||||
{ | ||||
public: | ||||
DynamicAnyHolderImpl(double val): _val(val) | ||||
{ | ||||
} | ||||
~DynamicAnyHolderImpl() | ||||
{ | ||||
} | ||||
const std::type_info& type() const | ||||
{ | ||||
return typeid(double); | ||||
} | ||||
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 | ||||
{ | ||||
convertToSmaller(_val, val); | ||||
} | ||||
void convert(UInt8& val) const | ||||
{ | ||||
convertSignedFloatToUnsigned(_val, val); | ||||
} | ||||
void convert(UInt16& val) const | ||||
{ | ||||
convertSignedFloatToUnsigned(_val, val); | ||||
} | ||||
void convert(UInt32& val) const | ||||
{ | ||||
convertSignedFloatToUnsigned(_val, val); | ||||
} | ||||
void convert(UInt64& val) const | ||||
{ | ||||
convertSignedFloatToUnsigned(_val, val); | ||||
} | ||||
void convert(bool& val) const | ||||
{ | ||||
val = !(_val <= std::numeric_limits<double>::min() && | ||||
_val >= -1 * std::numeric_limits<double>::min()); | ||||
} | ||||
void convert(float& val) const | ||||
{ | ||||
double fMin = -1 * std::numeric_limits<float>::max(); | ||||
double fMax = std::numeric_limits<float>::max(); | ||||
if (_val < fMin) throw RangeException("Value too small."); | ||||
if (_val > fMax) throw RangeException("Value too large."); | ||||
val = static_cast<float>(_val); | ||||
} | ||||
void convert(double& val) const | ||||
{ | ||||
val = _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); | ||||
} | ||||
void convert(DateTime&) const | ||||
{ | ||||
throw BadCastException("double -> DateTime"); | ||||
} | ||||
void convert(LocalDateTime&) const | ||||
{ | ||||
throw BadCastException("double -> LocalDateTime"); | ||||
} | ||||
void convert(Timestamp&) const | ||||
{ | ||||
throw BadCastException("double -> Timestamp"); | ||||
} | ||||
DynamicAnyHolder* clone() const | ||||
{ | ||||
return new DynamicAnyHolderImpl(_val); | ||||
} | ||||
const double& value() const | ||||
{ | ||||
return _val; | ||||
} | ||||
bool isArray() const | ||||
{ | ||||
return false; | ||||
} | ||||
bool isInteger() const | ||||
{ | ||||
return std::numeric_limits<double>::is_integer; | ||||
} | ||||
bool isSigned() const | ||||
{ | ||||
return std::numeric_limits<double>::is_signed; | ||||
} | ||||
bool isNumeric() const | ||||
{ | ||||
return std::numeric_limits<double>::is_specialized; | ||||
} | ||||
bool isString() const | ||||
{ | ||||
return false; | ||||
} | ||||
private: | ||||
double _val; | ||||
}; | ||||
template <> | ||||
class DynamicAnyHolderImpl<char>: public DynamicAnyHolder | ||||
{ | ||||
public: | ||||
DynamicAnyHolderImpl(char val): _val(val) | ||||
{ | ||||
} | ||||
~DynamicAnyHolderImpl() | ||||
{ | ||||
} | ||||
const std::type_info& type() const | ||||
{ | ||||
return typeid(char); | ||||
} | ||||
void convert(Int8& val) const | ||||
{ | ||||
val = static_cast<Int8>(_val); | ||||
} | ||||
void convert(Int16& val) const | ||||
{ | ||||
val = static_cast<UInt8>(_val); | ||||
} | ||||
void convert(Int32& val) const | ||||
{ | ||||
val = static_cast<UInt8>(_val); | ||||
} | ||||
void convert(Int64& val) const | ||||
{ | ||||
val = static_cast<UInt8>(_val); | ||||
} | ||||
void convert(UInt8& val) const | ||||
{ | ||||
val = static_cast<UInt8>(_val); | ||||
} | ||||
void convert(UInt16& val) const | ||||
{ | ||||
val = static_cast<UInt8>(_val); | ||||
} | ||||
void convert(UInt32& val) const | ||||
{ | ||||
val = static_cast<UInt8>(_val); | ||||
} | ||||
void convert(UInt64& val) const | ||||
{ | ||||
val = static_cast<UInt8>(_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 | ||||
{ | ||||
val = _val; | ||||
} | ||||
void convert(std::string& val) const | ||||
{ | ||||
val = std::string(1, _val); | ||||
} | ||||
void convert(DateTime&) const | ||||
{ | ||||
throw BadCastException("char -> DateTime"); | ||||
} | ||||
void convert(LocalDateTime&) const | ||||
{ | ||||
throw BadCastException("char -> LocalDateTime"); | ||||
} | ||||
void convert(Timestamp&) const | ||||
{ | ||||
throw BadCastException("char -> Timestamp"); | ||||
} | ||||
DynamicAnyHolder* clone() const | ||||
{ | ||||
return new DynamicAnyHolderImpl(_val); | ||||
} | ||||
const char& value() const | ||||
{ | ||||
return _val; | ||||
} | ||||
bool isArray() const | ||||
{ | ||||
return false; | ||||
} | ||||
bool isInteger() const | ||||
{ | ||||
return std::numeric_limits<char>::is_integer; | ||||
} | ||||
bool isSigned() const | ||||
{ | ||||
return std::numeric_limits<char>::is_signed; | ||||
} | ||||
bool isNumeric() const | ||||
{ | ||||
return std::numeric_limits<char>::is_specialized; | ||||
} | ||||
bool isString() const | ||||
{ | ||||
return false; | ||||
} | ||||
private: | ||||
char _val; | ||||
}; | ||||
template <> | ||||
class DynamicAnyHolderImpl<std::string>: public DynamicAnyHolder | ||||
{ | ||||
public: | ||||
DynamicAnyHolderImpl(const char* pVal): _val(pVal) | ||||
{ | ||||
} | ||||
DynamicAnyHolderImpl(const std::string& val): _val(val) | ||||
{ | ||||
} | ||||
~DynamicAnyHolderImpl() | ||||
{ | ||||
} | ||||
const std::type_info& type() const | ||||
{ | ||||
return typeid(std::string); | ||||
} | ||||
void convert(Int8& val) const | ||||
{ | ||||
int v = NumberParser::parse(_val); | ||||
convertToSmaller(v, val); | ||||
} | ||||
void convert(Int16& val) const | ||||
{ | ||||
int v = NumberParser::parse(_val); | ||||
convertToSmaller(v, val); | ||||
} | ||||
void convert(Int32& val) const | ||||
{ | ||||
val = NumberParser::parse(_val); | ||||
} | ||||
void convert(Int64& val) const | ||||
{ | ||||
val = NumberParser::parse64(_val); | ||||
} | ||||
void convert(UInt8& val) const | ||||
{ | ||||
unsigned int v = NumberParser::parseUnsigned(_val); | ||||
convertToSmallerUnsigned(v, val); | ||||
} | ||||
void convert(UInt16& val) const | ||||
{ | ||||
unsigned int v = NumberParser::parseUnsigned(_val); | ||||
convertToSmallerUnsigned(v, val); | ||||
} | ||||
void convert(UInt32& val) const | ||||
{ | ||||
val = NumberParser::parseUnsigned(_val); | ||||
} | ||||
void convert(UInt64& val) const | ||||
{ | ||||
val = NumberParser::parseUnsigned64(_val); | ||||
} | ||||
void convert(bool& val) const | ||||
{ | ||||
static const std::string VAL_FALSE("false"); | ||||
static const std::string VAL_INTFALSE("0"); | ||||
if (_val == VAL_INTFALSE || (icompare(_val, VAL_FALSE) == 0) | ||||
) | ||||
val = false; | ||||
else | ||||
val = true; | ||||
} | ||||
void convert(float& val) const | ||||
{ | ||||
double v = NumberParser::parseFloat(_val); | ||||
convertToSmaller(v, val); | ||||
} | ||||
void convert(double& val) const | ||||
{ | ||||
val = NumberParser::parseFloat(_val); | ||||
} | ||||
void convert(char& val) const | ||||
{ | ||||
if (_val.empty()) | ||||
val = '\0'; | ||||
else | ||||
val = _val[0]; | ||||
} | ||||
void convert(std::string& val) const | ||||
{ | ||||
val = _val; | ||||
} | ||||
void convert(DateTime& val) const | ||||
{ | ||||
int tzd = 0; | ||||
if (!DateTimeParser::tryParse(DateTimeFormat::ISO8601_FORMAT | ||||
, _val, val, tzd)) | ||||
throw BadCastException("string -> DateTime"); | ||||
} | ||||
void convert(LocalDateTime& ldt) const | ||||
{ | ||||
int tzd = 0; | ||||
DateTime tmp; | ||||
if (!DateTimeParser::tryParse(DateTimeFormat::ISO8601_FORMAT | ||||
, _val, tmp, tzd)) | ||||
throw BadCastException("string -> LocalDateTime"); | ||||
ldt = LocalDateTime(tzd, tmp, false); | ||||
} | ||||
void convert(Timestamp& ts) const | ||||
{ | ||||
int tzd = 0; | ||||
DateTime tmp; | ||||
if (!DateTimeParser::tryParse(DateTimeFormat::ISO8601_FORMAT | ||||
, _val, tmp, tzd)) | ||||
throw BadCastException("string -> Timestamp"); | ||||
ts = tmp.timestamp(); | ||||
} | ||||
DynamicAnyHolder* clone() const | ||||
{ | ||||
return new DynamicAnyHolderImpl(_val); | ||||
} | ||||
const std::string& value() const | ||||
{ | ||||
return _val; | ||||
} | ||||
bool isArray() const | ||||
{ | ||||
return false; | ||||
} | ||||
bool isInteger() const | ||||
{ | ||||
return false; | ||||
} | ||||
bool isSigned() const | ||||
{ | ||||
return false; | ||||
} | ||||
bool isNumeric() const | ||||
{ | ||||
return false; | ||||
} | ||||
bool isString() const | ||||
{ | ||||
return true; | ||||
} | ||||
private: | ||||
std::string _val; | ||||
}; | ||||
#ifndef POCO_LONG_IS_64_BIT | ||||
template <> | ||||
class DynamicAnyHolderImpl<long>: public DynamicAnyHolder | ||||
{ | ||||
public: | ||||
DynamicAnyHolderImpl(long val): _val(val) | ||||
{ | ||||
} | ||||
~DynamicAnyHolderImpl() | ||||
{ | ||||
} | ||||
const std::type_info& type() const | ||||
{ | ||||
return typeid(long); | ||||
} | ||||
void convert(Int8& val) const | ||||
{ | ||||
convertToSmaller(_val, val); | ||||
} | ||||
void convert(Int16& val) const | ||||
{ | ||||
convertToSmaller(_val, val); | ||||
} | ||||
void convert(Int32& val) const | ||||
{ | ||||
val = static_cast<Int32>(_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(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); | ||||
} | ||||
void convert(DateTime&) const | ||||
{ | ||||
throw BadCastException("long -> DateTime"); | ||||
} | ||||
void convert(LocalDateTime&) const | ||||
{ | ||||
throw BadCastException("long -> LocalDateTime"); | ||||
} | ||||
void convert(Timestamp&) const | ||||
{ | ||||
throw BadCastException("long -> Timestamp"); | ||||
} | ||||
DynamicAnyHolder* clone() const | ||||
{ | ||||
return new DynamicAnyHolderImpl(_val); | ||||
} | ||||
const long& value() const | ||||
{ | ||||
return _val; | ||||
} | ||||
bool isArray() const | ||||
{ | ||||
return false; | ||||
} | ||||
bool isInteger() const | ||||
{ | ||||
return std::numeric_limits<long>::is_integer; | ||||
} | ||||
bool isSigned() const | ||||
{ | ||||
return std::numeric_limits<long>::is_signed; | ||||
} | ||||
bool isNumeric() const | ||||
{ | ||||
return std::numeric_limits<long>::is_specialized; | ||||
} | ||||
bool isString() const | ||||
{ | ||||
return false; | ||||
} | ||||
private: | ||||
long _val; | ||||
}; | ||||
template <> | ||||
class DynamicAnyHolderImpl<unsigned long>: public DynamicAnyHolder | ||||
{ | ||||
public: | ||||
DynamicAnyHolderImpl(unsigned long val): _val(val) | ||||
{ | ||||
} | ||||
~DynamicAnyHolderImpl() | ||||
{ | ||||
} | ||||
const std::type_info& type() const | ||||
{ | ||||
return typeid(unsigned 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(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); | ||||
} | ||||
void convert(DateTime&) const | ||||
{ | ||||
throw BadCastException("unsigned long -> DateTime"); | ||||
} | ||||
void convert(LocalDateTime&) const | ||||
{ | ||||
throw BadCastException("unsigned long -> LocalDateTime"); | ||||
} | ||||
void convert(Timestamp&) const | ||||
{ | ||||
throw BadCastException("unsigned long -> Timestamp"); | ||||
} | ||||
DynamicAnyHolder* clone() const | ||||
{ | ||||
return new DynamicAnyHolderImpl(_val); | ||||
} | ||||
const unsigned long& value() const | ||||
{ | ||||
return _val; | ||||
} | ||||
bool isArray() const | ||||
{ | ||||
return false; | ||||
} | ||||
bool isInteger() const | ||||
{ | ||||
return std::numeric_limits<unsigned long>::is_integer; | ||||
} | ||||
bool isSigned() const | ||||
{ | ||||
return std::numeric_limits<unsigned long>::is_signed; | ||||
} | ||||
bool isNumeric() const | ||||
{ | ||||
return std::numeric_limits<unsigned long>::is_specialized; | ||||
} | ||||
bool isString() const | ||||
{ | ||||
return false; | ||||
} | ||||
private: | ||||
unsigned long _val; | ||||
}; | ||||
#endif // 64bit | ||||
template <typename T> | ||||
class DynamicAnyHolderImpl<std::vector<T> >: public DynamicAnyHolder | ||||
{ | ||||
public: | ||||
DynamicAnyHolderImpl(const std::vector<T>& val): _val(val) | ||||
{ | ||||
} | ||||
~DynamicAnyHolderImpl() | ||||
{ | ||||
} | ||||
const std::type_info& type() const | ||||
{ | ||||
return typeid(std::vector<T>); | ||||
} | ||||
void convert(Int8& val) const | ||||
{ | ||||
throw BadCastException("Cannot cast collection type to non-c | ||||
ollection type"); | ||||
} | ||||
void convert(Int16& val) const | ||||
{ | ||||
throw BadCastException("Cannot cast collection type to non-c | ||||
ollection type"); | ||||
} | ||||
void convert(Int32& val) const | ||||
{ | ||||
throw BadCastException("Cannot cast collection type to non-c | ||||
ollection type"); | ||||
} | ||||
void convert(Int64& val) const | ||||
{ | ||||
throw BadCastException("Cannot cast collection type to non-c | ||||
ollection type"); | ||||
} | ||||
void convert(UInt8& val) const | ||||
{ | ||||
throw BadCastException("Cannot cast collection type to non-c | ||||
ollection type"); | ||||
} | ||||
void convert(UInt16& val) const | ||||
{ | ||||
throw BadCastException("Cannot cast collection type to non-c | ||||
ollection type"); | ||||
} | ||||
void convert(UInt32& val) const | ||||
{ | ||||
throw BadCastException("Cannot cast collection type to non-c | ||||
ollection type"); | ||||
} | ||||
void convert(UInt64& val) const | ||||
{ | ||||
throw BadCastException("Cannot cast collection type to non-c | ||||
ollection type"); | ||||
} | ||||
void convert(bool& val) const | ||||
{ | ||||
throw BadCastException("Cannot cast collection type to non-c | ||||
ollection type"); | ||||
} | ||||
void convert(float& val) const | ||||
{ | ||||
throw BadCastException("Cannot cast collection type to non-c | ||||
ollection type"); | ||||
} | ||||
void convert(double& val) const | ||||
{ | ||||
throw BadCastException("Cannot cast collection type to non-c | ||||
ollection type"); | ||||
} | ||||
void convert(char& val) const | ||||
{ | ||||
throw BadCastException("Cannot cast collection type to non-c | ||||
ollection type"); | ||||
} | ||||
void convert(std::string& val) const | ||||
{ | ||||
throw BadCastException("Cannot cast collection type to non-c | ||||
ollection type"); | ||||
} | ||||
void convert(DateTime&) const | ||||
{ | ||||
throw BadCastException("vector -> DateTime"); | ||||
} | ||||
void convert(LocalDateTime&) const | ||||
{ | ||||
throw BadCastException("vector -> LocalDateTime"); | ||||
} | ||||
void convert(Timestamp&) const | ||||
{ | ||||
throw BadCastException("vector -> Timestamp"); | ||||
} | ||||
DynamicAnyHolder* clone() const | ||||
{ | ||||
return new DynamicAnyHolderImpl(_val); | ||||
} | ||||
const std::vector<T>& value() const | ||||
{ | ||||
return _val; | ||||
} | ||||
bool isArray() const | ||||
{ | ||||
return true; | ||||
} | ||||
bool isInteger() const | ||||
{ | ||||
return false; | ||||
} | ||||
bool isSigned() const | ||||
{ | ||||
return false; | ||||
} | ||||
bool isNumeric() const | ||||
{ | ||||
return false; | ||||
} | ||||
bool isString() const | ||||
{ | ||||
return false; | ||||
} | ||||
T& operator[](typename std::vector<T>::size_type n) | ||||
{ | ||||
return _val.operator[](n); | ||||
} | ||||
const T& operator[](typename std::vector<T>::size_type n) const | ||||
{ | ||||
return _val.operator[](n); | ||||
} | ||||
private: | ||||
std::vector<T> _val; | ||||
}; | ||||
template <> | ||||
class DynamicAnyHolderImpl<DateTime>: public DynamicAnyHolder | ||||
{ | ||||
public: | ||||
DynamicAnyHolderImpl(const DateTime& val): _val(val) | ||||
{ | ||||
} | ||||
~DynamicAnyHolderImpl() | ||||
{ | ||||
} | ||||
const std::type_info& type() const | ||||
{ | ||||
return typeid(DateTime); | ||||
} | ||||
void convert(Int8&) const | ||||
{ | ||||
throw BadCastException(); | ||||
} | ||||
void convert(Int16&) const | ||||
{ | ||||
throw BadCastException(); | ||||
} | ||||
void convert(Int32&) const | ||||
{ | ||||
throw BadCastException(); | ||||
} | ||||
void convert(Int64& val) const | ||||
{ | ||||
val = _val.timestamp().epochMicroseconds(); | ||||
} | ||||
void convert(UInt8&) const | ||||
{ | ||||
throw BadCastException(); | ||||
} | ||||
void convert(UInt16&) const | ||||
{ | ||||
throw BadCastException(); | ||||
} | ||||
void convert(UInt32&) const | ||||
{ | ||||
throw BadCastException(); | ||||
} | ||||
void convert(UInt64& val) const | ||||
{ | ||||
val = _val.timestamp().epochMicroseconds(); | ||||
} | ||||
void convert(bool&) const | ||||
{ | ||||
throw BadCastException(); | ||||
} | ||||
void convert(float&) const | ||||
{ | ||||
throw BadCastException(); | ||||
} | ||||
void convert(double&) const | ||||
{ | ||||
throw BadCastException(); | ||||
} | ||||
void convert(char&) const | ||||
{ | ||||
throw BadCastException(); | ||||
} | ||||
void convert(std::string& val) const | ||||
{ | ||||
val = DateTimeFormatter::format(_val, Poco::DateTimeFormat:: | ||||
ISO8601_FORMAT); | ||||
} | ||||
void convert(DateTime& val) const | ||||
{ | ||||
val = _val; | ||||
} | ||||
void convert(LocalDateTime& ldt) const | ||||
{ | ||||
ldt = _val.timestamp(); | ||||
} | ||||
void convert(Timestamp& ts) const | ||||
{ | ||||
ts = _val.timestamp(); | ||||
} | ||||
DynamicAnyHolder* clone() const | ||||
{ | ||||
return new DynamicAnyHolderImpl(_val); | ||||
} | ||||
const DateTime& value() const | ||||
{ | ||||
return _val; | ||||
} | ||||
bool isArray() const | ||||
{ | ||||
return false; | ||||
} | ||||
bool isInteger() const | ||||
{ | ||||
return false; | ||||
} | ||||
bool isSigned() const | ||||
{ | ||||
return false; | ||||
} | ||||
bool isNumeric() const | ||||
{ | ||||
return false; | ||||
} | ||||
bool isString() const | ||||
{ | ||||
return false; | ||||
} | ||||
private: | ||||
DateTime _val; | ||||
}; | ||||
template <> | ||||
class DynamicAnyHolderImpl<LocalDateTime>: public DynamicAnyHolder | ||||
{ | ||||
public: | ||||
DynamicAnyHolderImpl(const LocalDateTime& val): _val(val) | ||||
{ | ||||
} | ||||
~DynamicAnyHolderImpl() | ||||
{ | ||||
} | ||||
const std::type_info& type() const | ||||
{ | ||||
return typeid(LocalDateTime); | ||||
} | ||||
void convert(Int8&) const | ||||
{ | ||||
throw BadCastException(); | ||||
} | ||||
void convert(Int16&) const | ||||
{ | ||||
throw BadCastException(); | ||||
} | ||||
void convert(Int32&) const | ||||
{ | ||||
throw BadCastException(); | ||||
} | ||||
void convert(Int64& val) const | ||||
{ | ||||
val = _val.timestamp().epochMicroseconds(); | ||||
} | ||||
void convert(UInt8&) const | ||||
{ | ||||
throw BadCastException(); | ||||
} | ||||
void convert(UInt16&) const | ||||
{ | ||||
throw BadCastException(); | ||||
} | ||||
void convert(UInt32&) const | ||||
{ | ||||
throw BadCastException(); | ||||
} | ||||
void convert(UInt64& val) const | ||||
{ | ||||
val = _val.timestamp().epochMicroseconds(); | ||||
} | ||||
void convert(bool&) const | ||||
{ | ||||
throw BadCastException(); | ||||
} | ||||
void convert(float&) const | ||||
{ | ||||
throw BadCastException(); | ||||
} | ||||
void convert(double&) const | ||||
{ | ||||
throw BadCastException(); | ||||
} | ||||
void convert(char&) const | ||||
{ | ||||
throw BadCastException(); | ||||
} | ||||
void convert(std::string& val) const | ||||
{ | ||||
val = DateTimeFormatter::format(_val, Poco::DateTimeFormat:: | ||||
ISO8601_FORMAT); | ||||
} | ||||
void convert(DateTime& val) const | ||||
{ | ||||
val = _val.timestamp(); | ||||
} | ||||
void convert(LocalDateTime& ldt) const | ||||
{ | ||||
ldt = _val; | ||||
} | ||||
void convert(Timestamp& ts) const | ||||
{ | ||||
ts = _val.timestamp(); | ||||
} | ||||
DynamicAnyHolder* clone() const | ||||
{ | ||||
return new DynamicAnyHolderImpl(_val); | ||||
} | ||||
const LocalDateTime& value() const | ||||
{ | ||||
return _val; | ||||
} | ||||
bool isArray() const | ||||
{ | ||||
return false; | ||||
} | ||||
bool isInteger() const | ||||
{ | ||||
return false; | ||||
} | ||||
bool isSigned() const | ||||
{ | ||||
return false; | ||||
} | ||||
bool isNumeric() const | ||||
{ | ||||
return false; | ||||
} | ||||
bool isString() const | ||||
{ | ||||
return false; | ||||
} | ||||
private: | ||||
LocalDateTime _val; | ||||
}; | ||||
template <> | ||||
class DynamicAnyHolderImpl<Timestamp>: public DynamicAnyHolder | ||||
{ | ||||
public: | ||||
DynamicAnyHolderImpl(const Timestamp& val): _val(val) | ||||
{ | ||||
} | ||||
~DynamicAnyHolderImpl() | ||||
{ | ||||
} | ||||
const std::type_info& type() const | ||||
{ | ||||
return typeid(Timestamp); | ||||
} | ||||
void convert(Int8&) const | ||||
{ | ||||
throw BadCastException(); | ||||
} | ||||
void convert(Int16&) const | ||||
{ | ||||
throw BadCastException(); | ||||
} | ||||
void convert(Int32&) const | ||||
{ | ||||
throw BadCastException(); | ||||
} | ||||
void convert(Int64& val) const | ||||
{ | ||||
val = _val.epochMicroseconds(); | ||||
} | ||||
void convert(UInt8&) const | ||||
{ | ||||
throw BadCastException(); | ||||
} | ||||
void convert(UInt16&) const | ||||
{ | ||||
throw BadCastException(); | ||||
} | ||||
void convert(UInt32&) const | ||||
{ | ||||
throw BadCastException(); | ||||
} | ||||
void convert(UInt64& val) const | ||||
{ | ||||
val = _val.epochMicroseconds(); | ||||
} | ||||
void convert(bool&) const | ||||
{ | ||||
throw BadCastException(); | ||||
} | ||||
void convert(float&) const | ||||
{ | ||||
throw BadCastException(); | ||||
} | ||||
void convert(double&) const | ||||
{ | ||||
throw BadCastException(); | ||||
} | ||||
void convert(char&) const | ||||
{ | ||||
throw BadCastException(); | ||||
} | ||||
void convert(std::string& val) const | ||||
{ | ||||
val = DateTimeFormatter::format(_val, Poco::DateTimeFormat:: | ||||
ISO8601_FORMAT); | ||||
} | ||||
void convert(DateTime& val) const | ||||
{ | ||||
val = _val; | ||||
} | ||||
void convert(LocalDateTime& ldt) const | ||||
{ | ||||
ldt = _val; | ||||
} | ||||
void convert(Timestamp& ts) const | ||||
{ | ||||
ts = _val; | ||||
} | ||||
DynamicAnyHolder* clone() const | ||||
{ | ||||
return new DynamicAnyHolderImpl(_val); | ||||
} | ||||
const Timestamp& value() const | ||||
{ | ||||
return _val; | ||||
} | ||||
bool isArray() const | ||||
{ | ||||
return false; | ||||
} | ||||
bool isInteger() const | ||||
{ | ||||
return false; | ||||
} | ||||
bool isSigned() const | ||||
{ | ||||
return false; | ||||
} | ||||
bool isNumeric() const | ||||
{ | ||||
return false; | ||||
} | ||||
bool isString() const | ||||
{ | ||||
return false; | ||||
} | ||||
private: | ||||
Timestamp _val; | ||||
}; | ||||
} // namespace Poco | ||||
#endif // Foundation_DynamicAnyHolder_INCLUDED | #endif // Foundation_DynamicAnyHolder_INCLUDED | |||
End of changes. 4 change blocks. | ||||
3097 lines changed or deleted | 6 lines changed or added | |||
Environment.h | Environment.h | |||
---|---|---|---|---|
// | // | |||
// Environment.h | // Environment.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Environment.h#3 $ | // $Id: //poco/1.4/Foundation/include/Poco/Environment.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: Environment | // Module: Environment | |||
// | // | |||
// Definition of the Environment class. | // Definition of the Environment class. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 80 | skipping to change at line 80 | |||
static std::string osName(); | static std::string osName(); | |||
/// Returns the operating system name. | /// Returns the operating system name. | |||
static std::string osDisplayName(); | static std::string osDisplayName(); | |||
/// Returns the operating system name in a | /// Returns the operating system name in a | |||
/// "user-friendly" way. | /// "user-friendly" way. | |||
/// | /// | |||
/// Currently this is only implemented for | /// Currently this is only implemented for | |||
/// Windows. There it will return names like | /// Windows. There it will return names like | |||
/// "Windows XP" or "Windows 7/Server 2008 SP2". | /// "Windows XP" or "Windows 7/Server 2008 SP2". | |||
/// On other platforms, returns the same as | /// On other platform, returns the same as | |||
/// osName(). | /// osName(). | |||
static std::string osVersion(); | static std::string osVersion(); | |||
/// Returns the operating system version. | /// Returns the operating system version. | |||
static std::string osArchitecture(); | static std::string osArchitecture(); | |||
/// Returns the operating system architecture. | /// Returns the operating system architecture. | |||
static std::string nodeName(); | static std::string nodeName(); | |||
/// Returns the node (or host) name. | /// Returns the node (or host) name. | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
ExpireStrategy.h | ExpireStrategy.h | |||
---|---|---|---|---|
// | // | |||
// ExpireStrategy.h | // ExpireStrategy.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/ExpireStrategy.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/ExpireStrategy.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Cache | // Package: Cache | |||
// Module: ExpireStrategy | // Module: ExpireStrategy | |||
// | // | |||
// Definition of the ExpireStrategy class. | // Definition of the ExpireStrategy class. | |||
// | // | |||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 81 | skipping to change at line 81 | |||
if (_expireTime < 25000) throw InvalidArgumentException("exp ireTime must be at least 25 ms"); | if (_expireTime < 25000) throw InvalidArgumentException("exp ireTime must be at least 25 ms"); | |||
} | } | |||
~ExpireStrategy() | ~ExpireStrategy() | |||
{ | { | |||
} | } | |||
void onAdd(const void*, const KeyValueArgs <TKey, TValue>& args) | void onAdd(const void*, const KeyValueArgs <TKey, TValue>& args) | |||
{ | { | |||
Timestamp now; | Timestamp now; | |||
typename TimeIndex::value_type tiValue(now, args.key()); | IndexIterator it = _keyIndex.insert(typename TimeIndex::valu | |||
IndexIterator it = _keyIndex.insert(tiValue); | e_type(now, args.key())); | |||
typename Keys::value_type kValue(args.key(), it); | std::pair<Iterator, bool> stat = _keys.insert(typename Keys: | |||
std::pair<Iterator, bool> stat = _keys.insert(kValue); | :value_type(args.key(), it)); | |||
if (!stat.second) | if (!stat.second) | |||
{ | { | |||
_keyIndex.erase(stat.first->second); | _keyIndex.erase(stat.first->second); | |||
stat.first->second = it; | stat.first->second = it; | |||
} | } | |||
} | } | |||
void onRemove(const void*, const TKey& key) | void onRemove(const void*, const TKey& key) | |||
{ | { | |||
Iterator it = _keys.find(key); | Iterator it = _keys.find(key); | |||
End of changes. 2 change blocks. | ||||
5 lines changed or deleted | 5 lines changed or added | |||
FPEnvironment_DUMMY.h | FPEnvironment_DUMMY.h | |||
---|---|---|---|---|
// | // | |||
// FPEnvironment_DUMMY.h | // FPEnvironment_DUMMY.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/FPEnvironment_DUMMY.h#4 $ | // $Id: //poco/1.4/Foundation/include/Poco/FPEnvironment_DUMMY.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: FPEnvironment | // Module: FPEnvironment | |||
// | // | |||
// Definition of class FPEnvironmentImpl for platforms that do not | // Definition of class FPEnvironmentImpl for platforms that do not | |||
// support IEEE 754 extensions. | // support IEEE 754 extensions. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
skipping to change at line 43 | skipping to change at line 43 | |||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | |||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Foundation_FPEnvironment_DUMMY_INCLUDED | #ifndef Foundation_FPEnvironment_DUMMY_INCLUDED | |||
#define Foundation_FPEnvironment_DUMMY_INCLUDED | #define Foundation_FPEnvironment_DUMMY_INCLUDED | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
#include <cmath> | #include <math.h> | |||
namespace Poco { | namespace Poco { | |||
class Foundation_API FPEnvironmentImpl | class Foundation_API FPEnvironmentImpl | |||
{ | { | |||
protected: | protected: | |||
enum RoundingModeImpl | enum RoundingModeImpl | |||
{ | { | |||
FP_ROUND_DOWNWARD_IMPL, | FP_ROUND_DOWNWARD_IMPL, | |||
FP_ROUND_UPWARD_IMPL, | FP_ROUND_UPWARD_IMPL, | |||
skipping to change at line 93 | skipping to change at line 93 | |||
private: | private: | |||
static RoundingModeImpl _roundingMode; | static RoundingModeImpl _roundingMode; | |||
}; | }; | |||
// | // | |||
// inlines | // inlines | |||
// | // | |||
inline bool FPEnvironmentImpl::isInfiniteImpl(float value) | inline bool FPEnvironmentImpl::isInfiniteImpl(float value) | |||
{ | { | |||
return std::isinf(value) != 0; | return isinf(value) != 0; | |||
} | } | |||
inline bool FPEnvironmentImpl::isInfiniteImpl(double value) | inline bool FPEnvironmentImpl::isInfiniteImpl(double value) | |||
{ | { | |||
return std::isinf(value) != 0; | return isinf(value) != 0; | |||
} | } | |||
inline bool FPEnvironmentImpl::isInfiniteImpl(long double value) | inline bool FPEnvironmentImpl::isInfiniteImpl(long double value) | |||
{ | { | |||
return std::isinf((double) value) != 0; | return isinf((double) value) != 0; | |||
} | } | |||
inline bool FPEnvironmentImpl::isNaNImpl(float value) | inline bool FPEnvironmentImpl::isNaNImpl(float value) | |||
{ | { | |||
return std::isnan(value) != 0; | return isnan(value) != 0; | |||
} | } | |||
inline bool FPEnvironmentImpl::isNaNImpl(double value) | inline bool FPEnvironmentImpl::isNaNImpl(double value) | |||
{ | { | |||
return std::isnan(value) != 0; | return isnan(value) != 0; | |||
} | } | |||
inline bool FPEnvironmentImpl::isNaNImpl(long double value) | inline bool FPEnvironmentImpl::isNaNImpl(long double value) | |||
{ | { | |||
return std::isnan((double) value) != 0; | return isnan((double) value) != 0; | |||
} | } | |||
inline float FPEnvironmentImpl::copySignImpl(float target, float source) | inline float FPEnvironmentImpl::copySignImpl(float target, float source) | |||
{ | { | |||
return copysignf(target, source); | return copysignf(target, source); | |||
} | } | |||
inline double FPEnvironmentImpl::copySignImpl(double target, double source) | inline double FPEnvironmentImpl::copySignImpl(double target, double source) | |||
{ | { | |||
return copysign(target, source); | return copysign(target, source); | |||
End of changes. 8 change blocks. | ||||
8 lines changed or deleted | 8 lines changed or added | |||
FTPStreamFactory.h | FTPStreamFactory.h | |||
---|---|---|---|---|
// | // | |||
// FTPStreamFactory.h | // FTPStreamFactory.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/FTPStreamFactory.h#2 $ | // $Id: //poco/1.4/Net/include/Poco/Net/FTPStreamFactory.h#1 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: FTP | // Package: FTP | |||
// Module: FTPStreamFactory | // Module: FTPStreamFactory | |||
// | // | |||
// Definition of the FTPStreamFactory class. | // Definition of the FTPStreamFactory class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 119 | skipping to change at line 119 | |||
/// FTPStreamFactory is used for the first time. | /// FTPStreamFactory is used for the first time. | |||
static FTPPasswordProvider* getPasswordProvider(); | static FTPPasswordProvider* getPasswordProvider(); | |||
/// Returns the FTPPasswordProvider currently in use, | /// Returns the FTPPasswordProvider currently in use, | |||
/// or NULL if no one has been set. | /// or NULL if no one has been set. | |||
static void registerFactory(); | static void registerFactory(); | |||
/// Registers the FTPStreamFactory with the | /// Registers the FTPStreamFactory with the | |||
/// default URIStreamOpener instance. | /// default URIStreamOpener instance. | |||
static void unregisterFactory(); | ||||
/// Unregisters the FTPStreamFactory with the | ||||
/// default URIStreamOpener instance. | ||||
protected: | protected: | |||
static void splitUserInfo(const std::string& userInfo, std::string& username, std::string& password); | static void splitUserInfo(const std::string& userInfo, std::string& username, std::string& password); | |||
static void getUserInfo(const Poco::URI& uri, std::string& username, std::string& password); | static void getUserInfo(const Poco::URI& uri, std::string& username, std::string& password); | |||
static void getPathAndType(const Poco::URI& uri, std::string& path, char& type); | static void getPathAndType(const Poco::URI& uri, std::string& path, char& type); | |||
private: | private: | |||
static std::string _anonymousPassword; | static std::string _anonymousPassword; | |||
static FTPPasswordProvider* _pPasswordProvider; | static FTPPasswordProvider* _pPasswordProvider; | |||
}; | }; | |||
End of changes. 2 change blocks. | ||||
5 lines changed or deleted | 1 lines changed or added | |||
FileChannel.h | FileChannel.h | |||
---|---|---|---|---|
// | // | |||
// FileChannel.h | // FileChannel.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/FileChannel.h#5 $ | // $Id: //poco/1.4/Foundation/include/Poco/FileChannel.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Logging | // Package: Logging | |||
// Module: FileChannel | // Module: FileChannel | |||
// | // | |||
// Definition of the FileChannel class. | // Definition of the FileChannel class. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 138 | skipping to change at line 138 | |||
/// "access.log.20050802110300". | /// "access.log.20050802110300". | |||
/// | /// | |||
/// Using the "times" property it is possible to specify | /// Using the "times" property it is possible to specify | |||
/// time mode for the day/time based rotation. The following values | /// time mode for the day/time based rotation. The following values | |||
/// for the "times" property are supported: | /// for the "times" property are supported: | |||
/// | /// | |||
/// * utc: Rotation strategy is based on UTC time (default) . | /// * utc: Rotation strategy is based on UTC time (default) . | |||
/// * local: Rotation strategy is based on local time. | /// * local: Rotation strategy is based on local time. | |||
/// | /// | |||
/// Archived log files can be compressed using the gzip compression | /// Archived log files can be compressed using the gzip compression | |||
/// method. Compressing can be controlled with the "compress" | /// method. Compressing can be controlled with the "compression" | |||
/// property. The following values for the "compress" property | /// property. The following values for the "compress" property | |||
/// are supported: | /// are supported: | |||
/// | /// | |||
/// * true: Compress archived log files. | /// * true: Compress archived log files. | |||
/// * false: Do not compress archived log files. | /// * false: Do not compress archived log files. | |||
/// | /// | |||
/// Archived log files can be automatically purged, either if | /// Archived log files can be automatically purged, either if | |||
/// they reach a certain age, or if the number of archived | /// they reach a certain age, or if the number of archived | |||
/// log files reaches a given maximum number. This is | /// log files reaches a given maximum number. This is | |||
/// controlled by the purgeAge and purgeCount properties. | /// controlled by the purgeAge and purgeCount properties. | |||
/// | /// | |||
/// The purgeAge property can have the following values: | /// The purgeAge property can have the following values: | |||
/// | /// | |||
/// * "none" or "" no purging | ||||
/// * <n> [seconds]: the maximum age is <n> seconds. | /// * <n> [seconds]: the maximum age is <n> seconds. | |||
/// * <n> minutes: the maximum age is <n> minutes. | /// * <n> minutes: the maximum age is <n> minutes. | |||
/// * <n> hours: the maximum age is <n> hours. | /// * <n> hours: the maximum age is <n> hours. | |||
/// * <n> days: the maximum age is <n> days. | /// * <n> days: the maximum age is <n> days. | |||
/// * <n> weeks: the maximum age is <n> weeks. | /// * <n> weeks: the maximum age is <n> weeks. | |||
/// * <n> months: the maximum age is <n> months, where a month has 30 days. | /// * <n> months: the maximum age is <n> months, where a month has 30 days. | |||
/// | /// | |||
/// The purgeCount property has an integer value that | /// The purgeCount property has an integer value that specifies the | |||
/// specifies the maximum number of archived log files. | maximum number | |||
/// If the number is exceeded, archived log files are | /// of archived log files. If the number is exceeded, archived log f | |||
/// deleted, starting with the oldest. | iles are | |||
/// deleted, starting with the oldest. When "none" or empty string a | ||||
re | ||||
/// supplied, they reset purgeCount to none (no purging). | ||||
/// | /// | |||
/// The flush property specifies whether each log message is flushed | /// The flush property specifies whether each log message is flushed | |||
/// immediately to the log file (which may hurt application performa nce, | /// immediately to the log file (which may hurt application performa nce, | |||
/// but ensures that everything is in the log in case of a system cr ash), | /// but ensures that everything is in the log in case of a system cr ash), | |||
// or whether it's allowed to stay in the system's file buffer for some time. | // or whether it's allowed to stay in the system's file buffer for some time. | |||
/// Valid values are: | /// Valid values are: | |||
/// | /// | |||
/// * true: Every essages is immediately flushed to the log file | /// * true: Every essages is immediately flushed to the log file | |||
(default). | (default). | |||
/// * false: Messages are not immediately flushed to the log file. | /// * false: Messages are not immediately flushed to the log file | |||
/// | . | |||
/// The rotateOnOpen property specifies whether an existing log file | ||||
should be | ||||
/// rotated (and archived) when the channel is opened. Valid values | ||||
are: | ||||
/// | ||||
/// * true: The log file is rotated (and archived) when the chann | ||||
el is opened. | ||||
/// * false: Log messages will be appended to an existing log file | ||||
, | ||||
/// if it exists (unless other conditions for a rotation | ||||
are met). | ||||
/// This is the default. | ||||
/// | /// | |||
/// For a more lightweight file channel class, see SimpleFileChannel . | /// For a more lightweight file channel class, see SimpleFileChannel . | |||
{ | { | |||
public: | public: | |||
FileChannel(); | FileChannel(); | |||
/// Creates the FileChannel. | /// Creates the FileChannel. | |||
FileChannel(const std::string& path); | FileChannel(const std::string& path); | |||
/// Creates the FileChannel for a file with the given path. | /// Creates the FileChannel for a file with the given path. | |||
skipping to change at line 203 | skipping to change at line 196 | |||
void close(); | void close(); | |||
/// Closes the FileChannel. | /// Closes the FileChannel. | |||
void log(const Message& msg); | void log(const Message& msg); | |||
/// Logs the given message to the file. | /// Logs the given message to the file. | |||
void setProperty(const std::string& name, const std::string& value); | void setProperty(const std::string& name, const std::string& value); | |||
/// Sets the property with the given name. | /// Sets the property with the given name. | |||
/// | /// | |||
/// The following properties are supported: | /// The following properties are supported: | |||
/// * path: The log file's path. | /// * path: The log file's path. | |||
/// * rotation: The log file's rotation mode. See the | /// * rotation: The log file's rotation mode. See the | |||
/// FileChannel class for details. | /// FileChannel class for details. | |||
/// * archive: The log file's archive mode. See the | /// * archive: The log file's archive mode. See the | |||
/// FileChannel class for details. | /// FileChannel class for details. | |||
/// * times: The log file's time mode. See the | /// * times: The log file's time mode. See the | |||
/// FileChannel class for details. | /// FileChannel class for details. | |||
/// * compress: Enable or disable compression of | /// * compress: Enable or disable compression of | |||
/// archived files. See the FileChannel cl | /// archived files. See the FileChannel clas | |||
ass | s | |||
/// for details. | /// for details. | |||
/// * purgeAge: Maximum age of an archived log file be | /// * purgeAge: Maximum age of an archived log file befo | |||
fore | re | |||
/// it is purged. See the FileChannel clas | /// it is purged. See the FileChannel class | |||
s for | for | |||
/// details. | /// details. | |||
/// * purgeCount: Maximum number of archived log files b | /// * purgeCount: Maximum number of archived log files bef | |||
efore | ore | |||
/// files are purged. See the FileChannel | /// files are purged. See the FileChannel cl | |||
class | ass | |||
/// for details. | /// for details. | |||
/// * flush: Specifies whether messages are immedia | /// * flush: Specifies whether messages are immediate | |||
tely | ly | |||
/// flushed to the log file. See the FileC | /// flushed to the log file. See the FileCha | |||
hannel class | nnel class | |||
/// for details. | /// for details. | |||
/// * rotateOnOpen: Specifies whether an existing log file | ||||
should be | ||||
/// rotated and archived when the channel | ||||
is opened. | ||||
std::string getProperty(const std::string& name) const; | std::string getProperty(const std::string& name) const; | |||
/// Returns the value of the property with the given name. | /// Returns the value of the property with the given name. | |||
/// See setProperty() for a description of the supported | /// See setProperty() for a description of the supported | |||
/// properties. | /// properties. | |||
Timestamp creationDate() const; | Timestamp creationDate() const; | |||
/// Returns the log file's creation date. | /// Returns the log file's creation date. | |||
UInt64 size() const; | UInt64 size() const; | |||
skipping to change at line 247 | skipping to change at line 238 | |||
/// Returns the log file's path. | /// Returns the log file's path. | |||
static const std::string PROP_PATH; | static const std::string PROP_PATH; | |||
static const std::string PROP_ROTATION; | static const std::string PROP_ROTATION; | |||
static const std::string PROP_ARCHIVE; | static const std::string PROP_ARCHIVE; | |||
static const std::string PROP_TIMES; | static const std::string PROP_TIMES; | |||
static const std::string PROP_COMPRESS; | static const std::string PROP_COMPRESS; | |||
static const std::string PROP_PURGEAGE; | static const std::string PROP_PURGEAGE; | |||
static const std::string PROP_PURGECOUNT; | static const std::string PROP_PURGECOUNT; | |||
static const std::string PROP_FLUSH; | static const std::string PROP_FLUSH; | |||
static const std::string PROP_ROTATEONOPEN; | ||||
protected: | protected: | |||
~FileChannel(); | ~FileChannel(); | |||
void setRotation(const std::string& rotation); | void setRotation(const std::string& rotation); | |||
void setArchive(const std::string& archive); | void setArchive(const std::string& archive); | |||
void setCompress(const std::string& compress); | void setCompress(const std::string& compress); | |||
void setPurgeAge(const std::string& age); | void setPurgeAge(const std::string& age); | |||
void setPurgeCount(const std::string& count); | void setPurgeCount(const std::string& count); | |||
void setFlush(const std::string& flush); | void setFlush(const std::string& flush); | |||
void setRotateOnOpen(const std::string& rotateOnOpen); | ||||
void purge(); | void purge(); | |||
private: | private: | |||
std::string _path; | std::string _path; | |||
std::string _times; | std::string _times; | |||
std::string _rotation; | std::string _rotation; | |||
std::string _archive; | std::string _archive; | |||
bool _compress; | bool _compress; | |||
std::string _purgeAge; | std::string _purgeAge; | |||
std::string _purgeCount; | std::string _purgeCount; | |||
bool _flush; | bool _flush; | |||
bool _rotateOnOpen; | ||||
LogFile* _pFile; | LogFile* _pFile; | |||
RotateStrategy* _pRotateStrategy; | RotateStrategy* _pRotateStrategy; | |||
ArchiveStrategy* _pArchiveStrategy; | ArchiveStrategy* _pArchiveStrategy; | |||
PurgeStrategy* _pPurgeStrategy; | PurgeStrategy* _pPurgeStrategy; | |||
FastMutex _mutex; | FastMutex _mutex; | |||
}; | }; | |||
} // namespace Poco | } // namespace Poco | |||
#endif // Foundation_FileChannel_INCLUDED | #endif // Foundation_FileChannel_INCLUDED | |||
End of changes. 9 change blocks. | ||||
55 lines changed or deleted | 40 lines changed or added | |||
File_UNIX.h | File_UNIX.h | |||
---|---|---|---|---|
// | // | |||
// File_UNIX.h | // File_UNIX.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/File_UNIX.h#3 $ | // $Id: //poco/1.4/Foundation/include/Poco/File_UNIX.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Filesystem | // Package: Filesystem | |||
// Module: File | // Module: File | |||
// | // | |||
// Definition of the FileImpl class for Unix. | // Definition of the FileImpl class for Unix. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
File_WIN32.h | File_WIN32.h | |||
---|---|---|---|---|
// | // | |||
// File_WIN32.h | // File_WIN32.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/File_WIN32.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/File_WIN32.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Filesystem | // Package: Filesystem | |||
// Module: File | // Module: File | |||
// | // | |||
// Definition of the FileImpl class for WIN32. | // Definition of the FileImpl class for WIN32. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
File_WIN32U.h | File_WIN32U.h | |||
---|---|---|---|---|
// | // | |||
// File_WIN32U.h | // File_WIN32U.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/File_WIN32U.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/File_WIN32U.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Filesystem | // Package: Filesystem | |||
// Module: File | // Module: File | |||
// | // | |||
// Definition of the Unicode FileImpl class for WIN32. | // Definition of the Unicode FileImpl class for WIN32. | |||
// | // | |||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
Foundation.h | Foundation.h | |||
---|---|---|---|---|
// | // | |||
// Foundation.h | // Foundation.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Foundation.h#3 $ | // $Id: //poco/1.4/Foundation/include/Poco/Foundation.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: Foundation | // Module: Foundation | |||
// | // | |||
// Basic definitions for the POCO Foundation library. | // Basic definitions for the POCO Foundation library. | |||
// This file must be the first file included by every other Foundation | // This file must be the first file included by every other Foundation | |||
// header file. | // header file. | |||
// | // | |||
// Copyright (c) 2004-2010, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2010, Applied Informatics Software Engineering GmbH. | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
HMACEngine.h | HMACEngine.h | |||
---|---|---|---|---|
skipping to change at line 67 | skipping to change at line 67 | |||
{ | { | |||
public: | public: | |||
enum | enum | |||
{ | { | |||
BLOCK_SIZE = Engine::BLOCK_SIZE, | BLOCK_SIZE = Engine::BLOCK_SIZE, | |||
DIGEST_SIZE = Engine::DIGEST_SIZE | DIGEST_SIZE = Engine::DIGEST_SIZE | |||
}; | }; | |||
HMACEngine(const std::string& passphrase) | HMACEngine(const std::string& passphrase) | |||
{ | { | |||
init(passphrase.data(), (unsigned) passphrase.length()); | init(passphrase.data(), passphrase.length()); | |||
} | } | |||
HMACEngine(const char* passphrase, unsigned length) | HMACEngine(const char* passphrase, std::size_t length) | |||
{ | { | |||
poco_check_ptr (passphrase); | poco_check_ptr (passphrase); | |||
init(passphrase, length); | init(passphrase, length); | |||
} | } | |||
~HMACEngine() | ~HMACEngine() | |||
{ | { | |||
std::memset(_ipad, 0, BLOCK_SIZE); | std::memset(_ipad, 0, BLOCK_SIZE); | |||
std::memset(_opad, 0, BLOCK_SIZE); | std::memset(_opad, 0, BLOCK_SIZE); | |||
delete [] _ipad; | delete [] _ipad; | |||
delete [] _opad; | delete [] _opad; | |||
} | } | |||
unsigned digestLength() const | std::size_t digestLength() const | |||
{ | { | |||
return DIGEST_SIZE; | return DIGEST_SIZE; | |||
} | } | |||
void reset() | void reset() | |||
{ | { | |||
_engine.reset(); | _engine.reset(); | |||
_engine.update(_ipad, BLOCK_SIZE); | _engine.update(_ipad, BLOCK_SIZE); | |||
} | } | |||
skipping to change at line 112 | skipping to change at line 112 | |||
*pdb++ = *it; | *pdb++ = *it; | |||
_engine.reset(); | _engine.reset(); | |||
_engine.update(_opad, BLOCK_SIZE); | _engine.update(_opad, BLOCK_SIZE); | |||
_engine.update(db, DIGEST_SIZE); | _engine.update(db, DIGEST_SIZE); | |||
const DigestEngine::Digest& result = _engine.digest(); | const DigestEngine::Digest& result = _engine.digest(); | |||
reset(); | reset(); | |||
return result; | return result; | |||
} | } | |||
protected: | protected: | |||
void init(const char* passphrase, unsigned length) | void init(const char* passphrase, std::size_t length) | |||
{ | { | |||
_ipad = new char[BLOCK_SIZE]; | _ipad = new char[BLOCK_SIZE]; | |||
_opad = new char[BLOCK_SIZE]; | _opad = new char[BLOCK_SIZE]; | |||
std::memset(_ipad, 0, BLOCK_SIZE); | std::memset(_ipad, 0, BLOCK_SIZE); | |||
std::memset(_opad, 0, BLOCK_SIZE); | std::memset(_opad, 0, BLOCK_SIZE); | |||
if (length > BLOCK_SIZE) | if (length > BLOCK_SIZE) | |||
{ | { | |||
_engine.reset(); | _engine.reset(); | |||
_engine.update(passphrase, length); | _engine.update(passphrase, length); | |||
const DigestEngine::Digest& d = _engine.digest(); | const DigestEngine::Digest& d = _engine.digest(); | |||
skipping to change at line 145 | skipping to change at line 145 | |||
std::memcpy(_opad, passphrase, length); | std::memcpy(_opad, passphrase, length); | |||
} | } | |||
for (int i = 0; i < BLOCK_SIZE; ++i) | for (int i = 0; i < BLOCK_SIZE; ++i) | |||
{ | { | |||
_ipad[i] ^= 0x36; | _ipad[i] ^= 0x36; | |||
_opad[i] ^= 0x5c; | _opad[i] ^= 0x5c; | |||
} | } | |||
reset(); | reset(); | |||
} | } | |||
void updateImpl(const void* data, unsigned length) | void updateImpl(const void* data, std::size_t length) | |||
{ | { | |||
_engine.update(data, length); | _engine.update(data, length); | |||
} | } | |||
private: | private: | |||
HMACEngine(); | HMACEngine(); | |||
HMACEngine(const HMACEngine&); | HMACEngine(const HMACEngine&); | |||
HMACEngine& operator = (const HMACEngine&); | HMACEngine& operator = (const HMACEngine&); | |||
Engine _engine; | Engine _engine; | |||
End of changes. 5 change blocks. | ||||
5 lines changed or deleted | 5 lines changed or added | |||
HTTPClientSession.h | HTTPClientSession.h | |||
---|---|---|---|---|
// | // | |||
// HTTPClientSession.h | // HTTPClientSession.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/HTTPClientSession.h#5 $ | // $Id: //poco/1.4/Net/include/Poco/Net/HTTPClientSession.h#4 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: HTTPClient | // Package: HTTPClient | |||
// Module: HTTPClientSession | // Module: HTTPClientSession | |||
// | // | |||
// Definition of the HTTPClientSession class. | // Definition of the HTTPClientSession class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 44 | skipping to change at line 44 | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Net_HTTPClientSession_INCLUDED | #ifndef Net_HTTPClientSession_INCLUDED | |||
#define Net_HTTPClientSession_INCLUDED | #define Net_HTTPClientSession_INCLUDED | |||
#include "Poco/Net/Net.h" | #include "Poco/Net/Net.h" | |||
#include "Poco/Net/HTTPSession.h" | #include "Poco/Net/HTTPSession.h" | |||
#include "Poco/Net/SocketAddress.h" | #include "Poco/Net/SocketAddress.h" | |||
#include "Poco/SharedPtr.h" | ||||
#include <istream> | #include <istream> | |||
#include <ostream> | #include <ostream> | |||
namespace Poco { | namespace Poco { | |||
namespace Net { | namespace Net { | |||
class HTTPRequest; | class HTTPRequest; | |||
class HTTPResponse; | class HTTPResponse; | |||
class Net_API HTTPClientSession: public HTTPSession | class Net_API HTTPClientSession: public HTTPSession | |||
skipping to change at line 233 | skipping to change at line 232 | |||
void reconnect(); | void reconnect(); | |||
/// Connects the underlying socket to the HTTP server. | /// Connects the underlying socket to the HTTP server. | |||
int write(const char* buffer, std::streamsize length); | int write(const char* buffer, std::streamsize length); | |||
/// Tries to re-connect if keep-alive is on. | /// Tries to re-connect if keep-alive is on. | |||
virtual std::string proxyRequestPrefix() const; | virtual std::string proxyRequestPrefix() const; | |||
/// Returns the prefix prepended to the URI for proxy reques ts | /// Returns the prefix prepended to the URI for proxy reques ts | |||
/// (e.g., "http://myhost.com"). | /// (e.g., "http://myhost.com"). | |||
void deleteResponseStream(); | ||||
/// Deletes the response stream and sets it to 0. | ||||
void deleteRequestStream(); | ||||
/// Deletes the request stream and sets it to 0. | ||||
void setResponseStream(std::istream* pRespStream); | ||||
/// Sets the response stream iff _pResponseStream is 0. | ||||
void setRequestStream(std::ostream* pRequestStream); | ||||
/// Sets the request stream iff _pRequestStream is 0. | ||||
std::istream* getResponseStream() const; | ||||
/// Returns the currently set response stream. Can return 0. | ||||
std::ostream* getRequestStream() const; | ||||
/// Returns the currently set request stream. Can return 0. | ||||
void setReconnect(bool recon); | ||||
/// Sets _reconnect. | ||||
void setExpectResponseBody(bool expect); | ||||
/// Sets _expectResponseBody. | ||||
bool getExpectResponseBody() const; | ||||
/// Returns _expectResponseBody. | ||||
virtual bool mustReconnect() const; | virtual bool mustReconnect() const; | |||
/// Checks if we can reuse a persistent connection. | /// Checks if we can reuse a persistent connection. | |||
virtual void proxyAuthenticate(HTTPRequest& request); | virtual void proxyAuthenticate(HTTPRequest& request); | |||
/// Sets the proxy credentials (Proxy-Authorization header), if | /// Sets the proxy credentials (Proxy-Authorization header), if | |||
/// proxy username and password have been set. | /// proxy username and password have been set. | |||
void proxyAuthenticateImpl(HTTPRequest& request); | void proxyAuthenticateImpl(HTTPRequest& request); | |||
/// Sets the proxy credentials (Proxy-Authorization header), if | /// Sets the proxy credentials (Proxy-Authorization header), if | |||
/// proxy username and password have been set. | /// proxy username and password have been set. | |||
skipping to change at line 264 | skipping to change at line 290 | |||
Poco::UInt16 _port; | Poco::UInt16 _port; | |||
std::string _proxyHost; | std::string _proxyHost; | |||
Poco::UInt16 _proxyPort; | Poco::UInt16 _proxyPort; | |||
std::string _proxyUsername; | std::string _proxyUsername; | |||
std::string _proxyPassword; | std::string _proxyPassword; | |||
Poco::Timespan _keepAliveTimeout; | Poco::Timespan _keepAliveTimeout; | |||
Poco::Timestamp _lastRequest; | Poco::Timestamp _lastRequest; | |||
bool _reconnect; | bool _reconnect; | |||
bool _mustReconnect; | bool _mustReconnect; | |||
bool _expectResponseBody; | bool _expectResponseBody; | |||
Poco::SharedPtr<std::ostream> _pRequestStream; | std::ostream* _pRequestStream; | |||
Poco::SharedPtr<std::istream> _pResponseStream; | std::istream* _pResponseStream; | |||
HTTPClientSession(const HTTPClientSession&); | HTTPClientSession(const HTTPClientSession&); | |||
HTTPClientSession& operator = (const HTTPClientSession&); | HTTPClientSession& operator = (const HTTPClientSession&); | |||
friend class WebSocket; | friend class WebSocket; | |||
}; | }; | |||
// | // | |||
// inlines | // inlines | |||
// | // | |||
skipping to change at line 306 | skipping to change at line 332 | |||
inline const std::string& HTTPClientSession::getProxyUsername() const | inline const std::string& HTTPClientSession::getProxyUsername() const | |||
{ | { | |||
return _proxyUsername; | return _proxyUsername; | |||
} | } | |||
inline const std::string& HTTPClientSession::getProxyPassword() const | inline const std::string& HTTPClientSession::getProxyPassword() const | |||
{ | { | |||
return _proxyPassword; | return _proxyPassword; | |||
} | } | |||
inline std::istream* HTTPClientSession::getResponseStream() const | ||||
{ | ||||
return _pResponseStream; | ||||
} | ||||
inline std::ostream* HTTPClientSession::getRequestStream() const | ||||
{ | ||||
return _pRequestStream; | ||||
} | ||||
inline void HTTPClientSession::setReconnect(bool recon) | ||||
{ | ||||
_reconnect = recon; | ||||
} | ||||
inline void HTTPClientSession::setExpectResponseBody(bool expect) | ||||
{ | ||||
_expectResponseBody = expect; | ||||
} | ||||
inline bool HTTPClientSession::getExpectResponseBody() const | ||||
{ | ||||
return _expectResponseBody; | ||||
} | ||||
inline const Poco::Timespan& HTTPClientSession::getKeepAliveTimeout() const | inline const Poco::Timespan& HTTPClientSession::getKeepAliveTimeout() const | |||
{ | { | |||
return _keepAliveTimeout; | return _keepAliveTimeout; | |||
} | } | |||
} } // namespace Poco::Net | } } // namespace Poco::Net | |||
#endif // Net_HTTPClientSession_INCLUDED | #endif // Net_HTTPClientSession_INCLUDED | |||
End of changes. 5 change blocks. | ||||
4 lines changed or deleted | 55 lines changed or added | |||
HTTPCookie.h | HTTPCookie.h | |||
---|---|---|---|---|
// | // | |||
// HTTPCookie.h | // HTTPCookie.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/HTTPCookie.h#3 $ | // $Id: //poco/1.4/Net/include/Poco/Net/HTTPCookie.h#1 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: HTTP | // Package: HTTP | |||
// Module: HTTPCookie | // Module: HTTPCookie | |||
// | // | |||
// Definition of the HTTPCookie class. | // Definition of the HTTPCookie class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 138 | skipping to change at line 138 | |||
void setDomain(const std::string& domain); | void setDomain(const std::string& domain); | |||
/// Sets the domain for the cookie. | /// Sets the domain for the cookie. | |||
const std::string& getDomain() const; | const std::string& getDomain() const; | |||
/// Returns the domain for the cookie. | /// Returns the domain for the cookie. | |||
void setPath(const std::string& path); | void setPath(const std::string& path); | |||
/// Sets the path for the cookie. | /// Sets the path for the cookie. | |||
void setPriority(const std::string& priority); | ||||
/// Sets the priority for the cookie. | ||||
const std::string& getPath() const; | const std::string& getPath() const; | |||
/// Returns the path for the cookie. | /// Returns the path for the cookie. | |||
const std::string& getPriority() const; | ||||
/// Returns the priority for the cookie. | ||||
void setSecure(bool secure); | void setSecure(bool secure); | |||
/// Sets the value of the secure flag for | /// Sets the value of the secure flag for | |||
/// the cookie. | /// the cookie. | |||
bool getSecure() const; | bool getSecure() const; | |||
/// Returns the value of the secure flag | /// Returns the value of the secure flag | |||
/// for the cookie. | /// for the cookie. | |||
void setMaxAge(int maxAge); | void setMaxAge(int maxAge); | |||
/// Sets the maximum age in seconds for | /// Sets the maximum age in seconds for | |||
/// the cookie. | /// the cookie. | |||
/// | /// | |||
/// A value of -1 (default) causes the cookie | /// A value of -1 causes the cookie to | |||
/// to become a session cookie, which will | /// never expire on the client. | |||
/// be deleted when the browser window | ||||
/// is closed. | ||||
/// | /// | |||
/// A value of 0 deletes the cookie on | /// A value of 0 deletes the cookie on | |||
/// the client. | /// the client. | |||
int getMaxAge() const; | int getMaxAge() const; | |||
/// Returns the maximum age in seconds for | /// Returns the maximum age in seconds for | |||
/// the cookie. | /// the cookie. | |||
void setHttpOnly(bool flag = true); | void setHttpOnly(bool flag = true); | |||
/// Sets the HttpOnly flag for the cookie. | /// Sets the HttpOnly flag for the cookie. | |||
skipping to change at line 216 | skipping to change at line 208 | |||
/// escape sequences in the form %xx with the | /// escape sequences in the form %xx with the | |||
/// respective characters. | /// respective characters. | |||
private: | private: | |||
int _version; | int _version; | |||
std::string _name; | std::string _name; | |||
std::string _value; | std::string _value; | |||
std::string _comment; | std::string _comment; | |||
std::string _domain; | std::string _domain; | |||
std::string _path; | std::string _path; | |||
std::string _priority; | ||||
bool _secure; | bool _secure; | |||
int _maxAge; | int _maxAge; | |||
bool _httpOnly; | bool _httpOnly; | |||
}; | }; | |||
// | // | |||
// inlines | // inlines | |||
// | // | |||
inline int HTTPCookie::getVersion() const | inline int HTTPCookie::getVersion() const | |||
{ | { | |||
skipping to change at line 255 | skipping to change at line 246 | |||
inline const std::string& HTTPCookie::getDomain() const | inline const std::string& HTTPCookie::getDomain() const | |||
{ | { | |||
return _domain; | return _domain; | |||
} | } | |||
inline const std::string& HTTPCookie::getPath() const | inline const std::string& HTTPCookie::getPath() const | |||
{ | { | |||
return _path; | return _path; | |||
} | } | |||
inline const std::string& HTTPCookie::getPriority() const | ||||
{ | ||||
return _priority; | ||||
} | ||||
inline bool HTTPCookie::getSecure() const | inline bool HTTPCookie::getSecure() const | |||
{ | { | |||
return _secure; | return _secure; | |||
} | } | |||
inline int HTTPCookie::getMaxAge() const | inline int HTTPCookie::getMaxAge() const | |||
{ | { | |||
return _maxAge; | return _maxAge; | |||
} | } | |||
End of changes. 6 change blocks. | ||||
17 lines changed or deleted | 3 lines changed or added | |||
HTTPFixedLengthStream.h | HTTPFixedLengthStream.h | |||
---|---|---|---|---|
// | // | |||
// HTTPFixedLengthStream.h | // HTTPFixedLengthStream.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/HTTPFixedLengthStream.h#3 $ | // $Id: //poco/1.4/Net/include/Poco/Net/HTTPFixedLengthStream.h#1 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: HTTP | // Package: HTTP | |||
// Module: HTTPFixedLengthStream | // Module: HTTPFixedLengthStream | |||
// | // | |||
// Definition of the HTTPFixedLengthStream class. | // Definition of the HTTPFixedLengthStream class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
HTTPMessage.h | HTTPMessage.h | |||
---|---|---|---|---|
// | // | |||
// HTTPMessage.h | // HTTPMessage.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/HTTPMessage.h#4 $ | // $Id: //poco/1.4/Net/include/Poco/Net/HTTPMessage.h#3 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: HTTP | // Package: HTTP | |||
// Module: HTTPMessage | // Module: HTTPMessage | |||
// | // | |||
// Definition of the HTTPMessage class. | // Definition of the HTTPMessage class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
HTTPRequest.h | HTTPRequest.h | |||
---|---|---|---|---|
// | // | |||
// HTTPRequest.h | // HTTPRequest.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/HTTPRequest.h#3 $ | // $Id: //poco/1.4/Net/include/Poco/Net/HTTPRequest.h#2 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: HTTP | // Package: HTTP | |||
// Module: HTTPRequest | // Module: HTTPRequest | |||
// | // | |||
// Definition of the HTTPRequest class. | // Definition of the HTTPRequest class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 160 | skipping to change at line 160 | |||
static const std::string HTTP_POST; | static const std::string HTTP_POST; | |||
static const std::string HTTP_OPTIONS; | static const std::string HTTP_OPTIONS; | |||
static const std::string HTTP_DELETE; | static const std::string HTTP_DELETE; | |||
static const std::string HTTP_TRACE; | static const std::string HTTP_TRACE; | |||
static const std::string HTTP_CONNECT; | static const std::string HTTP_CONNECT; | |||
static const std::string HOST; | static const std::string HOST; | |||
static const std::string COOKIE; | static const std::string COOKIE; | |||
static const std::string AUTHORIZATION; | static const std::string AUTHORIZATION; | |||
static const std::string PROXY_AUTHORIZATION; | static const std::string PROXY_AUTHORIZATION; | |||
static const std::string UPGRADE; | ||||
protected: | protected: | |||
void getCredentials(const std::string& header, std::string& scheme, std::string& authInfo) const; | void getCredentials(const std::string& header, std::string& scheme, std::string& authInfo) const; | |||
/// Returns the authentication scheme and additional authent ication | /// Returns the authentication scheme and additional authent ication | |||
/// information contained in the given header of request. | /// information contained in the given header of request. | |||
/// | /// | |||
/// Throws a NotAuthenticatedException if no authentication information | /// Throws a NotAuthenticatedException if no authentication information | |||
/// is contained in the request. | /// is contained in the request. | |||
void setCredentials(const std::string& header, const std::string& sc heme, const std::string& authInfo); | void setCredentials(const std::string& header, const std::string& sc heme, const std::string& authInfo); | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 1 lines changed or added | |||
HTTPRequestHandlerFactory.h | HTTPRequestHandlerFactory.h | |||
---|---|---|---|---|
// | // | |||
// HTTPRequestHandlerFactory.h | // HTTPRequestHandlerFactory.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/HTTPRequestHandlerFactory.h#2 $ | // $Id: //poco/1.4/Net/include/Poco/Net/HTTPRequestHandlerFactory.h#1 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: HTTPServer | // Package: HTTPServer | |||
// Module: HTTPRequestHandlerFactory | // Module: HTTPRequestHandlerFactory | |||
// | // | |||
// Definition of the HTTPRequestHandlerFactory class. | // Definition of the HTTPRequestHandlerFactory class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
HTTPServer.h | HTTPServer.h | |||
---|---|---|---|---|
// | // | |||
// HTTPServer.h | // HTTPServer.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/HTTPServer.h#3 $ | // $Id: //poco/1.4/Net/include/Poco/Net/HTTPServer.h#1 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: HTTPServer | // Package: HTTPServer | |||
// Module: HTTPServer | // Module: HTTPServer | |||
// | // | |||
// Definition of the HTTPServer class. | // Definition of the HTTPServer class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 75 | skipping to change at line 75 | |||
/// Please see the TCPServer class for information about | /// Please see the TCPServer class for information about | |||
/// connection and thread handling. | /// connection and thread handling. | |||
/// | /// | |||
/// See RFC 2616 <http://www.faqs.org/rfcs/rfc2616.html> for more | /// See RFC 2616 <http://www.faqs.org/rfcs/rfc2616.html> for more | |||
/// information about the HTTP protocol. | /// information about the HTTP protocol. | |||
{ | { | |||
public: | public: | |||
HTTPServer(HTTPRequestHandlerFactory::Ptr pFactory, const ServerSock et& socket, HTTPServerParams::Ptr pParams); | HTTPServer(HTTPRequestHandlerFactory::Ptr pFactory, const ServerSock et& socket, HTTPServerParams::Ptr pParams); | |||
/// Creates the HTTPServer, using the given ServerSocket. | /// Creates the HTTPServer, using the given ServerSocket. | |||
/// | /// | |||
/// New threads are taken from the default thread pool. | /// The server takes ownership of the HTTPRequstHandlerFacto | |||
ry | ||||
/// and deletes it when it's no longer needed. | ||||
/// | ||||
/// The server also takes ownership of the HTTPServerParams | ||||
object. | ||||
/// | ||||
/// News threads are taken from the default thread pool. | ||||
HTTPServer(HTTPRequestHandlerFactory::Ptr pFactory, Poco::ThreadPool & threadPool, const ServerSocket& socket, HTTPServerParams::Ptr pParams); | HTTPServer(HTTPRequestHandlerFactory::Ptr pFactory, Poco::ThreadPool & threadPool, const ServerSocket& socket, HTTPServerParams::Ptr pParams); | |||
/// Creates the HTTPServer, using the given ServerSocket. | /// Creates the HTTPServer, using the given ServerSocket. | |||
/// | /// | |||
/// New threads are taken from the given thread pool. | /// The server takes ownership of the HTTPRequstHandlerFacto | |||
ry | ||||
/// and deletes it when it's no longer needed. | ||||
/// | ||||
/// The server also takes ownership of the HTTPServerParams | ||||
object. | ||||
/// | ||||
/// News threads are taken from the given thread pool. | ||||
~HTTPServer(); | ~HTTPServer(); | |||
/// Destroys the HTTPServer and its HTTPRequestHandlerFactor y. | /// Destroys the HTTPServer and its HTTPRequestHandlerFactor y. | |||
void stopAll(bool abortCurrent = false); | void stopAll(bool abortCurrent = false); | |||
/// Stops the server. In contrast to TCPServer::stop(), whic h also | /// Stops the server. In contrast to TCPServer::stop(), whic h also | |||
/// stops the server, but allows all client connections to f inish at | /// stops the server, but allows all client connections to f inish at | |||
/// their pace, this allows finer control over client connec tions. | /// their pace, this allows finer control over client connec tions. | |||
/// | /// | |||
/// If abortCurrent is false, all current requests are allow ed to | /// If abortCurrent is false, all current requests are allow ed to | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 17 lines changed or added | |||
HTTPServerConnection.h | HTTPServerConnection.h | |||
---|---|---|---|---|
// | // | |||
// HTTPServerConnection.h | // HTTPServerConnection.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/HTTPServerConnection.h#2 $ | // $Id: //poco/1.4/Net/include/Poco/Net/HTTPServerConnection.h#1 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: HTTPServer | // Package: HTTPServer | |||
// Module: HTTPServerConnection | // Module: HTTPServerConnection | |||
// | // | |||
// Definition of the HTTPServerConnection class. | // Definition of the HTTPServerConnection class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
HTTPServerRequestImpl.h | HTTPServerRequestImpl.h | |||
---|---|---|---|---|
// | // | |||
// HTTPServerRequestImpl.h | // HTTPServerRequestImpl.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/HTTPServerRequestImpl.h#2 $ | // $Id: //poco/1.4/Net/include/Poco/Net/HTTPServerRequestImpl.h#1 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: HTTPServer | // Package: HTTPServer | |||
// Module: HTTPServerRequestImpl | // Module: HTTPServerRequestImpl | |||
// | // | |||
// Definition of the HTTPServerRequestImpl class. | // Definition of the HTTPServerRequestImpl class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
HTTPServerResponseImpl.h | HTTPServerResponseImpl.h | |||
---|---|---|---|---|
// | // | |||
// HTTPServerResponseImpl.h | // HTTPServerResponseImpl.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/HTTPServerResponseImpl.h#2 $ | // $Id: //poco/1.4/Net/include/Poco/Net/HTTPServerResponseImpl.h#1 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: HTTPServer | // Package: HTTPServer | |||
// Module: HTTPServerResponseImpl | // Module: HTTPServerResponseImpl | |||
// | // | |||
// Definition of the HTTPServerResponseImpl class. | // Definition of the HTTPServerResponseImpl class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
HTTPSession.h | HTTPSession.h | |||
---|---|---|---|---|
// | // | |||
// HTTPSession.h | // HTTPSession.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/HTTPSession.h#3 $ | // $Id: //poco/1.4/Net/include/Poco/Net/HTTPSession.h#2 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: HTTP | // Package: HTTP | |||
// Module: HTTPSession | // Module: HTTPSession | |||
// | // | |||
// Definition of the HTTPSession class. | // Definition of the HTTPSession class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 184 | skipping to change at line 184 | |||
void attachSocket(const StreamSocket& socket); | void attachSocket(const StreamSocket& socket); | |||
/// Attaches a socket to the session, replacing the | /// Attaches a socket to the session, replacing the | |||
/// previously attached socket. | /// previously attached socket. | |||
void close(); | void close(); | |||
/// Closes the underlying socket. | /// Closes the underlying socket. | |||
void setException(const Poco::Exception& exc); | void setException(const Poco::Exception& exc); | |||
/// Stores a clone of the exception. | /// Stores a clone of the exception. | |||
void clearException(); | ||||
/// Clears the stored exception. | ||||
private: | private: | |||
enum | enum | |||
{ | { | |||
HTTP_DEFAULT_TIMEOUT = 60000000 | HTTP_DEFAULT_TIMEOUT = 60000000 | |||
}; | }; | |||
HTTPSession(const HTTPSession&); | HTTPSession(const HTTPSession&); | |||
HTTPSession& operator = (const HTTPSession&); | HTTPSession& operator = (const HTTPSession&); | |||
StreamSocket _socket; | StreamSocket _socket; | |||
End of changes. 2 change blocks. | ||||
4 lines changed or deleted | 1 lines changed or added | |||
HashMap.h | HashMap.h | |||
---|---|---|---|---|
// | // | |||
// HashMap.h | // HashMap.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/HashMap.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/HashMap.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Hashing | // Package: Hashing | |||
// Module: HashMap | // Module: HashMap | |||
// | // | |||
// Definition of the HashMap class. | // Definition of the HashMap class. | |||
// | // | |||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 177 | skipping to change at line 177 | |||
ValueType value(key); | ValueType value(key); | |||
return _table.find(value); | return _table.find(value); | |||
} | } | |||
Iterator find(const KeyType& key) | Iterator find(const KeyType& key) | |||
{ | { | |||
ValueType value(key); | ValueType value(key); | |||
return _table.find(value); | return _table.find(value); | |||
} | } | |||
std::size_t count(const KeyType& key) const | ||||
{ | ||||
ValueType value(key); | ||||
return _table.find(value) != _table.end() ? 1 : 0; | ||||
} | ||||
std::pair<Iterator, bool> insert(const PairType& pair) | std::pair<Iterator, bool> insert(const PairType& pair) | |||
{ | { | |||
ValueType value(pair.first, pair.second); | ValueType value(pair.first, pair.second); | |||
return _table.insert(value); | return _table.insert(value); | |||
} | } | |||
std::pair<Iterator, bool> insert(const ValueType& value) | std::pair<Iterator, bool> insert(const ValueType& value) | |||
{ | { | |||
return _table.insert(value); | return _table.insert(value); | |||
} | } | |||
End of changes. 2 change blocks. | ||||
7 lines changed or deleted | 1 lines changed or added | |||
HashTable.h | HashTable.h | |||
---|---|---|---|---|
// | // | |||
// HashTable.h | // HashTable.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/HashTable.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/HashTable.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Hashing | // Package: Hashing | |||
// Module: HashTable | // Module: HashTable | |||
// | // | |||
// Definition of the HashTable class. | // Definition of the HashTable class. | |||
// | // | |||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 347 | skipping to change at line 347 | |||
} | } | |||
} | } | |||
HashStatistic currentState(bool details = false) const | HashStatistic currentState(bool details = false) const | |||
/// Returns the current internal state | /// Returns the current internal state | |||
{ | { | |||
UInt32 numberOfEntries = (UInt32)_size; | UInt32 numberOfEntries = (UInt32)_size; | |||
UInt32 numZeroEntries = 0; | UInt32 numZeroEntries = 0; | |||
UInt32 maxEntriesPerHash = 0; | UInt32 maxEntriesPerHash = 0; | |||
std::vector<UInt32> detailedEntriesPerHash; | std::vector<UInt32> detailedEntriesPerHash; | |||
#ifdef _DEBUG | #ifdef DEBUG | |||
UInt32 totalSize = 0; | UInt32 totalSize = 0; | |||
#endif | #endif | |||
for (UInt32 i = 0; i < _maxCapacity; ++i) | for (UInt32 i = 0; i < _maxCapacity; ++i) | |||
{ | { | |||
if (_entries[i]) | if (_entries[i]) | |||
{ | { | |||
UInt32 size = (UInt32)_entries[i]->size(); | UInt32 size = (UInt32)_entries[i]->size(); | |||
poco_assert_dbg(size != 0); | poco_assert_dbg(size != 0); | |||
if (size > maxEntriesPerHash) | if (size > maxEntriesPerHash) | |||
maxEntriesPerHash = size; | maxEntriesPerHash = size; | |||
if (details) | if (details) | |||
detailedEntriesPerHash.push_back(siz e); | detailedEntriesPerHash.push_back(siz e); | |||
#ifdef _DEBUG | #ifdef DEBUG | |||
totalSize += size; | totalSize += size; | |||
#endif | #endif | |||
} | } | |||
else | else | |||
{ | { | |||
numZeroEntries++; | numZeroEntries++; | |||
if (details) | if (details) | |||
detailedEntriesPerHash.push_back(0); | detailedEntriesPerHash.push_back(0); | |||
} | } | |||
} | } | |||
#ifdef _DEBUG | #ifdef DEBUG | |||
poco_assert_dbg(totalSize == numberOfEntries); | poco_assert_dbg(totalSize == numberOfEntries); | |||
#endif | #endif | |||
return HashStatistic(_maxCapacity, numberOfEntries, numZeroE ntries, maxEntriesPerHash, detailedEntriesPerHash); | return HashStatistic(_maxCapacity, numberOfEntries, numZeroE ntries, maxEntriesPerHash, detailedEntriesPerHash); | |||
} | } | |||
private: | private: | |||
HashTableVector _entries; | HashTableVector _entries; | |||
std::size_t _size; | std::size_t _size; | |||
UInt32 _maxCapacity; | UInt32 _maxCapacity; | |||
KeyHashFunction _hash; | KeyHashFunction _hash; | |||
End of changes. 4 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added | |||
ICMPv4PacketImpl.h | ICMPv4PacketImpl.h | |||
---|---|---|---|---|
skipping to change at line 44 | skipping to change at line 44 | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Net_ICMPv4PacketImpl_INCLUDED | #ifndef Net_ICMPv4PacketImpl_INCLUDED | |||
#define Net_ICMPv4PacketImpl_INCLUDED | #define Net_ICMPv4PacketImpl_INCLUDED | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
#include "Poco/Net/Socket.h" | #include "Poco/Net/Socket.h" | |||
#include "Poco/Net/ICMPPacketImpl.h" | #include "Poco/Net/ICMPPacketImpl.h" | |||
#include <cstddef> | ||||
namespace Poco { | namespace Poco { | |||
namespace Net { | namespace Net { | |||
class Net_API ICMPv4PacketImpl : public ICMPPacketImpl | class Net_API ICMPv4PacketImpl : public ICMPPacketImpl | |||
/// This class implements the ICMPv4 packet. | /// This class implements the ICMPv4 packet. | |||
/// Parts are based on original ICMP code by | /// Parts are based on original ICMP code by | |||
/// Mike Muuss | /// Mike Muuss | |||
/// U. S. Army Ballistic Research Laboratory | /// U. S. Army Ballistic Research Laboratory | |||
/// December, 1983 | /// December, 1983 | |||
skipping to change at line 66 | skipping to change at line 67 | |||
// ICMPv4 header | // ICMPv4 header | |||
struct Header | struct Header | |||
{ | { | |||
Poco::UInt8 type; // ICMP packet type | Poco::UInt8 type; // ICMP packet type | |||
Poco::UInt8 code; // Type sub code | Poco::UInt8 code; // Type sub code | |||
Poco::UInt16 checksum; | Poco::UInt16 checksum; | |||
Poco::UInt16 id; | Poco::UInt16 id; | |||
Poco::UInt16 seq; | Poco::UInt16 seq; | |||
}; | }; | |||
// compile-time shield against misalignment | ||||
poco_static_assert (offsetof(Header, code) == 0x01); | ||||
poco_static_assert (offsetof(Header, checksum) == 0x02); | ||||
poco_static_assert (offsetof(Header, id) == 0x04); | ||||
poco_static_assert (offsetof(Header, seq) == 0x06); | ||||
enum MessageType | enum MessageType | |||
{ | { | |||
ECHO_REPLY, | ECHO_REPLY, | |||
ICMP_1, | ICMP_1, | |||
ICMP_2, | ICMP_2, | |||
DESTINATION_UNREACHABLE, | DESTINATION_UNREACHABLE, | |||
SOURCE_QUENCH, | SOURCE_QUENCH, | |||
REDIRECT, | REDIRECT, | |||
ICMP_6, | ICMP_6, | |||
ICMP_7, | ICMP_7, | |||
End of changes. 2 change blocks. | ||||
0 lines changed or deleted | 7 lines changed or added | |||
IPAddress.h | IPAddress.h | |||
---|---|---|---|---|
skipping to change at line 43 | skipping to change at line 43 | |||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Net_IPAddress_INCLUDED | #ifndef Net_IPAddress_INCLUDED | |||
#define Net_IPAddress_INCLUDED | #define Net_IPAddress_INCLUDED | |||
#include "Poco/Net/Net.h" | #include "Poco/Net/Net.h" | |||
#include "Poco/Net/SocketDefs.h" | #include "Poco/Net/SocketDefs.h" | |||
#include <vector> | ||||
namespace Poco { | namespace Poco { | |||
class BinaryReader; | ||||
class BinaryWriter; | ||||
namespace Net { | namespace Net { | |||
class IPAddressImpl; | class IPAddressImpl; | |||
class Net_API IPAddress | class Net_API IPAddress | |||
/// This class represents an internet (IP) host | /// This class represents an internet (IP) host | |||
/// address. The address can belong either to the | /// address. The address can belong either to the | |||
/// IPv4 or the IPv6 address family. | /// IPv4 or the IPv6 address family. | |||
/// | /// | |||
/// Relational operators (==, !=, <, <=, >, >=) are | /// Relational operators (==, !=, <, <=, >, >=) are | |||
skipping to change at line 68 | skipping to change at line 73 | |||
/// consistent. | /// consistent. | |||
/// | /// | |||
/// Especially, an IPv4 address is never equal to | /// Especially, an IPv4 address is never equal to | |||
/// an IPv6 address, even if the IPv6 address is | /// an IPv6 address, even if the IPv6 address is | |||
/// IPv4 compatible and the addresses are the same. | /// IPv4 compatible and the addresses are the same. | |||
/// | /// | |||
/// IPv6 addresses are supported only if the target platform | /// IPv6 addresses are supported only if the target platform | |||
/// supports IPv6. | /// supports IPv6. | |||
{ | { | |||
public: | public: | |||
typedef std::vector<IPAddress> List; | ||||
enum Family | enum Family | |||
/// Possible address families for IP addresses. | /// Possible address families for IP addresses. | |||
{ | { | |||
IPv4, | IPv4 | |||
IPv6 | #ifdef POCO_HAVE_IPv6 | |||
,IPv6 | ||||
#endif | ||||
}; | }; | |||
IPAddress(); | IPAddress(); | |||
/// Creates a wildcard (zero) IPv4 IPAddress. | /// Creates a wildcard (zero) IPv4 IPAddress. | |||
IPAddress(const IPAddress& addr); | IPAddress(const IPAddress& addr); | |||
/// Creates an IPAddress by copying another one. | /// Creates an IPAddress by copying another one. | |||
explicit IPAddress(Family family); | explicit IPAddress(Family family); | |||
/// Creates a wildcard (zero) IPAddress for the | /// Creates a wildcard (zero) IPAddress for the | |||
skipping to change at line 114 | skipping to change at line 123 | |||
/// A pointer to a in_addr or a in6_addr structure may be | /// A pointer to a in_addr or a in6_addr structure may be | |||
/// passed. | /// passed. | |||
IPAddress(const void* addr, poco_socklen_t length, Poco::UInt32 scop e); | IPAddress(const void* addr, poco_socklen_t length, Poco::UInt32 scop e); | |||
/// Creates an IPAddress from a native internet address. | /// Creates an IPAddress from a native internet address. | |||
/// A pointer to a in_addr or a in6_addr structure may be | /// A pointer to a in_addr or a in6_addr structure may be | |||
/// passed. Additionally, for an IPv6 address, a scope ID | /// passed. Additionally, for an IPv6 address, a scope ID | |||
/// may be specified. The scope ID will be ignored if an IPv 4 | /// may be specified. The scope ID will be ignored if an IPv 4 | |||
/// address is specified. | /// address is specified. | |||
IPAddress(unsigned prefix, Family family); | ||||
/// Creates an IPAddress mask with the given length | ||||
of prefix. | ||||
#if defined(_WIN32) | ||||
IPAddress(const SOCKET_ADDRESS& socket_address); | ||||
/// Creates an IPAddress from Windows SOCKET_ADDRESS | ||||
structure. | ||||
#endif | ||||
IPAddress(const struct sockaddr& sockaddr); | ||||
/// Same for struct sock_addr on POSIX. | ||||
~IPAddress(); | ~IPAddress(); | |||
/// Destroys the IPAddress. | /// Destroys the IPAddress. | |||
IPAddress& operator = (const IPAddress& addr); | IPAddress& operator = (const IPAddress& addr); | |||
/// Assigns an IPAddress. | /// Assigns an IPAddress. | |||
void swap(IPAddress& address); | void swap(IPAddress& address); | |||
/// Swaps the IPAddress with another one. | /// Swaps the IPAddress with another one. | |||
Family family() const; | Family family() const; | |||
skipping to change at line 175 | skipping to change at line 195 | |||
bool isWildcard() const; | bool isWildcard() const; | |||
/// Returns true iff the address is a wildcard (all zero) | /// Returns true iff the address is a wildcard (all zero) | |||
/// address. | /// address. | |||
bool isBroadcast() const; | bool isBroadcast() const; | |||
/// Returns true iff the address is a broadcast address. | /// Returns true iff the address is a broadcast address. | |||
/// | /// | |||
/// Only IPv4 addresses can be broadcast addresses. In a bro adcast | /// Only IPv4 addresses can be broadcast addresses. In a bro adcast | |||
/// address, all bits are one. | /// address, all bits are one. | |||
/// | /// | |||
/// For a IPv6 address, returns always false. | /// For an IPv6 address, returns always false. | |||
bool isLoopback() const; | bool isLoopback() const; | |||
/// Returns true iff the address is a loopback address. | /// Returns true iff the address is a loopback address. | |||
/// | /// | |||
/// For IPv4, the loopback address is 127.0.0.1. | /// For IPv4, the loopback address is 127.0.0.1. | |||
/// | /// | |||
/// For IPv6, the loopback address is ::1. | /// For IPv6, the loopback address is ::1. | |||
bool isMulticast() const; | bool isMulticast() const; | |||
/// Returns true iff the address is a multicast address. | /// Returns true iff the address is a multicast address. | |||
skipping to change at line 215 | skipping to change at line 235 | |||
/// | /// | |||
/// IPv6 link local addresses have 1111 1110 10 as the first | /// IPv6 link local addresses have 1111 1110 10 as the first | |||
/// 10 bits, followed by 54 zeros. | /// 10 bits, followed by 54 zeros. | |||
bool isSiteLocal() const; | bool isSiteLocal() const; | |||
/// Returns true iff the address is a site local unicast add ress. | /// Returns true iff the address is a site local unicast add ress. | |||
/// | /// | |||
/// IPv4 site local addresses are in on of the 10.0.0.0/24, | /// IPv4 site local addresses are in on of the 10.0.0.0/24, | |||
/// 192.168.0.0/16 or 172.16.0.0 to 172.31.255.255 ranges. | /// 192.168.0.0/16 or 172.16.0.0 to 172.31.255.255 ranges. | |||
/// | /// | |||
/// IPv6 site local addresses have 1111 1110 11 as the first | /// Originally, IPv6 site-local addresses had FEC0/10 (1111 | |||
/// 10 bits, followed by 38 zeros. | 1110 11) | |||
/// prefix (RFC 4291), followed by 38 zeros. Interfaces usin | ||||
g | ||||
/// this mask are supported, but obsolete; RFC 4193 prescrib | ||||
es | ||||
/// fc00::/7 (1111 110) as local unicast prefix. | ||||
bool isIPv4Compatible() const; | bool isIPv4Compatible() const; | |||
/// Returns true iff the address is IPv4 compatible. | /// Returns true iff the address is IPv4 compatible. | |||
/// | /// | |||
/// For IPv4 addresses, this is always true. | /// For IPv4 addresses, this is always true. | |||
/// | /// | |||
/// For IPv6, the address must be in the ::x:x range (the | /// For IPv6, the address must be in the ::x:x range (the | |||
/// first 96 bits are zero). | /// first 96 bits are zero). | |||
bool isIPv4Mapped() const; | bool isIPv4Mapped() const; | |||
skipping to change at line 294 | skipping to change at line 316 | |||
/// | /// | |||
/// For IPv6, global multicast addresses are in the | /// For IPv6, global multicast addresses are in the | |||
/// FFxF:x:x:x:x:x:x:x range. | /// FFxF:x:x:x:x:x:x:x range. | |||
bool operator == (const IPAddress& addr) const; | bool operator == (const IPAddress& addr) const; | |||
bool operator != (const IPAddress& addr) const; | bool operator != (const IPAddress& addr) const; | |||
bool operator < (const IPAddress& addr) const; | bool operator < (const IPAddress& addr) const; | |||
bool operator <= (const IPAddress& addr) const; | bool operator <= (const IPAddress& addr) const; | |||
bool operator > (const IPAddress& addr) const; | bool operator > (const IPAddress& addr) const; | |||
bool operator >= (const IPAddress& addr) const; | bool operator >= (const IPAddress& addr) const; | |||
IPAddress operator & (const IPAddress& addr) const; | ||||
IPAddress operator | (const IPAddress& addr) const; | ||||
IPAddress operator ^ (const IPAddress& addr) const; | ||||
IPAddress operator ~ () const; | ||||
poco_socklen_t length() const; | poco_socklen_t length() const; | |||
/// Returns the length in bytes of the internal socket addre ss structure. | /// Returns the length in bytes of the internal socket addre ss structure. | |||
const void* addr() const; | const void* addr() const; | |||
/// Returns the internal address structure. | /// Returns the internal address structure. | |||
int af() const; | int af() const; | |||
/// Returns the address family (AF_INET or AF_INET6) of the address. | /// Returns the address family (AF_INET or AF_INET6) of the address. | |||
unsigned prefixLength() const; | ||||
/// Returns the prefix length. | ||||
void mask(const IPAddress& mask); | void mask(const IPAddress& mask); | |||
/// Masks the IP address using the given netmask, which is u sually | /// Masks the IP address using the given netmask, which is u sually | |||
/// a IPv4 subnet mask. Only supported for IPv4 addresses. | /// a IPv4 subnet mask. Only supported for IPv4 addresses. | |||
/// | /// | |||
/// The new address is (address & mask). | /// The new address is (address & mask). | |||
void mask(const IPAddress& mask, const IPAddress& set); | void mask(const IPAddress& mask, const IPAddress& set); | |||
/// Masks the IP address using the given netmask, which is u sually | /// Masks the IP address using the given netmask, which is u sually | |||
/// a IPv4 subnet mask. Only supported for IPv4 addresses. | /// a IPv4 subnet mask. Only supported for IPv4 addresses. | |||
/// | /// | |||
skipping to change at line 370 | skipping to change at line 399 | |||
}; | }; | |||
// | // | |||
// inlines | // inlines | |||
// | // | |||
inline void swap(IPAddress& addr1, IPAddress& addr2) | inline void swap(IPAddress& addr1, IPAddress& addr2) | |||
{ | { | |||
addr1.swap(addr2); | addr1.swap(addr2); | |||
} | } | |||
BinaryWriter& operator << (BinaryWriter& writer, const IPAddress& value); | ||||
BinaryReader& operator >> (BinaryReader& reader, IPAddress& value); | ||||
} } // namespace Poco::Net | } } // namespace Poco::Net | |||
#endif // Net_IPAddress_INCLUDED | #endif // Net_IPAddress_INCLUDED | |||
End of changes. 10 change blocks. | ||||
5 lines changed or deleted | 42 lines changed or added | |||
Latin2Encoding.h | Latin2Encoding.h | |||
---|---|---|---|---|
// | // | |||
// Latin2Encoding.h | // Latin2Encoding.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Latin2Encoding.h#1 $ | // $Id: //poco/svn/Foundation/include/Poco/Latin2Encoding.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Text | // Package: Text | |||
// Module: Latin2Encoding | // Module: Latin2Encoding | |||
// | // | |||
// Definition of the Latin2Encoding class. | // Definition of the Latin2Encoding class. | |||
// | // | |||
// Copyright (c) 2004-2007, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2007, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
LinearHashTable.h | LinearHashTable.h | |||
---|---|---|---|---|
skipping to change at line 91 | skipping to change at line 91 | |||
typedef const Value* ConstPointer; | typedef const Value* ConstPointer; | |||
typedef HashFunc Hash; | typedef HashFunc Hash; | |||
typedef std::vector<Value> Bucket; | typedef std::vector<Value> Bucket; | |||
typedef std::vector<Bucket> BucketVec; | typedef std::vector<Bucket> BucketVec; | |||
typedef typename Bucket::iterator BucketIterator; | typedef typename Bucket::iterator BucketIterator; | |||
typedef typename BucketVec::iterator BucketVecIterator; | typedef typename BucketVec::iterator BucketVecIterator; | |||
class ConstIterator: public std::iterator<std::forward_iterator_tag, Value> | class ConstIterator: public std::iterator<std::forward_iterator_tag, Value> | |||
{ | { | |||
public: | public: | |||
ConstIterator() | ConstIterator(): _initialized(false) | |||
{ | { | |||
} | } | |||
ConstIterator(const BucketVecIterator& vecIt, const BucketVe cIterator& endIt, const BucketIterator& buckIt): | ConstIterator(const BucketVecIterator& vecIt, const BucketVe cIterator& endIt, const BucketIterator& buckIt): | |||
_vecIt(vecIt), | _vecIt(vecIt), | |||
_endIt(endIt), | _endIt(endIt), | |||
_buckIt(buckIt) | _buckIt(buckIt), | |||
_initialized(true) | ||||
{ | { | |||
} | } | |||
ConstIterator(const ConstIterator& it): | ConstIterator(const ConstIterator& it): | |||
_vecIt(it._vecIt), | _vecIt(it._vecIt), | |||
_endIt(it._endIt), | _endIt(it._endIt), | |||
_buckIt(it._buckIt) | _buckIt(it._buckIt), | |||
_initialized(it._initialized) | ||||
{ | { | |||
} | } | |||
ConstIterator& operator = (const ConstIterator& it) | ConstIterator& operator = (const ConstIterator& it) | |||
{ | { | |||
ConstIterator tmp(it); | ConstIterator tmp(it); | |||
swap(tmp); | swap(tmp); | |||
return *this; | return *this; | |||
} | } | |||
void swap(ConstIterator& it) | void swap(ConstIterator& it) | |||
{ | { | |||
using std::swap; | using std::swap; | |||
swap(_vecIt, it._vecIt); | // uninitialized iterators crash when swapped | |||
swap(_endIt, it._endIt); | if (_initialized) | |||
swap(_buckIt, it._buckIt); | { | |||
swap(_vecIt, it._vecIt); | ||||
swap(_endIt, it._endIt); | ||||
swap(_buckIt, it._buckIt); | ||||
swap(_initialized, it._initialized); | ||||
} | ||||
else | ||||
{ | ||||
_vecIt = it._vecIt; | ||||
_endIt = it._endIt; | ||||
_buckIt = it._buckIt; | ||||
_initialized = it._initialized; | ||||
} | ||||
} | } | |||
bool operator == (const ConstIterator& it) const | bool operator == (const ConstIterator& it) const | |||
{ | { | |||
return _vecIt == it._vecIt && (_vecIt == _endIt || _ buckIt == it._buckIt); | return _vecIt == it._vecIt && (_vecIt == _endIt || _ buckIt == it._buckIt); | |||
} | } | |||
bool operator != (const ConstIterator& it) const | bool operator != (const ConstIterator& it) const | |||
{ | { | |||
return _vecIt != it._vecIt || (_vecIt != _endIt && _ buckIt != it._buckIt); | return _vecIt != it._vecIt || (_vecIt != _endIt && _ buckIt != it._buckIt); | |||
skipping to change at line 169 | skipping to change at line 184 | |||
{ | { | |||
ConstIterator tmp(*this); | ConstIterator tmp(*this); | |||
++*this; | ++*this; | |||
return tmp; | return tmp; | |||
} | } | |||
protected: | protected: | |||
BucketVecIterator _vecIt; | BucketVecIterator _vecIt; | |||
BucketVecIterator _endIt; | BucketVecIterator _endIt; | |||
BucketIterator _buckIt; | BucketIterator _buckIt; | |||
bool _initialized; | ||||
friend class LinearHashTable; | friend class LinearHashTable; | |||
}; | }; | |||
class Iterator: public ConstIterator | class Iterator: public ConstIterator | |||
{ | { | |||
public: | public: | |||
Iterator() | Iterator() | |||
{ | { | |||
} | } | |||
skipping to change at line 193 | skipping to change at line 209 | |||
} | } | |||
Iterator(const Iterator& it): | Iterator(const Iterator& it): | |||
ConstIterator(it) | ConstIterator(it) | |||
{ | { | |||
} | } | |||
Iterator& operator = (const Iterator& it) | Iterator& operator = (const Iterator& it) | |||
{ | { | |||
Iterator tmp(it); | Iterator tmp(it); | |||
swap(tmp); | ConstIterator::swap(tmp); | |||
return *this; | return *this; | |||
} | } | |||
void swap(Iterator& it) | void swap(Iterator& it) | |||
{ | { | |||
ConstIterator::swap(it); | ConstIterator::swap(it); | |||
} | } | |||
typename Bucket::value_type& operator * () | typename Bucket::value_type& operator * () | |||
{ | { | |||
End of changes. 6 change blocks. | ||||
7 lines changed or deleted | 23 lines changed or added | |||
LogFile.h | LogFile.h | |||
---|---|---|---|---|
// | // | |||
// LogFile.h | // LogFile.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/LogFile.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/LogFile.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Logging | // Package: Logging | |||
// Module: LogFile | // Module: LogFile | |||
// | // | |||
// Definition of the LogFile class. | // Definition of the LogFile class. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
LogFile_STD.h | LogFile_STD.h | |||
---|---|---|---|---|
// | // | |||
// LogFile_STD.h | // LogFile_STD.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/LogFile_STD.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/LogFile_STD.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Logging | // Package: Logging | |||
// Module: LogFile | // Module: LogFile | |||
// | // | |||
// Definition of the LogFileImpl class using iostreams. | // Definition of the LogFileImpl class using iostreams. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
LogFile_VMS.h | LogFile_VMS.h | |||
---|---|---|---|---|
// | // | |||
// LogFile_VMS.h | // LogFile_VMS.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/LogFile_VMS.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/LogFile_VMS.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Logging | // Package: Logging | |||
// Module: LogFile | // Module: LogFile | |||
// | // | |||
// Definition of the LogFileImpl class using C I/O with OpenVMS extensions. | // Definition of the LogFileImpl class using C I/O with OpenVMS extensions. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
LogFile_WIN32.h | LogFile_WIN32.h | |||
---|---|---|---|---|
// | // | |||
// LogFile_WIN32.h | // LogFile_WIN32.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/LogFile_WIN32.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/LogFile_WIN32.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Logging | // Package: Logging | |||
// Module: LogFile | // Module: LogFile | |||
// | // | |||
// Definition of the LogFileImpl class using the Windows file APIs. | // Definition of the LogFileImpl class using the Windows file APIs. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
LogFile_WIN32U.h | LogFile_WIN32U.h | |||
---|---|---|---|---|
// | // | |||
// LogFile_WIN32U.h | // LogFile_WIN32U.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/LogFile_WIN32U.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/LogFile_WIN32U.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Logging | // Package: Logging | |||
// Module: LogFile | // Module: LogFile | |||
// | // | |||
// Definition of the LogFileImpl class using the Windows file APIs. | // Definition of the LogFileImpl class using the Windows file APIs. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
Logger.h | Logger.h | |||
---|---|---|---|---|
skipping to change at line 170 | skipping to change at line 170 | |||
void fatal(const std::string& msg, const char* file, int line); | void fatal(const std::string& msg, const char* file, int line); | |||
/// If the Logger's log level is at least PRIO_FATAL, | /// If the Logger's log level is at least PRIO_FATAL, | |||
/// creates a Message with priority PRIO_FATAL | /// creates a Message with priority PRIO_FATAL | |||
/// and the given message text and sends it | /// and the given message text and sends it | |||
/// to the attached channel. | /// to the attached channel. | |||
/// | /// | |||
/// File must be a static string, such as the value of | /// File must be a static string, such as the value of | |||
/// the __FILE__ macro. The string is not copied | /// the __FILE__ macro. The string is not copied | |||
/// internally for performance reasons. | /// internally for performance reasons. | |||
void fatal(const std::string& fmt, const Any& value1); | ||||
void fatal(const std::string& fmt, const Any& value1, const Any& val | ||||
ue2); | ||||
void fatal(const std::string& fmt, const Any& value1, const Any& val | ||||
ue2, const Any& value3); | ||||
void fatal(const std::string& fmt, const Any& value1, const Any& val | ||||
ue2, const Any& value3, const Any& value4); | ||||
void fatal(const std::string& fmt, const Any& value1, const Any& val | ||||
ue2, const Any& value3, const Any& value4, const Any& value5); | ||||
void fatal(const std::string& fmt, const Any& value1, const Any& val | ||||
ue2, const Any& value3, const Any& value4, const Any& value5, const Any& va | ||||
lue6); | ||||
void critical(const std::string& msg); | void critical(const std::string& msg); | |||
/// If the Logger's log level is at least PRIO_CRITICAL, | /// If the Logger's log level is at least PRIO_CRITICAL, | |||
/// creates a Message with priority PRIO_CRITICAL | /// creates a Message with priority PRIO_CRITICAL | |||
/// and the given message text and sends it | /// and the given message text and sends it | |||
/// to the attached channel. | /// to the attached channel. | |||
void critical(const std::string& msg, const char* file, int line); | void critical(const std::string& msg, const char* file, int line); | |||
/// If the Logger's log level is at least PRIO_CRITICAL, | /// If the Logger's log level is at least PRIO_CRITICAL, | |||
/// creates a Message with priority PRIO_CRITICAL | /// creates a Message with priority PRIO_CRITICAL | |||
/// and the given message text and sends it | /// and the given message text and sends it | |||
/// to the attached channel. | /// to the attached channel. | |||
/// | /// | |||
/// File must be a static string, such as the value of | /// File must be a static string, such as the value of | |||
/// the __FILE__ macro. The string is not copied | /// the __FILE__ macro. The string is not copied | |||
/// internally for performance reasons. | /// internally for performance reasons. | |||
void critical(const std::string& fmt, const Any& value1); | ||||
void critical(const std::string& fmt, const Any& value1, const Any& | ||||
value2); | ||||
void critical(const std::string& fmt, const Any& value1, const Any& | ||||
value2, const Any& value3); | ||||
void critical(const std::string& fmt, const Any& value1, const Any& | ||||
value2, const Any& value3, const Any& value4); | ||||
void critical(const std::string& fmt, const Any& value1, const Any& | ||||
value2, const Any& value3, const Any& value4, const Any& value5); | ||||
void critical(const std::string& fmt, const Any& value1, const Any& | ||||
value2, const Any& value3, const Any& value4, const Any& value5, const Any& | ||||
value6); | ||||
void error(const std::string& msg); | void error(const std::string& msg); | |||
/// If the Logger's log level is at least PRIO_ERROR, | /// If the Logger's log level is at least PRIO_ERROR, | |||
/// creates a Message with priority PRIO_ERROR | /// creates a Message with priority PRIO_ERROR | |||
/// and the given message text and sends it | /// and the given message text and sends it | |||
/// to the attached channel. | /// to the attached channel. | |||
void error(const std::string& msg, const char* file, int line); | void error(const std::string& msg, const char* file, int line); | |||
/// If the Logger's log level is at least PRIO_ERROR, | /// If the Logger's log level is at least PRIO_ERROR, | |||
/// creates a Message with priority PRIO_ERROR | /// creates a Message with priority PRIO_ERROR | |||
/// and the given message text and sends it | /// and the given message text and sends it | |||
/// to the attached channel. | /// to the attached channel. | |||
/// | /// | |||
/// File must be a static string, such as the value of | /// File must be a static string, such as the value of | |||
/// the __FILE__ macro. The string is not copied | /// the __FILE__ macro. The string is not copied | |||
/// internally for performance reasons. | /// internally for performance reasons. | |||
void error(const std::string& fmt, const Any& value1); | ||||
void error(const std::string& fmt, const Any& value1, const Any& val | ||||
ue2); | ||||
void error(const std::string& fmt, const Any& value1, const Any& val | ||||
ue2, const Any& value3); | ||||
void error(const std::string& fmt, const Any& value1, const Any& val | ||||
ue2, const Any& value3, const Any& value4); | ||||
void error(const std::string& fmt, const Any& value1, const Any& val | ||||
ue2, const Any& value3, const Any& value4, const Any& value5); | ||||
void error(const std::string& fmt, const Any& value1, const Any& val | ||||
ue2, const Any& value3, const Any& value4, const Any& value5, const Any& va | ||||
lue6); | ||||
void warning(const std::string& msg); | void warning(const std::string& msg); | |||
/// If the Logger's log level is at least PRIO_WARNING, | /// If the Logger's log level is at least PRIO_WARNING, | |||
/// creates a Message with priority PRIO_WARNING | /// creates a Message with priority PRIO_WARNING | |||
/// and the given message text and sends it | /// and the given message text and sends it | |||
/// to the attached channel. | /// to the attached channel. | |||
void warning(const std::string& msg, const char* file, int line); | void warning(const std::string& msg, const char* file, int line); | |||
/// If the Logger's log level is at least PRIO_WARNING, | /// If the Logger's log level is at least PRIO_WARNING, | |||
/// creates a Message with priority PRIO_WARNING | /// creates a Message with priority PRIO_WARNING | |||
/// and the given message text and sends it | /// and the given message text and sends it | |||
/// to the attached channel. | /// to the attached channel. | |||
/// | /// | |||
/// File must be a static string, such as the value of | /// File must be a static string, such as the value of | |||
/// the __FILE__ macro. The string is not copied | /// the __FILE__ macro. The string is not copied | |||
/// internally for performance reasons. | /// internally for performance reasons. | |||
void warning(const std::string& fmt, const Any& value1); | ||||
void warning(const std::string& fmt, const Any& value1, const Any& v | ||||
alue2); | ||||
void warning(const std::string& fmt, const Any& value1, const Any& v | ||||
alue2, const Any& value3); | ||||
void warning(const std::string& fmt, const Any& value1, const Any& v | ||||
alue2, const Any& value3, const Any& value4); | ||||
void warning(const std::string& fmt, const Any& value1, const Any& v | ||||
alue2, const Any& value3, const Any& value4, const Any& value5); | ||||
void warning(const std::string& fmt, const Any& value1, const Any& v | ||||
alue2, const Any& value3, const Any& value4, const Any& value5, const Any& | ||||
value6); | ||||
void notice(const std::string& msg); | void notice(const std::string& msg); | |||
/// If the Logger's log level is at least PRIO_NOTICE, | /// If the Logger's log level is at least PRIO_NOTICE, | |||
/// creates a Message with priority PRIO_NOTICE | /// creates a Message with priority PRIO_NOTICE | |||
/// and the given message text and sends it | /// and the given message text and sends it | |||
/// to the attached channel. | /// to the attached channel. | |||
void notice(const std::string& msg, const char* file, int line); | void notice(const std::string& msg, const char* file, int line); | |||
/// If the Logger's log level is at least PRIO_NOTICE, | /// If the Logger's log level is at least PRIO_NOTICE, | |||
/// creates a Message with priority PRIO_NOTICE | /// creates a Message with priority PRIO_NOTICE | |||
/// and the given message text and sends it | /// and the given message text and sends it | |||
/// to the attached channel. | /// to the attached channel. | |||
/// | /// | |||
/// File must be a static string, such as the value of | /// File must be a static string, such as the value of | |||
/// the __FILE__ macro. The string is not copied | /// the __FILE__ macro. The string is not copied | |||
/// internally for performance reasons. | /// internally for performance reasons. | |||
void notice(const std::string& fmt, const Any& value1); | ||||
void notice(const std::string& fmt, const Any& value1, const Any& va | ||||
lue2); | ||||
void notice(const std::string& fmt, const Any& value1, const Any& va | ||||
lue2, const Any& value3); | ||||
void notice(const std::string& fmt, const Any& value1, const Any& va | ||||
lue2, const Any& value3, const Any& value4); | ||||
void notice(const std::string& fmt, const Any& value1, const Any& va | ||||
lue2, const Any& value3, const Any& value4, const Any& value5); | ||||
void notice(const std::string& fmt, const Any& value1, const Any& va | ||||
lue2, const Any& value3, const Any& value4, const Any& value5, const Any& v | ||||
alue6); | ||||
void information(const std::string& msg); | void information(const std::string& msg); | |||
/// If the Logger's log level is at least PRIO_INFORMATION, | /// If the Logger's log level is at least PRIO_INFORMATION, | |||
/// creates a Message with priority PRIO_INFORMATION | /// creates a Message with priority PRIO_INFORMATION | |||
/// and the given message text and sends it | /// and the given message text and sends it | |||
/// to the attached channel. | /// to the attached channel. | |||
void information(const std::string& msg, const char* file, int line) ; | void information(const std::string& msg, const char* file, int line) ; | |||
/// If the Logger's log level is at least PRIO_INFORMATION, | /// If the Logger's log level is at least PRIO_INFORMATION, | |||
/// creates a Message with priority PRIO_INFORMATION | /// creates a Message with priority PRIO_INFORMATION | |||
/// and the given message text and sends it | /// and the given message text and sends it | |||
/// to the attached channel. | /// to the attached channel. | |||
/// | /// | |||
/// File must be a static string, such as the value of | /// File must be a static string, such as the value of | |||
/// the __FILE__ macro. The string is not copied | /// the __FILE__ macro. The string is not copied | |||
/// internally for performance reasons. | /// internally for performance reasons. | |||
void information(const std::string& fmt, const Any& value1); | ||||
void information(const std::string& fmt, const Any& value1, const An | ||||
y& value2); | ||||
void information(const std::string& fmt, const Any& value1, const An | ||||
y& value2, const Any& value3); | ||||
void information(const std::string& fmt, const Any& value1, const An | ||||
y& value2, const Any& value3, const Any& value4); | ||||
void information(const std::string& fmt, const Any& value1, const An | ||||
y& value2, const Any& value3, const Any& value4, const Any& value5); | ||||
void information(const std::string& fmt, const Any& value1, const An | ||||
y& value2, const Any& value3, const Any& value4, const Any& value5, const A | ||||
ny& value6); | ||||
void debug(const std::string& msg); | void debug(const std::string& msg); | |||
/// If the Logger's log level is at least PRIO_DEBUG, | /// If the Logger's log level is at least PRIO_DEBUG, | |||
/// creates a Message with priority PRIO_DEBUG | /// creates a Message with priority PRIO_DEBUG | |||
/// and the given message text and sends it | /// and the given message text and sends it | |||
/// to the attached channel. | /// to the attached channel. | |||
void debug(const std::string& msg, const char* file, int line); | void debug(const std::string& msg, const char* file, int line); | |||
/// If the Logger's log level is at least PRIO_DEBUG, | /// If the Logger's log level is at least PRIO_DEBUG, | |||
/// creates a Message with priority PRIO_DEBUG | /// creates a Message with priority PRIO_DEBUG | |||
/// and the given message text and sends it | /// and the given message text and sends it | |||
/// to the attached channel. | /// to the attached channel. | |||
/// | /// | |||
/// File must be a static string, such as the value of | /// File must be a static string, such as the value of | |||
/// the __FILE__ macro. The string is not copied | /// the __FILE__ macro. The string is not copied | |||
/// internally for performance reasons. | /// internally for performance reasons. | |||
void debug(const std::string& fmt, const Any& value1); | ||||
void debug(const std::string& fmt, const Any& value1, const Any& val | ||||
ue2); | ||||
void debug(const std::string& fmt, const Any& value1, const Any& val | ||||
ue2, const Any& value3); | ||||
void debug(const std::string& fmt, const Any& value1, const Any& val | ||||
ue2, const Any& value3, const Any& value4); | ||||
void debug(const std::string& fmt, const Any& value1, const Any& val | ||||
ue2, const Any& value3, const Any& value4, const Any& value5); | ||||
void debug(const std::string& fmt, const Any& value1, const Any& val | ||||
ue2, const Any& value3, const Any& value4, const Any& value5, const Any& va | ||||
lue6); | ||||
void trace(const std::string& msg); | void trace(const std::string& msg); | |||
/// If the Logger's log level is at least PRIO_TRACE, | /// If the Logger's log level is at least PRIO_TRACE, | |||
/// creates a Message with priority PRIO_TRACE | /// creates a Message with priority PRIO_TRACE | |||
/// and the given message text and sends it | /// and the given message text and sends it | |||
/// to the attached channel. | /// to the attached channel. | |||
void trace(const std::string& msg, const char* file, int line); | void trace(const std::string& msg, const char* file, int line); | |||
/// If the Logger's log level is at least PRIO_TRACE, | /// If the Logger's log level is at least PRIO_TRACE, | |||
/// creates a Message with priority PRIO_TRACE | /// creates a Message with priority PRIO_TRACE | |||
/// and the given message text and sends it | /// and the given message text and sends it | |||
/// to the attached channel. | /// to the attached channel. | |||
/// | /// | |||
/// File must be a static string, such as the value of | /// File must be a static string, such as the value of | |||
/// the __FILE__ macro. The string is not copied | /// the __FILE__ macro. The string is not copied | |||
/// internally for performance reasons. | /// internally for performance reasons. | |||
void trace(const std::string& fmt, const Any& value1); | ||||
void trace(const std::string& fmt, const Any& value1, const Any& val | ||||
ue2); | ||||
void trace(const std::string& fmt, const Any& value1, const Any& val | ||||
ue2, const Any& value3); | ||||
void trace(const std::string& fmt, const Any& value1, const Any& val | ||||
ue2, const Any& value3, const Any& value4); | ||||
void trace(const std::string& fmt, const Any& value1, const Any& val | ||||
ue2, const Any& value3, const Any& value4, const Any& value5); | ||||
void trace(const std::string& fmt, const Any& value1, const Any& val | ||||
ue2, const Any& value3, const Any& value4, const Any& value5, const Any& va | ||||
lue6); | ||||
void dump(const std::string& msg, const void* buffer, std::size_t le ngth, Message::Priority prio = Message::PRIO_DEBUG); | void dump(const std::string& msg, const void* buffer, std::size_t le ngth, Message::Priority prio = Message::PRIO_DEBUG); | |||
/// Logs the given message, followed by the data in buffer. | /// Logs the given message, followed by the data in buffer. | |||
/// | /// | |||
/// The data in buffer is written in canonical hex+ASCII for m: | /// The data in buffer is written in canonical hex+ASCII for m: | |||
/// Offset (4 bytes) in hexadecimal, followed by sixteen | /// Offset (4 bytes) in hexadecimal, followed by sixteen | |||
/// space-separated, two column, hexadecimal bytes, | /// space-separated, two column, hexadecimal bytes, | |||
/// followed by the same sixteen bytes as ASCII characters. | /// followed by the same sixteen bytes as ASCII characters. | |||
/// For bytes outside the range 32 .. 127, a dot is printed. | /// For bytes outside the range 32 .. 127, a dot is printed. | |||
bool is(int level) const; | bool is(int level) const; | |||
skipping to change at line 618 | skipping to change at line 674 | |||
inline void Logger::fatal(const std::string& msg) | inline void Logger::fatal(const std::string& msg) | |||
{ | { | |||
log(msg, Message::PRIO_FATAL); | log(msg, Message::PRIO_FATAL); | |||
} | } | |||
inline void Logger::fatal(const std::string& msg, const char* file, int lin e) | inline void Logger::fatal(const std::string& msg, const char* file, int lin e) | |||
{ | { | |||
log(msg, Message::PRIO_FATAL, file, line); | log(msg, Message::PRIO_FATAL, file, line); | |||
} | } | |||
inline void Logger::fatal(const std::string& fmt, const Any& value1) | ||||
{ | ||||
log(Poco::format(fmt, value1), Message::PRIO_FATAL); | ||||
} | ||||
inline void Logger::fatal(const std::string& fmt, const Any& value1, const | ||||
Any& value2) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2), Message::PRIO_FATAL); | ||||
} | ||||
inline void Logger::fatal(const std::string& fmt, const Any& value1, const | ||||
Any& value2, const Any& value3) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2, value3), Message::PRIO_FATAL); | ||||
} | ||||
inline void Logger::fatal(const std::string& fmt, const Any& value1, const | ||||
Any& value2, const Any& value3, const Any& value4) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2, value3, value4), Message::PRIO | ||||
_FATAL); | ||||
} | ||||
inline void Logger::fatal(const std::string& fmt, const Any& value1, const | ||||
Any& value2, const Any& value3, const Any& value4, const Any& value5) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2, value3, value4, value5), Messa | ||||
ge::PRIO_FATAL); | ||||
} | ||||
inline void Logger::fatal(const std::string& fmt, const Any& value1, const | ||||
Any& value2, const Any& value3, const Any& value4, const Any& value5, const | ||||
Any& value6) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6 | ||||
), Message::PRIO_FATAL); | ||||
} | ||||
inline void Logger::critical(const std::string& msg) | inline void Logger::critical(const std::string& msg) | |||
{ | { | |||
log(msg, Message::PRIO_CRITICAL); | log(msg, Message::PRIO_CRITICAL); | |||
} | } | |||
inline void Logger::critical(const std::string& msg, const char* file, int line) | inline void Logger::critical(const std::string& msg, const char* file, int line) | |||
{ | { | |||
log(msg, Message::PRIO_CRITICAL, file, line); | log(msg, Message::PRIO_CRITICAL, file, line); | |||
} | } | |||
inline void Logger::critical(const std::string& fmt, const Any& value1) | ||||
{ | ||||
log(Poco::format(fmt, value1), Message::PRIO_CRITICAL); | ||||
} | ||||
inline void Logger::critical(const std::string& fmt, const Any& value1, con | ||||
st Any& value2) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2), Message::PRIO_CRITICAL); | ||||
} | ||||
inline void Logger::critical(const std::string& fmt, const Any& value1, con | ||||
st Any& value2, const Any& value3) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2, value3), Message::PRIO_CRITICA | ||||
L); | ||||
} | ||||
inline void Logger::critical(const std::string& fmt, const Any& value1, con | ||||
st Any& value2, const Any& value3, const Any& value4) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2, value3, value4), Message::PRIO | ||||
_CRITICAL); | ||||
} | ||||
inline void Logger::critical(const std::string& fmt, const Any& value1, con | ||||
st Any& value2, const Any& value3, const Any& value4, const Any& value5) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2, value3, value4, value5), Messa | ||||
ge::PRIO_CRITICAL); | ||||
} | ||||
inline void Logger::critical(const std::string& fmt, const Any& value1, con | ||||
st Any& value2, const Any& value3, const Any& value4, const Any& value5, co | ||||
nst Any& value6) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6 | ||||
), Message::PRIO_CRITICAL); | ||||
} | ||||
inline void Logger::error(const std::string& msg) | inline void Logger::error(const std::string& msg) | |||
{ | { | |||
log(msg, Message::PRIO_ERROR); | log(msg, Message::PRIO_ERROR); | |||
} | } | |||
inline void Logger::error(const std::string& msg, const char* file, int lin e) | inline void Logger::error(const std::string& msg, const char* file, int lin e) | |||
{ | { | |||
log(msg, Message::PRIO_ERROR, file, line); | log(msg, Message::PRIO_ERROR, file, line); | |||
} | } | |||
inline void Logger::error(const std::string& fmt, const Any& value1) | ||||
{ | ||||
log(Poco::format(fmt, value1), Message::PRIO_ERROR); | ||||
} | ||||
inline void Logger::error(const std::string& fmt, const Any& value1, const | ||||
Any& value2) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2), Message::PRIO_ERROR); | ||||
} | ||||
inline void Logger::error(const std::string& fmt, const Any& value1, const | ||||
Any& value2, const Any& value3) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2, value3), Message::PRIO_ERROR); | ||||
} | ||||
inline void Logger::error(const std::string& fmt, const Any& value1, const | ||||
Any& value2, const Any& value3, const Any& value4) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2, value3, value4), Message::PRIO | ||||
_ERROR); | ||||
} | ||||
inline void Logger::error(const std::string& fmt, const Any& value1, const | ||||
Any& value2, const Any& value3, const Any& value4, const Any& value5) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2, value3, value4, value5), Messa | ||||
ge::PRIO_ERROR); | ||||
} | ||||
inline void Logger::error(const std::string& fmt, const Any& value1, const | ||||
Any& value2, const Any& value3, const Any& value4, const Any& value5, const | ||||
Any& value6) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6 | ||||
), Message::PRIO_ERROR); | ||||
} | ||||
inline void Logger::warning(const std::string& msg) | inline void Logger::warning(const std::string& msg) | |||
{ | { | |||
log(msg, Message::PRIO_WARNING); | log(msg, Message::PRIO_WARNING); | |||
} | } | |||
inline void Logger::warning(const std::string& msg, const char* file, int l ine) | inline void Logger::warning(const std::string& msg, const char* file, int l ine) | |||
{ | { | |||
log(msg, Message::PRIO_WARNING, file, line); | log(msg, Message::PRIO_WARNING, file, line); | |||
} | } | |||
inline void Logger::warning(const std::string& fmt, const Any& value1) | ||||
{ | ||||
log(Poco::format(fmt, value1), Message::PRIO_WARNING); | ||||
} | ||||
inline void Logger::warning(const std::string& fmt, const Any& value1, cons | ||||
t Any& value2) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2), Message::PRIO_WARNING); | ||||
} | ||||
inline void Logger::warning(const std::string& fmt, const Any& value1, cons | ||||
t Any& value2, const Any& value3) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2, value3), Message::PRIO_WARNING | ||||
); | ||||
} | ||||
inline void Logger::warning(const std::string& fmt, const Any& value1, cons | ||||
t Any& value2, const Any& value3, const Any& value4) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2, value3, value4), Message::PRIO | ||||
_WARNING); | ||||
} | ||||
inline void Logger::warning(const std::string& fmt, const Any& value1, cons | ||||
t Any& value2, const Any& value3, const Any& value4, const Any& value5) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2, value3, value4, value5), Messa | ||||
ge::PRIO_WARNING); | ||||
} | ||||
inline void Logger::warning(const std::string& fmt, const Any& value1, cons | ||||
t Any& value2, const Any& value3, const Any& value4, const Any& value5, con | ||||
st Any& value6) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6 | ||||
), Message::PRIO_WARNING); | ||||
} | ||||
inline void Logger::notice(const std::string& msg) | inline void Logger::notice(const std::string& msg) | |||
{ | { | |||
log(msg, Message::PRIO_NOTICE); | log(msg, Message::PRIO_NOTICE); | |||
} | } | |||
inline void Logger::notice(const std::string& msg, const char* file, int li ne) | inline void Logger::notice(const std::string& msg, const char* file, int li ne) | |||
{ | { | |||
log(msg, Message::PRIO_NOTICE, file, line); | log(msg, Message::PRIO_NOTICE, file, line); | |||
} | } | |||
inline void Logger::notice(const std::string& fmt, const Any& value1) | ||||
{ | ||||
log(Poco::format(fmt, value1), Message::PRIO_NOTICE); | ||||
} | ||||
inline void Logger::notice(const std::string& fmt, const Any& value1, const | ||||
Any& value2) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2), Message::PRIO_NOTICE); | ||||
} | ||||
inline void Logger::notice(const std::string& fmt, const Any& value1, const | ||||
Any& value2, const Any& value3) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2, value3), Message::PRIO_NOTICE) | ||||
; | ||||
} | ||||
inline void Logger::notice(const std::string& fmt, const Any& value1, const | ||||
Any& value2, const Any& value3, const Any& value4) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2, value3, value4), Message::PRIO | ||||
_NOTICE); | ||||
} | ||||
inline void Logger::notice(const std::string& fmt, const Any& value1, const | ||||
Any& value2, const Any& value3, const Any& value4, const Any& value5) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2, value3, value4, value5), Messa | ||||
ge::PRIO_NOTICE); | ||||
} | ||||
inline void Logger::notice(const std::string& fmt, const Any& value1, const | ||||
Any& value2, const Any& value3, const Any& value4, const Any& value5, cons | ||||
t Any& value6) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6 | ||||
), Message::PRIO_NOTICE); | ||||
} | ||||
inline void Logger::information(const std::string& msg) | inline void Logger::information(const std::string& msg) | |||
{ | { | |||
log(msg, Message::PRIO_INFORMATION); | log(msg, Message::PRIO_INFORMATION); | |||
} | } | |||
inline void Logger::information(const std::string& msg, const char* file, i nt line) | inline void Logger::information(const std::string& msg, const char* file, i nt line) | |||
{ | { | |||
log(msg, Message::PRIO_INFORMATION, file, line); | log(msg, Message::PRIO_INFORMATION, file, line); | |||
} | } | |||
inline void Logger::information(const std::string& fmt, const Any& value1) | ||||
{ | ||||
log(Poco::format(fmt, value1), Message::PRIO_INFORMATION); | ||||
} | ||||
inline void Logger::information(const std::string& fmt, const Any& value1, | ||||
const Any& value2) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2), Message::PRIO_INFORMATION); | ||||
} | ||||
inline void Logger::information(const std::string& fmt, const Any& value1, | ||||
const Any& value2, const Any& value3) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2, value3), Message::PRIO_INFORMA | ||||
TION); | ||||
} | ||||
inline void Logger::information(const std::string& fmt, const Any& value1, | ||||
const Any& value2, const Any& value3, const Any& value4) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2, value3, value4), Message::PRIO | ||||
_INFORMATION); | ||||
} | ||||
inline void Logger::information(const std::string& fmt, const Any& value1, | ||||
const Any& value2, const Any& value3, const Any& value4, const Any& value5) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2, value3, value4, value5), Messa | ||||
ge::PRIO_INFORMATION); | ||||
} | ||||
inline void Logger::information(const std::string& fmt, const Any& value1, | ||||
const Any& value2, const Any& value3, const Any& value4, const Any& value5, | ||||
const Any& value6) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6 | ||||
), Message::PRIO_INFORMATION); | ||||
} | ||||
inline void Logger::debug(const std::string& msg) | inline void Logger::debug(const std::string& msg) | |||
{ | { | |||
log(msg, Message::PRIO_DEBUG); | log(msg, Message::PRIO_DEBUG); | |||
} | } | |||
inline void Logger::debug(const std::string& msg, const char* file, int lin e) | inline void Logger::debug(const std::string& msg, const char* file, int lin e) | |||
{ | { | |||
log(msg, Message::PRIO_DEBUG, file, line); | log(msg, Message::PRIO_DEBUG, file, line); | |||
} | } | |||
inline void Logger::debug(const std::string& fmt, const Any& value1) | ||||
{ | ||||
log(Poco::format(fmt, value1), Message::PRIO_DEBUG); | ||||
} | ||||
inline void Logger::debug(const std::string& fmt, const Any& value1, const | ||||
Any& value2) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2), Message::PRIO_DEBUG); | ||||
} | ||||
inline void Logger::debug(const std::string& fmt, const Any& value1, const | ||||
Any& value2, const Any& value3) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2, value3), Message::PRIO_DEBUG); | ||||
} | ||||
inline void Logger::debug(const std::string& fmt, const Any& value1, const | ||||
Any& value2, const Any& value3, const Any& value4) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2, value3, value4), Message::PRIO | ||||
_DEBUG); | ||||
} | ||||
inline void Logger::debug(const std::string& fmt, const Any& value1, const | ||||
Any& value2, const Any& value3, const Any& value4, const Any& value5) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2, value3, value4, value5), Messa | ||||
ge::PRIO_DEBUG); | ||||
} | ||||
inline void Logger::debug(const std::string& fmt, const Any& value1, const | ||||
Any& value2, const Any& value3, const Any& value4, const Any& value5, const | ||||
Any& value6) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6 | ||||
), Message::PRIO_DEBUG); | ||||
} | ||||
inline void Logger::trace(const std::string& msg) | inline void Logger::trace(const std::string& msg) | |||
{ | { | |||
log(msg, Message::PRIO_TRACE); | log(msg, Message::PRIO_TRACE); | |||
} | } | |||
inline void Logger::trace(const std::string& msg, const char* file, int lin e) | inline void Logger::trace(const std::string& msg, const char* file, int lin e) | |||
{ | { | |||
log(msg, Message::PRIO_TRACE, file, line); | log(msg, Message::PRIO_TRACE, file, line); | |||
} | } | |||
inline void Logger::trace(const std::string& fmt, const Any& value1) | ||||
{ | ||||
log(Poco::format(fmt, value1), Message::PRIO_TRACE); | ||||
} | ||||
inline void Logger::trace(const std::string& fmt, const Any& value1, const | ||||
Any& value2) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2), Message::PRIO_TRACE); | ||||
} | ||||
inline void Logger::trace(const std::string& fmt, const Any& value1, const | ||||
Any& value2, const Any& value3) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2, value3), Message::PRIO_TRACE); | ||||
} | ||||
inline void Logger::trace(const std::string& fmt, const Any& value1, const | ||||
Any& value2, const Any& value3, const Any& value4) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2, value3, value4), Message::PRIO | ||||
_TRACE); | ||||
} | ||||
inline void Logger::trace(const std::string& fmt, const Any& value1, const | ||||
Any& value2, const Any& value3, const Any& value4, const Any& value5) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2, value3, value4, value5), Messa | ||||
ge::PRIO_TRACE); | ||||
} | ||||
inline void Logger::trace(const std::string& fmt, const Any& value1, const | ||||
Any& value2, const Any& value3, const Any& value4, const Any& value5, const | ||||
Any& value6) | ||||
{ | ||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6 | ||||
), Message::PRIO_TRACE); | ||||
} | ||||
inline bool Logger::is(int level) const | inline bool Logger::is(int level) const | |||
{ | { | |||
return _level >= level; | return _level >= level; | |||
} | } | |||
inline bool Logger::fatal() const | inline bool Logger::fatal() const | |||
{ | { | |||
return _level >= Message::PRIO_FATAL; | return _level >= Message::PRIO_FATAL; | |||
} | } | |||
End of changes. 16 change blocks. | ||||
0 lines changed or deleted | 420 lines changed or added | |||
MD4Engine.h | MD4Engine.h | |||
---|---|---|---|---|
skipping to change at line 83 | skipping to change at line 83 | |||
public: | public: | |||
enum | enum | |||
{ | { | |||
BLOCK_SIZE = 64, | BLOCK_SIZE = 64, | |||
DIGEST_SIZE = 16 | DIGEST_SIZE = 16 | |||
}; | }; | |||
MD4Engine(); | MD4Engine(); | |||
~MD4Engine(); | ~MD4Engine(); | |||
unsigned digestLength() const; | std::size_t digestLength() const; | |||
void reset(); | void reset(); | |||
const DigestEngine::Digest& digest(); | const DigestEngine::Digest& digest(); | |||
protected: | protected: | |||
void updateImpl(const void* data, unsigned length); | void updateImpl(const void* data, std::size_t length); | |||
private: | private: | |||
static void transform(UInt32 state[4], const unsigned char block[64] ); | static void transform(UInt32 state[4], const unsigned char block[64] ); | |||
static void encode(unsigned char* output, const UInt32* input, unsig | static void encode(unsigned char* output, const UInt32* input, std:: | |||
ned int len); | size_t len); | |||
static void decode(UInt32* output, const unsigned char* input, unsig | static void decode(UInt32* output, const unsigned char* input, std:: | |||
ned int len); | size_t len); | |||
struct Context | struct Context | |||
{ | { | |||
UInt32 state[4]; // state (ABCD) | UInt32 state[4]; // state (ABCD) | |||
UInt32 count[2]; // number of bits, modulo 2^64 (ls b first) | UInt32 count[2]; // number of bits, modulo 2^64 (ls b first) | |||
unsigned char buffer[64]; // input buffer | unsigned char buffer[64]; // input buffer | |||
}; | }; | |||
Context _context; | Context _context; | |||
DigestEngine::Digest _digest; | DigestEngine::Digest _digest; | |||
End of changes. 3 change blocks. | ||||
6 lines changed or deleted | 6 lines changed or added | |||
MD5Engine.h | MD5Engine.h | |||
---|---|---|---|---|
skipping to change at line 83 | skipping to change at line 83 | |||
public: | public: | |||
enum | enum | |||
{ | { | |||
BLOCK_SIZE = 64, | BLOCK_SIZE = 64, | |||
DIGEST_SIZE = 16 | DIGEST_SIZE = 16 | |||
}; | }; | |||
MD5Engine(); | MD5Engine(); | |||
~MD5Engine(); | ~MD5Engine(); | |||
unsigned digestLength() const; | std::size_t digestLength() const; | |||
void reset(); | void reset(); | |||
const DigestEngine::Digest& digest(); | const DigestEngine::Digest& digest(); | |||
protected: | protected: | |||
void updateImpl(const void* data, unsigned length); | void updateImpl(const void* data, std::size_t length); | |||
private: | private: | |||
static void transform(UInt32 state[4], const unsigned char block[64] ); | static void transform(UInt32 state[4], const unsigned char block[64] ); | |||
static void encode(unsigned char* output, const UInt32* input, unsig | static void encode(unsigned char* output, const UInt32* input, std:: | |||
ned int len); | size_t len); | |||
static void decode(UInt32* output, const unsigned char* input, unsig | static void decode(UInt32* output, const unsigned char* input, std:: | |||
ned int len); | size_t len); | |||
struct Context | struct Context | |||
{ | { | |||
UInt32 state[4]; // state (ABCD) | UInt32 state[4]; // state (ABCD) | |||
UInt32 count[2]; // number of bits, modulo 2^64 (ls b first) | UInt32 count[2]; // number of bits, modulo 2^64 (ls b first) | |||
unsigned char buffer[64]; // input buffer | unsigned char buffer[64]; // input buffer | |||
}; | }; | |||
Context _context; | Context _context; | |||
DigestEngine::Digest _digest; | DigestEngine::Digest _digest; | |||
End of changes. 3 change blocks. | ||||
6 lines changed or deleted | 6 lines changed or added | |||
MailMessage.h | MailMessage.h | |||
---|---|---|---|---|
skipping to change at line 93 | skipping to change at line 93 | |||
MailMessage(); | MailMessage(); | |||
/// Creates an empty MailMessage. | /// Creates an empty MailMessage. | |||
virtual ~MailMessage(); | virtual ~MailMessage(); | |||
/// Destroys the MailMessage. | /// Destroys the MailMessage. | |||
void addRecipient(const MailRecipient& recipient); | void addRecipient(const MailRecipient& recipient); | |||
/// Adds a recipient for the message. | /// Adds a recipient for the message. | |||
void setRecipients(const Recipients& recipient); | ||||
/// Clears existing and sets new recipient list for the mess | ||||
age. | ||||
const Recipients& recipients() const; | const Recipients& recipients() const; | |||
/// Returns the recipients of the message. | /// Returns the recipients of the message. | |||
void setSubject(const std::string& subject); | void setSubject(const std::string& subject); | |||
/// Sets the subject of the message. | /// Sets the subject of the message. | |||
/// | /// | |||
/// The subject must not contain any non-ASCII | /// The subject must not contain any non-ASCII | |||
/// characters. To include non-ASCII characters | /// characters. To include non-ASCII characters | |||
/// in the subject, use RFC 2047 word encoding | /// in the subject, use RFC 2047 word encoding | |||
/// (see encodeWord()). | /// (see encodeWord()). | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 4 lines changed or added | |||
MapConfiguration.h | MapConfiguration.h | |||
---|---|---|---|---|
// | // | |||
// MapConfiguration.h | // MapConfiguration.h | |||
// | // | |||
// $Id: //poco/1.4/Util/include/Poco/Util/MapConfiguration.h#2 $ | // $Id: //poco/1.4/Util/include/Poco/Util/MapConfiguration.h#1 $ | |||
// | // | |||
// Library: Util | // Library: Util | |||
// Package: Configuration | // Package: Configuration | |||
// Module: MapConfiguration | // Module: MapConfiguration | |||
// | // | |||
// Definition of the MapConfiguration class. | // Definition of the MapConfiguration class. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 58 | skipping to change at line 58 | |||
class Util_API MapConfiguration: public AbstractConfiguration | class Util_API MapConfiguration: public AbstractConfiguration | |||
/// An implementation of AbstractConfiguration that stores configura tion data in a map. | /// An implementation of AbstractConfiguration that stores configura tion data in a map. | |||
{ | { | |||
public: | public: | |||
MapConfiguration(); | MapConfiguration(); | |||
/// Creates an empty MapConfiguration. | /// Creates an empty MapConfiguration. | |||
void clear(); | void clear(); | |||
/// Clears the configuration. | /// Clears the configuration. | |||
void copyTo(AbstractConfiguration& config); | ||||
/// Copies all configuration properties to the given configu | ||||
ration. | ||||
protected: | protected: | |||
typedef std::map<std::string, std::string> StringMap; | typedef std::map<std::string, std::string> StringMap; | |||
typedef StringMap::const_iterator iterator; | typedef StringMap::const_iterator iterator; | |||
bool getRaw(const std::string& key, std::string& value) const; | bool getRaw(const std::string& key, std::string& value) const; | |||
void setRaw(const std::string& key, const std::string& value); | void setRaw(const std::string& key, const std::string& value); | |||
void enumerate(const std::string& key, Keys& range) const; | void enumerate(const std::string& key, Keys& range) const; | |||
void removeRaw(const std::string& key); | void removeRaw(const std::string& key); | |||
~MapConfiguration(); | ~MapConfiguration(); | |||
End of changes. 2 change blocks. | ||||
5 lines changed or deleted | 1 lines changed or added | |||
MemoryStream.h | MemoryStream.h | |||
---|---|---|---|---|
skipping to change at line 57 | skipping to change at line 57 | |||
#include <ostream> | #include <ostream> | |||
namespace Poco { | namespace Poco { | |||
template <typename ch, typename tr> | template <typename ch, typename tr> | |||
class BasicMemoryStreamBuf: public std::basic_streambuf<ch, tr> | class BasicMemoryStreamBuf: public std::basic_streambuf<ch, tr> | |||
/// BasicMemoryStreamBuf is a simple implementation of a | /// BasicMemoryStreamBuf is a simple implementation of a | |||
/// stream buffer for reading and writing from a memory area. | /// stream buffer for reading and writing from a memory area. | |||
/// | /// | |||
/// This streambuf only supports unidirectional streams. | /// This streambuf only supports unidirectional streams. | |||
/// In other words, the BasicBufferedStreamBuf can be | /// In other words, the BasicMemoryStreamBuf can be | |||
/// used for the implementation of an istream or an | /// used for the implementation of an istream or an | |||
/// ostream, but not for an iostream. | /// ostream, but not for an iostream. | |||
{ | { | |||
protected: | protected: | |||
typedef std::basic_streambuf<ch, tr> Base; | typedef std::basic_streambuf<ch, tr> Base; | |||
typedef std::basic_ios<ch, tr> IOS; | typedef std::basic_ios<ch, tr> IOS; | |||
typedef ch char_type; | typedef ch char_type; | |||
typedef tr char_traits; | typedef tr char_traits; | |||
typedef typename Base::int_type int_type; | typedef typename Base::int_type int_type; | |||
typedef typename Base::pos_type pos_type; | typedef typename Base::pos_type pos_type; | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
MessageHeader.h | MessageHeader.h | |||
---|---|---|---|---|
// | // | |||
// MessageHeader.h | // MessageHeader.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/MessageHeader.h#5 $ | // $Id: //poco/1.4/Net/include/Poco/Net/MessageHeader.h#3 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: Messages | // Package: Messages | |||
// Module: MessageHeader | // Module: MessageHeader | |||
// | // | |||
// Definition of the MessageHeader class. | // Definition of the MessageHeader class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
MetaProgramming.h | MetaProgramming.h | |||
---|---|---|---|---|
skipping to change at line 101 | skipping to change at line 101 | |||
template <typename T> | template <typename T> | |||
struct IsConst<const T> | struct IsConst<const T> | |||
{ | { | |||
enum | enum | |||
{ | { | |||
VALUE = 1 | VALUE = 1 | |||
}; | }; | |||
}; | }; | |||
template <typename T, int i> | ||||
struct IsConst<const T[i]> | ||||
/// Specialization for const char arrays | ||||
{ | ||||
enum | ||||
{ | ||||
VALUE = 1 | ||||
}; | ||||
}; | ||||
template <typename T> | template <typename T> | |||
struct TypeWrapper | struct TypeWrapper | |||
/// Use the type wrapper if you want to decouple constness and refer ences from template types. | /// Use the type wrapper if you want to decouple constness and refer ences from template types. | |||
{ | { | |||
typedef T TYPE; | typedef T TYPE; | |||
typedef const T CONSTTYPE; | typedef const T CONSTTYPE; | |||
typedef T& REFTYPE; | typedef T& REFTYPE; | |||
typedef const T& CONSTREFTYPE; | typedef const T& CONSTREFTYPE; | |||
}; | }; | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 10 lines changed or added | |||
MulticastSocket.h | MulticastSocket.h | |||
---|---|---|---|---|
// | // | |||
// MulticastSocket.h | // MulticastSocket.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/MulticastSocket.h#2 $ | // $Id: //poco/1.4/Net/include/Poco/Net/MulticastSocket.h#1 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: Sockets | // Package: Sockets | |||
// Module: MulticastSocket | // Module: MulticastSocket | |||
// | // | |||
// Definition of the MulticastSocket class. | // Definition of the MulticastSocket class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 58 | skipping to change at line 58 | |||
class Net_API MulticastSocket: public DatagramSocket | class Net_API MulticastSocket: public DatagramSocket | |||
/// A MulticastSocket is a special DatagramSocket | /// A MulticastSocket is a special DatagramSocket | |||
/// that can be used to send packets to and receive | /// that can be used to send packets to and receive | |||
/// packets from multicast groups. | /// packets from multicast groups. | |||
{ | { | |||
public: | public: | |||
MulticastSocket(); | MulticastSocket(); | |||
/// Creates the MulticastSocket. | /// Creates the MulticastSocket. | |||
explicit MulticastSocket(IPAddress::Family family); | explicit MulticastSocket(IPAddress::Family family); | |||
/// Creates an unconnected multicast socket. | /// Creates an unconnected datagram socket. | |||
/// | /// | |||
/// The socket will be created for the | /// The socket will be created for the | |||
/// given address family. | /// given address family. | |||
MulticastSocket(const SocketAddress& address, bool reuseAddress = fa lse); | MulticastSocket(const SocketAddress& address, bool reuseAddress = fa lse); | |||
/// Creates a multicast socket and binds it | /// Creates a datagram socket and binds it | |||
/// to the given address. | /// to the given address. | |||
/// | /// | |||
/// Depending on the address family, the socket | /// Depending on the address family, the socket | |||
/// will be either an IPv4 or an IPv6 socket. | /// will be either an IPv4 or an IPv6 socket. | |||
MulticastSocket(const Socket& socket); | MulticastSocket(const Socket& socket); | |||
/// Creates the MulticastSocket with the SocketImpl | /// Creates the DatagramSocket with the SocketImpl | |||
/// from another socket. The SocketImpl must be | /// from another socket. The SocketImpl must be | |||
/// a DatagramSocketImpl, otherwise an InvalidArgumentExcept ion | /// a DatagramSocketImpl, otherwise an InvalidArgumentExcept ion | |||
/// will be thrown. | /// will be thrown. | |||
~MulticastSocket(); | ~MulticastSocket(); | |||
/// Destroys the DatagramSocket. | /// Destroys the DatagramSocket. | |||
MulticastSocket& operator = (const Socket& socket); | MulticastSocket& operator = (const Socket& socket); | |||
/// Assignment operator. | /// Assignment operator. | |||
/// | /// | |||
End of changes. 4 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added | |||
Mutex.h | Mutex.h | |||
---|---|---|---|---|
skipping to change at line 169 | skipping to change at line 169 | |||
void unlock(); | void unlock(); | |||
/// Unlocks the mutex so that it can be acquired by | /// Unlocks the mutex so that it can be acquired by | |||
/// other threads. | /// other threads. | |||
private: | private: | |||
FastMutex(const FastMutex&); | FastMutex(const FastMutex&); | |||
FastMutex& operator = (const FastMutex&); | FastMutex& operator = (const FastMutex&); | |||
}; | }; | |||
class Foundation_API NullMutex | class Foundation_API NullMutex | |||
/// A NullMutex is an simple mutex implementation | /// A NullMutex is an empty mutex implementation | |||
/// which performs no locking at all. Useful in policy driven design | /// which performs no locking at all. Useful in policy driven design | |||
/// where the type of mutex used can be now a template parameter all | /// where the type of mutex used can be now a template parameter all | |||
owing | owing the user to switch | |||
/// to switch between thread-safe and not thread-safe implementation | /// between thread-safe and not thread-safe depending on his need | |||
s. | /// Works with the ScopedLock class | |||
{ | { | |||
public: | public: | |||
typedef Poco::ScopedLock<NullMutex> ScopedLock; | typedef Poco::ScopedLock<NullMutex> ScopedLock; | |||
NullMutex() | NullMutex() | |||
/// Creates the NullMutex. | /// Creates the NullMutex. | |||
{ | { | |||
} | } | |||
~NullMutex() | ~NullMutex() | |||
End of changes. 2 change blocks. | ||||
5 lines changed or deleted | 5 lines changed or added | |||
Net.h | Net.h | |||
---|---|---|---|---|
skipping to change at line 89 | skipping to change at line 89 | |||
/// Calls WSAStartup() on Windows, does nothing | /// Calls WSAStartup() on Windows, does nothing | |||
/// on other platforms. | /// on other platforms. | |||
void Net_API uninitializeNetwork(); | void Net_API uninitializeNetwork(); | |||
/// Uninitialize the network subsystem. | /// Uninitialize the network subsystem. | |||
/// Calls WSACleanup() on Windows, does nothing | /// Calls WSACleanup() on Windows, does nothing | |||
/// on other platforms. | /// on other platforms. | |||
} } // namespace Poco::Net | } } // namespace Poco::Net | |||
// Default to enabled IPv6 support if not explicitly disabled | ||||
#if !defined(POCO_NET_NO_IPv6) && !defined (POCO_HAVE_IPv6) | ||||
#define POCO_HAVE_IPv6 | ||||
#elif defined(POCO_NET_NO_IPv6) && defined (POCO_HAVE_IPv6) | ||||
#undef POCO_HAVE_IPv6 | ||||
#endif // POCO_NET_NO_IPv6, POCO_HAVE_IPv6 | ||||
#if !defined(s6_addr16) | ||||
#if defined(POCO_OS_FAMILY_WINDOWS) | ||||
#define s6_addr16 u.Word | ||||
#else | ||||
#define s6_addr16 __u6_addr.__u6_addr16 | ||||
#endif | ||||
#endif | ||||
#if !defined(s6_addr32) | ||||
#if defined(POCO_OS_FAMILY_UNIX) | ||||
#if (POCO_OS == POCO_OS_SOLARIS) | ||||
#define s6_addr32 _S6_un._S6_u32 | ||||
#else | ||||
#define s6_addr32 __u6_addr.__u6_addr32 | ||||
#endif | ||||
#endif | ||||
#endif | ||||
#endif // Net_Net_INCLUDED | #endif // Net_Net_INCLUDED | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 25 lines changed or added | |||
NetException.h | NetException.h | |||
---|---|---|---|---|
skipping to change at line 70 | skipping to change at line 70 | |||
POCO_DECLARE_EXCEPTION(Net_API, MultipartException, MessageException) | POCO_DECLARE_EXCEPTION(Net_API, MultipartException, MessageException) | |||
POCO_DECLARE_EXCEPTION(Net_API, HTTPException, NetException) | POCO_DECLARE_EXCEPTION(Net_API, HTTPException, NetException) | |||
POCO_DECLARE_EXCEPTION(Net_API, NotAuthenticatedException, HTTPException) | POCO_DECLARE_EXCEPTION(Net_API, NotAuthenticatedException, HTTPException) | |||
POCO_DECLARE_EXCEPTION(Net_API, UnsupportedRedirectException, HTTPException ) | POCO_DECLARE_EXCEPTION(Net_API, UnsupportedRedirectException, HTTPException ) | |||
POCO_DECLARE_EXCEPTION(Net_API, FTPException, NetException) | POCO_DECLARE_EXCEPTION(Net_API, FTPException, NetException) | |||
POCO_DECLARE_EXCEPTION(Net_API, SMTPException, NetException) | POCO_DECLARE_EXCEPTION(Net_API, SMTPException, NetException) | |||
POCO_DECLARE_EXCEPTION(Net_API, POP3Exception, NetException) | POCO_DECLARE_EXCEPTION(Net_API, POP3Exception, NetException) | |||
POCO_DECLARE_EXCEPTION(Net_API, ICMPException, NetException) | POCO_DECLARE_EXCEPTION(Net_API, ICMPException, NetException) | |||
POCO_DECLARE_EXCEPTION(Net_API, HTMLFormException, NetException) | POCO_DECLARE_EXCEPTION(Net_API, HTMLFormException, NetException) | |||
POCO_DECLARE_EXCEPTION(Net_API, WebSocketException, NetException) | POCO_DECLARE_EXCEPTION(Net_API, WebSocketException, NetException) | |||
POCO_DECLARE_EXCEPTION(Net_API, UnsupportedFamilyException, NetException) | ||||
} } // namespace Poco::Net | } } // namespace Poco::Net | |||
#endif // Net_NetException_INCLUDED | #endif // Net_NetException_INCLUDED | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 1 lines changed or added | |||
NetworkInterface.h | NetworkInterface.h | |||
---|---|---|---|---|
skipping to change at line 44 | skipping to change at line 44 | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Net_NetworkInterface_INCLUDED | #ifndef Net_NetworkInterface_INCLUDED | |||
#define Net_NetworkInterface_INCLUDED | #define Net_NetworkInterface_INCLUDED | |||
#include "Poco/Net/Net.h" | #include "Poco/Net/Net.h" | |||
#include "Poco/Net/IPAddress.h" | #include "Poco/Net/IPAddress.h" | |||
#include "Poco/Mutex.h" | #include "Poco/Mutex.h" | |||
#include <vector> | #include "Poco/Tuple.h" | |||
#include <map> | ||||
namespace Poco { | namespace Poco { | |||
namespace Net { | namespace Net { | |||
class NetworkInterfaceImpl; | class NetworkInterfaceImpl; | |||
class Net_API NetworkInterface | class Net_API NetworkInterface | |||
/// This class represents a network interface. | /// This class represents a network interface. | |||
/// | /// | |||
/// NetworkInterface is used with MulticastSocket to specify | /// NetworkInterface is used with MulticastSocket to specify | |||
/// multicast interfaces for sending and receiving multicast | /// multicast interfaces for sending and receiving multicast | |||
/// messages. | /// messages. | |||
/// | /// | |||
/// The class also provides static member functions for | /// The class also provides static member functions for | |||
/// enumerating or searching network interfaces. | /// enumerating or searching network interfaces and their | |||
/// respective configuration values. | ||||
{ | { | |||
public: | public: | |||
typedef std::vector<NetworkInterface> NetworkInterfaceList; | typedef std::vector<NetworkInterface> List; | |||
typedef List NetworkInterfac | ||||
eList;//@deprecated | ||||
typedef std::map<unsigned, NetworkInterface> Map; | ||||
typedef Poco::Tuple<IPAddress, IPAddress, IPAddress> AddressTuple; | ||||
typedef std::vector<AddressTuple> AddressList; | ||||
typedef AddressList::iterator AddressIterator | ||||
; | ||||
typedef AddressList::const_iterator ConstAddressIte | ||||
rator; | ||||
typedef std::vector<unsigned char> MACAddress; | ||||
enum AddressType | ||||
{ | ||||
IP_ADDRESS, | ||||
SUBNET_MASK, | ||||
BROADCAST_ADDRESS | ||||
}; | ||||
enum Type | ||||
{ | ||||
NI_TYPE_ETHERNET_CSMACD, | ||||
NI_TYPE_ISO88025_TOKENRING, | ||||
NI_TYPE_FRAMERELAY, | ||||
NI_TYPE_PPP, | ||||
NI_TYPE_SOFTWARE_LOOPBACK, | ||||
NI_TYPE_ATM, | ||||
NI_TYPE_IEEE80211, | ||||
NI_TYPE_TUNNEL, | ||||
NI_TYPE_IEEE1394, | ||||
NI_TYPE_OTHER | ||||
}; | ||||
enum IPVersion | enum IPVersion | |||
{ | { | |||
IPv4_ONLY, /// Return interfaces with IPv4 address only | IPv4_ONLY, /// Return interfaces with IPv4 address only | |||
IPv6_ONLY, /// Return interfaces with IPv6 address only | IPv6_ONLY, /// Return interfaces with IPv6 address only | |||
IPv4_OR_IPv6 /// Return interfaces with IPv4 or IPv6 addres s | IPv4_OR_IPv6 /// Return interfaces with IPv4 or IPv6 addres s | |||
}; | }; | |||
NetworkInterface(); | static const unsigned NO_INDEX = ~0; | |||
#if defined(POCO_OS_FAMILY_WINDOWS) | ||||
static const char MAC_SEPARATOR = '-'; | ||||
#else | ||||
static const char MAC_SEPARATOR = ':'; | ||||
#endif | ||||
NetworkInterface(unsigned index = NO_INDEX); | ||||
/// Creates a NetworkInterface representing the | /// Creates a NetworkInterface representing the | |||
/// default interface. | /// default interface. | |||
/// | /// | |||
/// The name is empty, the IP address is the wildcard | /// The name is empty, the IP address is the wildcard | |||
/// address and the index is zero. | /// address and the index is max value of unsigned integer. | |||
NetworkInterface(const NetworkInterface& interfc); | NetworkInterface(const NetworkInterface& interfc); | |||
/// Creates the NetworkInterface by copying another one. | /// Creates the NetworkInterface by copying another one. | |||
~NetworkInterface(); | ~NetworkInterface(); | |||
/// Destroys the NetworkInterface. | /// Destroys the NetworkInterface. | |||
NetworkInterface& operator = (const NetworkInterface& interfc); | NetworkInterface& operator = (const NetworkInterface& interfc); | |||
/// Assigns another NetworkInterface. | /// Assigns another NetworkInterface. | |||
bool operator < (const NetworkInterface& other) const; | ||||
/// Operatorr less-than. | ||||
bool operator == (const NetworkInterface& other) const; | ||||
/// Operator equal. Compares interface indices. | ||||
void swap(NetworkInterface& other); | void swap(NetworkInterface& other); | |||
/// Swaps the NetworkInterface with another one. | /// Swaps the NetworkInterface with another one. | |||
int index() const; | unsigned index() const; | |||
/// Returns the interface index. | /// Returns the interface OS index. | |||
/// | ||||
/// Only supported if IPv6 is available. | ||||
/// Returns -1 if IPv6 is not available. | ||||
const std::string& name() const; | const std::string& name() const; | |||
/// Returns the interface name. | /// Returns the interface name. | |||
const std::string& displayName() const; | const std::string& displayName() const; | |||
/// Returns the interface display name. | /// Returns the interface display name. | |||
/// | /// | |||
/// On Windows platforms, this is currently the network adap ter | /// On Windows platforms, this is currently the network adap ter | |||
/// name. This may change to the "friendly name" of the netw ork | /// name. This may change to the "friendly name" of the netw ork | |||
/// connection in a future version, however. | /// connection in a future version, however. | |||
/// | /// | |||
/// On other platforms this is the same as name(). | /// On other platforms this is the same as name(). | |||
const IPAddress& address() const; | const IPAddress& firstAddress(IPAddress::Family family) const; | |||
/// Returns the IP address bound to the interface. | /// Returns the first IP address bound to the interface. | |||
const IPAddress& address(unsigned index = 0) const; | ||||
/// Returns the IP address bound to the interface at index p | ||||
osition. | ||||
const IPAddress& subnetMask() const; | void addAddress(const IPAddress& address); | |||
/// Returns the IPv4 subnet mask for this network interface. | /// Adds address to the interface. | |||
const IPAddress& broadcastAddress() const; | void addAddress(const IPAddress& address, const IPAddress& subnetMas | |||
/// Returns the IPv4 broadcast address for this network inte | k, const IPAddress& broadcastAddress); | |||
rface. | /// Adds address to the interface. | |||
const AddressList& addressList() const; | ||||
/// Returns the list of IP addresses bound to the interface. | ||||
const IPAddress& subnetMask(unsigned index) const; | ||||
/// Returns the subnet mask for this network interface. | ||||
const IPAddress& broadcastAddress(unsigned index) const; | ||||
/// Returns the broadcast address for this network interface | ||||
. | ||||
const IPAddress& destAddress(unsigned index) const; | ||||
/// Returns the IPv4 point-to-point destiation address for t | ||||
his network interface. | ||||
const MACAddress& macAddress() const; | ||||
/// Returns MAC (Media Access Control) address for the inter | ||||
face. | ||||
unsigned mtu() const; | ||||
/// Returns the MTU for this interface. | ||||
NetworkInterface::Type type() const; | ||||
/// returns the MIB IfType of the interface. | ||||
bool supportsIP() const; | ||||
/// Returns true if the interface supports IP. | ||||
bool supportsIPv4() const; | bool supportsIPv4() const; | |||
/// Returns true if the interface supports IPv4. | /// Returns true if the interface supports IPv4. | |||
bool supportsIPv6() const; | bool supportsIPv6() const; | |||
/// Returns true if the interface supports IPv6. | /// Returns true if the interface supports IPv6. | |||
bool supportsBroadcast() const; | ||||
/// Returns true if the interface supports broadcast. | ||||
bool supportsMulticast() const; | ||||
/// Returns true if the interface supports multicast. | ||||
bool isLoopback() const; | ||||
/// Returns true if the interface is loopback. | ||||
bool isPointToPoint() const; | ||||
/// Returns true if the interface is point-to-point. | ||||
bool isRunning() const; | ||||
/// Returns true if the interface is running. | ||||
bool isUp() const; | ||||
/// Returns true if the interface is up. | ||||
static NetworkInterface forName(const std::string& name, bool requir eIPv6 = false); | static NetworkInterface forName(const std::string& name, bool requir eIPv6 = false); | |||
/// Returns the NetworkInterface for the given name. | /// Returns the NetworkInterface for the given name. | |||
/// | /// | |||
/// If requireIPv6 is false, an IPv4 interface is returned. | /// If requireIPv6 is false, an IPv4 interface is returned. | |||
/// Otherwise, an IPv6 interface is returned. | /// Otherwise, an IPv6 interface is returned. | |||
/// | /// | |||
/// Throws an InterfaceNotFoundException if an interface | /// Throws an InterfaceNotFoundException if an interface | |||
/// with the give name does not exist. | /// with the give name does not exist. | |||
static NetworkInterface forName(const std::string& name, IPVersion i pVersion); | static NetworkInterface forName(const std::string& name, IPVersion i pVersion); | |||
skipping to change at line 145 | skipping to change at line 230 | |||
/// The ipVersion argument can be used to specify whether | /// The ipVersion argument can be used to specify whether | |||
/// an IPv4 (IPv4_ONLY) or IPv6 (IPv6_ONLY) interface is req uired, | /// an IPv4 (IPv4_ONLY) or IPv6 (IPv6_ONLY) interface is req uired, | |||
/// or whether the caller does not care (IPv4_OR_IPv6). | /// or whether the caller does not care (IPv4_OR_IPv6). | |||
static NetworkInterface forAddress(const IPAddress& address); | static NetworkInterface forAddress(const IPAddress& address); | |||
/// Returns the NetworkInterface for the given IP address. | /// Returns the NetworkInterface for the given IP address. | |||
/// | /// | |||
/// Throws an InterfaceNotFoundException if an interface | /// Throws an InterfaceNotFoundException if an interface | |||
/// with the give address does not exist. | /// with the give address does not exist. | |||
static NetworkInterface forIndex(int index); | static NetworkInterface forIndex(unsigned index); | |||
/// Returns the NetworkInterface for the given interface ind ex. | /// Returns the NetworkInterface for the given interface ind ex. | |||
/// If an index of 0 is specified, a NetworkInterface instan ce | /// If an index of 0 is specified, a NetworkInterface instan ce | |||
/// representing the default interface (empty name and | /// representing the default interface (empty name and | |||
/// wildcard address) is returned. | /// wildcard address) is returned. | |||
/// | /// | |||
/// Throws an InterfaceNotFoundException if an interface | /// Throws an InterfaceNotFoundException if an interface | |||
/// with the given index does not exist (or IPv6 is not | /// with the given index does not exist (or IPv6 is not | |||
/// available). | /// available). | |||
static NetworkInterfaceList list(); | static List list(bool ipOnly = true, bool upOnly = true); | |||
/// Returns a list with all network interfaces | /// Returns a list with all network interfaces | |||
/// on the system. | /// on the system. | |||
/// | /// | |||
/// If ipOnly is true, only interfaces supporting IP | ||||
/// are returned. Otherwise, all system network interfaces | ||||
/// are returned. | ||||
/// | ||||
/// If upOnly is true, only interfaces being up are returned | ||||
. | ||||
/// Otherwise, both interfaces being up and down are returne | ||||
d. | ||||
/// | ||||
/// If there are multiple addresses bound to one interface, | /// If there are multiple addresses bound to one interface, | |||
/// multiple NetworkInterface instances are created for | /// multiple NetworkInterface entries are listed for | |||
/// the same interface. | /// the same interface. | |||
static Map map(bool ipOnly = true, bool upOnly = true); | ||||
/// Returns a map containing system network interfaces | ||||
/// Map is keyed by interface system indices. | ||||
/// | ||||
/// If ipOnly is true, only interfaces supporting IP | ||||
/// are returned. Otherwise, all system network interfaces | ||||
/// are returned. | ||||
/// | ||||
/// If upOnly is true, only interfaces being up are returned | ||||
. | ||||
/// Otherwise, both interfaces being up and down are returne | ||||
d. | ||||
/// | ||||
/// If there are multiple addresses bound to one interface, | ||||
/// they are contained within the NetworkInterface (second) | ||||
/// member of the pair. | ||||
protected: | protected: | |||
NetworkInterface(const std::string& name, const std::string& display | NetworkInterface(const std::string& name, const std::string& display | |||
Name, const IPAddress& address, int index = -1); | Name, const IPAddress& address, unsigned index); | |||
/// Creates the NetworkInterface. | ||||
NetworkInterface(const std::string& name, const std::string& display | ||||
Name, unsigned index); | ||||
/// Creates the NetworkInterface. | /// Creates the NetworkInterface. | |||
NetworkInterface(const std::string& name, const std::string& display Name, const IPAddress& address, const IPAddress& subnetMask, const IPAddres s& broadcastAddress, int index = -1); | NetworkInterface(const std::string& name, const IPAddress& address, unsigned index); | |||
/// Creates the NetworkInterface. | /// Creates the NetworkInterface. | |||
NetworkInterface(const std::string& name, const IPAddress& address, int index = -1); | NetworkInterface(const std::string& name, const std::string& display Name, const IPAddress& address, const IPAddress& subnetMask, const IPAddres s& broadcastAddress, unsigned index); | |||
/// Creates the NetworkInterface. | /// Creates the NetworkInterface. | |||
NetworkInterface(const std::string& name, const IPAddress& address, const IPAddress& subnetMask, const IPAddress& broadcastAddress, int index = -1); | NetworkInterface(const std::string& name, const IPAddress& address, const IPAddress& subnetMask, const IPAddress& broadcastAddress, unsigned in dex); | |||
/// Creates the NetworkInterface. | /// Creates the NetworkInterface. | |||
IPAddress interfaceNameToAddress(const std::string& interfaceName) c onst; | IPAddress interfaceNameToAddress(const std::string& interfaceName) c onst; | |||
/// Determines the IPAddress bound to the interface with the given name. | /// Determines the IPAddress bound to the interface with the given name. | |||
int interfaceNameToIndex(const std::string& interfaceName) const; | unsigned interfaceNameToIndex(const std::string& interfaceName) cons t; | |||
/// Determines the interface index of the interface with the given name. | /// Determines the interface index of the interface with the given name. | |||
NetworkInterfaceImpl& impl() { return *_pImpl; }; | ||||
private: | private: | |||
NetworkInterfaceImpl* _pImpl; | NetworkInterfaceImpl* _pImpl; | |||
static Poco::FastMutex _mutex; | static Poco::FastMutex _mutex; | |||
}; | }; | |||
/// | ||||
/// inlines | ||||
/// | ||||
inline bool NetworkInterface::operator < (const NetworkInterface& other) co | ||||
nst | ||||
{ | ||||
return this->index() < other.index(); | ||||
} | ||||
inline bool NetworkInterface::operator == (const NetworkInterface& other) c | ||||
onst | ||||
{ | ||||
return this->index() == other.index(); | ||||
} | ||||
} } // namespace Poco::Net | } } // namespace Poco::Net | |||
Net_API std::ostream& operator<<(std::ostream& os, const Poco::Net::Network | ||||
Interface::MACAddress& mac); | ||||
#endif // Net_NetworkInterface_INCLUDED | #endif // Net_NetworkInterface_INCLUDED | |||
End of changes. 24 change blocks. | ||||
26 lines changed or deleted | 169 lines changed or added | |||
NotificationCenter.h | NotificationCenter.h | |||
---|---|---|---|---|
skipping to change at line 116 | skipping to change at line 116 | |||
/// Registers an observer with the NotificationCenter. | /// Registers an observer with the NotificationCenter. | |||
/// Usage: | /// Usage: | |||
/// Observer<MyClass, MyNotification> obs(*this, &MyClas s::handleNotification); | /// Observer<MyClass, MyNotification> obs(*this, &MyClas s::handleNotification); | |||
/// notificationCenter.addObserver(obs); | /// notificationCenter.addObserver(obs); | |||
/// | /// | |||
/// Alternatively, the NObserver template class can be used instead of Observer. | /// Alternatively, the NObserver template class can be used instead of Observer. | |||
void removeObserver(const AbstractObserver& observer); | void removeObserver(const AbstractObserver& observer); | |||
/// Unregisters an observer with the NotificationCenter. | /// Unregisters an observer with the NotificationCenter. | |||
bool hasObserver(const AbstractObserver& observer) const; | ||||
/// Returns true if the observer is registered with this Not | ||||
ificationCenter. | ||||
void postNotification(Notification::Ptr pNotification); | void postNotification(Notification::Ptr pNotification); | |||
/// Posts a notification to the NotificationCenter. | /// Posts a notification to the NotificationCenter. | |||
/// The NotificationCenter then delivers the notification | /// The NotificationCenter then delivers the notification | |||
/// to all interested observers. | /// to all interested observers. | |||
/// If an observer throws an exception, dispatching terminat es | /// If an observer throws an exception, dispatching terminat es | |||
/// and the exception is rethrown to the caller. | /// and the exception is rethrown to the caller. | |||
/// Ownership of the notification object is claimed and the | /// Ownership of the notification object is claimed and the | |||
/// notification is released before returning. Therefore, | /// notification is released before returning. Therefore, | |||
/// a call like | /// a call like | |||
/// notificationCenter.postNotification(new MyNotificatio n); | /// notificationCenter.postNotification(new MyNotificatio n); | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 4 lines changed or added | |||
Nullable.h | Nullable.h | |||
---|---|---|---|---|
skipping to change at line 44 | skipping to change at line 44 | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Foundation_Nullable_INCLUDED | #ifndef Foundation_Nullable_INCLUDED | |||
#define Foundation_Nullable_INCLUDED | #define Foundation_Nullable_INCLUDED | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
#include "Poco/Exception.h" | #include "Poco/Exception.h" | |||
#include <algorithm> | #include <algorithm> | |||
#include <iostream> | ||||
namespace Poco { | namespace Poco { | |||
enum NullType | ||||
{ | ||||
NULL_GENERIC = 0 | ||||
}; | ||||
template <typename C> | template <typename C> | |||
class Nullable | class Nullable | |||
/// Nullable is a simple wrapper class for value types | /// Nullable is a simple wrapper class for value types | |||
/// that allows to introduce a "null" value or state | /// that allows objects or native type variables | |||
/// to value objects. | /// to have "null" value. | |||
/// | /// | |||
/// The class is useful for passing parameters to functions | /// The class is useful for passing parameters to functions | |||
/// when parameters are optional and no default values | /// when parameters are optional and no default values | |||
/// should be used. | /// should be used or when a non-assigned state is needed, | |||
/// such as in e.g. fetching null values from database. | ||||
/// | /// | |||
/// A Nullable can be default constructed. In this case, | /// A Nullable can be default constructed. In this case, | |||
/// the Nullable will have a Null value and isNull() will | /// the Nullable will have a Null value and isNull() will | |||
/// return true. Calling value() (without default value) on | /// return true. Calling value() (without default value) on | |||
/// a Null object will throw a NullValueException. | /// a Null object will throw a NullValueException. | |||
/// | /// | |||
/// A Nullable can also be constructed from a value. | /// A Nullable can also be constructed from a value. | |||
/// It is possible to assign a value to a Nullable, and | /// It is possible to assign a value to a Nullable, and | |||
/// to reset a Nullable to contain a Null value by calling | /// to reset a Nullable to contain a Null value by calling | |||
/// clear(). | /// clear(). | |||
skipping to change at line 78 | skipping to change at line 85 | |||
/// default construction. | /// default construction. | |||
{ | { | |||
public: | public: | |||
Nullable(): | Nullable(): | |||
/// Creates an empty Nullable. | /// Creates an empty Nullable. | |||
_value(), | _value(), | |||
_isNull(true) | _isNull(true) | |||
{ | { | |||
} | } | |||
Nullable(const NullType&): | ||||
/// Creates an empty Nullable. | ||||
_value(), | ||||
_isNull(true) | ||||
{ | ||||
} | ||||
Nullable(const C& value): | Nullable(const C& value): | |||
/// Creates a Nullable with the given value. | /// Creates a Nullable with the given value. | |||
_value(value), | _value(value), | |||
_isNull(false) | _isNull(false) | |||
{ | { | |||
} | } | |||
Nullable(const Nullable& other): | Nullable(const Nullable& other): | |||
/// Creates a Nullable by copying another one. | /// Creates a Nullable by copying another one. | |||
_value(other._value), | _value(other._value), | |||
skipping to change at line 113 | skipping to change at line 127 | |||
} | } | |||
Nullable& assign(const Nullable& other) | Nullable& assign(const Nullable& other) | |||
/// Assigns another Nullable. | /// Assigns another Nullable. | |||
{ | { | |||
Nullable tmp(other); | Nullable tmp(other); | |||
swap(tmp); | swap(tmp); | |||
return *this; | return *this; | |||
} | } | |||
Nullable& assign(NullType) | ||||
/// Sets value to null. | ||||
{ | ||||
_isNull = true; | ||||
return *this; | ||||
} | ||||
Nullable& operator = (const C& value) | Nullable& operator = (const C& value) | |||
/// Assigns a value to the Nullable. | ||||
{ | { | |||
return assign(value); | return assign(value); | |||
} | } | |||
Nullable& operator = (const Nullable& other) | Nullable& operator = (const Nullable& other) | |||
/// Assigns another Nullable. | ||||
{ | { | |||
return assign(other); | return assign(other); | |||
} | } | |||
Nullable& operator = (NullType) | ||||
/// Assigns another Nullable. | ||||
{ | ||||
_isNull = true; | ||||
return *this; | ||||
} | ||||
void swap(Nullable& other) | void swap(Nullable& other) | |||
/// Swaps this Nullable with other. | ||||
{ | { | |||
std::swap(_value, other._value); | std::swap(_value, other._value); | |||
std::swap(_isNull, other._isNull); | std::swap(_isNull, other._isNull); | |||
} | } | |||
bool operator == (const Nullable<C>& other) const | ||||
/// Compares two Nullables for equality | ||||
{ | ||||
return (_isNull && other._isNull) || (_isNull == other._isNu | ||||
ll && _value == other._value); | ||||
} | ||||
bool operator == (const C& value) const | ||||
/// Compares Nullable with value for equality | ||||
{ | ||||
return (!_isNull && _value == value); | ||||
} | ||||
bool operator == (const NullType&) const | ||||
/// Compares Nullable with NullData for equality | ||||
{ | ||||
return _isNull; | ||||
} | ||||
bool operator != (const C& value) const | ||||
/// Compares Nullable with value for non equality | ||||
{ | ||||
return !(*this == value); | ||||
} | ||||
bool operator != (const Nullable<C>& other) const | ||||
/// Compares two Nullables for non equality | ||||
{ | ||||
return !(*this == other); | ||||
} | ||||
bool operator != (const NullType&) const | ||||
/// Compares with NullData for non equality | ||||
{ | ||||
return !_isNull; | ||||
} | ||||
bool operator < (const Nullable<C>& other) const | ||||
/// Compares two Nullable objects. Return true if this objec | ||||
t's | ||||
/// value is smaler than the other object's value. | ||||
/// Null value is smaller than a non-null value. | ||||
{ | ||||
if (_isNull && other._isNull) return false; | ||||
if (!_isNull && !other._isNull) | ||||
return (_value < other._value); | ||||
if (_isNull && !other._isNull) return true; | ||||
return false; | ||||
} | ||||
bool operator > (const Nullable<C>& other) const | ||||
/// Compares two Nullable objects. Return true if this objec | ||||
t's | ||||
/// value is greater than the other object's value. | ||||
/// A non-null value is greater than a null value. | ||||
{ | ||||
return !(*this == other) && !(*this < other); | ||||
} | ||||
C& value() | ||||
/// Returns the Nullable's value. | ||||
/// | ||||
/// Throws a NullValueException if the Nullable is empty. | ||||
{ | ||||
if (!_isNull) | ||||
return _value; | ||||
else | ||||
throw NullValueException(); | ||||
} | ||||
const C& value() const | const C& value() const | |||
/// Returns the Nullable's value. | /// Returns the Nullable's value. | |||
/// | /// | |||
/// Throws a NullValueException if the Nullable is empty. | /// Throws a NullValueException if the Nullable is empty. | |||
{ | { | |||
if (!_isNull) | if (!_isNull) | |||
return _value; | return _value; | |||
else | else | |||
throw NullValueException(); | throw NullValueException(); | |||
} | } | |||
const C& value(const C& deflt) const | const C& value(const C& deflt) const | |||
/// Returns the Nullable's value, or the | /// Returns the Nullable's value, or the | |||
/// given default value if the Nullable is empty. | /// given default value if the Nullable is empty. | |||
{ | { | |||
return _isNull ? deflt : _value; | return _isNull ? deflt : _value; | |||
} | } | |||
operator C& () | ||||
/// Get reference to the value | ||||
{ | ||||
return value(); | ||||
} | ||||
operator const C& () const | ||||
/// Get const reference to the value | ||||
{ | ||||
return value(); | ||||
} | ||||
operator NullType& () | ||||
/// Get reference to the value | ||||
{ | ||||
return _null; | ||||
} | ||||
bool isNull() const | bool isNull() const | |||
/// Returns true iff the Nullable is empty. | /// Returns true if the Nullable is empty. | |||
{ | { | |||
return _isNull; | return _isNull; | |||
} | } | |||
void clear() | void clear() | |||
/// Clears the Nullable. | /// Clears the Nullable. | |||
{ | { | |||
_isNull = true; | _isNull = true; | |||
} | } | |||
private: | private: | |||
C _value; | C _value; | |||
bool _isNull; | bool _isNull; | |||
NullType _null; | ||||
}; | }; | |||
template <typename C> | template <typename C> | |||
inline void swap(Nullable<C>& n1, Nullable<C>& n2) | inline void swap(Nullable<C>& n1, Nullable<C>& n2) | |||
{ | { | |||
n1.swap(n2); | n1.swap(n2); | |||
} | } | |||
template <typename C> | ||||
std::ostream& operator<<(std::ostream& out, const Nullable<C>& obj) | ||||
{ | ||||
if (!obj.isNull()) out << obj.value(); | ||||
return out; | ||||
} | ||||
template <typename C> | ||||
bool operator == (const NullType&, const Nullable<C>& n) | ||||
/// Returns true if this Nullable is null. | ||||
{ | ||||
return n.isNull(); | ||||
} | ||||
template <typename C> | ||||
bool operator != (const C& c, const Nullable<C>& n) | ||||
/// Compares Nullable with value for non equality | ||||
{ | ||||
return !(n == c); | ||||
} | ||||
template <typename C> | ||||
bool operator == (const C& c, const Nullable<C>& n) | ||||
/// Compares Nullable with NullData for equality | ||||
{ | ||||
return (n == c); | ||||
} | ||||
template <typename C> | ||||
bool operator != (const NullType&, const Nullable<C>& n) | ||||
/// Returns true if this Nullable is not null. | ||||
{ | ||||
return !n.isNull(); | ||||
} | ||||
} // namespace Poco | } // namespace Poco | |||
#endif // Foundation_Nullable_INCLUDED | #endif // Foundation_Nullable_INCLUDED | |||
End of changes. 15 change blocks. | ||||
6 lines changed or deleted | 165 lines changed or added | |||
NumberFormatter.h | NumberFormatter.h | |||
---|---|---|---|---|
skipping to change at line 59 | skipping to change at line 59 | |||
/// There are two kind of static member functions: | /// There are two kind of static member functions: | |||
/// * format* functions return a std::string containing | /// * format* functions return a std::string containing | |||
/// the formatted value. | /// the formatted value. | |||
/// * append* functions append the formatted value to | /// * append* functions append the formatted value to | |||
/// an existing string. | /// an existing string. | |||
/// | /// | |||
/// Internally, std::sprintf() is used to do the actual | /// Internally, std::sprintf() is used to do the actual | |||
/// formatting. | /// formatting. | |||
{ | { | |||
public: | public: | |||
enum BoolFormat | ||||
{ | ||||
FMT_TRUE_FALSE, | ||||
FMT_YES_NO, | ||||
FMT_ON_OFF | ||||
}; | ||||
static std::string format(int value); | static std::string format(int value); | |||
/// Formats an integer value in decimal notation. | /// Formats an integer value in decimal notation. | |||
static std::string format(int value, int width); | static std::string format(int value, int width); | |||
/// Formats an integer value in decimal notation, | /// Formats an integer value in decimal notation, | |||
/// right justified in a field having at least | /// right justified in a field having at least | |||
/// the specified width. | /// the specified width. | |||
static std::string format0(int value, int width); | static std::string format0(int value, int width); | |||
/// Formats an integer value in decimal notation, | /// Formats an integer value in decimal notation, | |||
skipping to change at line 215 | skipping to change at line 222 | |||
static std::string format(double value, int width, int precision); | static std::string format(double value, int width, int precision); | |||
/// Formats a double value in decimal floating-point notatio n, | /// Formats a double value in decimal floating-point notatio n, | |||
/// right justified in a field of the specified width, | /// right justified in a field of the specified width, | |||
/// with the number of fractional digits given in precision. | /// with the number of fractional digits given in precision. | |||
static std::string format(const void* ptr); | static std::string format(const void* ptr); | |||
/// Formats a pointer in an eight (32-bit architectures) or | /// Formats a pointer in an eight (32-bit architectures) or | |||
/// sixteen (64-bit architectures) characters wide | /// sixteen (64-bit architectures) characters wide | |||
/// field in hexadecimal notation. | /// field in hexadecimal notation. | |||
static std::string format(bool value, BoolFormat format = FMT_TRUE_F | ||||
ALSE); | ||||
/// Formats a bool value in decimal/text notation, | ||||
/// according to format parameter. | ||||
static void append(std::string& str, int value); | static void append(std::string& str, int value); | |||
/// Formats an integer value in decimal notation. | /// Formats an integer value in decimal notation. | |||
static void append(std::string& str, int value, int width); | static void append(std::string& str, int value, int width); | |||
/// Formats an integer value in decimal notation, | /// Formats an integer value in decimal notation, | |||
/// right justified in a field having at least | /// right justified in a field having at least | |||
/// the specified width. | /// the specified width. | |||
static void append0(std::string& str, int value, int width); | static void append0(std::string& str, int value, int width); | |||
/// Formats an integer value in decimal notation, | /// Formats an integer value in decimal notation, | |||
End of changes. 2 change blocks. | ||||
0 lines changed or deleted | 12 lines changed or added | |||
NumberParser.h | NumberParser.h | |||
---|---|---|---|---|
// | // | |||
// NumberParser.h | // NumberParser.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/NumberParser.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/NumberParser.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: NumberParser | // Module: NumberParser | |||
// | // | |||
// Definition of the NumberParser class. | // Definition of the NumberParser class. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 42 | skipping to change at line 42 | |||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | |||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Foundation_NumberParser_INCLUDED | #ifndef Foundation_NumberParser_INCLUDED | |||
#define Foundation_NumberParser_INCLUDED | #define Foundation_NumberParser_INCLUDED | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
#include <string> | ||||
#undef min | ||||
#undef max | ||||
#include <limits> | ||||
namespace Poco { | namespace Poco { | |||
class Foundation_API NumberParser | class Foundation_API NumberParser | |||
/// The NumberParser class provides static methods | /// The NumberParser class provides static methods | |||
/// for parsing numbers out of strings. | /// for parsing numbers out of strings. | |||
{ | { | |||
public: | public: | |||
static int parse(const std::string& s); | static const unsigned short NUM_BASE_OCT = 010; | |||
static const unsigned short NUM_BASE_DEC = 10; | ||||
static const unsigned short NUM_BASE_HEX = 0x10; | ||||
static int parse(const std::string& s, char thousandSeparator = ',') | ||||
; | ||||
/// Parses an integer value in decimal notation from the giv en string. | /// Parses an integer value in decimal notation from the giv en string. | |||
/// Throws a SyntaxException if the string does not hold a n umber in decimal notation. | /// Throws a SyntaxException if the string does not hold a n umber in decimal notation. | |||
static bool tryParse(const std::string& s, int& value); | static bool tryParse(const std::string& s, int& value, char thousand Separator = ','); | |||
/// Parses an integer value in decimal notation from the giv en string. | /// Parses an integer value in decimal notation from the giv en string. | |||
/// Returns true if a valid integer has been found, false ot herwise. | /// Returns true if a valid integer has been found, false ot herwise. | |||
/// If parsing was not successful, value is undefined. | ||||
static unsigned parseUnsigned(const std::string& s); | static unsigned parseUnsigned(const std::string& s, char thousandSep arator = ','); | |||
/// Parses an unsigned integer value in decimal notation fro m the given string. | /// Parses an unsigned integer value in decimal notation fro m the given string. | |||
/// Throws a SyntaxException if the string does not hold a n umber in decimal notation. | /// Throws a SyntaxException if the string does not hold a n umber in decimal notation. | |||
static bool tryParseUnsigned(const std::string& s, unsigned& value); | static bool tryParseUnsigned(const std::string& s, unsigned& value, char thousandSeparator = ','); | |||
/// Parses an unsigned integer value in decimal notation fro m the given string. | /// Parses an unsigned integer value in decimal notation fro m the given string. | |||
/// Returns true if a valid integer has been found, false ot herwise. | /// Returns true if a valid integer has been found, false ot herwise. | |||
/// If parsing was not successful, value is undefined. | ||||
static unsigned parseHex(const std::string& s); | static unsigned parseHex(const std::string& s); | |||
/// Parses an integer value in hexadecimal notation from the given string. | /// Parses an integer value in hexadecimal notation from the given string. | |||
/// Throws a SyntaxException if the string does not hold a n umber in | /// Throws a SyntaxException if the string does not hold a n umber in | |||
/// hexadecimal notation. | /// hexadecimal notation. | |||
static bool tryParseHex(const std::string& s, unsigned& value); | static bool tryParseHex(const std::string& s, unsigned& value); | |||
/// Parses an unsigned integer value in hexadecimal notation from the given string. | /// Parses an unsigned integer value in hexadecimal notation from the given string. | |||
/// Returns true if a valid integer has been found, false ot herwise. | /// Returns true if a valid integer has been found, false ot herwise. | |||
/// If parsing was not successful, value is undefined. | ||||
static unsigned parseOct(const std::string& s); | ||||
/// Parses an integer value in octal notation from the given | ||||
string. | ||||
/// Throws a SyntaxException if the string does not hold a n | ||||
umber in | ||||
/// hexadecimal notation. | ||||
static bool tryParseOct(const std::string& s, unsigned& value); | ||||
/// Parses an unsigned integer value in octal notation from | ||||
the given string. | ||||
/// Returns true if a valid integer has been found, false ot | ||||
herwise. | ||||
#if defined(POCO_HAVE_INT64) | #if defined(POCO_HAVE_INT64) | |||
static Int64 parse64(const std::string& s); | static Int64 parse64(const std::string& s, char thousandSeparator = ','); | |||
/// Parses a 64-bit integer value in decimal notation from t he given string. | /// Parses a 64-bit integer value in decimal notation from t he given string. | |||
/// Throws a SyntaxException if the string does not hold a n umber in decimal notation. | /// Throws a SyntaxException if the string does not hold a n umber in decimal notation. | |||
static bool tryParse64(const std::string& s, Int64& value); | static bool tryParse64(const std::string& s, Int64& value, char thou sandSeparator = ','); | |||
/// Parses a 64-bit integer value in decimal notation from t he given string. | /// Parses a 64-bit integer value in decimal notation from t he given string. | |||
/// Returns true if a valid integer has been found, false ot herwise. | /// Returns true if a valid integer has been found, false ot herwise. | |||
/// If parsing was not successful, value is undefined. | ||||
static UInt64 parseUnsigned64(const std::string& s); | static UInt64 parseUnsigned64(const std::string& s, char thousandSep arator = ','); | |||
/// Parses an unsigned 64-bit integer value in decimal notat ion from the given string. | /// Parses an unsigned 64-bit integer value in decimal notat ion from the given string. | |||
/// Throws a SyntaxException if the string does not hold a n umber in decimal notation. | /// Throws a SyntaxException if the string does not hold a n umber in decimal notation. | |||
static bool tryParseUnsigned64(const std::string& s, UInt64& value); | static bool tryParseUnsigned64(const std::string& s, UInt64& value, char thousandSeparator = ','); | |||
/// Parses an unsigned 64-bit integer value in decimal notat ion from the given string. | /// Parses an unsigned 64-bit integer value in decimal notat ion from the given string. | |||
/// Returns true if a valid integer has been found, false ot herwise. | /// Returns true if a valid integer has been found, false ot herwise. | |||
/// If parsing was not successful, value is undefined. | ||||
static UInt64 parseHex64(const std::string& s); | static UInt64 parseHex64(const std::string& s); | |||
/// Parses a 64 bit-integer value in hexadecimal notation fr om the given string. | /// Parses a 64 bit-integer value in hexadecimal notation fr om the given string. | |||
/// Throws a SyntaxException if the string does not hold a n umber in hexadecimal notation. | /// Throws a SyntaxException if the string does not hold a n umber in hexadecimal notation. | |||
static bool tryParseHex64(const std::string& s, UInt64& value); | static bool tryParseHex64(const std::string& s, UInt64& value); | |||
/// Parses an unsigned 64-bit integer value in hexadecimal n otation from the given string. | /// Parses an unsigned 64-bit integer value in hexadecimal n otation from the given string. | |||
/// Returns true if a valid integer has been found, false ot herwise. | /// Returns true if a valid integer has been found, false ot herwise. | |||
/// If parsing was not successful, value is undefined. | ||||
static UInt64 parseOct64(const std::string& s); | ||||
/// Parses a 64 bit-integer value in octal notation from the | ||||
given string. | ||||
/// Throws a SyntaxException if the string does not hold a n | ||||
umber in hexadecimal notation. | ||||
static bool tryParseOct64(const std::string& s, UInt64& value); | ||||
/// Parses an unsigned 64-bit integer value in octal notatio | ||||
n from the given string. | ||||
/// Returns true if a valid integer has been found, false ot | ||||
herwise. | ||||
#endif // defined(POCO_HAVE_INT64) | #endif // defined(POCO_HAVE_INT64) | |||
static double parseFloat(const std::string& s); | static double parseFloat(const std::string& s, char decimalSeparator = '.', char thousandSeparator = ','); | |||
/// Parses a double value in decimal floating point notation | /// Parses a double value in decimal floating point notation | |||
/// from the given string. | /// from the given string. | |||
/// Throws a SyntaxException if the string does not hold a f loating-point | /// Throws a SyntaxException if the string does not hold a f loating-point | |||
/// number in decimal notation. | /// number in decimal notation. | |||
static bool tryParseFloat(const std::string& s, double& value); | static bool tryParseFloat(const std::string& s, double& value, char decimalSeparator = '.', char thousandSeparator = ','); | |||
/// Parses a double value in decimal floating point notation | /// Parses a double value in decimal floating point notation | |||
/// from the given string. | /// from the given string. | |||
/// Returns true if a valid floating point number has been f ound, | /// Returns true if a valid floating point number has been f ound, | |||
/// false otherwise. | /// false otherwise. | |||
/// If parsing was not successful, value is undefined. | ||||
static bool parseBool(const std::string& s); | ||||
/// Parses a bool value in decimal or string notation | ||||
/// from the given string. | ||||
/// Valid forms are: "0", "1", "true", "on", false", "yes", | ||||
"no", "off". | ||||
/// String forms are NOT case sensitive. | ||||
/// Throws a SyntaxException if the string does not hold a v | ||||
alid bool number | ||||
static bool tryParseBool(const std::string& s, bool& value); | ||||
/// Parses a bool value in decimal or string notation | ||||
/// from the given string. | ||||
/// Valid forms are: "0", "1", "true", "on", false", "yes", | ||||
"no", "off". | ||||
/// String forms are NOT case sensitive. | ||||
/// Returns true if a valid bool number has been found, | ||||
/// false otherwise. | ||||
}; | }; | |||
} // namespace Poco | } // namespace Poco | |||
#endif // Foundation_NumberParser_INCLUDED | #endif // Foundation_NumberParser_INCLUDED | |||
End of changes. 19 change blocks. | ||||
18 lines changed or deleted | 63 lines changed or added | |||
ObjectPool.h | ObjectPool.h | |||
---|---|---|---|---|
// | // | |||
// ObjectPool.h | // ObjectPool.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/ObjectPool.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/ObjectPool.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: ObjectPool | // Module: ObjectPool | |||
// | // | |||
// Definition of the ObjectPool template class and friends. | // Definition of the ObjectPool template class and friends. | |||
// | // | |||
// Copyright (c) 2010-2012, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2010-2012, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 185 | skipping to change at line 185 | |||
/// When an object is returned to the pool: | /// When an object is returned to the pool: | |||
/// - If the object is valid (checked by calling validateObject() | /// - If the object is valid (checked by calling validateObject() | |||
/// from the object factory), the object is deactivated. If the | /// from the object factory), the object is deactivated. If the | |||
/// number of objects in the pool is below the capacity, | /// number of objects in the pool is below the capacity, | |||
/// the object is added to the pool. Otherwise it is destroyed. | /// the object is added to the pool. Otherwise it is destroyed. | |||
/// - If the object is not valid, it is destroyed immediately. | /// - If the object is not valid, it is destroyed immediately. | |||
{ | { | |||
public: | public: | |||
ObjectPool(std::size_t capacity, std::size_t peakCapacity): | ObjectPool(std::size_t capacity, std::size_t peakCapacity): | |||
/// Creates a new ObjectPool with the given capacity | /// Creates a new ObjectPool with the given capacity | |||
/// and peak capcacity. | /// and peak capacity. | |||
/// | /// | |||
/// The PoolableObjectFactory must have a public default con structor. | /// The PoolableObjectFactory must have a public default con structor. | |||
_capacity(capacity), | _capacity(capacity), | |||
_peakCapacity(peakCapacity), | _peakCapacity(peakCapacity), | |||
_size(0) | _size(0) | |||
{ | { | |||
poco_assert (capacity <= peakCapacity); | poco_assert (capacity <= peakCapacity); | |||
} | } | |||
ObjectPool(const F& factory, std::size_t capacity, std::size_t peakC apacity): | ObjectPool(const F& factory, std::size_t capacity, std::size_t peakC apacity): | |||
skipping to change at line 210 | skipping to change at line 210 | |||
_capacity(capacity), | _capacity(capacity), | |||
_peakCapacity(peakCapacity), | _peakCapacity(peakCapacity), | |||
_size(0) | _size(0) | |||
{ | { | |||
poco_assert (capacity <= peakCapacity); | poco_assert (capacity <= peakCapacity); | |||
} | } | |||
~ObjectPool() | ~ObjectPool() | |||
/// Destroys the ObjectPool. | /// Destroys the ObjectPool. | |||
{ | { | |||
try | for (typename std::vector<P>::iterator it = _pool.begin(); i t != _pool.end(); ++it) | |||
{ | { | |||
for (typename std::vector<P>::iterator it = _pool.be | _factory.destroyObject(*it); | |||
gin(); it != _pool.end(); ++it) | ||||
{ | ||||
_factory.destroyObject(*it); | ||||
} | ||||
} | ||||
catch (...) | ||||
{ | ||||
poco_unexpected(); | ||||
} | } | |||
} | } | |||
P borrowObject() | P borrowObject() | |||
/// Obtains an object from the pool, or creates a new object if | /// Obtains an object from the pool, or creates a new object if | |||
/// possible. | /// possible. | |||
/// | /// | |||
/// Returns null if no object is available. | /// Returns null if no object is available. | |||
/// | /// | |||
/// If activating the object fails, the object is destroyed and | /// If activating the object fails, the object is destroyed and | |||
End of changes. 4 change blocks. | ||||
12 lines changed or deleted | 4 lines changed or added | |||
Path_WIN32.h | Path_WIN32.h | |||
---|---|---|---|---|
// | // | |||
// Path_WIN32.h | // Path_WIN32.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Path_WIN32.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/Path_WIN32.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Filesystem | // Package: Filesystem | |||
// Module: Path | // Module: Path | |||
// | // | |||
// Definition of the PathImpl class for WIN32. | // Definition of the PathImpl class for WIN32. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 53 | skipping to change at line 53 | |||
namespace Poco { | namespace Poco { | |||
class Foundation_API PathImpl | class Foundation_API PathImpl | |||
{ | { | |||
public: | public: | |||
static std::string currentImpl(); | static std::string currentImpl(); | |||
static std::string homeImpl(); | static std::string homeImpl(); | |||
static std::string tempImpl(); | static std::string tempImpl(); | |||
static std::string nullImpl(); | static std::string nullImpl(); | |||
static std::string systemImpl(); | ||||
static std::string expandImpl(const std::string& path); | static std::string expandImpl(const std::string& path); | |||
static void listRootsImpl(std::vector<std::string>& roots); | static void listRootsImpl(std::vector<std::string>& roots); | |||
}; | }; | |||
} // namespace Poco | } // namespace Poco | |||
#endif // Foundation_Path_WIN32_INCLUDED | #endif // Foundation_Path_WIN32_INCLUDED | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 1 lines changed or added | |||
Path_WIN32U.h | Path_WIN32U.h | |||
---|---|---|---|---|
// | // | |||
// Path_WIN32U.h | // Path_WIN32U.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Path_WIN32U.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/Path_WIN32U.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Filesystem | // Package: Filesystem | |||
// Module: Path | // Module: Path | |||
// | // | |||
// Definition of the PathImpl class for WIN32. | // Definition of the PathImpl class for WIN32. | |||
// | // | |||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 53 | skipping to change at line 53 | |||
namespace Poco { | namespace Poco { | |||
class Foundation_API PathImpl | class Foundation_API PathImpl | |||
{ | { | |||
public: | public: | |||
static std::string currentImpl(); | static std::string currentImpl(); | |||
static std::string homeImpl(); | static std::string homeImpl(); | |||
static std::string tempImpl(); | static std::string tempImpl(); | |||
static std::string nullImpl(); | static std::string nullImpl(); | |||
static std::string systemImpl(); | ||||
static std::string expandImpl(const std::string& path); | static std::string expandImpl(const std::string& path); | |||
static void listRootsImpl(std::vector<std::string>& roots); | static void listRootsImpl(std::vector<std::string>& roots); | |||
enum | enum | |||
{ | { | |||
MAX_PATH_LEN = 32767 | MAX_PATH_LEN = 32767 | |||
}; | }; | |||
}; | }; | |||
} // namespace Poco | } // namespace Poco | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 1 lines changed or added | |||
Platform.h | Platform.h | |||
---|---|---|---|---|
// | // | |||
// Platform.h | // Platform.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Platform.h#9 $ | // $Id: //poco/1.4/Foundation/include/Poco/Platform.h#4 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: Platform | // Module: Platform | |||
// | // | |||
// Platform and architecture identification macros. | // Platform and architecture identification macros. | |||
// | // | |||
// NOTE: This file may be included from both C++ and C code, so it | // NOTE: This file may be included from both C++ and C code, so it | |||
// must not contain any C++ specific things. | // must not contain any C++ specific things. | |||
// | // | |||
skipping to change at line 65 | skipping to change at line 65 | |||
#define POCO_OS_IRIX 0x0009 | #define POCO_OS_IRIX 0x0009 | |||
#define POCO_OS_SOLARIS 0x000a | #define POCO_OS_SOLARIS 0x000a | |||
#define POCO_OS_QNX 0x000b | #define POCO_OS_QNX 0x000b | |||
#define POCO_OS_VXWORKS 0x000c | #define POCO_OS_VXWORKS 0x000c | |||
#define POCO_OS_CYGWIN 0x000d | #define POCO_OS_CYGWIN 0x000d | |||
#define POCO_OS_UNKNOWN_UNIX 0x00ff | #define POCO_OS_UNKNOWN_UNIX 0x00ff | |||
#define POCO_OS_WINDOWS_NT 0x1001 | #define POCO_OS_WINDOWS_NT 0x1001 | |||
#define POCO_OS_WINDOWS_CE 0x1011 | #define POCO_OS_WINDOWS_CE 0x1011 | |||
#define POCO_OS_VMS 0x2001 | #define POCO_OS_VMS 0x2001 | |||
#if defined(__FreeBSD__) | #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) | |||
#define POCO_OS_FAMILY_UNIX 1 | #define POCO_OS_FAMILY_UNIX 1 | |||
#define POCO_OS_FAMILY_BSD 1 | #define POCO_OS_FAMILY_BSD 1 | |||
#define POCO_OS POCO_OS_FREE_BSD | #define POCO_OS POCO_OS_FREE_BSD | |||
#elif defined(_AIX) || defined(__TOS_AIX__) | #elif defined(_AIX) || defined(__TOS_AIX__) | |||
#define POCO_OS_FAMILY_UNIX 1 | #define POCO_OS_FAMILY_UNIX 1 | |||
#define POCO_OS POCO_OS_AIX | #define POCO_OS POCO_OS_AIX | |||
#elif defined(hpux) || defined(_hpux) | #elif defined(hpux) || defined(_hpux) | |||
#define POCO_OS_FAMILY_UNIX 1 | #define POCO_OS_FAMILY_UNIX 1 | |||
#define POCO_OS POCO_OS_HPUX | #define POCO_OS POCO_OS_HPUX | |||
#elif defined(__digital__) || defined(__osf__) | #elif defined(__digital__) || defined(__osf__) | |||
skipping to change at line 102 | skipping to change at line 102 | |||
#define POCO_OS POCO_OS_OPEN_BSD | #define POCO_OS POCO_OS_OPEN_BSD | |||
#elif defined(sgi) || defined(__sgi) | #elif defined(sgi) || defined(__sgi) | |||
#define POCO_OS_FAMILY_UNIX 1 | #define POCO_OS_FAMILY_UNIX 1 | |||
#define POCO_OS POCO_OS_IRIX | #define POCO_OS POCO_OS_IRIX | |||
#elif defined(sun) || defined(__sun) | #elif defined(sun) || defined(__sun) | |||
#define POCO_OS_FAMILY_UNIX 1 | #define POCO_OS_FAMILY_UNIX 1 | |||
#define POCO_OS POCO_OS_SOLARIS | #define POCO_OS POCO_OS_SOLARIS | |||
#elif defined(__QNX__) | #elif defined(__QNX__) | |||
#define POCO_OS_FAMILY_UNIX 1 | #define POCO_OS_FAMILY_UNIX 1 | |||
#define POCO_OS POCO_OS_QNX | #define POCO_OS POCO_OS_QNX | |||
#elif defined(__CYGWIN__) | ||||
#define POCO_OS_FAMILY_UNIX 1 | ||||
#define POCO_OS POCO_OS_CYGWIN | ||||
#elif defined(unix) || defined(__unix) || defined(__unix__) | #elif defined(unix) || defined(__unix) || defined(__unix__) | |||
#define POCO_OS_FAMILY_UNIX 1 | #define POCO_OS_FAMILY_UNIX 1 | |||
#define POCO_OS POCO_OS_UNKNOWN_UNIX | #define POCO_OS POCO_OS_UNKNOWN_UNIX | |||
#elif defined(_WIN32_WCE) | #elif defined(_WIN32_WCE) | |||
#define POCO_OS_FAMILY_WINDOWS 1 | #define POCO_OS_FAMILY_WINDOWS 1 | |||
#define POCO_OS POCO_OS_WINDOWS_CE | #define POCO_OS POCO_OS_WINDOWS_CE | |||
#elif defined(_WIN32) || defined(_WIN64) | #elif defined(_WIN32) || defined(_WIN64) | |||
#define POCO_OS_FAMILY_WINDOWS 1 | #define POCO_OS_FAMILY_WINDOWS 1 | |||
#define POCO_OS POCO_OS_WINDOWS_NT | #define POCO_OS POCO_OS_WINDOWS_NT | |||
#elif defined(__CYGWIN__) | ||||
#define POCO_OS_FAMILY_UNIX 1 | ||||
#define POCO_OS POCO_OS_CYGWIN | ||||
#elif defined(__VMS) | #elif defined(__VMS) | |||
#define POCO_OS_FAMILY_VMS 1 | #define POCO_OS_FAMILY_VMS 1 | |||
#define POCO_OS POCO_OS_VMS | #define POCO_OS POCO_OS_VMS | |||
#elif defined(POCO_VXWORKS) | #elif defined(POCO_VXWORKS) | |||
#define POCO_OS_FAMILY_UNIX 1 | #define POCO_OS_FAMILY_UNIX 1 | |||
#define POCO_OS POCO_OS_VXWORKS | #define POCO_OS POCO_OS_VXWORKS | |||
#endif | #endif | |||
#if !defined(POCO_OS) | ||||
#error "Unknown Platform." | ||||
#endif | ||||
// | // | |||
// Hardware Architecture and Byte Order | // Hardware Architecture and Byte Order | |||
// | // | |||
#define POCO_ARCH_ALPHA 0x01 | #define POCO_ARCH_ALPHA 0x01 | |||
#define POCO_ARCH_IA32 0x02 | #define POCO_ARCH_IA32 0x02 | |||
#define POCO_ARCH_IA64 0x03 | #define POCO_ARCH_IA64 0x03 | |||
#define POCO_ARCH_MIPS 0x04 | #define POCO_ARCH_MIPS 0x04 | |||
#define POCO_ARCH_HPPA 0x05 | #define POCO_ARCH_HPPA 0x05 | |||
#define POCO_ARCH_PPC 0x06 | #define POCO_ARCH_PPC 0x06 | |||
#define POCO_ARCH_POWER 0x07 | #define POCO_ARCH_POWER 0x07 | |||
#define POCO_ARCH_SPARC 0x08 | #define POCO_ARCH_SPARC 0x08 | |||
#define POCO_ARCH_AMD64 0x09 | #define POCO_ARCH_AMD64 0x09 | |||
#define POCO_ARCH_ARM 0x0a | #define POCO_ARCH_ARM 0x0a | |||
#define POCO_ARCH_M68K 0x0b | #define POCO_ARCH_M68K 0x0b | |||
#define POCO_ARCH_S390 0x0c | #define POCO_ARCH_S390 0x0c | |||
#define POCO_ARCH_SH 0x0d | #define POCO_ARCH_SH 0x0d | |||
#define POCO_ARCH_NIOS2 0x0e | #define POCO_ARCH_NIOS2 0x0e | |||
#define POCO_ARCH_ARM64 0x0f | ||||
#if defined(__ALPHA) || defined(__alpha) || defined(__alpha__) || defined(_ M_ALPHA) | #if defined(__ALPHA) || defined(__alpha) || defined(__alpha__) || defined(_ M_ALPHA) | |||
#define POCO_ARCH POCO_ARCH_ALPHA | #define POCO_ARCH POCO_ARCH_ALPHA | |||
#define POCO_ARCH_LITTLE_ENDIAN 1 | #define POCO_ARCH_LITTLE_ENDIAN 1 | |||
#elif defined(i386) || defined(__i386) || defined(__i386__) || defined(_M_I X86) | #elif defined(i386) || defined(__i386) || defined(__i386__) || defined(_M_I X86) | |||
#define POCO_ARCH POCO_ARCH_IA32 | #define POCO_ARCH POCO_ARCH_IA32 | |||
#define POCO_ARCH_LITTLE_ENDIAN 1 | #define POCO_ARCH_LITTLE_ENDIAN 1 | |||
#elif defined(_IA64) || defined(__IA64__) || defined(__ia64__) || defined(_ _ia64) || defined(_M_IA64) | #elif defined(_IA64) || defined(__IA64__) || defined(__ia64__) || defined(_ _ia64) || defined(_M_IA64) | |||
#define POCO_ARCH POCO_ARCH_IA64 | #define POCO_ARCH POCO_ARCH_IA64 | |||
#if defined(hpux) || defined(_hpux) | #if defined(hpux) || defined(_hpux) | |||
skipping to change at line 185 | skipping to change at line 180 | |||
#elif defined(__sparc__) || defined(__sparc) || defined(sparc) | #elif defined(__sparc__) || defined(__sparc) || defined(sparc) | |||
#define POCO_ARCH POCO_ARCH_SPARC | #define POCO_ARCH POCO_ARCH_SPARC | |||
#define POCO_ARCH_BIG_ENDIAN 1 | #define POCO_ARCH_BIG_ENDIAN 1 | |||
#elif defined(__arm__) || defined(__arm) || defined(ARM) || defined(_ARM_) || defined(__ARM__) || defined(_M_ARM) | #elif defined(__arm__) || defined(__arm) || defined(ARM) || defined(_ARM_) || defined(__ARM__) || defined(_M_ARM) | |||
#define POCO_ARCH POCO_ARCH_ARM | #define POCO_ARCH POCO_ARCH_ARM | |||
#if defined(__ARMEB__) | #if defined(__ARMEB__) | |||
#define POCO_ARCH_BIG_ENDIAN 1 | #define POCO_ARCH_BIG_ENDIAN 1 | |||
#else | #else | |||
#define POCO_ARCH_LITTLE_ENDIAN 1 | #define POCO_ARCH_LITTLE_ENDIAN 1 | |||
#endif | #endif | |||
#elif defined(__arm64__) || defined(__arm64) | ||||
#define POCO_ARCH POCO_ARCH_ARM64 | ||||
#if defined(__ARMEB__) | ||||
#define POCO_ARCH_BIG_ENDIAN 1 | ||||
#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && __ | ||||
BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ | ||||
#define POCO_ARCH_BIG_ENDIAN 1 | ||||
#else | ||||
#define POCO_ARCH_LITTLE_ENDIAN 1 | ||||
#endif | ||||
#elif defined(__m68k__) | #elif defined(__m68k__) | |||
#define POCO_ARCH POCO_ARCH_M68K | #define POCO_ARCH POCO_ARCH_M68K | |||
#define POCO_ARCH_BIG_ENDIAN 1 | #define POCO_ARCH_BIG_ENDIAN 1 | |||
#elif defined(__s390__) | #elif defined(__s390__) | |||
#define POCO_ARCH POCO_ARCH_S390 | #define POCO_ARCH POCO_ARCH_S390 | |||
#define POCO_ARCH_BIG_ENDIAN 1 | #define POCO_ARCH_BIG_ENDIAN 1 | |||
#elif defined(__sh__) || defined(__sh) || defined(SHx) || defined(_SHX_) | #elif defined(__sh__) || defined(__sh) | |||
#define POCO_ARCH POCO_ARCH_SH | #define POCO_ARCH POCO_ARCH_SH | |||
#if defined(__LITTLE_ENDIAN__) || (POCO_OS == POCO_OS_WINDOWS_CE) | #if defined(__LITTLE_ENDIAN__) | |||
#define POCO_ARCH_LITTLE_ENDIAN 1 | #define POCO_ARCH_LITTLE_ENDIAN 1 | |||
#else | #else | |||
#define POCO_ARCH_BIG_ENDIAN 1 | #define POCO_ARCH_BIG_ENDIAN 1 | |||
#endif | #endif | |||
#elif defined (nios2) || defined(__nios2) || defined(__nios2__) | #elif defined (nios2) || defined(__nios2) || defined(__nios2__) | |||
#define POCO_ARCH POCO_ARCH_NIOS2 | #define POCO_ARCH POCO_ARCH_NIOS2 | |||
#if defined(__nios2_little_endian) || defined(nios2_little_endian) || d efined(__nios2_little_endian__) | #if defined(__nios2_little_endian) || defined(nios2_little_endian) || d efined(__nios2_little_endian__) | |||
#define POCO_ARCH_LITTLE_ENDIAN 1 | #define POCO_ARCH_LITTLE_ENDIAN 1 | |||
#else | #else | |||
#define POCO_ARCH_BIG_ENDIAN 1 | #define POCO_ARCH_BIG_ENDIAN 1 | |||
#endif | #endif | |||
#endif | #endif | |||
#if !defined(POCO_ARCH) | ||||
#error "Unknown Hardware Architecture." | ||||
#endif | ||||
// | ||||
// Thread-safety of local static initialization | ||||
// | ||||
#if __cplusplus >= 201103L || __GNUC__ >= 4 || defined(__clang__) | ||||
#ifndef POCO_LOCAL_STATIC_INIT_IS_THREADSAFE | ||||
#define POCO_LOCAL_STATIC_INIT_IS_THREADSAFE 1 | ||||
#endif | ||||
#endif | ||||
#endif // Foundation_Platform_INCLUDED | #endif // Foundation_Platform_INCLUDED | |||
End of changes. 10 change blocks. | ||||
35 lines changed or deleted | 7 lines changed or added | |||
Platform_WIN32.h | Platform_WIN32.h | |||
---|---|---|---|---|
// | // | |||
// Platform_WIN32.h | // Platform_WIN32.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Platform_WIN32.h#3 $ | // $Id: //poco/1.4/Foundation/include/Poco/Platform_WIN32.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: Platform | // Module: Platform | |||
// | // | |||
// Platform and architecture identification macros | // Platform and architecture identification macros | |||
// and platform-specific definitions for Windows. | // and platform-specific definitions for Windows. | |||
// | // | |||
// Copyright (c) 2004-2007, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2007, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
skipping to change at line 42 | skipping to change at line 42 | |||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVEN T | // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVEN T | |||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | |||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Foundation_Platform_WIN32_INCLUDED | #ifndef Foundation_Platform_WIN32_INCLUDED | |||
#define Foundation_Platform_WIN32_INCLUDED | #define Foundation_Platform_WIN32_INCLUDED | |||
#include "Poco/UnWindows.h" | ||||
// determine the real version | ||||
#if defined(_WIN32_WINNT_WIN7) | ||||
//Windows 7 _WIN32_WINNT_WIN7 (0x0601) | ||||
#ifdef _WIN32_WINNT | ||||
#undef _WIN32_WINNT | ||||
#endif | ||||
#define _WIN32_WINNT _WIN32_WINNT_WIN7 | ||||
#elif defined (_WIN32_WINNT_WS08) | ||||
//Windows Server 2008 _WIN32_WINNT_WS08 (0x0600) | ||||
#ifdef _WIN32_WINNT | ||||
#undef _WIN32_WINNT | ||||
#endif | ||||
#define _WIN32_WINNT _WIN32_WINNT_WS08 | ||||
#elif defined (_WIN32_WINNT_VISTA) | ||||
//Windows Vista _WIN32_WINNT_VISTA (0x0600) | ||||
#ifdef _WIN32_WINNT | ||||
#undef _WIN32_WINNT | ||||
#endif | ||||
#define _WIN32_WINNT _WIN32_WINNT_VISTA | ||||
#elif defined (_WIN32_WINNT_LONGHORN) | ||||
//Windows Vista and server 2008 Development _WIN32_WINNT_LONGHORN (0 | ||||
x0600) | ||||
#ifdef _WIN32_WINNT | ||||
#undef _WIN32_WINNT | ||||
#endif | ||||
#define _WIN32_WINNT _WIN32_WINNT_LONGHORN | ||||
#elif defined (_WIN32_WINNT_WS03) | ||||
//Windows Server 2003 with SP1, | ||||
//Windows XP with SP2 _WIN32_WINNT_WS03 (0x0502) | ||||
#ifdef _WIN32_WINNT | ||||
#undef _WIN32_WINNT | ||||
#endif | ||||
#define _WIN32_WINNT _WIN32_WINNT_WS03 | ||||
#elif defined (_WIN32_WINNT_WINXP) | ||||
//Windows Server 2003, Windows XP _WIN32_WINNT_WINXP (0x0501) | ||||
#ifdef _WIN32_WINNT | ||||
#undef _WIN32_WINNT | ||||
#endif | ||||
#define _WIN32_WINNT _WIN32_WINNT_WINXP | ||||
#elif defined (_WIN32_WINNT_WIN2K) | ||||
//Windows 2000 _WIN32_WINNT_WIN2K (0x0500) | ||||
#ifdef _WIN32_WINNT | ||||
#undef _WIN32_WINNT | ||||
#endif | ||||
#define _WIN32_WINNT _WIN32_WINNT_WIN2K | ||||
#elif defined (WINVER) | ||||
#ifdef _WIN32_WINNT | ||||
#undef _WIN32_WINNT | ||||
#endif | ||||
#define _WIN32_WINNT WINVER | ||||
#endif | ||||
#if defined(_MSC_VER) && !defined(POCO_MSVC_SECURE_WARNINGS) && !defined(_C | ||||
RT_SECURE_NO_DEPRECATE) | ||||
#define _CRT_SECURE_NO_DEPRECATE | ||||
#endif | ||||
// Verify that we're built with the multithreaded | // Verify that we're built with the multithreaded | |||
// versions of the runtime libraries | // versions of the runtime libraries | |||
#if defined(_MSC_VER) && !defined(_MT) | #if defined(_MSC_VER) && !defined(_MT) | |||
#error Must compile with /MD, /MDd, /MT or /MTd | #error Must compile with /MD, /MDd, /MT or /MTd | |||
#endif | #endif | |||
// Check debug/release settings consistency | // Check debug/release settings consistency | |||
#if defined(NDEBUG) && defined(_DEBUG) | #if defined(NDEBUG) && defined(_DEBUG) | |||
#error Inconsistent build settings (check for /MD[d]) | #error Inconsistent build settings (check for /MD[d]) | |||
#endif | #endif | |||
// Reduce bloat imported by "Poco/UnWindows.h" | #if (_MSC_VER >= 1300) && (_MSC_VER < 1400) // Visual Studio 2003, MSVC++ 7 | |||
#if defined(_WIN32) | .1 | |||
#if !defined(_WIN32_WINNT) | #define POCO_MSVS_VERSION 2003 | |||
#define _WIN32_WINNT 0x0501 | #define POCO_MSVC_VERSION 71 | |||
#endif | #elif (_MSC_VER >= 1400) && (_MSC_VER < 1500) // Visual Studio 2005, MSVC++ | |||
#if !defined(WIN32_LEAN_AND_MEAN) && !defined(POCO_BLOATED_WIN32) | 8.0 | |||
#define WIN32_LEAN_AND_MEAN | #define POCO_MSVS_VERSION 2005 | |||
#endif | #define POCO_MSVC_VERSION 80 | |||
#elif (_MSC_VER >= 1500) && (_MSC_VER < 1600) // Visual Studio 2008, MSVC++ | ||||
9.0 | ||||
#define POCO_MSVS_VERSION 2008 | ||||
#define POCO_MSVC_VERSION 90 | ||||
#elif (_MSC_VER >= 1600) && (_MSC_VER < 1700) // Visual Studio 2010, MSVC++ | ||||
10.0 | ||||
#define POCO_MSVS_VERSION 2010 | ||||
#define POCO_MSVC_VERSION 100 | ||||
#elif (_MSC_VER >= 1700) && (_MSC_VER < 1800) // Visual Studio 2011, MSVC++ | ||||
11.0 | ||||
#define POCO_MSVS_VERSION 2011 | ||||
#define POCO_MSVC_VERSION 110 | ||||
#endif | #endif | |||
// Unicode Support | // Unicode Support | |||
#if defined(UNICODE) && !defined(POCO_WIN32_UTF8) | #if defined(UNICODE) && !defined(POCO_WIN32_UTF8) | |||
#define POCO_WIN32_UTF8 | #define POCO_WIN32_UTF8 | |||
#endif | #endif | |||
// Turn off some annoying warnings | // Turn off some annoying warnings | |||
#if defined(_MSC_VER) | #if defined(_MSC_VER) | |||
#pragma warning(disable:4018) // signed/unsigned comparison | #pragma warning(disable:4018) // signed/unsigned comparison | |||
#pragma warning(disable:4251) // ... needs to have dll-interface war | #pragma warning(disable:4250) // VC++ 11.0: inheriting from std st | |||
ning | ream classes produces C4250 warning; | |||
#pragma warning(disable:4355) // 'this' : used in base member initia | // s | |||
lizer list | ee <http://connect.microsoft.com/VisualStudio/feedback/details/733720/inher | |||
#pragma warning(disable:4996) // VC++ 8.0 deprecation warnings | iting-from-std-fstream-produces-c4250-warning> | |||
#pragma warning(disable:4351) // new behavior: elements of array '.. | #pragma warning(disable:4251) // ... needs to have dll-interface w | |||
.' will be default initialized | arning | |||
#pragma warning(disable:4675) // resolved overload was found by argu | #pragma warning(disable:4275) // non dll-interface class 'std::exc | |||
ment-dependent lookup | eption' used as base for dll-interface class 'Poco::Exception' | |||
#pragma warning(disable:4275) // non dll-interface class 'std::excep | #pragma warning(disable:4344) // behavior change: use of explicit | |||
tion' used as base for dll-interface class 'Poco::Exception' | template arguments results in call to '...' but '...' is a better match | |||
#pragma warning(disable:4250) // VC++ 11.0: inheriting from std stre | #pragma warning(disable:4351) // new behavior: elements of array ' | |||
am classes produces C4250 warning; | ...' will be default initialized | |||
// see <http://connect.microsoft.com/Visu | #pragma warning(disable:4355) // 'this' : used in base member init | |||
alStudio/feedback/details/733720/inheriting-from-std-fstream-produces-c4250 | ializer list | |||
-warning> | #pragma warning(disable:4675) // resolved overload was found by ar | |||
gument-dependent lookup | ||||
#pragma warning(disable:4996) // VC++ 8.0 deprecation warnings | ||||
#endif | ||||
// Enable C++11 support for VS 2010 and newer | ||||
#if defined(_MSC_VER) && (_MSC_VER >= 1600) && !defined(POCO_ENABLE_CPP11) | ||||
#define POCO_ENABLE_CPP11 | ||||
#endif | #endif | |||
#if defined(__INTEL_COMPILER) | #if defined(__INTEL_COMPILER) | |||
#pragma warning(disable:1738) // base class dllexport/dllimport spec ification differs from that of the derived class | #pragma warning(disable:1738) // base class dllexport/dllimport spec ification differs from that of the derived class | |||
#pragma warning(disable:1478) // function ... was declared "deprecat ed" | #pragma warning(disable:1478) // function ... was declared "deprecat ed" | |||
#pragma warning(disable:1744) // field of class type without a DLL i nterface used in a class with a DLL interface | #pragma warning(disable:1744) // field of class type without a DLL i nterface used in a class with a DLL interface | |||
#endif | #endif | |||
#endif // Foundation_Platform_WIN32_INCLUDED | #endif // Foundation_Platform_WIN32_INCLUDED | |||
End of changes. 4 change blocks. | ||||
26 lines changed or deleted | 104 lines changed or added | |||
RWLock.h | RWLock.h | |||
---|---|---|---|---|
// | // | |||
// RWLock.h | // RWLock.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/RWLock.h#4 $ | // $Id: //poco/1.4/Foundation/include/Poco/RWLock.h#3 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Threading | // Package: Threading | |||
// Module: RWLock | // Module: RWLock | |||
// | // | |||
// Definition of the RWLock class. | // Definition of the RWLock class. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 175 | skipping to change at line 175 | |||
inline ScopedRWLock::ScopedRWLock(RWLock& rwl, bool write): _rwl(rwl) | inline ScopedRWLock::ScopedRWLock(RWLock& rwl, bool write): _rwl(rwl) | |||
{ | { | |||
if (write) | if (write) | |||
_rwl.writeLock(); | _rwl.writeLock(); | |||
else | else | |||
_rwl.readLock(); | _rwl.readLock(); | |||
} | } | |||
inline ScopedRWLock::~ScopedRWLock() | inline ScopedRWLock::~ScopedRWLock() | |||
{ | { | |||
try | _rwl.unlock(); | |||
{ | ||||
_rwl.unlock(); | ||||
} | ||||
catch (...) | ||||
{ | ||||
poco_unexpected(); | ||||
} | ||||
} | } | |||
inline ScopedReadRWLock::ScopedReadRWLock(RWLock& rwl): ScopedRWLock(rwl, f alse) | inline ScopedReadRWLock::ScopedReadRWLock(RWLock& rwl): ScopedRWLock(rwl, f alse) | |||
{ | { | |||
} | } | |||
inline ScopedReadRWLock::~ScopedReadRWLock() | inline ScopedReadRWLock::~ScopedReadRWLock() | |||
{ | { | |||
} | } | |||
End of changes. 2 change blocks. | ||||
9 lines changed or deleted | 2 lines changed or added | |||
RefCountedObject.h | RefCountedObject.h | |||
---|---|---|---|---|
// | // | |||
// RefCountedObject.h | // RefCountedObject.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/RefCountedObject.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/RefCountedObject.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: RefCountedObject | // Module: RefCountedObject | |||
// | // | |||
// Definition of the RefCountedObject class. | // Definition of the RefCountedObject class. | |||
// | // | |||
// Copyright (c) 2004-2009, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2009, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 61 | skipping to change at line 61 | |||
/// by copying and assignment. | /// by copying and assignment. | |||
{ | { | |||
public: | public: | |||
RefCountedObject(); | RefCountedObject(); | |||
/// Creates the RefCountedObject. | /// Creates the RefCountedObject. | |||
/// The initial reference count is one. | /// The initial reference count is one. | |||
void duplicate() const; | void duplicate() const; | |||
/// Increments the object's reference count. | /// Increments the object's reference count. | |||
void release() const throw(); | void release() const; | |||
/// Decrements the object's reference count | /// Decrements the object's reference count | |||
/// and deletes the object if the count | /// and deletes the object if the count | |||
/// reaches zero. | /// reaches zero. | |||
int referenceCount() const; | int referenceCount() const; | |||
/// Returns the reference count. | /// Returns the reference count. | |||
protected: | protected: | |||
virtual ~RefCountedObject(); | virtual ~RefCountedObject(); | |||
/// Destroys the RefCountedObject. | /// Destroys the RefCountedObject. | |||
skipping to change at line 93 | skipping to change at line 93 | |||
inline int RefCountedObject::referenceCount() const | inline int RefCountedObject::referenceCount() const | |||
{ | { | |||
return _counter.value(); | return _counter.value(); | |||
} | } | |||
inline void RefCountedObject::duplicate() const | inline void RefCountedObject::duplicate() const | |||
{ | { | |||
++_counter; | ++_counter; | |||
} | } | |||
inline void RefCountedObject::release() const throw() | inline void RefCountedObject::release() const | |||
{ | { | |||
if (--_counter == 0) delete this; | if (--_counter == 0) delete this; | |||
} | } | |||
} // namespace Poco | } // namespace Poco | |||
#endif // Foundation_RefCountedObject_INCLUDED | #endif // Foundation_RefCountedObject_INCLUDED | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
SHA1Engine.h | SHA1Engine.h | |||
---|---|---|---|---|
skipping to change at line 66 | skipping to change at line 66 | |||
public: | public: | |||
enum | enum | |||
{ | { | |||
BLOCK_SIZE = 64, | BLOCK_SIZE = 64, | |||
DIGEST_SIZE = 20 | DIGEST_SIZE = 20 | |||
}; | }; | |||
SHA1Engine(); | SHA1Engine(); | |||
~SHA1Engine(); | ~SHA1Engine(); | |||
unsigned digestLength() const; | std::size_t digestLength() const; | |||
void reset(); | void reset(); | |||
const DigestEngine::Digest& digest(); | const DigestEngine::Digest& digest(); | |||
protected: | protected: | |||
void updateImpl(const void* data, unsigned length); | void updateImpl(const void* data, std::size_t length); | |||
private: | private: | |||
void transform(); | void transform(); | |||
static void byteReverse(UInt32* buffer, int byteCount); | static void byteReverse(UInt32* buffer, int byteCount); | |||
typedef UInt8 BYTE; | typedef UInt8 BYTE; | |||
struct Context | struct Context | |||
{ | { | |||
UInt32 digest[5]; // Message digest | UInt32 digest[5]; // Message digest | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
SMTPClientSession.h | SMTPClientSession.h | |||
---|---|---|---|---|
skipping to change at line 57 | skipping to change at line 57 | |||
namespace Net { | namespace Net { | |||
class MailMessage; | class MailMessage; | |||
class Net_API SMTPClientSession | class Net_API SMTPClientSession | |||
/// This class implements an Simple Mail | /// This class implements an Simple Mail | |||
/// Transfer Procotol (SMTP, RFC 2821) | /// Transfer Procotol (SMTP, RFC 2821) | |||
/// client for sending e-mail messages. | /// client for sending e-mail messages. | |||
{ | { | |||
public: | public: | |||
typedef std::vector<std::string> Recipients; | ||||
enum | enum | |||
{ | { | |||
SMTP_PORT = 25 | SMTP_PORT = 25 | |||
}; | }; | |||
enum LoginMethod | enum LoginMethod | |||
{ | { | |||
AUTH_NONE, | AUTH_NONE, | |||
AUTH_CRAM_MD5, | AUTH_CRAM_MD5, | |||
AUTH_CRAM_SHA1, | AUTH_CRAM_SHA1, | |||
skipping to change at line 128 | skipping to change at line 130 | |||
void close(); | void close(); | |||
/// Sends a QUIT command and closes the connection to the se rver. | /// Sends a QUIT command and closes the connection to the se rver. | |||
/// | /// | |||
/// Throws a SMTPException in case of a SMTP-specific error, or a | /// Throws a SMTPException in case of a SMTP-specific error, or a | |||
/// NetException in case of a general network communication failure. | /// NetException in case of a general network communication failure. | |||
void sendMessage(const MailMessage& message); | void sendMessage(const MailMessage& message); | |||
/// Sends the given mail message by sending a MAIL FROM comm and, | /// Sends the given mail message by sending a MAIL FROM comm and, | |||
/// a RCPT TO command for every recipient, and a DATA comman d with | /// a RCPT TO command for every recipient, and a DATA comman d with | |||
/// the message headers and content. | /// the message headers and content. Using this function res | |||
ults in | ||||
/// RCPT TO commands list generated from the recipient list | ||||
supplied | ||||
/// with the message itself. | ||||
/// | ||||
/// Throws a SMTPException in case of a SMTP-specific error, | ||||
or a | ||||
/// NetException in case of a general network communication | ||||
failure. | ||||
void sendMessage(const MailMessage& message, const Recipients& recip | ||||
ients); | ||||
/// Sends the given mail message by sending a MAIL FROM comm | ||||
and, | ||||
/// a RCPT TO command for every recipient, and a DATA comman | ||||
d with | ||||
/// the message headers and content. Using this function res | ||||
ults in | ||||
/// message header being generated from the supplied recipie | ||||
nts list. | ||||
/// | /// | |||
/// Throws a SMTPException in case of a SMTP-specific error, or a | /// Throws a SMTPException in case of a SMTP-specific error, or a | |||
/// NetException in case of a general network communication failure. | /// NetException in case of a general network communication failure. | |||
int sendCommand(const std::string& command, std::string& response); | int sendCommand(const std::string& command, std::string& response); | |||
/// Sends the given command verbatim to the server | /// Sends the given command verbatim to the server | |||
/// and waits for a response. | /// and waits for a response. | |||
/// | /// | |||
/// Throws a SMTPException in case of a SMTP-specific error, or a | /// Throws a SMTPException in case of a SMTP-specific error, or a | |||
/// NetException in case of a general network communication failure. | /// NetException in case of a general network communication failure. | |||
skipping to change at line 174 | skipping to change at line 187 | |||
void login(const std::string& hostname, std::string& response); | void login(const std::string& hostname, std::string& response); | |||
void loginUsingCRAMMD5(const std::string& username, const std::strin g& password); | void loginUsingCRAMMD5(const std::string& username, const std::strin g& password); | |||
void loginUsingCRAMSHA1(const std::string& username, const std::stri ng& password); | void loginUsingCRAMSHA1(const std::string& username, const std::stri ng& password); | |||
void loginUsingCRAM(const std::string& username, const std::string& method, Poco::DigestEngine& hmac); | void loginUsingCRAM(const std::string& username, const std::string& method, Poco::DigestEngine& hmac); | |||
void loginUsingLogin(const std::string& username, const std::string& password); | void loginUsingLogin(const std::string& username, const std::string& password); | |||
void loginUsingPlain(const std::string& username, const std::string& password); | void loginUsingPlain(const std::string& username, const std::string& password); | |||
DialogSocket& socket(); | DialogSocket& socket(); | |||
private: | private: | |||
void sendCommands(const MailMessage& message, const Recipients* pRec | ||||
ipients = 0); | ||||
void transportMessage(const MailMessage& message); | ||||
DialogSocket _socket; | DialogSocket _socket; | |||
bool _isOpen; | bool _isOpen; | |||
}; | }; | |||
// | // | |||
// inlines | // inlines | |||
// | // | |||
inline bool SMTPClientSession::isPositiveCompletion(int status) | inline bool SMTPClientSession::isPositiveCompletion(int status) | |||
{ | { | |||
return status/100 == SMTP_POSITIVE_COMPLETION; | return status/100 == SMTP_POSITIVE_COMPLETION; | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 27 lines changed or added | |||
ScopedLock.h | ScopedLock.h | |||
---|---|---|---|---|
// | // | |||
// ScopedLock.h | // ScopedLock.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/ScopedLock.h#4 $ | // $Id: //poco/1.4/Foundation/include/Poco/ScopedLock.h#3 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Threading | // Package: Threading | |||
// Module: Mutex | // Module: Mutex | |||
// | // | |||
// Definition of the ScopedLock template class. | // Definition of the ScopedLock template class. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 66 | skipping to change at line 66 | |||
_mutex.lock(); | _mutex.lock(); | |||
} | } | |||
ScopedLock(M& mutex, long milliseconds): _mutex(mutex) | ScopedLock(M& mutex, long milliseconds): _mutex(mutex) | |||
{ | { | |||
_mutex.lock(milliseconds); | _mutex.lock(milliseconds); | |||
} | } | |||
~ScopedLock() | ~ScopedLock() | |||
{ | { | |||
try | _mutex.unlock(); | |||
{ | ||||
_mutex.unlock(); | ||||
} | ||||
catch (...) | ||||
{ | ||||
poco_unexpected(); | ||||
} | ||||
} | } | |||
private: | private: | |||
M& _mutex; | M& _mutex; | |||
ScopedLock(); | ScopedLock(); | |||
ScopedLock(const ScopedLock&); | ScopedLock(const ScopedLock&); | |||
ScopedLock& operator = (const ScopedLock&); | ScopedLock& operator = (const ScopedLock&); | |||
}; | }; | |||
skipping to change at line 107 | skipping to change at line 100 | |||
_pMutex->lock(); | _pMutex->lock(); | |||
} | } | |||
ScopedLockWithUnlock(M& mutex, long milliseconds): _pMutex(&mutex) | ScopedLockWithUnlock(M& mutex, long milliseconds): _pMutex(&mutex) | |||
{ | { | |||
_pMutex->lock(milliseconds); | _pMutex->lock(milliseconds); | |||
} | } | |||
~ScopedLockWithUnlock() | ~ScopedLockWithUnlock() | |||
{ | { | |||
try | unlock(); | |||
{ | ||||
unlock(); | ||||
} | ||||
catch (...) | ||||
{ | ||||
poco_unexpected(); | ||||
} | ||||
} | } | |||
void unlock() | void unlock() | |||
{ | { | |||
if (_pMutex) | if (_pMutex) | |||
{ | { | |||
_pMutex->unlock(); | _pMutex->unlock(); | |||
_pMutex = 0; | _pMutex = 0; | |||
} | } | |||
} | } | |||
End of changes. 3 change blocks. | ||||
17 lines changed or deleted | 3 lines changed or added | |||
ScopedUnlock.h | ScopedUnlock.h | |||
---|---|---|---|---|
// | // | |||
// ScopedUnlock.h | // ScopedUnlock.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/ScopedUnlock.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/ScopedUnlock.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Threading | // Package: Threading | |||
// Module: Mutex | // Module: Mutex | |||
// | // | |||
// Definition of the ScopedUnlock template class. | // Definition of the ScopedUnlock template class. | |||
// | // | |||
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2007, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 60 | skipping to change at line 60 | |||
/// The destructor locks the mutex. | /// The destructor locks the mutex. | |||
{ | { | |||
public: | public: | |||
inline ScopedUnlock(M& mutex, bool unlockNow = true): _mutex(mutex) | inline ScopedUnlock(M& mutex, bool unlockNow = true): _mutex(mutex) | |||
{ | { | |||
if (unlockNow) | if (unlockNow) | |||
_mutex.unlock(); | _mutex.unlock(); | |||
} | } | |||
inline ~ScopedUnlock() | inline ~ScopedUnlock() | |||
{ | { | |||
try | _mutex.lock(); | |||
{ | ||||
_mutex.lock(); | ||||
} | ||||
catch (...) | ||||
{ | ||||
poco_unexpected(); | ||||
} | ||||
} | } | |||
private: | private: | |||
M& _mutex; | M& _mutex; | |||
ScopedUnlock(); | ScopedUnlock(); | |||
ScopedUnlock(const ScopedUnlock&); | ScopedUnlock(const ScopedUnlock&); | |||
ScopedUnlock& operator = (const ScopedUnlock&); | ScopedUnlock& operator = (const ScopedUnlock&); | |||
}; | }; | |||
End of changes. 2 change blocks. | ||||
9 lines changed or deleted | 2 lines changed or added | |||
ServerApplication.h | ServerApplication.h | |||
---|---|---|---|---|
// | // | |||
// ServerApplication.h | // ServerApplication.h | |||
// | // | |||
// $Id: //poco/1.4/Util/include/Poco/Util/ServerApplication.h#4 $ | // $Id: //poco/1.4/Util/include/Poco/Util/ServerApplication.h#3 $ | |||
// | // | |||
// Library: Util | // Library: Util | |||
// Package: Application | // Package: Application | |||
// Module: ServerApplication | // Module: ServerApplication | |||
// | // | |||
// Definition of the ServerApplication class. | // Definition of the ServerApplication class. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 47 | skipping to change at line 47 | |||
#ifndef Util_ServerApplication_INCLUDED | #ifndef Util_ServerApplication_INCLUDED | |||
#define Util_ServerApplication_INCLUDED | #define Util_ServerApplication_INCLUDED | |||
#include "Poco/Util/Util.h" | #include "Poco/Util/Util.h" | |||
#include "Poco/Util/Application.h" | #include "Poco/Util/Application.h" | |||
#include "Poco/Event.h" | #include "Poco/Event.h" | |||
#if defined(POCO_OS_FAMILY_WINDOWS) | #if defined(POCO_OS_FAMILY_WINDOWS) | |||
#include "Poco/NamedEvent.h" | #include "Poco/NamedEvent.h" | |||
#endif | #endif | |||
#include <iostream> | ||||
namespace Poco { | namespace Poco { | |||
namespace Util { | namespace Util { | |||
class Util_API ServerApplication: public Application | class Util_API ServerApplication: public Application | |||
/// A subclass of the Application class that is used | /// A subclass of the Application class that is used | |||
/// for implementing server applications. | /// for implementing server applications. | |||
/// | /// | |||
/// A ServerApplication allows for the application | /// A ServerApplication allows for the application | |||
/// to run as a Windows service or as a Unix daemon | /// to run as a Windows service or as a Unix daemon | |||
skipping to change at line 245 | skipping to change at line 244 | |||
} } // namespace Poco::Util | } } // namespace Poco::Util | |||
// | // | |||
// Macro to implement main() | // Macro to implement main() | |||
// | // | |||
#if defined(_WIN32) && defined(POCO_WIN32_UTF8) | #if defined(_WIN32) && defined(POCO_WIN32_UTF8) | |||
#define POCO_SERVER_MAIN(App) \ | #define POCO_SERVER_MAIN(App) \ | |||
int wmain(int argc, wchar_t** argv) \ | int wmain(int argc, wchar_t** argv) \ | |||
{ \ | { \ | |||
try \ | App app; \ | |||
{ | return app.run(argc, argv); \ | |||
\ | ||||
App app; \ | ||||
return app.run(argc, argv); \ | ||||
} | ||||
\ | ||||
catch (Poco::Exception& exc) \ | ||||
{ | ||||
\ | ||||
std::cerr << exc.displayText() << std::endl; \ | ||||
return Poco::Util::Application::EXIT_SOFTWARE; \ | ||||
} | ||||
\ | ||||
} | } | |||
#elif defined(POCO_VXWORKS) | #elif defined(POCO_VXWORKS) | |||
#define POCO_SERVER_MAIN(App) \ | #define POCO_SERVER_MAIN(App) \ | |||
int pocoSrvMain(const char* appName, ...) | int pocoSrvMain(const char* appName, ...) \ | |||
\ | { \ | |||
{ | std::vector<std::string> args; \ | |||
\ | args.push_back(std::string(appName)); \ | |||
std::vector<std::string> args; | va_list vargs; \ | |||
\ | va_start(vargs, appName); \ | |||
args.push_back(std::string(appName)); | const char* arg = va_arg(vargs, const char*); \ | |||
\ | while (arg) \ | |||
va_list vargs; | { \ | |||
\ | args.push_back(std::string(arg)); \ | |||
va_start(vargs, appName); | arg = va_arg(vargs, const char*); \ | |||
\ | } \ | |||
const char* arg = va_arg(vargs, const char*); \ | va_end(vargs); \ | |||
while (arg) | App app; \ | |||
\ | return app.run(args); \ | |||
{ | ||||
\ | ||||
args.push_back(std::string(arg)); | ||||
\ | ||||
arg = va_arg(vargs, const char*); | ||||
\ | ||||
} | ||||
\ | ||||
va_end(vargs); | ||||
\ | ||||
try | ||||
\ | ||||
{ | ||||
\ | ||||
App app; | ||||
\ | ||||
return app.run(args); | ||||
\ | ||||
} | ||||
\ | ||||
catch (Poco::Exception& exc) | ||||
\ | ||||
{ | ||||
\ | ||||
std::cerr << exc.displayText() << std::endl; \ | ||||
return Poco::Util::Application::EXIT_SOFTWARE; \ | ||||
} | ||||
\ | ||||
} | } | |||
#else | #else | |||
#define POCO_SERVER_MAIN(App) \ | #define POCO_SERVER_MAIN(App) \ | |||
int main(int argc, char** argv) \ | int main(int argc, char** argv) \ | |||
{ \ | { \ | |||
try \ | App app; \ | |||
{ | return app.run(argc, argv); \ | |||
\ | ||||
App app; \ | ||||
return app.run(argc, argv); \ | ||||
} | ||||
\ | ||||
catch (Poco::Exception& exc) \ | ||||
{ | ||||
\ | ||||
std::cerr << exc.displayText() << std::endl; \ | ||||
return Poco::Util::Application::EXIT_SOFTWARE; \ | ||||
} | ||||
\ | ||||
} | } | |||
#endif | #endif | |||
#endif // Util_ServerApplication_INCLUDED | #endif // Util_ServerApplication_INCLUDED | |||
End of changes. 5 change blocks. | ||||
73 lines changed or deleted | 20 lines changed or added | |||
SharedPtr.h | SharedPtr.h | |||
---|---|---|---|---|
// | // | |||
// SharedPtr.h | // SharedPtr.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/SharedPtr.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/SharedPtr.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: SharedPtr | // Module: SharedPtr | |||
// | // | |||
// Definition of the SharedPtr template class. | // Definition of the SharedPtr template class. | |||
// | // | |||
// Copyright (c) 2005-2008, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2008, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 152 | skipping to change at line 152 | |||
_pCounter->duplicate(); | _pCounter->duplicate(); | |||
} | } | |||
SharedPtr(const SharedPtr& ptr): _pCounter(ptr._pCounter), _ptr(ptr. _ptr) | SharedPtr(const SharedPtr& ptr): _pCounter(ptr._pCounter), _ptr(ptr. _ptr) | |||
{ | { | |||
_pCounter->duplicate(); | _pCounter->duplicate(); | |||
} | } | |||
~SharedPtr() | ~SharedPtr() | |||
{ | { | |||
try | release(); | |||
{ | ||||
release(); | ||||
} | ||||
catch (...) | ||||
{ | ||||
poco_unexpected(); | ||||
} | ||||
} | } | |||
SharedPtr& assign(C* ptr) | SharedPtr& assign(C* ptr) | |||
{ | { | |||
if (get() != ptr) | if (get() != ptr) | |||
{ | { | |||
RC* pTmp = new RC; | RC* pTmp = new RC; | |||
release(); | release(); | |||
_pCounter = pTmp; | _pCounter = pTmp; | |||
_ptr = ptr; | _ptr = ptr; | |||
End of changes. 2 change blocks. | ||||
9 lines changed or deleted | 2 lines changed or added | |||
SimpleFileChannel.h | SimpleFileChannel.h | |||
---|---|---|---|---|
// | // | |||
// SimpleFileChannel.h | // SimpleFileChannel.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/SimpleFileChannel.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/SimpleFileChannel.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Logging | // Package: Logging | |||
// Module: SimpleFileChannel | // Module: SimpleFileChannel | |||
// | // | |||
// Definition of the SimpleFileChannel class. | // Definition of the SimpleFileChannel class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
SimpleHashTable.h | SimpleHashTable.h | |||
---|---|---|---|---|
// | // | |||
// SimpleHashTable.h | // SimpleHashTable.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/SimpleHashTable.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/SimpleHashTable.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Hashing | // Package: Hashing | |||
// Module: SimpleHashTable | // Module: SimpleHashTable | |||
// | // | |||
// Definition of the SimpleHashTable class. | // Definition of the SimpleHashTable class. | |||
// | // | |||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 388 | skipping to change at line 388 | |||
UInt32 totalSize = 0; | UInt32 totalSize = 0; | |||
#endif | #endif | |||
for (int i=0; i < _capacity; ++i) | for (int i=0; i < _capacity; ++i) | |||
{ | { | |||
if (_entries[i]) | if (_entries[i]) | |||
{ | { | |||
maxEntriesPerHash = 1; | maxEntriesPerHash = 1; | |||
UInt32 size = 1; | UInt32 size = 1; | |||
if (details) | if (details) | |||
detailedEntriesPerHash.push_back(siz e); | detailedEntriesPerHash.push_back(siz e); | |||
#ifdef _DEBUG | #ifdef DEBUG | |||
totalSize += size; | totalSize += size; | |||
#endif | #endif | |||
} | } | |||
else | else | |||
{ | { | |||
numZeroEntries++; | numZeroEntries++; | |||
if (details) | if (details) | |||
detailedEntriesPerHash.push_back(0); | detailedEntriesPerHash.push_back(0); | |||
} | } | |||
} | } | |||
#ifdef _DEBUG | ||||
poco_assert_dbg(totalSize == numberOfEntries); | poco_assert_dbg(totalSize == numberOfEntries); | |||
#endif | ||||
return HashStatistic(_capacity, numberOfEntries, numZeroEntr ies, maxEntriesPerHash, detailedEntriesPerHash); | return HashStatistic(_capacity, numberOfEntries, numZeroEntr ies, maxEntriesPerHash, detailedEntriesPerHash); | |||
} | } | |||
private: | private: | |||
HashTableVector _entries; | HashTableVector _entries; | |||
std::size_t _size; | std::size_t _size; | |||
UInt32 _capacity; | UInt32 _capacity; | |||
KeyHashFunction _hash; | KeyHashFunction _hash; | |||
}; | }; | |||
End of changes. 4 change blocks. | ||||
4 lines changed or deleted | 3 lines changed or added | |||
Socket.h | Socket.h | |||
---|---|---|---|---|
// | // | |||
// Socket.h | // Socket.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/Socket.h#3 $ | // $Id: //poco/1.4/Net/include/Poco/Net/Socket.h#2 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: Sockets | // Package: Sockets | |||
// Module: Socket | // Module: Socket | |||
// | // | |||
// Definition of the Socket class. | // Definition of the Socket class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 141 | skipping to change at line 141 | |||
/// return value will be 0. | /// return value will be 0. | |||
/// | /// | |||
/// If one of the sockets passed to select() is closed while | /// If one of the sockets passed to select() is closed while | |||
/// select() runs, select will return immediately. However, | /// select() runs, select will return immediately. However, | |||
/// the closed socket will not be included in any list. | /// the closed socket will not be included in any list. | |||
/// In this case, the return value may be greater than the s um | /// In this case, the return value may be greater than the s um | |||
/// of all sockets in all list. | /// of all sockets in all list. | |||
bool poll(const Poco::Timespan& timeout, int mode) const; | bool poll(const Poco::Timespan& timeout, int mode) const; | |||
/// Determines the status of the socket, using a | /// Determines the status of the socket, using a | |||
/// call to select(). | /// call to poll() or select(). | |||
/// | /// | |||
/// The mode argument is constructed by combining the values | /// The mode argument is constructed by combining the values | |||
/// of the SelectMode enumeration. | /// of the SelectMode enumeration. | |||
/// | /// | |||
/// Returns true if the next operation corresponding to | /// Returns true if the next operation corresponding to | |||
/// mode will not block, false otherwise. | /// mode will not block, false otherwise. | |||
int available() const; | int available() const; | |||
/// Returns the number of bytes available that can be read | /// Returns the number of bytes available that can be read | |||
/// without causing the socket to block. | /// without causing the socket to block. | |||
skipping to change at line 324 | skipping to change at line 324 | |||
protected: | protected: | |||
Socket(SocketImpl* pImpl); | Socket(SocketImpl* pImpl); | |||
/// Creates the Socket and attaches the given SocketImpl. | /// Creates the Socket and attaches the given SocketImpl. | |||
/// The socket takes owership of the SocketImpl. | /// The socket takes owership of the SocketImpl. | |||
poco_socket_t sockfd() const; | poco_socket_t sockfd() const; | |||
/// Returns the socket descriptor for this socket. | /// Returns the socket descriptor for this socket. | |||
private: | private: | |||
#if defined(POCO_HAVE_FD_POLL) | ||||
class FDCompare | ||||
/// Utility functor used to compare socket file descriptors. | ||||
/// Used in poll() member function. | ||||
{ | ||||
public: | ||||
FDCompare(int fd): _fd(fd) { } | ||||
inline bool operator()(const Socket& socket) const | ||||
{ return socket.sockfd() == _fd; } | ||||
private: | ||||
FDCompare(); | ||||
int _fd; | ||||
}; | ||||
#endif | ||||
SocketImpl* _pImpl; | SocketImpl* _pImpl; | |||
}; | }; | |||
// | // | |||
// inlines | // inlines | |||
// | // | |||
inline bool Socket::operator == (const Socket& socket) const | inline bool Socket::operator == (const Socket& socket) const | |||
{ | { | |||
return _pImpl == socket._pImpl; | return _pImpl == socket._pImpl; | |||
} | } | |||
skipping to change at line 565 | skipping to change at line 582 | |||
inline bool Socket::secure() const | inline bool Socket::secure() const | |||
{ | { | |||
return _pImpl->secure(); | return _pImpl->secure(); | |||
} | } | |||
inline bool Socket::supportsIPv4() | inline bool Socket::supportsIPv4() | |||
{ | { | |||
return true; | return true; | |||
} | } | |||
inline bool Socket::supportsIPv6() | ||||
{ | ||||
#if defined(POCO_HAVE_IPv6) | ||||
return true; | ||||
#else | ||||
return false; | ||||
#endif | ||||
} | ||||
inline void Socket::init(int af) | ||||
{ | ||||
_pImpl->init(af); | ||||
} | ||||
} } // namespace Poco::Net | } } // namespace Poco::Net | |||
#endif // Net_Socket_INCLUDED | #endif // Net_Socket_INCLUDED | |||
End of changes. 4 change blocks. | ||||
2 lines changed or deleted | 33 lines changed or added | |||
SocketAcceptor.h | SocketAcceptor.h | |||
---|---|---|---|---|
// | // | |||
// SocketAcceptor.h | // SocketAcceptor.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/SocketAcceptor.h#2 $ | // $Id: //poco/1.4/Net/include/Poco/Net/SocketAcceptor.h#1 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: Reactor | // Package: Reactor | |||
// Module: SocketAcceptor | // Module: SocketAcceptor | |||
// | // | |||
// Definition of the SocketAcceptor class. | // Definition of the SocketAcceptor class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 107 | skipping to change at line 107 | |||
_pReactor(0) | _pReactor(0) | |||
/// Creates an SocketAcceptor, using the given ServerSocket. | /// Creates an SocketAcceptor, using the given ServerSocket. | |||
/// The SocketAcceptor registers itself with the given Socke tReactor. | /// The SocketAcceptor registers itself with the given Socke tReactor. | |||
{ | { | |||
registerAcceptor(reactor); | registerAcceptor(reactor); | |||
} | } | |||
virtual ~SocketAcceptor() | virtual ~SocketAcceptor() | |||
/// Destroys the SocketAcceptor. | /// Destroys the SocketAcceptor. | |||
{ | { | |||
try | unregisterAcceptor(); | |||
{ | ||||
unregisterAcceptor(); | ||||
} | ||||
catch (...) | ||||
{ | ||||
poco_unexpected(); | ||||
} | ||||
} | } | |||
virtual void registerAcceptor(SocketReactor& reactor) | virtual void registerAcceptor(SocketReactor& reactor) | |||
/// Registers the SocketAcceptor with a SocketReactor. | /// Registers the SocketAcceptor with a SocketReactor. | |||
/// | /// | |||
/// A subclass can override this and, for example, also regi ster | /// A subclass can override this and, for example, also regi ster | |||
/// an event handler for a timeout event. | /// an event handler for a timeout event. | |||
/// | /// | |||
/// The overriding method must call the baseclass implementa tion first. | /// The overriding method must call the baseclass implementa tion first. | |||
{ | { | |||
End of changes. 2 change blocks. | ||||
9 lines changed or deleted | 2 lines changed or added | |||
SocketAddress.h | SocketAddress.h | |||
---|---|---|---|---|
// | // | |||
// SocketAddress.h | // SocketAddress.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/SocketAddress.h#3 $ | // $Id: //poco/1.4/Net/include/Poco/Net/SocketAddress.h#2 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: NetCore | // Package: NetCore | |||
// Module: SocketAddress | // Module: SocketAddress | |||
// | // | |||
// Definition of the SocketAddress class. | // Definition of the SocketAddress class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
SocketConnector.h | SocketConnector.h | |||
---|---|---|---|---|
// | // | |||
// SocketConnector.h | // SocketConnector.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/SocketConnector.h#2 $ | // $Id: //poco/1.4/Net/include/Poco/Net/SocketConnector.h#1 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: Reactor | // Package: Reactor | |||
// Module: SocketConnector | // Module: SocketConnector | |||
// | // | |||
// Definition of the SocketConnector class. | // Definition of the SocketConnector class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 111 | skipping to change at line 111 | |||
/// Creates an acceptor, using the given ServerSocket. | /// Creates an acceptor, using the given ServerSocket. | |||
/// The SocketConnector registers itself with the given Sock etReactor. | /// The SocketConnector registers itself with the given Sock etReactor. | |||
{ | { | |||
_socket.connectNB(address); | _socket.connectNB(address); | |||
registerConnector(reactor); | registerConnector(reactor); | |||
} | } | |||
virtual ~SocketConnector() | virtual ~SocketConnector() | |||
/// Destroys the SocketConnector. | /// Destroys the SocketConnector. | |||
{ | { | |||
try | unregisterConnector(); | |||
{ | ||||
unregisterConnector(); | ||||
} | ||||
catch (...) | ||||
{ | ||||
poco_unexpected(); | ||||
} | ||||
} | } | |||
virtual void registerConnector(SocketReactor& reactor) | virtual void registerConnector(SocketReactor& reactor) | |||
/// Registers the SocketConnector with a SocketReactor. | /// Registers the SocketConnector with a SocketReactor. | |||
/// | /// | |||
/// A subclass can override this and, for example, also regi ster | /// A subclass can override this and, for example, also regi ster | |||
/// an event handler for a timeout event. | /// an event handler for a timeout event. | |||
/// | /// | |||
/// The overriding method must call the baseclass implementa tion first. | /// The overriding method must call the baseclass implementa tion first. | |||
{ | { | |||
End of changes. 2 change blocks. | ||||
9 lines changed or deleted | 2 lines changed or added | |||
SocketDefs.h | SocketDefs.h | |||
---|---|---|---|---|
// | // | |||
// SocketDefs.h | // SocketDefs.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/SocketDefs.h#7 $ | // $Id: //poco/1.4/Net/include/Poco/Net/SocketDefs.h#6 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: NetCore | // Package: NetCore | |||
// Module: SocketDefs | // Module: SocketDefs | |||
// | // | |||
// Include platform-specific header files for sockets. | // Include platform-specific header files for sockets. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 42 | skipping to change at line 42 | |||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | |||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Net_SocketDefs_INCLUDED | #ifndef Net_SocketDefs_INCLUDED | |||
#define Net_SocketDefs_INCLUDED | #define Net_SocketDefs_INCLUDED | |||
#if defined(POCO_OS_FAMILY_WINDOWS) | #if defined(POCO_OS_FAMILY_WINDOWS) | |||
#include "Poco/UnWindows.h" | #include "Poco/UnWindows.h" | |||
#include <winsock2.h> | #include <winsock2.h> | |||
#include <ws2tcpip.h> | #include <ws2tcpip.h> | |||
#define POCO_INVALID_SOCKET INVALID_SOCKET | #define POCO_INVALID_SOCKET INVALID_SOCKET | |||
#define poco_socket_t SOCKET | #define poco_socket_t SOCKET | |||
#define poco_socklen_t int | #define poco_socklen_t int | |||
#define poco_ioctl_request_t int | #define poco_ioctl_request_t int | |||
#define poco_closesocket(s) closesocket(s) | #define poco_closesocket(s) closesocket(s) | |||
#define POCO_EINTR WSAEINTR | #define POCO_EINTR WSAEINTR | |||
#define POCO_EACCES WSAEACCES | #define POCO_EACCES WSAEACCES | |||
#define POCO_EFAULT WSAEFAULT | #define POCO_EFAULT WSAEFAULT | |||
#define POCO_EINVAL WSAEINVAL | #define POCO_EINVAL WSAEINVAL | |||
#define POCO_EMFILE WSAEMFILE | #define POCO_EMFILE WSAEMFILE | |||
#define POCO_EAGAIN WSAEWOULDBLOCK | #define POCO_EAGAIN WSAEWOULDBLOCK | |||
#define POCO_EWOULDBLOCK WSAEWOULDBLOCK | #define POCO_EWOULDBLOCK WSAEWOULDBLOCK | |||
#define POCO_EINPROGRESS WSAEINPROGRESS | #define POCO_EINPROGRESS WSAEINPROGRESS | |||
#define POCO_EALREADY WSAEALREADY | #define POCO_EALREADY WSAEALREADY | |||
#define POCO_ENOTSOCK WSAENOTSOCK | #define POCO_ENOTSOCK WSAENOTSOCK | |||
#define POCO_EDESTADDRREQ WSAEDESTADDRREQ | #define POCO_EDESTADDRREQ WSAEDESTADDRREQ | |||
#define POCO_EMSGSIZE WSAEMSGSIZE | #define POCO_EMSGSIZE WSAEMSGSIZE | |||
#define POCO_EPROTOTYPE WSAEPROTOTYPE | #define POCO_EPROTOTYPE WSAEPROTOTYPE | |||
#define POCO_ENOPROTOOPT WSAENOPROTOOPT | #define POCO_ENOPROTOOPT WSAENOPROTOOPT | |||
#define POCO_EPROTONOSUPPORT WSAEPROTONOSUPPORT | #define POCO_EPROTONOSUPPORT WSAEPROTONOSUPPORT | |||
#define POCO_ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT | #define POCO_ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT | |||
#define POCO_ENOTSUP WSAEOPNOTSUPP | #define POCO_ENOTSUP WSAEOPNOTSUPP | |||
#define POCO_EPFNOSUPPORT WSAEPFNOSUPPORT | #define POCO_EPFNOSUPPORT WSAEPFNOSUPPORT | |||
#define POCO_EAFNOSUPPORT WSAEAFNOSUPPORT | #define POCO_EAFNOSUPPORT WSAEAFNOSUPPORT | |||
#define POCO_EADDRINUSE WSAEADDRINUSE | #define POCO_EADDRINUSE WSAEADDRINUSE | |||
#define POCO_EADDRNOTAVAIL WSAEADDRNOTAVAIL | #define POCO_EADDRNOTAVAIL WSAEADDRNOTAVAIL | |||
#define POCO_ENETDOWN WSAENETDOWN | #define POCO_ENETDOWN WSAENETDOWN | |||
#define POCO_ENETUNREACH WSAENETUNREACH | #define POCO_ENETUNREACH WSAENETUNREACH | |||
#define POCO_ENETRESET WSAENETRESET | #define POCO_ENETRESET WSAENETRESET | |||
#define POCO_ECONNABORTED WSAECONNABORTED | #define POCO_ECONNABORTED WSAECONNABORTED | |||
#define POCO_ECONNRESET WSAECONNRESET | #define POCO_ECONNRESET WSAECONNRESET | |||
#define POCO_ENOBUFS WSAENOBUFS | #define POCO_ENOBUFS WSAENOBUFS | |||
#define POCO_EISCONN WSAEISCONN | #define POCO_EISCONN WSAEISCONN | |||
#define POCO_ENOTCONN WSAENOTCONN | #define POCO_ENOTCONN WSAENOTCONN | |||
#define POCO_ESHUTDOWN WSAESHUTDOWN | #define POCO_ESHUTDOWN WSAESHUTDOWN | |||
#define POCO_ETIMEDOUT WSAETIMEDOUT | #define POCO_ETIMEDOUT WSAETIMEDOUT | |||
#define POCO_ECONNREFUSED WSAECONNREFUSED | #define POCO_ECONNREFUSED WSAECONNREFUSED | |||
#define POCO_EHOSTDOWN WSAEHOSTDOWN | #define POCO_EHOSTDOWN WSAEHOSTDOWN | |||
#define POCO_EHOSTUNREACH WSAEHOSTUNREACH | #define POCO_EHOSTUNREACH WSAEHOSTUNREACH | |||
#define POCO_ESYSNOTREADY WSASYSNOTREADY | #define POCO_ESYSNOTREADY WSASYSNOTREADY | |||
#define POCO_ENOTINIT WSANOTINITIALISED | #define POCO_ENOTINIT WSANOTINITIALISED | |||
#define POCO_HOST_NOT_FOUND WSAHOST_NOT_FOUND | #define POCO_HOST_NOT_FOUND WSAHOST_NOT_FOUND | |||
#define POCO_TRY_AGAIN WSATRY_AGAIN | #define POCO_TRY_AGAIN WSATRY_AGAIN | |||
#define POCO_NO_RECOVERY WSANO_RECOVERY | #define POCO_NO_RECOVERY WSANO_RECOVERY | |||
#define POCO_NO_DATA WSANO_DATA | #define POCO_NO_DATA WSANO_DATA | |||
#ifndef ADDRESS_FAMILY | ||||
#define ADDRESS_FAMILY USHORT | ||||
#endif | ||||
#elif defined(POCO_VXWORKS) | #elif defined(POCO_VXWORKS) | |||
#include <hostLib.h> | #include <hostLib.h> | |||
#include <ifLib.h> | #include <ifLib.h> | |||
#include <inetLib.h> | #include <inetLib.h> | |||
#include <ioLib.h> | #include <ioLib.h> | |||
#include <resolvLib.h> | #include <resolvLib.h> | |||
#include <types.h> | #include <types.h> | |||
#include <socket.h> | #include <socket.h> | |||
#include <netinet/tcp.h> | #include <netinet/tcp.h> | |||
#define POCO_INVALID_SOCKET -1 | #define POCO_INVALID_SOCKET -1 | |||
#define poco_socket_t int | #define poco_socket_t int | |||
#define poco_socklen_t int | #define poco_socklen_t int | |||
#define poco_ioctl_request_t int | #define poco_ioctl_request_t int | |||
#define poco_closesocket(s) ::close(s) | #define poco_closesocket(s) ::close(s) | |||
#define POCO_EINTR EINTR | #define POCO_EINTR EINTR | |||
#define POCO_EACCES EACCES | #define POCO_EACCES EACCES | |||
#define POCO_EFAULT EFAULT | #define POCO_EFAULT EFAULT | |||
#define POCO_EINVAL EINVAL | #define POCO_EINVAL EINVAL | |||
#define POCO_EMFILE EMFILE | #define POCO_EMFILE EMFILE | |||
#define POCO_EAGAIN EAGAIN | #define POCO_EAGAIN EAGAIN | |||
#define POCO_EWOULDBLOCK EWOULDBLOCK | #define POCO_EWOULDBLOCK EWOULDBLOCK | |||
#define POCO_EINPROGRESS EINPROGRESS | #define POCO_EINPROGRESS EINPROGRESS | |||
#define POCO_EALREADY EALREADY | #define POCO_EALREADY EALREADY | |||
#define POCO_ENOTSOCK ENOTSOCK | #define POCO_ENOTSOCK ENOTSOCK | |||
#define POCO_EDESTADDRREQ EDESTADDRREQ | #define POCO_EDESTADDRREQ EDESTADDRREQ | |||
#define POCO_EMSGSIZE EMSGSIZE | #define POCO_EMSGSIZE EMSGSIZE | |||
#define POCO_EPROTOTYPE EPROTOTYPE | #define POCO_EPROTOTYPE EPROTOTYPE | |||
#define POCO_ENOPROTOOPT ENOPROTOOPT | #define POCO_ENOPROTOOPT ENOPROTOOPT | |||
#define POCO_EPROTONOSUPPORT EPROTONOSUPPORT | #define POCO_EPROTONOSUPPORT EPROTONOSUPPORT | |||
#define POCO_ESOCKTNOSUPPORT ESOCKTNOSUPPORT | #define POCO_ESOCKTNOSUPPORT ESOCKTNOSUPPORT | |||
#define POCO_ENOTSUP ENOTSUP | #define POCO_ENOTSUP ENOTSUP | |||
#define POCO_EPFNOSUPPORT EPFNOSUPPORT | #define POCO_EPFNOSUPPORT EPFNOSUPPORT | |||
#define POCO_EAFNOSUPPORT EAFNOSUPPORT | #define POCO_EAFNOSUPPORT EAFNOSUPPORT | |||
#define POCO_EADDRINUSE EADDRINUSE | #define POCO_EADDRINUSE EADDRINUSE | |||
#define POCO_EADDRNOTAVAIL EADDRNOTAVAIL | #define POCO_EADDRNOTAVAIL EADDRNOTAVAIL | |||
#define POCO_ENETDOWN ENETDOWN | #define POCO_ENETDOWN ENETDOWN | |||
#define POCO_ENETUNREACH ENETUNREACH | #define POCO_ENETUNREACH ENETUNREACH | |||
#define POCO_ENETRESET ENETRESET | #define POCO_ENETRESET ENETRESET | |||
#define POCO_ECONNABORTED ECONNABORTED | #define POCO_ECONNABORTED ECONNABORTED | |||
#define POCO_ECONNRESET ECONNRESET | #define POCO_ECONNRESET ECONNRESET | |||
#define POCO_ENOBUFS ENOBUFS | #define POCO_ENOBUFS ENOBUFS | |||
#define POCO_EISCONN EISCONN | #define POCO_EISCONN EISCONN | |||
#define POCO_ENOTCONN ENOTCONN | #define POCO_ENOTCONN ENOTCONN | |||
#define POCO_ESHUTDOWN ESHUTDOWN | #define POCO_ESHUTDOWN ESHUTDOWN | |||
#define POCO_ETIMEDOUT ETIMEDOUT | #define POCO_ETIMEDOUT ETIMEDOUT | |||
#define POCO_ECONNREFUSED ECONNREFUSED | #define POCO_ECONNREFUSED ECONNREFUSED | |||
#define POCO_EHOSTDOWN EHOSTDOWN | #define POCO_EHOSTDOWN EHOSTDOWN | |||
#define POCO_EHOSTUNREACH EHOSTUNREACH | #define POCO_EHOSTUNREACH EHOSTUNREACH | |||
#define POCO_ESYSNOTREADY -4 | #define POCO_ESYSNOTREADY -4 | |||
#define POCO_ENOTINIT -5 | #define POCO_ENOTINIT -5 | |||
#define POCO_HOST_NOT_FOUND HOST_NOT_FOUND | #define POCO_HOST_NOT_FOUND HOST_NOT_FOUND | |||
#define POCO_TRY_AGAIN TRY_AGAIN | #define POCO_TRY_AGAIN TRY_AGAIN | |||
#define POCO_NO_RECOVERY NO_RECOVERY | #define POCO_NO_RECOVERY NO_RECOVERY | |||
#define POCO_NO_DATA NO_DATA | #define POCO_NO_DATA NO_DATA | |||
#elif defined(POCO_OS_FAMILY_UNIX) || defined(POCO_OS_FAMILY_VMS) | #elif defined(POCO_OS_FAMILY_UNIX) || defined(POCO_OS_FAMILY_VMS) | |||
#include <unistd.h> | #include <unistd.h> | |||
#include <errno.h> | #include <errno.h> | |||
#include <sys/types.h> | #include <sys/types.h> | |||
#include <sys/socket.h> | #include <sys/socket.h> | |||
#if POCO_OS != POCO_OS_HPUX | #include <fcntl.h> | |||
#include <sys/select.h> | #if POCO_OS != POCO_OS_HPUX | |||
#endif | #include <sys/select.h> | |||
#include <sys/ioctl.h> | #endif | |||
#if defined(POCO_OS_FAMILY_VMS) | #include <sys/ioctl.h> | |||
#include <inet.h> | #if defined(POCO_OS_FAMILY_VMS) | |||
#else | #include <inet.h> | |||
#include <arpa/inet.h> | #else | |||
#include <arpa/inet.h> | ||||
#endif | ||||
#include <netinet/in.h> | ||||
#include <netinet/tcp.h> | ||||
#include <netdb.h> | ||||
#if defined(POCO_OS_FAMILY_UNIX) | ||||
#if (POCO_OS == POCO_OS_LINUX) | ||||
// <linux/if.h> is needed by NetworkInterface for if | ||||
map, ifreq and ifconf definitions | ||||
#include <linux/if.h> | ||||
// if_nametoindex and if_indextoname are needed by I | ||||
PAddress and NetworkInterface | ||||
// we can't get them from <net/if.h> because of a co | ||||
nflict with <linux/if.h>, so | ||||
// we declare them here | ||||
extern "C" | ||||
{ | ||||
extern unsigned int if_nametoindex (__const char *__ | ||||
ifname) __THROW; | ||||
extern char *if_indextoname (unsigned int __ifindex, | ||||
char *__ifname) __THROW; | ||||
} | ||||
#else | ||||
#include <net/if.h> | ||||
#endif | ||||
#endif | ||||
#if (POCO_OS == POCO_OS_SOLARIS) || (POCO_OS == POCO_OS_MAC_OS_X) | ||||
#include <sys/sockio.h> | ||||
#include <sys/filio.h> | ||||
#endif | ||||
#define POCO_INVALID_SOCKET -1 | ||||
#define poco_socket_t int | ||||
#define poco_socklen_t socklen_t | ||||
#define poco_fcntl_request_t int | ||||
#if defined(POCO_OS_FAMILY_BSD) | ||||
#define poco_ioctl_request_t unsigned long | ||||
#else | ||||
#define poco_ioctl_request_t int | ||||
#endif | ||||
#define poco_closesocket(s) ::close(s) | ||||
#define POCO_EINTR EINTR | ||||
#define POCO_EACCES EACCES | ||||
#define POCO_EFAULT EFAULT | ||||
#define POCO_EINVAL EINVAL | ||||
#define POCO_EMFILE EMFILE | ||||
#define POCO_EAGAIN EAGAIN | ||||
#define POCO_EWOULDBLOCK EWOULDBLOCK | ||||
#define POCO_EINPROGRESS EINPROGRESS | ||||
#define POCO_EALREADY EALREADY | ||||
#define POCO_ENOTSOCK ENOTSOCK | ||||
#define POCO_EDESTADDRREQ EDESTADDRREQ | ||||
#define POCO_EMSGSIZE EMSGSIZE | ||||
#define POCO_EPROTOTYPE EPROTOTYPE | ||||
#define POCO_ENOPROTOOPT ENOPROTOOPT | ||||
#define POCO_EPROTONOSUPPORT EPROTONOSUPPORT | ||||
#if defined(ESOCKTNOSUPPORT) | ||||
#define POCO_ESOCKTNOSUPPORT ESOCKTNOSUPPORT | ||||
#else | ||||
#define POCO_ESOCKTNOSUPPORT -1 | ||||
#endif | ||||
#define POCO_ENOTSUP ENOTSUP | ||||
#define POCO_EPFNOSUPPORT EPFNOSUPPORT | ||||
#define POCO_EAFNOSUPPORT EAFNOSUPPORT | ||||
#define POCO_EADDRINUSE EADDRINUSE | ||||
#define POCO_EADDRNOTAVAIL EADDRNOTAVAIL | ||||
#define POCO_ENETDOWN ENETDOWN | ||||
#define POCO_ENETUNREACH ENETUNREACH | ||||
#define POCO_ENETRESET ENETRESET | ||||
#define POCO_ECONNABORTED ECONNABORTED | ||||
#define POCO_ECONNRESET ECONNRESET | ||||
#define POCO_ENOBUFS ENOBUFS | ||||
#define POCO_EISCONN EISCONN | ||||
#define POCO_ENOTCONN ENOTCONN | ||||
#if defined(ESHUTDOWN) | ||||
#define POCO_ESHUTDOWN ESHUTDOWN | ||||
#else | ||||
#define POCO_ESHUTDOWN -2 | ||||
#endif | ||||
#define POCO_ETIMEDOUT ETIMEDOUT | ||||
#define POCO_ECONNREFUSED ECONNREFUSED | ||||
#if defined(EHOSTDOWN) | ||||
#define POCO_EHOSTDOWN EHOSTDOWN | ||||
#else | ||||
#define POCO_EHOSTDOWN -3 | ||||
#endif | ||||
#define POCO_EHOSTUNREACH EHOSTUNREACH | ||||
#define POCO_ESYSNOTREADY -4 | ||||
#define POCO_ENOTINIT -5 | ||||
#define POCO_HOST_NOT_FOUND HOST_NOT_FOUND | ||||
#define POCO_TRY_AGAIN TRY_AGAIN | ||||
#define POCO_NO_RECOVERY NO_RECOVERY | ||||
#define POCO_NO_DATA NO_DATA | ||||
#endif | #endif | |||
#include <netinet/in.h> | ||||
#include <netinet/tcp.h> | #if defined(POCO_OS_FAMILY_BSD) || (POCO_OS == POCO_OS_TRU64) || (POCO_OS = | |||
#include <netdb.h> | = POCO_OS_AIX) || (POCO_OS == POCO_OS_IRIX) || (POCO_OS == POCO_OS_QNX) || | |||
#if defined(POCO_OS_FAMILY_UNIX) | (POCO_OS == POCO_OS_VXWORKS) | |||
#include <net/if.h> | #define POCO_HAVE_SALEN 1 | |||
#endif | ||||
#if defined(sun) || defined(__APPLE__) | ||||
#include <sys/sockio.h> | ||||
#include <sys/filio.h> | ||||
#endif | ||||
#define POCO_INVALID_SOCKET -1 | ||||
#define poco_socket_t int | ||||
#define poco_socklen_t socklen_t | ||||
#if defined(POCO_OS_FAMILY_BSD) | ||||
#define poco_ioctl_request_t unsigned long | ||||
#else | ||||
#define poco_ioctl_request_t int | ||||
#endif | #endif | |||
#define poco_closesocket(s) ::close(s) | ||||
#define POCO_EINTR EINTR | #if POCO_OS != POCO_OS_VXWORKS && !defined(POCO_NET_NO_ADDRINFO) | |||
#define POCO_EACCES EACCES | #define POCO_HAVE_ADDRINFO 1 | |||
#define POCO_EFAULT EFAULT | ||||
#define POCO_EINVAL EINVAL | ||||
#define POCO_EMFILE EMFILE | ||||
#define POCO_EAGAIN EAGAIN | ||||
#define POCO_EWOULDBLOCK EWOULDBLOCK | ||||
#define POCO_EINPROGRESS EINPROGRESS | ||||
#define POCO_EALREADY EALREADY | ||||
#define POCO_ENOTSOCK ENOTSOCK | ||||
#define POCO_EDESTADDRREQ EDESTADDRREQ | ||||
#define POCO_EMSGSIZE EMSGSIZE | ||||
#define POCO_EPROTOTYPE EPROTOTYPE | ||||
#define POCO_ENOPROTOOPT ENOPROTOOPT | ||||
#define POCO_EPROTONOSUPPORT EPROTONOSUPPORT | ||||
#if defined(ESOCKTNOSUPPORT) | ||||
#define POCO_ESOCKTNOSUPPORT ESOCKTNOSUPPORT | ||||
#else | ||||
#define POCO_ESOCKTNOSUPPORT -1 | ||||
#endif | #endif | |||
#define POCO_ENOTSUP ENOTSUP | ||||
#define POCO_EPFNOSUPPORT EPFNOSUPPORT | #if (POCO_OS == POCO_OS_HPUX) || (POCO_OS == POCO_OS_SOLARIS) || (POCO_OS = | |||
#define POCO_EAFNOSUPPORT EAFNOSUPPORT | = POCO_OS_WINDOWS_CE) | |||
#define POCO_EADDRINUSE EADDRINUSE | #define POCO_BROKEN_TIMEOUTS 1 | |||
#define POCO_EADDRNOTAVAIL EADDRNOTAVAIL | #endif | |||
#define POCO_ENETDOWN ENETDOWN | ||||
#define POCO_ENETUNREACH ENETUNREACH | #if defined(POCO_HAVE_ADDRINFO) | |||
#define POCO_ENETRESET ENETRESET | #if !defined(AI_ADDRCONFIG) | |||
#define POCO_ECONNABORTED ECONNABORTED | #define AI_ADDRCONFIG 0 | |||
#define POCO_ECONNRESET ECONNRESET | #endif | |||
#define POCO_ENOBUFS ENOBUFS | ||||
#define POCO_EISCONN EISCONN | ||||
#define POCO_ENOTCONN ENOTCONN | ||||
#if defined(ESHUTDOWN) | ||||
#define POCO_ESHUTDOWN ESHUTDOWN | ||||
#else | ||||
#define POCO_ESHUTDOWN -2 | ||||
#endif | #endif | |||
#define POCO_ETIMEDOUT ETIMEDOUT | ||||
#define POCO_ECONNREFUSED ECONNREFUSED | #if defined(POCO_HAVE_SALEN) | |||
#if defined(EHOSTDOWN) | #define poco_set_sa_len(pSA, len) (pSA)->sa_len = (len) | |||
#define POCO_EHOSTDOWN EHOSTDOWN | #define poco_set_sin_len(pSA) (pSA)->sin_len = sizeof(struct s | |||
ockaddr_in) | ||||
#if defined(POCO_HAVE_IPv6) | ||||
#define poco_set_sin6_len(pSA) (pSA)->sin6_len = sizeof(stru | ||||
ct sockaddr_in6) | ||||
#endif | ||||
#else | #else | |||
#define POCO_EHOSTDOWN -3 | #define poco_set_sa_len(pSA, len) (void) 0 | |||
#define poco_set_sin_len(pSA) (void) 0 | ||||
#define poco_set_sin6_len(pSA) (void) 0 | ||||
#endif | #endif | |||
#define POCO_EHOSTUNREACH EHOSTUNREACH | ||||
#define POCO_ESYSNOTREADY -4 | #ifndef INADDR_NONE | |||
#define POCO_ENOTINIT -5 | #define INADDR_NONE 0xffffffff | |||
#define POCO_HOST_NOT_FOUND HOST_NOT_FOUND | ||||
#define POCO_TRY_AGAIN TRY_AGAIN | ||||
#define POCO_NO_RECOVERY NO_RECOVERY | ||||
#define POCO_NO_DATA NO_DATA | ||||
#endif | #endif | |||
#if defined(POCO_OS_FAMILY_BSD) || (POCO_OS == POCO_OS_TRU64) || (POCO_OS = | #ifndef INADDR_ANY | |||
= POCO_OS_AIX) || (POCO_OS == POCO_OS_IRIX) || (POCO_OS == POCO_OS_QNX) || | #define INADDR_ANY 0x00000000 | |||
(POCO_OS == POCO_OS_VXWORKS) | ||||
#define POCO_HAVE_SALEN 1 | ||||
#endif | #endif | |||
#if POCO_OS != POCO_OS_VXWORKS && !defined(POCO_NET_NO_ADDRINFO) | #ifndef INADDR_BROADCAST | |||
#define POCO_HAVE_ADDRINFO 1 | #define INADDR_BROADCAST 0xffffffff | |||
#endif | #endif | |||
#if (POCO_OS == POCO_OS_HPUX) || (POCO_OS == POCO_OS_SOLARIS) || (POCO_OS = | #ifndef INADDR_LOOPBACK | |||
= POCO_OS_WINDOWS_CE) || (POCO_OS == POCO_OS_CYGWIN) | #define INADDR_LOOPBACK 0x7f000001 | |||
#define POCO_BROKEN_TIMEOUTS 1 | ||||
#endif | #endif | |||
#if defined(POCO_HAVE_ADDRINFO) | #ifndef INADDR_UNSPEC_GROUP | |||
#if !defined(AI_ADDRCONFIG) | #define INADDR_UNSPEC_GROUP 0xe0000000 | |||
#define AI_ADDRCONFIG 0 | ||||
#endif | #endif | |||
#ifndef INADDR_ALLHOSTS_GROUP | ||||
#define INADDR_ALLHOSTS_GROUP 0xe0000001 | ||||
#endif | #endif | |||
#if defined(POCO_HAVE_SALEN) | #ifndef INADDR_ALLRTRS_GROUP | |||
#define poco_set_sa_len(pSA, len) (pSA)->sa_len = (len) | #define INADDR_ALLRTRS_GROUP 0xe0000002 | |||
#define poco_set_sin_len(pSA) (pSA)->sin_len = sizeof(struct sockaddr_ | ||||
in) | ||||
#if defined(POCO_HAVE_IPv6) | ||||
#define poco_set_sin6_len(pSA) (pSA)->sin6_len = sizeof(struct sockaddr_ | ||||
in6) | ||||
#endif | #endif | |||
#else | ||||
#define poco_set_sa_len(pSA, len) (void) 0 | #ifndef INADDR_MAX_LOCAL_GROUP | |||
#define poco_set_sin_len(pSA) (void) 0 | #define INADDR_MAX_LOCAL_GROUP 0xe00000ff | |||
#define poco_set_sin6_len(pSA) (void) 0 | ||||
#endif | #endif | |||
#ifndef INADDR_NONE | #if defined(POCO_ARCH_BIG_ENDIAN) | |||
#define INADDR_NONE 0xFFFFFFFF | #define poco_ntoh_16(x) (x) | |||
#define poco_ntoh_32(x) (x) | ||||
#else | ||||
#define poco_ntoh_16(x) \ | ||||
((((x) >> 8) & 0x00ff) | (((x) << 8) & 0xff00)) | ||||
#define poco_ntoh_32(x) \ | ||||
((((x) >> 24) & 0x000000ff) | (((x) >> 8) & 0x0000ff00) | (( | ||||
(x) << 8) & 0x00ff0000) | (((x) << 24) & 0xff000000)) | ||||
#endif | #endif | |||
#define poco_hton_16(x) poco_ntoh_16(x) | ||||
#define poco_hton_32(x) poco_ntoh_32(x) | ||||
#endif // Net_SocketDefs_INCLUDED | #endif // Net_SocketDefs_INCLUDED | |||
End of changes. 19 change blocks. | ||||
205 lines changed or deleted | 269 lines changed or added | |||
SocketImpl.h | SocketImpl.h | |||
---|---|---|---|---|
skipping to change at line 371 | skipping to change at line 371 | |||
poco_socket_t sockfd() const; | poco_socket_t sockfd() const; | |||
/// Returns the socket descriptor for the | /// Returns the socket descriptor for the | |||
/// underlying native socket. | /// underlying native socket. | |||
void ioctl(poco_ioctl_request_t request, int& arg); | void ioctl(poco_ioctl_request_t request, int& arg); | |||
/// A wrapper for the ioctl system call. | /// A wrapper for the ioctl system call. | |||
void ioctl(poco_ioctl_request_t request, void* arg); | void ioctl(poco_ioctl_request_t request, void* arg); | |||
/// A wrapper for the ioctl system call. | /// A wrapper for the ioctl system call. | |||
#if defined(POCO_OS_FAMILY_UNIX) | ||||
int fcntl(poco_fcntl_request_t request); | ||||
/// A wrapper for the fcntl system call. | ||||
int fcntl(poco_fcntl_request_t request, long arg); | ||||
/// A wrapper for the fcntl system call. | ||||
#endif | ||||
bool initialized() const; | bool initialized() const; | |||
/// Returns true iff the underlying socket is initialized. | /// Returns true iff the underlying socket is initialized. | |||
protected: | protected: | |||
SocketImpl(); | SocketImpl(); | |||
/// Creates a SocketImpl. | /// Creates a SocketImpl. | |||
SocketImpl(poco_socket_t sockfd); | SocketImpl(poco_socket_t sockfd); | |||
/// Creates a SocketImpl using the given native socket. | /// Creates a SocketImpl using the given native socket. | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 8 lines changed or added | |||
SocketNotifier.h | SocketNotifier.h | |||
---|---|---|---|---|
skipping to change at line 69 | skipping to change at line 69 | |||
public: | public: | |||
explicit SocketNotifier(const Socket& socket); | explicit SocketNotifier(const Socket& socket); | |||
/// Creates the SocketNotifier for the given socket. | /// Creates the SocketNotifier for the given socket. | |||
void addObserver(SocketReactor* pReactor, const Poco::AbstractObserv er& observer); | void addObserver(SocketReactor* pReactor, const Poco::AbstractObserv er& observer); | |||
/// Adds the given observer. | /// Adds the given observer. | |||
void removeObserver(SocketReactor* pReactor, const Poco::AbstractObs erver& observer); | void removeObserver(SocketReactor* pReactor, const Poco::AbstractObs erver& observer); | |||
/// Removes the given observer. | /// Removes the given observer. | |||
bool hasObserver(const Poco::AbstractObserver& observer) const; | ||||
/// Returns true if the given observer is registered. | ||||
bool accepts(SocketNotification* pNotification); | bool accepts(SocketNotification* pNotification); | |||
/// Returns true if there is at least one observer for the g iven notification. | /// Returns true if there is at least one observer for the g iven notification. | |||
void dispatch(SocketNotification* pNotification); | void dispatch(SocketNotification* pNotification); | |||
/// Dispatches the notification to all observers. | /// Dispatches the notification to all observers. | |||
bool hasObservers() const; | bool hasObservers() const; | |||
/// Returns true if there are subscribers. | /// Returns true if there are subscribers. | |||
std::size_t countObservers() const; | std::size_t countObservers() const; | |||
skipping to change at line 101 | skipping to change at line 104 | |||
}; | }; | |||
// | // | |||
// inlines | // inlines | |||
// | // | |||
inline bool SocketNotifier::accepts(SocketNotification* pNotification) | inline bool SocketNotifier::accepts(SocketNotification* pNotification) | |||
{ | { | |||
return _events.find(pNotification) != _events.end(); | return _events.find(pNotification) != _events.end(); | |||
} | } | |||
inline bool SocketNotifier::hasObserver(const Poco::AbstractObserver& obser | ||||
ver) const | ||||
{ | ||||
return _nc.hasObserver(observer); | ||||
} | ||||
inline bool SocketNotifier::hasObservers() const | inline bool SocketNotifier::hasObservers() const | |||
{ | { | |||
return _nc.hasObservers(); | return _nc.hasObservers(); | |||
} | } | |||
inline std::size_t SocketNotifier::countObservers() const | inline std::size_t SocketNotifier::countObservers() const | |||
{ | { | |||
return _nc.countObservers(); | return _nc.countObservers(); | |||
} | } | |||
End of changes. 2 change blocks. | ||||
0 lines changed or deleted | 9 lines changed or added | |||
SocketReactor.h | SocketReactor.h | |||
---|---|---|---|---|
skipping to change at line 167 | skipping to change at line 167 | |||
const Poco::Timespan& getTimeout() const; | const Poco::Timespan& getTimeout() const; | |||
/// Returns the timeout. | /// Returns the timeout. | |||
void addEventHandler(const Socket& socket, const Poco::AbstractObser ver& observer); | void addEventHandler(const Socket& socket, const Poco::AbstractObser ver& observer); | |||
/// Registers an event handler with the SocketReactor. | /// Registers an event handler with the SocketReactor. | |||
/// | /// | |||
/// Usage: | /// Usage: | |||
/// Poco::Observer<MyEventHandler, SocketNotification> o bs(*this, &MyEventHandler::handleMyEvent); | /// Poco::Observer<MyEventHandler, SocketNotification> o bs(*this, &MyEventHandler::handleMyEvent); | |||
/// reactor.addEventHandler(obs); | /// reactor.addEventHandler(obs); | |||
bool hasEventHandler(const Socket& socket, const Poco::AbstractObser | ||||
ver& observer); | ||||
/// Returns true if the observer is reistered with SocketRea | ||||
ctor for the given socket. | ||||
void removeEventHandler(const Socket& socket, const Poco::AbstractOb server& observer); | void removeEventHandler(const Socket& socket, const Poco::AbstractOb server& observer); | |||
/// Unregisters an event handler with the SocketReactor. | /// Unregisters an event handler with the SocketReactor. | |||
/// | /// | |||
/// Usage: | /// Usage: | |||
/// Poco::Observer<MyEventHandler, SocketNotification> o bs(*this, &MyEventHandler::handleMyEvent); | /// Poco::Observer<MyEventHandler, SocketNotification> o bs(*this, &MyEventHandler::handleMyEvent); | |||
/// reactor.removeEventHandler(obs); | /// reactor.removeEventHandler(obs); | |||
protected: | protected: | |||
virtual void onTimeout(); | virtual void onTimeout(); | |||
/// Called if the timeout expires and no other events are av ailable. | /// Called if the timeout expires and no other events are av ailable. | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 5 lines changed or added | |||
Stopwatch.h | Stopwatch.h | |||
---|---|---|---|---|
// | // | |||
// Stopwatch.h | // Stopwatch.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Stopwatch.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/Stopwatch.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: DateTime | // Package: DateTime | |||
// Module: Stopwatch | // Module: Stopwatch | |||
// | // | |||
// Definition of the Stopwatch class. | // Definition of the Stopwatch class. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 42 | skipping to change at line 42 | |||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | |||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Foundation_Stopwatch_INCLUDED | #ifndef Foundation_Stopwatch_INCLUDED | |||
#define Foundation_Stopwatch_INCLUDED | #define Foundation_Stopwatch_INCLUDED | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
#include "Poco/Clock.h" | #include "Poco/Timestamp.h" | |||
namespace Poco { | namespace Poco { | |||
class Foundation_API Stopwatch | class Foundation_API Stopwatch | |||
/// A simple facility to measure time intervals | /// A simple facility to measure time intervals | |||
/// with microsecond resolution. | /// with microsecond resolution. | |||
/// | ||||
/// Note that Stopwatch is based on the Timestamp | ||||
/// class. Therefore, if during a Stopwatch run, | ||||
/// the system time is changed, the measured time | ||||
/// will not be correct. | ||||
{ | { | |||
public: | public: | |||
Stopwatch(); | Stopwatch(); | |||
~Stopwatch(); | ~Stopwatch(); | |||
void start(); | void start(); | |||
/// Starts (or restarts) the stopwatch. | /// Starts (or restarts) the stopwatch. | |||
void stop(); | void stop(); | |||
/// Stops or pauses the stopwatch. | /// Stops or pauses the stopwatch. | |||
void reset(); | void reset(); | |||
/// Resets the stopwatch. | /// Resets the stopwatch. | |||
void restart(); | void restart(); | |||
/// Resets and starts the stopwatch. | /// Resets and starts the stopwatch. | |||
Clock::ClockDiff elapsed() const; | Timestamp::TimeDiff elapsed() const; | |||
/// Returns the elapsed time in microseconds | /// Returns the elapsed time in microseconds | |||
/// since the stopwatch started. | /// since the stopwatch started. | |||
int elapsedSeconds() const; | int elapsedSeconds() const; | |||
/// Returns the number of seconds elapsed | /// Returns the number of seconds elapsed | |||
/// since the stopwatch started. | /// since the stopwatch started. | |||
static Clock::ClockVal resolution(); | static Timestamp::TimeVal resolution(); | |||
/// Returns the resolution of the stopwatch. | /// Returns the resolution of the stopwatch. | |||
private: | private: | |||
Stopwatch(const Stopwatch&); | Stopwatch(const Stopwatch&); | |||
Stopwatch& operator = (const Stopwatch&); | Stopwatch& operator = (const Stopwatch&); | |||
Clock _start; | Timestamp _start; | |||
Clock::ClockDiff _elapsed; | Timestamp::TimeDiff _elapsed; | |||
bool _running; | bool _running; | |||
}; | }; | |||
// | // | |||
// inlines | // inlines | |||
// | // | |||
inline void Stopwatch::start() | inline void Stopwatch::start() | |||
{ | { | |||
if (!_running) | if (!_running) | |||
{ | { | |||
_start.update(); | _start.update(); | |||
_running = true; | _running = true; | |||
} | } | |||
} | } | |||
inline void Stopwatch::stop() | inline void Stopwatch::stop() | |||
{ | { | |||
if (_running) | if (_running) | |||
{ | { | |||
Clock current; | Timestamp current; | |||
_elapsed += current - _start; | _elapsed += current - _start; | |||
_running = false; | _running = false; | |||
} | } | |||
} | } | |||
inline int Stopwatch::elapsedSeconds() const | inline int Stopwatch::elapsedSeconds() const | |||
{ | { | |||
return int(elapsed()/resolution()); | return int(elapsed()/resolution()); | |||
} | } | |||
inline Clock::ClockVal Stopwatch::resolution() | inline Timestamp::TimeVal Stopwatch::resolution() | |||
{ | { | |||
return Clock::resolution(); | return Timestamp::resolution(); | |||
} | } | |||
} // namespace Poco | } // namespace Poco | |||
#endif // Foundation_Stopwatch_INCLUDED | #endif // Foundation_Stopwatch_INCLUDED | |||
End of changes. 9 change blocks. | ||||
10 lines changed or deleted | 15 lines changed or added | |||
StreamSocket.h | StreamSocket.h | |||
---|---|---|---|---|
skipping to change at line 43 | skipping to change at line 43 | |||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Net_StreamSocket_INCLUDED | #ifndef Net_StreamSocket_INCLUDED | |||
#define Net_StreamSocket_INCLUDED | #define Net_StreamSocket_INCLUDED | |||
#include "Poco/Net/Net.h" | #include "Poco/Net/Net.h" | |||
#include "Poco/Net/Socket.h" | #include "Poco/Net/Socket.h" | |||
#include "Poco/FIFOBuffer.h" | ||||
namespace Poco { | namespace Poco { | |||
namespace Net { | namespace Net { | |||
class StreamSocketImpl; | class StreamSocketImpl; | |||
class Net_API StreamSocket: public Socket | class Net_API StreamSocket: public Socket | |||
/// This class provides an interface to a | /// This class provides an interface to a | |||
/// TCP stream socket. | /// TCP stream socket. | |||
{ | { | |||
skipping to change at line 126 | skipping to change at line 127 | |||
int sendBytes(const void* buffer, int length, int flags = 0); | int sendBytes(const void* buffer, int length, int flags = 0); | |||
/// Sends the contents of the given buffer through | /// Sends the contents of the given buffer through | |||
/// the socket. | /// the socket. | |||
/// | /// | |||
/// Returns the number of bytes sent, which may be | /// Returns the number of bytes sent, which may be | |||
/// less than the number of bytes specified. | /// less than the number of bytes specified. | |||
/// | /// | |||
/// Certain socket implementations may also return a negativ e | /// Certain socket implementations may also return a negativ e | |||
/// value denoting a certain condition. | /// value denoting a certain condition. | |||
int sendBytes(Poco::FIFOBuffer& buffer); | ||||
/// Sends the contents of the given buffer through | ||||
/// the socket. FIFOBuffer has writable/readable transiton | ||||
/// notifications which may be enabled to notify the caller | ||||
when | ||||
/// the buffer transitions between empty, partially full and | ||||
/// full states. | ||||
/// | ||||
/// Returns the number of bytes sent, which may be | ||||
/// less than the number of bytes specified. | ||||
/// | ||||
/// Certain socket implementations may also return a negativ | ||||
e | ||||
/// value denoting a certain condition. | ||||
int receiveBytes(void* buffer, int length, int flags = 0); | int receiveBytes(void* buffer, int length, int flags = 0); | |||
/// Receives data from the socket and stores it | /// Receives data from the socket and stores it | |||
/// in buffer. Up to length bytes are received. | /// in buffer. Up to length bytes are received. | |||
/// | /// | |||
/// Returns the number of bytes received. | /// Returns the number of bytes received. | |||
/// A return value of 0 means a graceful shutdown | /// A return value of 0 means a graceful shutdown | |||
/// of the connection from the peer. | /// of the connection from the peer. | |||
/// | /// | |||
/// Throws a TimeoutException if a receive timeout has | /// Throws a TimeoutException if a receive timeout has | |||
/// been set and nothing is received within that interval. | /// been set and nothing is received within that interval. | |||
/// Throws a NetException (or a subclass) in case of other e rrors. | /// Throws a NetException (or a subclass) in case of other e rrors. | |||
int receiveBytes(Poco::FIFOBuffer& buffer); | ||||
/// Receives data from the socket and stores it | ||||
/// in buffer. Up to length bytes are received. FIFOBuffer h | ||||
as | ||||
/// writable/readable transiton notifications which may be e | ||||
nabled | ||||
/// to notify the caller when the buffer transitions between | ||||
empty, | ||||
/// partially full and full states. | ||||
/// | ||||
/// Returns the number of bytes received. | ||||
/// A return value of 0 means a graceful shutdown | ||||
/// of the connection from the peer. | ||||
/// | ||||
/// Throws a TimeoutException if a receive timeout has | ||||
/// been set and nothing is received within that interval. | ||||
/// Throws a NetException (or a subclass) in case of other e | ||||
rrors. | ||||
void sendUrgent(unsigned char data); | void sendUrgent(unsigned char data); | |||
/// Sends one byte of urgent data through | /// Sends one byte of urgent data through | |||
/// the socket. | /// the socket. | |||
/// | /// | |||
/// The data is sent with the MSG_OOB flag. | /// The data is sent with the MSG_OOB flag. | |||
/// | /// | |||
/// The preferred way for a socket to receive urgent data | /// The preferred way for a socket to receive urgent data | |||
/// is by enabling the SO_OOBINLINE option. | /// is by enabling the SO_OOBINLINE option. | |||
public: | ||||
StreamSocket(SocketImpl* pImpl); | StreamSocket(SocketImpl* pImpl); | |||
/// Creates the Socket and attaches the given SocketImpl. | /// Creates the Socket and attaches the given SocketImpl. | |||
/// The socket takes owership of the SocketImpl. | /// The socket takes owership of the SocketImpl. | |||
/// | /// | |||
/// The SocketImpl must be a StreamSocketImpl, otherwise | /// The SocketImpl must be a StreamSocketImpl, otherwise | |||
/// an InvalidArgumentException will be thrown. | /// an InvalidArgumentException will be thrown. | |||
private: | ||||
enum | ||||
{ | ||||
BUFFER_SIZE = 1024 | ||||
}; | ||||
friend class ServerSocket; | friend class ServerSocket; | |||
friend class SocketIOS; | friend class SocketIOS; | |||
}; | }; | |||
} } // namespace Poco::Net | } } // namespace Poco::Net | |||
#endif // Net_StreamSocket_INCLUDED | #endif // Net_StreamSocket_INCLUDED | |||
End of changes. 5 change blocks. | ||||
1 lines changed or deleted | 41 lines changed or added | |||
String.h | String.h | |||
---|---|---|---|---|
skipping to change at line 190 | skipping to change at line 190 | |||
It end2) | It end2) | |||
/// Case-insensitive string comparison | /// Case-insensitive string comparison | |||
{ | { | |||
typename S::size_type sz = str.size(); | typename S::size_type sz = str.size(); | |||
if (pos > sz) pos = sz; | if (pos > sz) pos = sz; | |||
if (pos + n > sz) n = sz - pos; | if (pos + n > sz) n = sz - pos; | |||
It it1 = str.begin() + pos; | It it1 = str.begin() + pos; | |||
It end1 = str.begin() + pos + n; | It end1 = str.begin() + pos + n; | |||
while (it1 != end1 && it2 != end2) | while (it1 != end1 && it2 != end2) | |||
{ | { | |||
typename S::value_type c1(Ascii::toLower(*it1)); | typename S::value_type c1(Ascii::toLower(*it1)); | |||
typename S::value_type c2(Ascii::toLower(*it2)); | typename S::value_type c2(Ascii::toLower(*it2)); | |||
if (c1 < c2) | if (c1 < c2) | |||
return -1; | return -1; | |||
else if (c1 > c2) | else if (c1 > c2) | |||
return 1; | return 1; | |||
++it1; ++it2; | ++it1; ++it2; | |||
} | } | |||
if (it1 == end1) | if (it1 == end1) | |||
return it2 == end2 ? 0 : -1; | return it2 == end2 ? 0 : -1; | |||
else | else | |||
return 1; | return 1; | |||
} | } | |||
template <class S> | template <class S> | |||
int icompare(const S& str1, const S& str2) | int icompare(const S& str1, const S& str2) | |||
// A special optimization for an often used case. | // A special optimization for an often used case. | |||
{ | { | |||
typename S::const_iterator it1(str1.begin()); | typename S::const_iterator it1(str1.begin()); | |||
typename S::const_iterator end1(str1.end()); | typename S::const_iterator end1(str1.end()); | |||
typename S::const_iterator it2(str2.begin()); | typename S::const_iterator it2(str2.begin()); | |||
typename S::const_iterator end2(str2.end()); | typename S::const_iterator end2(str2.end()); | |||
while (it1 != end1 && it2 != end2) | while (it1 != end1 && it2 != end2) | |||
{ | { | |||
typename S::value_type c1(Ascii::toLower(*it1)); | typename S::value_type c1(Ascii::toLower(*it1)); | |||
typename S::value_type c2(Ascii::toLower(*it2)); | typename S::value_type c2(Ascii::toLower(*it2)); | |||
if (c1 < c2) | if (c1 < c2) | |||
return -1; | return -1; | |||
else if (c1 > c2) | else if (c1 > c2) | |||
return 1; | return 1; | |||
++it1; ++it2; | ++it1; ++it2; | |||
} | } | |||
if (it1 == end1) | if (it1 == end1) | |||
return it2 == end2 ? 0 : -1; | return it2 == end2 ? 0 : -1; | |||
else | else | |||
return 1; | return 1; | |||
} | } | |||
template <class S> | template <class S> | |||
int icompare(const S& str1, typename S::size_type n1, const S& str2, typena me S::size_type n2) | int icompare(const S& str1, typename S::size_type n1, const S& str2, typena me S::size_type n2) | |||
{ | { | |||
if (n2 > str2.size()) n2 = str2.size(); | if (n2 > str2.size()) n2 = str2.size(); | |||
return icompare(str1, 0, n1, str2.begin(), str2.begin() + n2); | return icompare(str1, 0, n1, str2.begin(), str2.begin() + n2); | |||
} | } | |||
template <class S> | template <class S> | |||
skipping to change at line 294 | skipping to change at line 294 | |||
const typename S::value_type* ptr) | const typename S::value_type* ptr) | |||
{ | { | |||
poco_check_ptr (ptr); | poco_check_ptr (ptr); | |||
typename S::size_type sz = str.size(); | typename S::size_type sz = str.size(); | |||
if (pos > sz) pos = sz; | if (pos > sz) pos = sz; | |||
if (pos + n > sz) n = sz - pos; | if (pos + n > sz) n = sz - pos; | |||
typename S::const_iterator it = str.begin() + pos; | typename S::const_iterator it = str.begin() + pos; | |||
typename S::const_iterator end = str.begin() + pos + n; | typename S::const_iterator end = str.begin() + pos + n; | |||
while (it != end && *ptr) | while (it != end && *ptr) | |||
{ | { | |||
typename S::value_type c1(Ascii::toLower(*it)); | typename S::value_type c1(Ascii::toLower(*it)); | |||
typename S::value_type c2(Ascii::toLower(*ptr)); | typename S::value_type c2(Ascii::toLower(*ptr)); | |||
if (c1 < c2) | if (c1 < c2) | |||
return -1; | return -1; | |||
else if (c1 > c2) | else if (c1 > c2) | |||
return 1; | return 1; | |||
++it; ++ptr; | ++it; ++ptr; | |||
} | } | |||
if (it == end) | if (it == end) | |||
return *ptr == 0 ? 0 : -1; | return *ptr == 0 ? 0 : -1; | |||
else | else | |||
return 1; | return 1; | |||
} | } | |||
template <class S> | template <class S> | |||
int icompare( | int icompare( | |||
const S& str, | const S& str, | |||
typename S::size_type pos, | typename S::size_type pos, | |||
const typename S::value_type* ptr) | const typename S::value_type* ptr) | |||
{ | { | |||
return icompare(str, pos, str.size() - pos, ptr); | return icompare(str, pos, str.size() - pos, ptr); | |||
} | } | |||
End of changes. 9 change blocks. | ||||
30 lines changed or deleted | 30 lines changed or added | |||
StringTokenizer.h | StringTokenizer.h | |||
---|---|---|---|---|
skipping to change at line 57 | skipping to change at line 57 | |||
class Foundation_API StringTokenizer | class Foundation_API StringTokenizer | |||
/// A simple tokenizer that splits a string into | /// A simple tokenizer that splits a string into | |||
/// tokens, which are separated by separator characters. | /// tokens, which are separated by separator characters. | |||
/// An iterator is used to iterate over all tokens. | /// An iterator is used to iterate over all tokens. | |||
{ | { | |||
public: | public: | |||
enum Options | enum Options | |||
{ | { | |||
TOK_IGNORE_EMPTY = 1, /// ignore empty tokens | TOK_IGNORE_EMPTY = 1, /// ignore empty tokens | |||
TOK_TRIM = 2 /// remove leading and trailing whites pace from tokens | TOK_TRIM = 2 /// remove leading and trailing whites pace from tokens | |||
}; | }; | |||
typedef std::vector<std::string>::const_iterator Iterator; | typedef std::vector<std::string> TokenVec; | |||
typedef TokenVec::const_iterator Iterator; | ||||
StringTokenizer(const std::string& str, const std::string& separator s, int options = 0); | StringTokenizer(const std::string& str, const std::string& separator s, int options = 0); | |||
/// Splits the given string into tokens. The tokens are expe cted to be | /// Splits the given string into tokens. The tokens are expe cted to be | |||
/// separated by one of the separator characters given in se parators. | /// separated by one of the separator characters given in se parators. | |||
/// Additionally, options can be specified: | /// Additionally, options can be specified: | |||
/// * TOK_IGNORE_EMPTY: empty tokens are ignored | /// * TOK_IGNORE_EMPTY: empty tokens are ignored | |||
/// * TOK_TRIM: trailing and leading whitespace is removed from tokens. | /// * TOK_TRIM: trailing and leading whitespace is removed from tokens. | |||
/// An empty token at the end of str is always ignored. For example, | /// An empty token at the end of str is always ignored. For example, | |||
/// a StringTokenizer with the following arguments: | /// a StringTokenizer with the following arguments: | |||
/// StringTokenizer(",ab,cd,", ","); | /// StringTokenizer(",ab,cd,", ","); | |||
/// will produce three tokens, "", "ab" and "cd". | /// will produce three tokens, "", "ab" and "cd". | |||
~StringTokenizer(); | ~StringTokenizer(); | |||
/// Destroys the tokenizer. | /// Destroys the tokenizer. | |||
Iterator begin() const; | Iterator begin() const; | |||
Iterator end() const; | Iterator end() const; | |||
const std::string& operator [] (std::size_t index) const; | const std::string& operator [] (std::size_t index) const; | |||
/// Returns the index'th token. | /// Returns const reference the index'th token. | |||
/// Throws a RangeException if the index is out of range. | /// Throws a RangeException if the index is out of range. | |||
std::string& operator [] (std::size_t index); | ||||
/// Returns reference to the index'th token. | ||||
/// Throws a RangeException if the index is out of range. | ||||
bool has(const std::string& token) const; | ||||
/// Returns true if token exists, false otherwise. | ||||
std::size_t find(const std::string& token, std::size_t pos = 0) cons | ||||
t; | ||||
/// Returns the index of the first occurence of the token | ||||
/// starting at position pos. | ||||
/// Throws a NotFoundException if the token is not found. | ||||
std::size_t replace(const std::string& oldToken, const std::string& | ||||
newToken, std::size_t pos = 0); | ||||
/// Starting at position pos, replaces all subsequent tokens | ||||
having value | ||||
/// equal to oldToken with newToken. | ||||
/// Returns the number of modified tokens. | ||||
std::size_t count() const; | std::size_t count() const; | |||
/// Returns the number of tokens. | /// Returns the total number of tokens. | |||
std::size_t count(const std::string& token) const; | ||||
/// Returns the number of tokens equal to the specified toke | ||||
n. | ||||
private: | private: | |||
StringTokenizer(const StringTokenizer&); | StringTokenizer(const StringTokenizer&); | |||
StringTokenizer& operator = (const StringTokenizer&); | StringTokenizer& operator = (const StringTokenizer&); | |||
std::vector<std::string> _tokens; | TokenVec _tokens; | |||
}; | }; | |||
// | // | |||
// inlines | // inlines | |||
// | // | |||
inline StringTokenizer::Iterator StringTokenizer::begin() const | inline StringTokenizer::Iterator StringTokenizer::begin() const | |||
{ | { | |||
return _tokens.begin(); | return _tokens.begin(); | |||
} | } | |||
inline StringTokenizer::Iterator StringTokenizer::end() const | inline StringTokenizer::Iterator StringTokenizer::end() const | |||
{ | { | |||
return _tokens.end(); | return _tokens.end(); | |||
} | } | |||
inline std::string& StringTokenizer::operator [] (std::size_t index) | ||||
{ | ||||
if (index >= _tokens.size()) throw RangeException(); | ||||
return _tokens[index]; | ||||
} | ||||
inline const std::string& StringTokenizer::operator [] (std::size_t index) const | inline const std::string& StringTokenizer::operator [] (std::size_t index) const | |||
{ | { | |||
if (index >= _tokens.size()) throw RangeException(); | if (index >= _tokens.size()) throw RangeException(); | |||
return _tokens[index]; | return _tokens[index]; | |||
} | } | |||
inline std::size_t StringTokenizer::count() const | inline std::size_t StringTokenizer::count() const | |||
{ | { | |||
return _tokens.size(); | return _tokens.size(); | |||
} | } | |||
End of changes. 7 change blocks. | ||||
5 lines changed or deleted | 36 lines changed or added | |||
TCPServer.h | TCPServer.h | |||
---|---|---|---|---|
skipping to change at line 99 | skipping to change at line 99 | |||
/// To stop the server from accepting new connections, call stop(). | /// To stop the server from accepting new connections, call stop(). | |||
/// | /// | |||
/// After calling stop(), no new connections will be accepted and | /// After calling stop(), no new connections will be accepted and | |||
/// all queued connections will be discarded. | /// all queued connections will be discarded. | |||
/// Already served connections, however, will continue being served. | /// Already served connections, however, will continue being served. | |||
{ | { | |||
public: | public: | |||
TCPServer(TCPServerConnectionFactory::Ptr pFactory, const ServerSock et& socket, TCPServerParams::Ptr pParams = 0); | TCPServer(TCPServerConnectionFactory::Ptr pFactory, const ServerSock et& socket, TCPServerParams::Ptr pParams = 0); | |||
/// Creates the TCPServer, using the given ServerSocket. | /// Creates the TCPServer, using the given ServerSocket. | |||
/// | /// | |||
/// The server takes ownership of the TCPServerConnectionFac | ||||
tory | ||||
/// and deletes it when it's no longer needed. | ||||
/// | ||||
/// The server also takes ownership of the TCPServerParams o | ||||
bject. | ||||
/// If no TCPServerParams object is given, the server's TCPS erverDispatcher | /// If no TCPServerParams object is given, the server's TCPS erverDispatcher | |||
/// creates its own one. | /// creates its own one. | |||
/// | /// | |||
/// New threads are taken from the default thread pool. | /// New threads are taken from the default thread pool. | |||
TCPServer(TCPServerConnectionFactory::Ptr pFactory, Poco::ThreadPool & threadPool, const ServerSocket& socket, TCPServerParams::Ptr pParams = 0) ; | TCPServer(TCPServerConnectionFactory::Ptr pFactory, Poco::ThreadPool & threadPool, const ServerSocket& socket, TCPServerParams::Ptr pParams = 0) ; | |||
/// Creates the TCPServer, using the given ServerSocket. | /// Creates the TCPServer, using the given ServerSocket. | |||
/// | /// | |||
/// The server takes ownership of the TCPServerConnectionFac | ||||
tory | ||||
/// and deletes it when it's no longer needed. | ||||
/// | ||||
/// The server also takes ownership of the TCPServerParams o | ||||
bject. | ||||
/// If no TCPServerParams object is given, the server's TCPS erverDispatcher | /// If no TCPServerParams object is given, the server's TCPS erverDispatcher | |||
/// creates its own one. | /// creates its own one. | |||
/// | /// | |||
/// New threads are taken from the given thread pool. | /// New threads are taken from the given thread pool. | |||
virtual ~TCPServer(); | virtual ~TCPServer(); | |||
/// Destroys the TCPServer and its TCPServerConnectionFactor y. | /// Destroys the TCPServer and its TCPServerConnectionFactor y. | |||
const TCPServerParams& params() const; | const TCPServerParams& params() const; | |||
/// Returns a const reference to the TCPServerParam object | /// Returns a const reference to the TCPServerParam object | |||
End of changes. 2 change blocks. | ||||
0 lines changed or deleted | 12 lines changed or added | |||
TCPServerDispatcher.h | TCPServerDispatcher.h | |||
---|---|---|---|---|
skipping to change at line 60 | skipping to change at line 60 | |||
namespace Poco { | namespace Poco { | |||
namespace Net { | namespace Net { | |||
class Net_API TCPServerDispatcher: public Poco::Runnable | class Net_API TCPServerDispatcher: public Poco::Runnable | |||
/// A helper class for TCPServer that dispatches | /// A helper class for TCPServer that dispatches | |||
/// connections to server connection threads. | /// connections to server connection threads. | |||
{ | { | |||
public: | public: | |||
TCPServerDispatcher(TCPServerConnectionFactory::Ptr pFactory, Poco:: ThreadPool& threadPool, TCPServerParams::Ptr pParams); | TCPServerDispatcher(TCPServerConnectionFactory::Ptr pFactory, Poco:: ThreadPool& threadPool, TCPServerParams::Ptr pParams); | |||
/// Creates the TCPServerDispatcher. | /// Creates the TCPServerDispatcher. | |||
/// | ||||
/// The dispatcher takes ownership of the TCPServerParams ob | ||||
ject. | ||||
/// If no TCPServerParams object is supplied, the TCPServerD | ||||
ispatcher | ||||
/// creates one. | ||||
void duplicate(); | void duplicate(); | |||
/// Increments the object's reference count. | /// Increments the object's reference count. | |||
void release(); | void release(); | |||
/// Decrements the object's reference count | /// Decrements the object's reference count | |||
/// and deletes the object if the count | /// and deletes the object if the count | |||
/// reaches zero. | /// reaches zero. | |||
void run(); | void run(); | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 6 lines changed or added | |||
TaskManager.h | TaskManager.h | |||
---|---|---|---|---|
// | // | |||
// TaskManager.h | // TaskManager.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/TaskManager.h#3 $ | // $Id: //poco/1.4/Foundation/include/Poco/TaskManager.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Tasks | // Package: Tasks | |||
// Module: Tasks | // Module: Tasks | |||
// | // | |||
// Definition of the TaskManager class. | // Definition of the TaskManager class. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 120 | skipping to change at line 120 | |||
/// Observer<MyClass, MyNotification> obs(*this, &MyClas s::handleNotification); | /// Observer<MyClass, MyNotification> obs(*this, &MyClas s::handleNotification); | |||
/// notificationCenter.addObserver(obs); | /// notificationCenter.addObserver(obs); | |||
void removeObserver(const AbstractObserver& observer); | void removeObserver(const AbstractObserver& observer); | |||
/// Unregisters an observer with the NotificationCenter. | /// Unregisters an observer with the NotificationCenter. | |||
static const int MIN_PROGRESS_NOTIFICATION_INTERVAL; | static const int MIN_PROGRESS_NOTIFICATION_INTERVAL; | |||
protected: | protected: | |||
void postNotification(const Notification::Ptr& pNf); | void postNotification(const Notification::Ptr& pNf); | |||
/// Posts a notification to the task manager's | /// Posts a notification to the task manager's | |||
/// notification center. | /// notification center. | |||
void taskStarted(Task* pTask); | void taskStarted(Task* pTask); | |||
void taskProgress(Task* pTask, float progress); | void taskProgress(Task* pTask, float progress); | |||
void taskCancelled(Task* pTask); | void taskCancelled(Task* pTask); | |||
void taskFinished(Task* pTask); | void taskFinished(Task* pTask); | |||
void taskFailed(Task* pTask, const Exception& exc); | void taskFailed(Task* pTask, const Exception& exc); | |||
private: | private: | |||
ThreadPool& _threadPool; | ThreadPool& _threadPool; | |||
TaskList _taskList; | TaskList _taskList; | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
TemporaryFile.h | TemporaryFile.h | |||
---|---|---|---|---|
skipping to change at line 66 | skipping to change at line 66 | |||
/// The TemporaryFile class does not actually | /// The TemporaryFile class does not actually | |||
/// create the file - this is up to the application. | /// create the file - this is up to the application. | |||
/// The class does, however, delete the temporary | /// The class does, however, delete the temporary | |||
/// file - either in the destructor, or immediately | /// file - either in the destructor, or immediately | |||
/// before the application terminates. | /// before the application terminates. | |||
{ | { | |||
public: | public: | |||
TemporaryFile(); | TemporaryFile(); | |||
/// Creates the TemporaryFile. | /// Creates the TemporaryFile. | |||
TemporaryFile(const std::string& tempDir); | TemporaryFile(const std::string& tempDir); | |||
/// Creates the TemporaryFile using the given directory. | /// Creates the TemporaryFile using the given directory. | |||
~TemporaryFile(); | ~TemporaryFile(); | |||
/// Destroys the TemporaryFile and | /// Destroys the TemporaryFile and | |||
/// deletes the corresponding file on | /// deletes the corresponding file on | |||
/// disk unless keep() or keepUntilExit() | /// disk unless keep() or keepUntilExit() | |||
/// has been called. | /// has been called. | |||
void keep(); | void keep(); | |||
/// Disables automatic deletion of the file in | /// Disables automatic deletion of the file in | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
Thread.h | Thread.h | |||
---|---|---|---|---|
// | // | |||
// Thread.h | // Thread.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Thread.h#6 $ | // $Id: //poco/1.4/Foundation/include/Poco/Thread.h#3 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Threading | // Package: Threading | |||
// Module: Thread | // Module: Thread | |||
// | // | |||
// Definition of the Thread class. | // Definition of the Thread class. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 157 | skipping to change at line 157 | |||
/// Setting the stack size to 0 will use the default stack s ize. | /// Setting the stack size to 0 will use the default stack s ize. | |||
/// Typically, the real stack size is rounded up to the near est | /// Typically, the real stack size is rounded up to the near est | |||
/// page size multiple. | /// page size multiple. | |||
int getStackSize() const; | int getStackSize() const; | |||
/// Returns the thread's stack size in bytes. | /// Returns the thread's stack size in bytes. | |||
/// If the default stack size is used, 0 is returned. | /// If the default stack size is used, 0 is returned. | |||
void start(Runnable& target); | void start(Runnable& target); | |||
/// Starts the thread with the given target. | /// Starts the thread with the given target. | |||
/// | ||||
/// Note that the given Runnable object must be | ||||
/// valid during the entire lifetime of the thread, as | ||||
/// only a reference to it is stored internally. | ||||
void start(Callable target, void* pData = 0); | void start(Callable target, void* pData = 0); | |||
/// Starts the thread with the given target and parameter. | /// Starts the thread with the given target and parameter. | |||
void join(); | void join(); | |||
/// Waits until the thread completes execution. | /// Waits until the thread completes execution. | |||
/// If multiple threads try to join the same | /// If multiple threads try to join the same | |||
/// thread, the result is undefined. | /// thread, the result is undefined. | |||
void join(long milliseconds); | void join(long milliseconds); | |||
End of changes. 2 change blocks. | ||||
5 lines changed or deleted | 1 lines changed or added | |||
ThreadTarget.h | ThreadTarget.h | |||
---|---|---|---|---|
// | // | |||
// ThreadTarget.h | // ThreadTarget.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/ThreadTarget.h#1 $ | // $Id: ThreadTarget.h 1327 2010-02-09 13:56:31Z obiltschnig $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Threading | // Package: Threading | |||
// Module: ThreadTarget | // Module: ThreadTarget | |||
// | // | |||
// Definition of the ThreadTarget class. | // Definition of the ThreadTarget class. | |||
// | // | |||
// Copyright (c) 2008, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2008, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
Thread_POSIX.h | Thread_POSIX.h | |||
---|---|---|---|---|
// | // | |||
// Thread_POSIX.h | // Thread_POSIX.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Thread_POSIX.h#6 $ | // $Id: //poco/1.4/Foundation/include/Poco/Thread_POSIX.h#3 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Threading | // Package: Threading | |||
// Module: Thread | // Module: Thread | |||
// | // | |||
// Definition of the ThreadImpl class for POSIX Threads. | // Definition of the ThreadImpl class for POSIX Threads. | |||
// | // | |||
// Copyright (c) 2004-2007, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2007, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
Thread_VX.h | Thread_VX.h | |||
---|---|---|---|---|
// | // | |||
// Thread_VX.h | // Thread_VX.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Thread_VX.h#4 $ | // $Id: //poco/1.4/Foundation/include/Poco/Thread_VX.h#3 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Threading | // Package: Threading | |||
// Module: Thread | // Module: Thread | |||
// | // | |||
// Definition of the ThreadImpl class for VxWorks tasks. | // Definition of the ThreadImpl class for VxWorks tasks. | |||
// | // | |||
// Copyright (c) 2004-2011, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2011, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 55 | skipping to change at line 55 | |||
#include "Poco/RefCountedObject.h" | #include "Poco/RefCountedObject.h" | |||
#include "Poco/AutoPtr.h" | #include "Poco/AutoPtr.h" | |||
#include <taskLib.h> | #include <taskLib.h> | |||
#include <taskVarLib.h> | #include <taskVarLib.h> | |||
namespace Poco { | namespace Poco { | |||
class Foundation_API ThreadImpl | class Foundation_API ThreadImpl | |||
{ | { | |||
public: | public: | |||
typedef int TIDImpl; | typedef int TIDImpl; | |||
typedef void (*Callable)(void*); | typedef void (*Callable)(void*); | |||
enum Priority | enum Priority | |||
{ | { | |||
PRIO_LOWEST_IMPL, | PRIO_LOWEST_IMPL, | |||
PRIO_LOW_IMPL, | PRIO_LOW_IMPL, | |||
PRIO_NORMAL_IMPL, | PRIO_NORMAL_IMPL, | |||
PRIO_HIGH_IMPL, | PRIO_HIGH_IMPL, | |||
PRIO_HIGHEST_IMPL | PRIO_HIGHEST_IMPL | |||
}; | }; | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
Thread_WIN32.h | Thread_WIN32.h | |||
---|---|---|---|---|
// | // | |||
// Thread_WIN32.h | // Thread_WIN32.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Thread_WIN32.h#3 $ | // $Id: //poco/1.4/Foundation/include/Poco/Thread_WIN32.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Threading | // Package: Threading | |||
// Module: Thread | // Module: Thread | |||
// | // | |||
// Definition of the ThreadImpl class for WIN32. | // Definition of the ThreadImpl class for WIN32. | |||
// | // | |||
// Copyright (c) 2004-2009, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2009, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
TimedNotificationQueue.h | TimedNotificationQueue.h | |||
---|---|---|---|---|
// | // | |||
// TimedNotificationQueue.h | // TimedNotificationQueue.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/TimedNotificationQueue.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/TimedNotificationQueue.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Notifications | // Package: Notifications | |||
// Module: TimedNotificationQueue | // Module: TimedNotificationQueue | |||
// | // | |||
// Definition of the TimedNotificationQueue class. | // Definition of the TimedNotificationQueue class. | |||
// | // | |||
// Copyright (c) 2009, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2009, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 46 | skipping to change at line 46 | |||
// | // | |||
#ifndef Foundation_TimedNotificationQueue_INCLUDED | #ifndef Foundation_TimedNotificationQueue_INCLUDED | |||
#define Foundation_TimedNotificationQueue_INCLUDED | #define Foundation_TimedNotificationQueue_INCLUDED | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
#include "Poco/Notification.h" | #include "Poco/Notification.h" | |||
#include "Poco/Mutex.h" | #include "Poco/Mutex.h" | |||
#include "Poco/Event.h" | #include "Poco/Event.h" | |||
#include "Poco/Timestamp.h" | #include "Poco/Timestamp.h" | |||
#include "Poco/Clock.h" | ||||
#include <map> | #include <map> | |||
namespace Poco { | namespace Poco { | |||
class Foundation_API TimedNotificationQueue | class Foundation_API TimedNotificationQueue | |||
/// A TimedNotificationQueue object provides a way to implement time d, asynchronous | /// A TimedNotificationQueue object provides a way to implement time d, asynchronous | |||
/// notifications. This is especially useful for sending notificatio ns | /// notifications. This is especially useful for sending notificatio ns | |||
/// from one thread to another, for example from a background thread to | /// from one thread to another, for example from a background thread to | |||
/// the main (user interface) thread. | /// the main (user interface) thread. | |||
/// | /// | |||
skipping to change at line 87 | skipping to change at line 86 | |||
/// Destroys the TimedNotificationQueue. | /// Destroys the TimedNotificationQueue. | |||
void enqueueNotification(Notification::Ptr pNotification, Timestamp timestamp); | void enqueueNotification(Notification::Ptr pNotification, Timestamp timestamp); | |||
/// Enqueues the given notification by adding it to | /// Enqueues the given notification by adding it to | |||
/// the queue according to the given timestamp. | /// the queue according to the given timestamp. | |||
/// Lower timestamp values are inserted before higher ones. | /// Lower timestamp values are inserted before higher ones. | |||
/// The queue takes ownership of the notification, thus | /// The queue takes ownership of the notification, thus | |||
/// a call like | /// a call like | |||
/// notificationQueue.enqueueNotification(new MyNotifica tion, someTime); | /// notificationQueue.enqueueNotification(new MyNotifica tion, someTime); | |||
/// does not result in a memory leak. | /// does not result in a memory leak. | |||
/// | ||||
/// The Timestamp is converted to an equivalent Clock value. | ||||
void enqueueNotification(Notification::Ptr pNotification, Clock cloc | ||||
k); | ||||
/// Enqueues the given notification by adding it to | ||||
/// the queue according to the given clock value. | ||||
/// Lower clock values are inserted before higher ones. | ||||
/// The queue takes ownership of the notification, thus | ||||
/// a call like | ||||
/// notificationQueue.enqueueNotification(new MyNotifica | ||||
tion, someTime); | ||||
/// does not result in a memory leak. | ||||
Notification* dequeueNotification(); | Notification* dequeueNotification(); | |||
/// Dequeues the next pending notification with a timestamp | /// Dequeues the next pending notification with a timestamp | |||
/// less than or equal to the current time. | /// less than or equal to the current time. | |||
/// Returns 0 (null) if no notification is available. | /// Returns 0 (null) if no notification is available. | |||
/// The caller gains ownership of the notification and | /// The caller gains ownership of the notification and | |||
/// is expected to release it when done with it. | /// is expected to release it when done with it. | |||
/// | /// | |||
/// It is highly recommended that the result is immediately | /// It is highly recommended that the result is immediately | |||
/// assigned to a Notification::Ptr, to avoid potential | /// assigned to a Notification::Ptr, to avoid potential | |||
/// memory management issues. | /// memory management issues. | |||
Notification* waitDequeueNotification(); | Notification* waitDequeueNotification(); | |||
/// Dequeues the next pending notification. | /// Dequeues the next pending notification. | |||
/// If no notification is available, waits for a notificatio n | /// If no notification is available, waits for a notificatio n | |||
/// to be enqueued. | /// to be enqueued. | |||
/// The caller gains ownership of the notification and | /// The caller gains ownership of the notification and | |||
/// is expected to release it when done with it. | /// is expected to release it when done with it. | |||
/// This method returns 0 (null) if wakeUpWaitingThreads() | ||||
/// has been called by another thread. | ||||
/// | /// | |||
/// It is highly recommended that the result is immediately | /// It is highly recommended that the result is immediately | |||
/// assigned to a Notification::Ptr, to avoid potential | /// assigned to a Notification::Ptr, to avoid potential | |||
/// memory management issues. | /// memory management issues. | |||
Notification* waitDequeueNotification(long milliseconds); | Notification* waitDequeueNotification(long milliseconds); | |||
/// Dequeues the next pending notification. | /// Dequeues the next pending notification. | |||
/// If no notification is available, waits for a notificatio n | /// If no notification is available, waits for a notificatio n | |||
/// to be enqueued up to the specified time. | /// to be enqueued up to the specified time. | |||
/// Returns 0 (null) if no notification is available. | /// Returns 0 (null) if no notification is available. | |||
skipping to change at line 147 | skipping to change at line 137 | |||
/// Returns the number of notifications in the queue. | /// Returns the number of notifications in the queue. | |||
void clear(); | void clear(); | |||
/// Removes all notifications from the queue. | /// Removes all notifications from the queue. | |||
/// | /// | |||
/// Calling clear() while another thread executes one of | /// Calling clear() while another thread executes one of | |||
/// the dequeue member functions will result in undefined | /// the dequeue member functions will result in undefined | |||
/// behavior. | /// behavior. | |||
protected: | protected: | |||
typedef std::multimap<Clock, Notification::Ptr> NfQueue; | typedef std::multimap<Timestamp, Notification::Ptr> NfQueue; | |||
Notification::Ptr dequeueOne(NfQueue::iterator& it); | Notification::Ptr dequeueOne(NfQueue::iterator& it); | |||
bool wait(Clock::ClockDiff interval); | bool wait(Timestamp::TimeDiff interval); | |||
private: | private: | |||
NfQueue _nfQueue; | NfQueue _nfQueue; | |||
Event _nfAvailable; | Event _nfAvailable; | |||
mutable FastMutex _mutex; | mutable FastMutex _mutex; | |||
}; | }; | |||
} // namespace Poco | } // namespace Poco | |||
#endif // Foundation_TimedNotificationQueue_INCLUDED | #endif // Foundation_TimedNotificationQueue_INCLUDED | |||
End of changes. 7 change blocks. | ||||
18 lines changed or deleted | 6 lines changed or added | |||
Timer.h | Timer.h | |||
---|---|---|---|---|
// | // | |||
// Timer.h | // Timer.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Timer.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/Timer.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Threading | // Package: Threading | |||
// Module: Timer | // Module: Timer | |||
// | // | |||
// Definition of the Timer and related classes. | // Definition of the Timer and related classes. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 46 | skipping to change at line 46 | |||
// | // | |||
#ifndef Foundation_Timer_INCLUDED | #ifndef Foundation_Timer_INCLUDED | |||
#define Foundation_Timer_INCLUDED | #define Foundation_Timer_INCLUDED | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
#include "Poco/Runnable.h" | #include "Poco/Runnable.h" | |||
#include "Poco/Mutex.h" | #include "Poco/Mutex.h" | |||
#include "Poco/Event.h" | #include "Poco/Event.h" | |||
#include "Poco/Thread.h" | #include "Poco/Thread.h" | |||
#include "Poco/Clock.h" | #include "Poco/Timestamp.h" | |||
namespace Poco { | namespace Poco { | |||
class AbstractTimerCallback; | class AbstractTimerCallback; | |||
class ThreadPool; | class ThreadPool; | |||
class Foundation_API Timer: protected Runnable | class Foundation_API Timer: protected Runnable | |||
/// This class implements a thread-based timer. | /// This class implements a thread-based timer. | |||
/// A timer starts a thread that first waits for a given start inter val. | /// A timer starts a thread that first waits for a given start inter val. | |||
/// Once that interval expires, the timer callback is called repeate dly | /// Once that interval expires, the timer callback is called repeate dly | |||
skipping to change at line 167 | skipping to change at line 167 | |||
protected: | protected: | |||
void run(); | void run(); | |||
private: | private: | |||
volatile long _startInterval; | volatile long _startInterval; | |||
volatile long _periodicInterval; | volatile long _periodicInterval; | |||
Event _wakeUp; | Event _wakeUp; | |||
Event _done; | Event _done; | |||
long _skipped; | long _skipped; | |||
AbstractTimerCallback* _pCallback; | AbstractTimerCallback* _pCallback; | |||
Clock _nextInvocation; | Timestamp _nextInvocation; | |||
mutable FastMutex _mutex; | mutable FastMutex _mutex; | |||
Timer(const Timer&); | Timer(const Timer&); | |||
Timer& operator = (const Timer&); | Timer& operator = (const Timer&); | |||
}; | }; | |||
class Foundation_API AbstractTimerCallback | class Foundation_API AbstractTimerCallback | |||
/// This is the base class for all instantiations of | /// This is the base class for all instantiations of | |||
/// the TimerCallback template. | /// the TimerCallback template. | |||
{ | { | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
Types.h | Types.h | |||
---|---|---|---|---|
// | // | |||
// Types.h | // Types.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Types.h#3 $ | // $Id: //poco/1.4/Foundation/include/Poco/Types.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: Types | // Module: Types | |||
// | // | |||
// Definitions of fixed-size integer types for various platforms | // Definitions of fixed-size integer types for various platforms | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 68 | skipping to change at line 68 | |||
#define POCO_PTR_IS_64_BIT 1 | #define POCO_PTR_IS_64_BIT 1 | |||
typedef signed __int64 IntPtr; | typedef signed __int64 IntPtr; | |||
typedef unsigned __int64 UIntPtr; | typedef unsigned __int64 UIntPtr; | |||
#else | #else | |||
typedef signed long IntPtr; | typedef signed long IntPtr; | |||
typedef unsigned long UIntPtr; | typedef unsigned long UIntPtr; | |||
#endif | #endif | |||
#define POCO_HAVE_INT64 1 | #define POCO_HAVE_INT64 1 | |||
#elif defined(__GNUC__) || defined(__clang__) | #elif defined(__GNUC__) || defined(__clang__) | |||
// | // | |||
// Unix/GCC/Clang | // Unix/GCC | |||
// | // | |||
typedef signed char Int8; | typedef signed char Int8; | |||
typedef unsigned char UInt8; | typedef unsigned char UInt8; | |||
typedef signed short Int16; | typedef signed short Int16; | |||
typedef unsigned short UInt16; | typedef unsigned short UInt16; | |||
typedef signed int Int32; | typedef signed int Int32; | |||
typedef unsigned int UInt32; | typedef unsigned int UInt32; | |||
typedef signed long IntPtr; | typedef signed long IntPtr; | |||
typedef unsigned long UIntPtr; | typedef unsigned long UIntPtr; | |||
#if defined(__LP64__) | #if defined(__LP64__) | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
URI.h | URI.h | |||
---|---|---|---|---|
// | // | |||
// URI.h | // URI.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/URI.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/URI.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: URI | // Package: URI | |||
// Module: URI | // Module: URI | |||
// | // | |||
// Definition of the URI class. | // Definition of the URI class. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 46 | skipping to change at line 46 | |||
// | // | |||
#ifndef Foundation_URI_INCLUDED | #ifndef Foundation_URI_INCLUDED | |||
#define Foundation_URI_INCLUDED | #define Foundation_URI_INCLUDED | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
#include <vector> | #include <vector> | |||
namespace Poco { | namespace Poco { | |||
class Path; | ||||
class Foundation_API URI | class Foundation_API URI | |||
/// A Uniform Resource Identifier, as specified in RFC 3986. | /// A Uniform Resource Identifier, as specified in RFC 3986. | |||
/// | /// | |||
/// The URI class provides methods for building URIs from their | /// The URI class provides methods for building URIs from their | |||
/// parts, as well as for splitting URIs into their parts. | /// parts, as well as for splitting URIs into their parts. | |||
/// Furthermore, the class provides methods for resolving | /// Furthermore, the class provides methods for resolving | |||
/// relative URIs against base URIs. | /// relative URIs against base URIs. | |||
/// | /// | |||
/// The class automatically performs a few normalizations on | /// The class automatically performs a few normalizations on | |||
/// all URIs and URI parts passed to it: | /// all URIs and URI parts passed to it: | |||
skipping to change at line 93 | skipping to change at line 91 | |||
URI(const std::string& scheme, const std::string& authority, const s td::string& path, const std::string& query, const std::string& fragment); | URI(const std::string& scheme, const std::string& authority, const s td::string& path, const std::string& query, const std::string& fragment); | |||
/// Creates an URI from its parts. | /// Creates an URI from its parts. | |||
URI(const URI& uri); | URI(const URI& uri); | |||
/// Copy constructor. Creates an URI from another one. | /// Copy constructor. Creates an URI from another one. | |||
URI(const URI& baseURI, const std::string& relativeURI); | URI(const URI& baseURI, const std::string& relativeURI); | |||
/// Creates an URI from a base URI and a relative URI, accor ding to | /// Creates an URI from a base URI and a relative URI, accor ding to | |||
/// the algorithm in section 5.2 of RFC 3986. | /// the algorithm in section 5.2 of RFC 3986. | |||
explicit URI(const Path& path); | ||||
/// Creates a URI from a path. | ||||
/// | ||||
/// The path will be made absolute, and a file:// URI | ||||
/// will be built from it. | ||||
~URI(); | ~URI(); | |||
/// Destroys the URI. | /// Destroys the URI. | |||
URI& operator = (const URI& uri); | URI& operator = (const URI& uri); | |||
/// Assignment operator. | /// Assignment operator. | |||
URI& operator = (const std::string& uri); | URI& operator = (const std::string& uri); | |||
/// Parses and assigns an URI from the given string. Throws a | /// Parses and assigns an URI from the given string. Throws a | |||
/// SyntaxException if the uri is not valid. | /// SyntaxException if the uri is not valid. | |||
End of changes. 3 change blocks. | ||||
9 lines changed or deleted | 1 lines changed or added | |||
UUID.h | UUID.h | |||
---|---|---|---|---|
// | // | |||
// UUID.h | // UUID.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/UUID.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/UUID.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: UUID | // Package: UUID | |||
// Module: UUID | // Module: UUID | |||
// | // | |||
// Definition of the UUID class. | // Definition of the UUID class. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 53 | skipping to change at line 53 | |||
namespace Poco { | namespace Poco { | |||
class Foundation_API UUID | class Foundation_API UUID | |||
/// A UUID is an identifier that is unique across both space and tim e, | /// A UUID is an identifier that is unique across both space and tim e, | |||
/// with respect to the space of all UUIDs. Since a UUID is a fixed | /// with respect to the space of all UUIDs. Since a UUID is a fixed | |||
/// size and contains a time field, it is possible for values to | /// size and contains a time field, it is possible for values to | |||
/// rollover (around A.D. 3400, depending on the specific algorithm | /// rollover (around A.D. 3400, depending on the specific algorithm | |||
/// used). A UUID can be used for multiple purposes, from tagging | /// used). A UUID can be used for multiple purposes, from tagging | |||
/// objects with an extremely short lifetime, to reliably identifyin g | /// objects with an extremely short lifetime, to reliably identifyin g | |||
/// very persistent objects across a network. | /// very persistent objects across a network. | |||
/// | ||||
/// This class implements a Universal Unique Identifier, | /// This class implements a Universal Unique Identifier, | |||
/// as specified in Appendix A of the DCE 1.1 Remote Procedure | /// as specified in Appendix A of the DCE 1.1 Remote Procedure | |||
/// Call Specification (http://www.opengroup.org/onlinepubs/9629399/ ), | /// Call Specification (http://www.opengroup.org/onlinepubs/9629399/ ), | |||
/// RFC 2518 (WebDAV), section 6.4.1 and the UUIDs and GUIDs interne t | /// RFC 2518 (WebDAV), section 6.4.1 and the UUIDs and GUIDs interne t | |||
/// draft by Leach/Salz from February, 1998 | /// draft by Leach/Salz from February, 1998 | |||
/// (http://www.ics.uci.edu/~ejw/authoring/uuid-guid/draft-leach-uui | /// (http://ftp.ics.uci.edu/pub/ietf/webdav/uuid-guid/draft-leach-uu | |||
ds-guids-01.txt) | ids-guids-01.txt) | |||
/// and also http://tools.ietf.org/html/draft-mealling-uuid-urn-05 | /// and also | |||
/// http://www.ietf.org/internet-drafts/draft-mealling-uuid-urn-03.t | ||||
xt | ||||
{ | { | |||
public: | public: | |||
enum Version | enum Version | |||
{ | { | |||
UUID_TIME_BASED = 0x01, | UUID_TIME_BASED = 0x01, | |||
UUID_DCE_UID = 0x02, | UUID_DCE_UID = 0x02, | |||
UUID_NAME_BASED = 0x03, | UUID_NAME_BASED = 0x03, | |||
UUID_RANDOM = 0x04 | UUID_RANDOM = 0x04 | |||
}; | }; | |||
End of changes. 3 change blocks. | ||||
5 lines changed or deleted | 6 lines changed or added | |||
UnWindows.h | UnWindows.h | |||
---|---|---|---|---|
// | // | |||
// UnWindows.h | // UnWindows.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/UnWindows.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/UnWindows.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: UnWindows | // Module: UnWindows | |||
// | // | |||
// A wrapper around the <windows.h> header file that #undef's some | // A wrapper around the <windows.h> header file that #undef's some | |||
// of the macros for function names defined by <windows.h> that | // of the macros for function names defined by <windows.h> that | |||
// are a frequent source of conflicts (e.g., GetUserName). | // are a frequent source of conflicts (e.g., GetUserName). | |||
// | // | |||
// Remember, that most of the WIN32 API functions come in two variants, | // Remember, that most of the WIN32 API functions come in two variants, | |||
skipping to change at line 57 | skipping to change at line 57 | |||
// | // | |||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVEN T | // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVEN T | |||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | |||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Foundation_UnWindows_INCLUDED | ||||
#define Foundation_UnWindows_INCLUDED | ||||
// Reduce bloat | ||||
#if defined(_WIN32) | ||||
#if !defined(WIN32_LEAN_AND_MEAN) && !defined(POCO_BLOATED_WIN32) | ||||
#define WIN32_LEAN_AND_MEAN | ||||
#endif | ||||
#endif | ||||
#if defined(_WIN32_WINNT) && (_WIN32_WINNT < 0x0501) | ||||
#error Unsupported Windows version. | ||||
#elif !defined(_WIN32_WINNT) | ||||
// define minimum supported | ||||
#define _WIN32_WINNT 0x0501 | ||||
#endif | ||||
#include <windows.h> | #include <windows.h> | |||
#if !defined(POCO_NO_UNWINDOWS) | #if !defined(POCO_NO_UNWINDOWS) | |||
// A list of annoying macros to #undef. | // A list of annoying macros to #undef. | |||
// Feel free to extend as required. | // Extend as required. | |||
#undef GetBinaryType | #undef GetBinaryType | |||
#undef GetShortPathName | #undef GetShortPathName | |||
#undef GetLongPathName | #undef GetLongPathName | |||
#undef GetEnvironmentStrings | #undef GetEnvironmentStrings | |||
#undef SetEnvironmentStrings | #undef SetEnvironmentStrings | |||
#undef FreeEnvironmentStrings | #undef FreeEnvironmentStrings | |||
#undef FormatMessage | #undef FormatMessage | |||
#undef EncryptFile | #undef EncryptFile | |||
#undef DecryptFile | #undef DecryptFile | |||
#undef CreateMutex | #undef CreateMutex | |||
skipping to change at line 109 | skipping to change at line 126 | |||
#undef CopyFile | #undef CopyFile | |||
#undef MoveFile | #undef MoveFile | |||
#undef ReplaceFile | #undef ReplaceFile | |||
#undef GetComputerName | #undef GetComputerName | |||
#undef SetComputerName | #undef SetComputerName | |||
#undef GetUserName | #undef GetUserName | |||
#undef LogonUser | #undef LogonUser | |||
#undef GetVersion | #undef GetVersion | |||
#undef GetObject | #undef GetObject | |||
#endif // POCO_NO_UNWINDOWS | #endif // POCO_NO_UNWINDOWS | |||
#endif // Foundation_UnWindows_INCLUDED | ||||
End of changes. 4 change blocks. | ||||
2 lines changed or deleted | 19 lines changed or added | |||
UnbufferedStreamBuf.h | UnbufferedStreamBuf.h | |||
---|---|---|---|---|
skipping to change at line 92 | skipping to change at line 92 | |||
if (c != char_traits::eof()) | if (c != char_traits::eof()) | |||
return writeToDevice(char_traits::to_char_type(c)); | return writeToDevice(char_traits::to_char_type(c)); | |||
else | else | |||
return c; | return c; | |||
} | } | |||
virtual int_type underflow() | virtual int_type underflow() | |||
{ | { | |||
if (_ispb) | if (_ispb) | |||
{ | { | |||
return _pb; | return _pb; | |||
} | } | |||
else | else | |||
{ | { | |||
int_type c = readFromDevice(); | int_type c = readFromDevice(); | |||
if (c != char_traits::eof()) | if (c != char_traits::eof()) | |||
{ | { | |||
_ispb = true; | _ispb = true; | |||
_pb = c; | _pb = c; | |||
} | } | |||
return c; | return c; | |||
} | } | |||
} | } | |||
virtual int_type uflow() | virtual int_type uflow() | |||
{ | { | |||
if (_ispb) | if (_ispb) | |||
{ | { | |||
_ispb = false; | _ispb = false; | |||
return _pb; | return _pb; | |||
} | } | |||
else | else | |||
{ | { | |||
int_type c = readFromDevice(); | int_type c = readFromDevice(); | |||
if (c != char_traits::eof()) | if (c != char_traits::eof()) | |||
{ | { | |||
_pb = c; | _pb = c; | |||
} | } | |||
return c; | return c; | |||
} | } | |||
} | } | |||
virtual int_type pbackfail(int_type c) | virtual int_type pbackfail(int_type c) | |||
{ | { | |||
if (_ispb) | if (_ispb) | |||
{ | { | |||
return char_traits::eof(); | return char_traits::eof(); | |||
} | } | |||
else | else | |||
{ | { | |||
_ispb = true; | _ispb = true; | |||
_pb = c; | _pb = c; | |||
return c; | return c; | |||
} | } | |||
} | } | |||
virtual std::streamsize xsgetn(char_type* p, std::streamsize count) | virtual std::streamsize xsgetn(char_type* p, std::streamsize count) | |||
/// Some platforms (for example, Compaq C++) have buggy impl ementations of | /// Some platforms (for example, Compaq C++) have buggy impl ementations of | |||
/// xsgetn that handle null buffers incorrectly. | /// xsgetn that handle null buffers incorrectly. | |||
/// Anyway, it does not hurt to provide an optimized impleme ntation | /// Anyway, it does not hurt to provide an optimized impleme ntation | |||
/// of xsgetn for this streambuf implementation. | /// of xsgetn for this streambuf implementation. | |||
{ | { | |||
std::streamsize copied = 0; | std::streamsize copied = 0; | |||
End of changes. 5 change blocks. | ||||
18 lines changed or deleted | 18 lines changed or added | |||
Unicode.h | Unicode.h | |||
---|---|---|---|---|
// | // | |||
// Unicode.h | // Unicode.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Unicode.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/Unicode.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Text | // Package: Text | |||
// Module: Unicode | // Module: Unicode | |||
// | // | |||
// Definition of the Unicode class. | // Definition of the Unicode class. | |||
// | // | |||
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2007, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 187 | skipping to change at line 187 | |||
UCP_LEPCHA, | UCP_LEPCHA, | |||
UCP_LYCIAN, | UCP_LYCIAN, | |||
UCP_LYDIAN, | UCP_LYDIAN, | |||
UCP_OL_CHIKI, | UCP_OL_CHIKI, | |||
UCP_REJANG, | UCP_REJANG, | |||
UCP_SAURASHTRA, | UCP_SAURASHTRA, | |||
UCP_SUNDANESE, | UCP_SUNDANESE, | |||
UCP_VAI | UCP_VAI | |||
}; | }; | |||
enum | ||||
{ | ||||
UCP_MAX_CODEPOINT = 0x10FFFF | ||||
}; | ||||
struct CharacterProperties | struct CharacterProperties | |||
/// This structure holds the character properties | /// This structure holds the character properties | |||
/// of an Unicode character. | /// of an Unicode character. | |||
{ | { | |||
CharacterCategory category; | CharacterCategory category; | |||
CharacterType type; | CharacterType type; | |||
Script script; | Script script; | |||
}; | }; | |||
static void properties(int ch, CharacterProperties& props); | static void properties(int ch, CharacterProperties& props); | |||
End of changes. 2 change blocks. | ||||
6 lines changed or deleted | 1 lines changed or added | |||
UnicodeConverter.h | UnicodeConverter.h | |||
---|---|---|---|---|
// | // | |||
// UnicodeConverter.h | // UnicodeConverter.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/UnicodeConverter.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/UnicodeConverter.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Text | // Package: Text | |||
// Module: UnicodeConverter | // Module: UnicodeConverter | |||
// | // | |||
// Definition of the UnicodeConverter class. | // Definition of the UnicodeConverter class. | |||
// | // | |||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 38 | skipping to change at line 38 | |||
// | // | |||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVEN T | // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVEN T | |||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | |||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef POCO_NO_WSTRING | ||||
#ifndef Foundation_UnicodeConverter_INCLUDED | #ifndef Foundation_UnicodeConverter_INCLUDED | |||
#define Foundation_UnicodeConverter_INCLUDED | #define Foundation_UnicodeConverter_INCLUDED | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
#include "Poco/UTFString.h" | ||||
namespace Poco { | namespace Poco { | |||
class Foundation_API UnicodeConverter | class Foundation_API UnicodeConverter | |||
/// A convenience class that converts strings from | /// A convenience class that converts strings from | |||
/// UTF-8 encoded std::strings to UTF-16 encoded std::wstrings | /// UTF-8 encoded std::strings to UTF-16 or UTF-32 encoded std::wstr ings | |||
/// and vice-versa. | /// and vice-versa. | |||
/// | /// | |||
/// This class is mainly used for working with the Unicode Windows A PIs | /// This class is mainly used for working with the Unicode Windows A PIs | |||
/// and probably won't be of much use anywhere else. | /// and probably won't be of much use anywhere else ??? | |||
{ | { | |||
public: | public: | |||
static void toUTF16(const std::string& utf8String, std::wstring& utf | static void convert(const std::string& utf8String, UTF32String& utf3 | |||
16String); | 2String); | |||
/// Converts the given UTF-8 encoded string into an UTF-16 e | /// Converts the given UTF-8 encoded string into an UTF-32 e | |||
ncoded wstring. | ncoded wide string. | |||
static void convert(const char* utf8String, std::size_t length, UTF | ||||
32String& utf32String); | ||||
/// Converts the given UTF-8 encoded character sequence into | ||||
an UTF-32 encoded wide string. | ||||
static void convert(const char* utf8String, UTF32String& utf32String | ||||
); | ||||
/// Converts the given zero-terminated UTF-8 encoded charact | ||||
er sequence into an UTF-32 encoded wide string. | ||||
static void convert(const std::string& utf8String, UTF16String& utf1 | ||||
6String); | ||||
/// Converts the given UTF-8 encoded string into an UTF-16 e | ||||
ncoded wide string. | ||||
static void convert(const char* utf8String, std::size_t length, UTF | ||||
16String& utf16String); | ||||
/// Converts the given UTF-8 encoded character sequence into | ||||
an UTF-16 encoded wide string. | ||||
static void toUTF16(const char* utf8String, int length, std::wstring | static void convert(const char* utf8String, UTF16String& utf16String | |||
& utf16String); | ); | |||
/// Converts the given UTF-8 encoded character sequence into | /// Converts the given zero-terminated UTF-8 encoded charact | |||
an UTF-16 encoded string. | er sequence into an UTF-16 encoded wide string. | |||
static void toUTF16(const char* utf8String, std::wstring& utf16Strin | static void convert(const UTF16String& utf16String, std::string& utf | |||
g); | 8String); | |||
/// Converts the given zero-terminated UTF-8 encoded charact | /// Converts the given UTF-16 encoded wide string into an UT | |||
er sequence into an UTF-16 encoded wstring. | F-8 encoded string. | |||
static void toUTF8(const std::wstring& utf16String, std::string& utf | static void convert(const UTF32String& utf32String, std::string& utf | |||
8String); | 8String); | |||
/// Converts the given UTF-16 encoded wstring into an UTF-8 | /// Converts the given UTF-32 encoded wide string into an UT | |||
encoded string. | F-8 encoded string. | |||
static void toUTF8(const wchar_t* utf16String, int length, std::stri | static void convert(const UTF16Char* utf16String, std::size_t lengt | |||
ng& utf8String); | h, std::string& utf8String); | |||
/// Converts the given zero-terminated UTF-16 encoded wide c | /// Converts the given zero-terminated UTF-16 encoded wide c | |||
haracter sequence into an UTF-8 encoded wstring. | haracter sequence into an UTF-8 encoded string. | |||
static void toUTF8(const wchar_t* utf16String, std::string& utf8Stri | static void convert(const UTF32Char* utf16String, std::size_t length | |||
ng); | , std::string& utf8String); | |||
/// Converts the given zero-terminated UTF-32 encoded wide c | ||||
haracter sequence into an UTF-8 encoded string. | ||||
static void convert(const UTF16Char* utf16String, std::string& utf8S | ||||
tring); | ||||
/// Converts the given UTF-16 encoded zero terminated charac ter sequence into an UTF-8 encoded string. | /// Converts the given UTF-16 encoded zero terminated charac ter sequence into an UTF-8 encoded string. | |||
static void convert(const UTF32Char* utf32String, std::string& utf8S | ||||
tring); | ||||
/// Converts the given UTF-32 encoded zero terminated charac | ||||
ter sequence into an UTF-8 encoded string. | ||||
template <typename F, typename T> | ||||
static void toUTF32(const F& f, T& t) | ||||
{ | ||||
convert(f, t); | ||||
} | ||||
template <typename F, typename T> | ||||
static void toUTF32(const F& f, std::size_t l, T& t) | ||||
{ | ||||
convert(f, l, t); | ||||
} | ||||
template <typename F, typename T> | ||||
static void toUTF16(const F& f, T& t) | ||||
{ | ||||
convert(f, t); | ||||
} | ||||
template <typename F, typename T> | ||||
static void toUTF16(const F& f, std::size_t l, T& t) | ||||
{ | ||||
convert(f, l, t); | ||||
} | ||||
template <typename F, typename T> | ||||
static void toUTF8(const F& f, T& t) | ||||
{ | ||||
convert(f, t); | ||||
} | ||||
template <typename F, typename T> | ||||
static void toUTF8(const F& f, std::size_t l, T& t) | ||||
{ | ||||
convert(f, l, t); | ||||
} | ||||
template <typename T> | ||||
static size_t UTFStrlen(const T* ptr) | ||||
/// Returns the length (in characters) of a zero-terminated | ||||
UTF string. | ||||
{ | ||||
if (ptr == 0) return 0; | ||||
const T* p; | ||||
for (p = ptr; *p; ++p); | ||||
return p - ptr; | ||||
} | ||||
}; | }; | |||
} // namespace Poco | } // namespace Poco | |||
#endif // Foundation_UnicodeConverter_INCLUDED | #endif // Foundation_UnicodeConverter_INCLUDED | |||
#endif // POCO_NO_WSTRING | ||||
End of changes. 13 change blocks. | ||||
27 lines changed or deleted | 103 lines changed or added | |||
Units.h | Units.h | |||
---|---|---|---|---|
skipping to change at line 314 | skipping to change at line 314 | |||
} | } | |||
template <int Num, int Den, typename V, typename U> | template <int Num, int Den, typename V, typename U> | |||
Value<V, Power<U, Num, Den> > raise(const Value<V, U>& a) | Value<V, Power<U, Num, Den> > raise(const Value<V, U>& a) | |||
{ | { | |||
return Value<V, Power<U, Num, Den> >(Internal::FixedPower<Num, Den>: :Power(a.get())); | return Value<V, Power<U, Num, Den> >(Internal::FixedPower<Num, Den>: :Power(a.get())); | |||
} | } | |||
namespace Internal | namespace Internal | |||
{ | { | |||
#ifndef POCO_ENABLE_CPP11 | ||||
template <bool> struct static_assert; | template <bool> struct static_assert; | |||
template <> struct static_assert<true> { }; | template <> struct static_assert<true> { }; | |||
/// Ensures (at compile-time) that the template argument is true. | /// Ensures (at compile-time) that the template argument is true. | |||
#endif | ||||
template <typename T1, typename T2> | template <typename T1, typename T2> | |||
struct Convertible; | struct Convertible; | |||
template <typename U> | template <typename U> | |||
struct ScalingFactor; | struct ScalingFactor; | |||
template <typename T1, typename T2> | template <typename T1, typename T2> | |||
struct Convert3 | struct Convert3 | |||
/// Converts T1 to T2. | /// Converts T1 to T2. | |||
skipping to change at line 360 | skipping to change at line 362 | |||
} | } | |||
}; | }; | |||
template <typename T1, typename T2> | template <typename T1, typename T2> | |||
struct Convert | struct Convert | |||
/// Converts T1 to T2. | /// Converts T1 to T2. | |||
/// If you really want to implement your own conversion rout ine, | /// If you really want to implement your own conversion rout ine, | |||
/// specialize this template. | /// specialize this template. | |||
/// The default implementation falls through to Convert2. | /// The default implementation falls through to Convert2. | |||
{ | { | |||
#ifdef POCO_ENABLE_CPP11 | ||||
static_assert(Convertible<T1,T2>::Value, "Error: Value not c | ||||
onvertible."); | ||||
#else | ||||
static_assert<Convertible<T1,T2>::Value> checkConvertible; | static_assert<Convertible<T1,T2>::Value> checkConvertible; | |||
#endif | ||||
/// If this fails, then T1 is not Convertible to T2: | /// If this fails, then T1 is not Convertible to T2: | |||
template <typename V> | template <typename V> | |||
static V fn(const V& v) | static V fn(const V& v) | |||
{ | { | |||
return Convert2<T1,T2>::fn(v); | return Convert2<T1,T2>::fn(v); | |||
} | } | |||
}; | }; | |||
template <typename T> | template <typename T> | |||
End of changes. 4 change blocks. | ||||
0 lines changed or deleted | 7 lines changed or added | |||
Version.h | Version.h | |||
---|---|---|---|---|
// | // | |||
// Version.h | // Version.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Version.h#20 $ | // $Id: //poco/1.4/Foundation/include/Poco/Version.h#10 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: Version | // Module: Version | |||
// | // | |||
// Version information for the POCO C++ Libraries. | // Version information for the POCO C++ Libraries. | |||
// | // | |||
// Copyright (c) 2004-2012, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2012, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 55 | skipping to change at line 55 | |||
// - AA is the major version number, | // - AA is the major version number, | |||
// - BB is the minor version number, | // - BB is the minor version number, | |||
// - CC is the revision number, and | // - CC is the revision number, and | |||
// - DD is the patch level number. | // - DD is the patch level number. | |||
// Note that some patch level numbers have | // Note that some patch level numbers have | |||
// a special meaning: | // a special meaning: | |||
// Dx are development releases | // Dx are development releases | |||
// Ax are alpha releases | // Ax are alpha releases | |||
// Bx are beta releases | // Bx are beta releases | |||
// | // | |||
#define POCO_VERSION 0x01040700 | #define POCO_VERSION 0x01050000 | |||
#endif // Foundation_Version_INCLUDED | #endif // Foundation_Version_INCLUDED | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
WebSocket.h | WebSocket.h | |||
---|---|---|---|---|
// | // | |||
// WebSocket.h | // WebSocket.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/WebSocket.h#5 $ | // $Id: //poco/1.4/Net/include/Poco/Net/WebSocket.h#1 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: WebSocket | // Package: WebSocket | |||
// Module: WebSocket | // Module: WebSocket | |||
// | // | |||
// Definition of the WebSocket class. | // Definition of the WebSocket class. | |||
// | // | |||
// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2012, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 94 | skipping to change at line 94 | |||
enum FrameOpcodes | enum FrameOpcodes | |||
/// Frame header opcodes. | /// Frame header opcodes. | |||
{ | { | |||
FRAME_OP_CONT = 0x00, /// Continuation frame. | FRAME_OP_CONT = 0x00, /// Continuation frame. | |||
FRAME_OP_TEXT = 0x01, /// Text frame. | FRAME_OP_TEXT = 0x01, /// Text frame. | |||
FRAME_OP_BINARY = 0x02, /// Binary frame. | FRAME_OP_BINARY = 0x02, /// Binary frame. | |||
FRAME_OP_CLOSE = 0x08, /// Close connection. | FRAME_OP_CLOSE = 0x08, /// Close connection. | |||
FRAME_OP_PING = 0x09, /// Ping frame. | FRAME_OP_PING = 0x09, /// Ping frame. | |||
FRAME_OP_PONG = 0x0a, /// Pong frame. | FRAME_OP_PONG = 0x0a, /// Pong frame. | |||
FRAME_OP_BITMASK = 0x0f, /// Bit mask for opcodes. | FRAME_OP_BITMASK = 0x0f /// Bit mask for opcodes. | |||
FRAME_OP_SETRAW = 0x100 /// Set raw flags (for use with sen | ||||
dBytes() and FRAME_OP_CONT). | ||||
}; | }; | |||
enum SendFlags | enum SendFlags | |||
/// Combined header flags and opcodes for use with sendFrame (). | /// Combined header flags and opcodes for use with sendFrame (). | |||
{ | { | |||
FRAME_TEXT = FRAME_FLAG_FIN | FRAME_OP_TEXT, | FRAME_TEXT = FRAME_FLAG_FIN | FRAME_OP_TEXT, | |||
/// Use this for sending a single text (UTF-8) paylo ad frame. | /// Use this for sending a single text (UTF-8) paylo ad frame. | |||
FRAME_BINARY = FRAME_FLAG_FIN | FRAME_OP_BINARY | FRAME_BINARY = FRAME_FLAG_FIN | FRAME_OP_BINARY | |||
/// Use this for sending a single binary payload fra me. | /// Use this for sending a single binary payload fra me. | |||
}; | }; | |||
skipping to change at line 185 | skipping to change at line 184 | |||
/// The given credentials are used for authentication | /// The given credentials are used for authentication | |||
/// if requested by the server. | /// if requested by the server. | |||
/// | /// | |||
/// Additional HTTP headers for the initial handshake reques t | /// Additional HTTP headers for the initial handshake reques t | |||
/// (such as Origin or Sec-WebSocket-Protocol) can be given | /// (such as Origin or Sec-WebSocket-Protocol) can be given | |||
/// in the request object. | /// in the request object. | |||
/// | /// | |||
/// The result of the handshake can be obtained from the res ponse | /// The result of the handshake can be obtained from the res ponse | |||
/// object. | /// object. | |||
WebSocket(const Socket& socket); | ||||
/// Creates a WebSocket from another Socket, which must be a | ||||
WebSocket, | ||||
/// otherwise a Poco::InvalidArgumentException will be throw | ||||
n. | ||||
virtual ~WebSocket(); | virtual ~WebSocket(); | |||
/// Destroys the StreamSocket. | /// Destroys the StreamSocket. | |||
WebSocket& operator = (const Socket& socket); | WebSocket& operator = (const Socket& socket); | |||
/// Assignment operator. | /// Assignment operator. | |||
/// | /// | |||
/// The other socket must be a WebSocket, otherwise a Poco:: | /// Releases the socket's SocketImpl and | |||
InvalidArgumentException | /// attaches the SocketImpl from the other socket and | |||
/// will be thrown. | /// increments the reference count of the SocketImpl. | |||
void shutdown(); | void shutdown(); | |||
/// Sends a Close control frame to the server end of | /// Sends a Close control frame to the server end of | |||
/// the connection to initiate an orderly shutdown | /// the connection to initiate an orderly shutdown | |||
/// of the connection. | /// of the connection. | |||
void shutdown(Poco::UInt16 statusCode, const std::string& statusMess age = ""); | void shutdown(Poco::UInt16 statusCode, const std::string& statusMess age = ""); | |||
/// Sends a Close control frame to the server end of | /// Sends a Close control frame to the server end of | |||
/// the connection to initiate an orderly shutdown | /// the connection to initiate an orderly shutdown | |||
/// of the connection. | /// of the connection. | |||
skipping to change at line 229 | skipping to change at line 225 | |||
/// value denoting a certain condition. | /// value denoting a certain condition. | |||
int receiveFrame(void* buffer, int length, int& flags); | int receiveFrame(void* buffer, int length, int& flags); | |||
/// Receives a frame from the socket and stores it | /// Receives a frame from the socket and stores it | |||
/// in buffer. Up to length bytes are received. If | /// in buffer. Up to length bytes are received. If | |||
/// the frame's payload is larger, a WebSocketException | /// the frame's payload is larger, a WebSocketException | |||
/// is thrown and the WebSocket connection must be | /// is thrown and the WebSocket connection must be | |||
/// terminated. | /// terminated. | |||
/// | /// | |||
/// Returns the number of bytes received. | /// Returns the number of bytes received. | |||
/// A return value of 0 means that the peer has | /// A return value of 0 means a graceful shutdown | |||
/// shut down or closed the connection. | /// of the connection from the peer. | |||
/// | /// | |||
/// Throws a TimeoutException if a receive timeout has | /// Throws a TimeoutException if a receive timeout has | |||
/// been set and nothing is received within that interval. | /// been set and nothing is received within that interval. | |||
/// Throws a NetException (or a subclass) in case of other e rrors. | /// Throws a NetException (or a subclass) in case of other e rrors. | |||
/// | /// | |||
/// The frame flags and opcode (FrameFlags and FrameOpcodes) | /// The frame flags and opcode (FrameFlags and FrameOpcodes) | |||
/// is stored in flags. | /// is stored in flags. | |||
Mode mode() const; | Mode mode() const; | |||
/// Returns WS_SERVER if the WebSocket is a server-side | /// Returns WS_SERVER if the WebSocket is a server-side | |||
End of changes. 5 change blocks. | ||||
15 lines changed or deleted | 7 lines changed or added | |||
WebSocketImpl.h | WebSocketImpl.h | |||
---|---|---|---|---|
// | // | |||
// WebSocketImpl.h | // WebSocketImpl.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/WebSocketImpl.h#6 $ | // $Id: //poco/1.4/Net/include/Poco/Net/WebSocketImpl.h#1 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: WebSocket | // Package: WebSocket | |||
// Module: WebSocketImpl | // Module: WebSocketImpl | |||
// | // | |||
// Definition of the StreamSocketImpl class. | // Definition of the StreamSocketImpl class. | |||
// | // | |||
// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2012, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 77 | skipping to change at line 77 | |||
virtual void bind6(const SocketAddress& address, bool reuseAddress = false, bool ipV6Only = false); | virtual void bind6(const SocketAddress& address, bool reuseAddress = false, bool ipV6Only = false); | |||
virtual void listen(int backlog = 64); | virtual void listen(int backlog = 64); | |||
virtual void close(); | virtual void close(); | |||
virtual void shutdownReceive(); | virtual void shutdownReceive(); | |||
virtual void shutdownSend(); | virtual void shutdownSend(); | |||
virtual void shutdown(); | virtual void shutdown(); | |||
virtual int sendTo(const void* buffer, int length, const SocketAddre ss& address, int flags = 0); | virtual int sendTo(const void* buffer, int length, const SocketAddre ss& address, int flags = 0); | |||
virtual int receiveFrom(void* buffer, int length, SocketAddress& add ress, int flags = 0); | virtual int receiveFrom(void* buffer, int length, SocketAddress& add ress, int flags = 0); | |||
virtual void sendUrgent(unsigned char data); | virtual void sendUrgent(unsigned char data); | |||
virtual bool secure() const; | virtual bool secure() const; | |||
virtual void setSendTimeout(const Poco::Timespan& timeout); | ||||
virtual Poco::Timespan getSendTimeout(); | ||||
virtual void setReceiveTimeout(const Poco::Timespan& timeout); | ||||
virtual Poco::Timespan getReceiveTimeout(); | ||||
// Internal | // Internal | |||
int frameFlags() const; | int frameFlags() const; | |||
/// Returns the frame flags of the most recently received fr ame. | /// Returns the frame flags of the most recently received fr ame. | |||
bool mustMaskPayload() const; | bool mustMaskPayload() const; | |||
/// Returns true if the payload must be masked. | /// Returns true if the payload must be masked. | |||
protected: | protected: | |||
enum | enum | |||
{ | { | |||
FRAME_FLAG_MASK = 0x80, | FRAME_FLAG_MASK = 0x80, | |||
MAX_HEADER_LENGTH = 14 | MAX_HEADER_LENGTH = 14 | |||
}; | }; | |||
int receiveNBytes(void* buffer, int bytes); | ||||
virtual ~WebSocketImpl(); | virtual ~WebSocketImpl(); | |||
private: | private: | |||
WebSocketImpl(); | WebSocketImpl(); | |||
StreamSocketImpl* _pStreamSocketImpl; | StreamSocketImpl* _pStreamSocketImpl; | |||
int _frameFlags; | int _frameFlags; | |||
bool _mustMaskPayload; | bool _mustMaskPayload; | |||
Poco::Random _rnd; | Poco::Random _rnd; | |||
}; | }; | |||
End of changes. 3 change blocks. | ||||
6 lines changed or deleted | 1 lines changed or added | |||
WinRegistryConfiguration.h | WinRegistryConfiguration.h | |||
---|---|---|---|---|
// | // | |||
// WinRegistryConfiguration.h | // WinRegistryConfiguration.h | |||
// | // | |||
// $Id: //poco/1.4/Util/include/Poco/Util/WinRegistryConfiguration.h#3 $ | // $Id: //poco/1.4/Util/include/Poco/Util/WinRegistryConfiguration.h#2 $ | |||
// | // | |||
// Library: Util | // Library: Util | |||
// Package: Windows | // Package: Windows | |||
// Module: WinRegistryConfiguration | // Module: WinRegistryConfiguration | |||
// | // | |||
// Definition of the WinRegistryConfiguration class. | // Definition of the WinRegistryConfiguration class. | |||
// | // | |||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 76 | skipping to change at line 76 | |||
protected: | protected: | |||
~WinRegistryConfiguration(); | ~WinRegistryConfiguration(); | |||
/// Destroys the WinRegistryConfiguration. | /// Destroys the WinRegistryConfiguration. | |||
bool getRaw(const std::string& key, std::string& value) const; | bool getRaw(const std::string& key, std::string& value) const; | |||
void setRaw(const std::string& key, const std::string& value); | void setRaw(const std::string& key, const std::string& value); | |||
void enumerate(const std::string& key, Keys& range) const; | void enumerate(const std::string& key, Keys& range) const; | |||
void removeRaw(const std::string& key); | void removeRaw(const std::string& key); | |||
std::string convertToRegFormat(const std::string& key, std::string& keyName) const; | std::string convertToRegFormat(const std::string& key, std::string& keyName) const; | |||
/// takes a key in the format of A.B.C and converts it to | /// Takes a key in the format of A.B.C and converts it to | |||
/// registry format A\B\C, the last entry is the keyName, th e rest is returned as path | /// registry format A\B\C, the last entry is the keyName, th e rest is returned as path | |||
friend class WinConfigurationTest; | ||||
private: | private: | |||
std::string _rootPath; | std::string _rootPath; | |||
REGSAM _extraSam; | REGSAM _extraSam; | |||
}; | }; | |||
} } // namespace Poco::Util | } } // namespace Poco::Util | |||
#endif // Util_WinRegistryConfiguration_INCLUDED | #endif // Util_WinRegistryConfiguration_INCLUDED | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 3 lines changed or added | |||
WinRegistryKey.h | WinRegistryKey.h | |||
---|---|---|---|---|
skipping to change at line 63 | skipping to change at line 63 | |||
{ | { | |||
public: | public: | |||
typedef std::vector<std::string> Keys; | typedef std::vector<std::string> Keys; | |||
typedef std::vector<std::string> Values; | typedef std::vector<std::string> Values; | |||
enum Type | enum Type | |||
{ | { | |||
REGT_NONE = 0, | REGT_NONE = 0, | |||
REGT_STRING = 1, | REGT_STRING = 1, | |||
REGT_STRING_EXPAND = 2, | REGT_STRING_EXPAND = 2, | |||
REGT_DWORD = 4 | REGT_DWORD = 4, | |||
REGT_QWORD = 11 | ||||
}; | }; | |||
WinRegistryKey(const std::string& key, bool readOnly = false, REGSAM extraSam = 0); | WinRegistryKey(const std::string& key, bool readOnly = false, REGSAM extraSam = 0); | |||
/// Creates the WinRegistryKey. | /// Creates the WinRegistryKey. | |||
/// | /// | |||
/// The key must start with one of the root key names | /// The key must start with one of the root key names | |||
/// like HKEY_CLASSES_ROOT, e.g. HKEY_LOCAL_MACHINE\SYSTEM\C urrentControlSet\Services. | /// like HKEY_CLASSES_ROOT, e.g. HKEY_LOCAL_MACHINE\SYSTEM\C urrentControlSet\Services. | |||
/// | /// | |||
/// If readOnly is true, then only read access to the regist ry | /// If readOnly is true, then only read access to the regist ry | |||
/// is available and any attempt to write to the registry wi ll | /// is available and any attempt to write to the registry wi ll | |||
skipping to change at line 124 | skipping to change at line 125 | |||
void setInt(const std::string& name, int value); | void setInt(const std::string& name, int value); | |||
/// Sets the numeric (REG_DWORD) value with the given name. | /// Sets the numeric (REG_DWORD) value with the given name. | |||
/// An empty name denotes the default value. | /// An empty name denotes the default value. | |||
int getInt(const std::string& name); | int getInt(const std::string& name); | |||
/// Returns the numeric value (REG_DWORD) with the given nam e. | /// Returns the numeric value (REG_DWORD) with the given nam e. | |||
/// An empty name denotes the default value. | /// An empty name denotes the default value. | |||
/// | /// | |||
/// Throws a NotFoundException if the value does not exist. | /// Throws a NotFoundException if the value does not exist. | |||
#if defined(POCO_HAVE_INT64) | ||||
Poco::Int64 getInt64(const std::string& name); | ||||
/// Returns the numeric value (REG_QWORD) with the given nam | ||||
e. | ||||
/// An empty name denotes the default value. | ||||
/// | ||||
/// Throws a NotFoundException if the value does not exist. | ||||
#endif // POCO_HAVE_INT64 | ||||
void deleteValue(const std::string& name); | void deleteValue(const std::string& name); | |||
/// Deletes the value with the given name. | /// Deletes the value with the given name. | |||
/// | /// | |||
/// Throws a NotFoundException if the value does not exist. | /// Throws a NotFoundException if the value does not exist. | |||
void deleteKey(); | void deleteKey(); | |||
/// Recursively deletes the key and all subkeys. | /// Recursively deletes the key and all subkeys. | |||
bool exists(); | bool exists(); | |||
/// Returns true iff the key exists. | /// Returns true iff the key exists. | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 13 lines changed or added | |||
Windows1250Encoding.h | Windows1250Encoding.h | |||
---|---|---|---|---|
// | // | |||
// Windows1250Encoding.h | // Windows1250Encoding.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Windows1250Encoding.h#1 $ | // $Id: //poco/svn/Foundation/include/Poco/Windows1250Encoding.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Text | // Package: Text | |||
// Module: Windows1250Encoding | // Module: Windows1250Encoding | |||
// | // | |||
// Definition of the Windows1250Encoding class. | // Definition of the Windows1250Encoding class. | |||
// | // | |||
// Copyright (c) 2005-2007, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2007, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
Windows1251Encoding.h | Windows1251Encoding.h | |||
---|---|---|---|---|
// | // | |||
// Windows1251Encoding.h | // Windows1251Encoding.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Windows1251Encoding.h#1 $ | // $Id: //poco/svn/Foundation/include/Poco/Windows1251Encoding.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Text | // Package: Text | |||
// Module: Windows1251Encoding | // Module: Windows1251Encoding | |||
// | // | |||
// Definition of the Windows1251Encoding class. | // Definition of the Windows1251Encoding class. | |||
// | // | |||
// Copyright (c) 2005-2007, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2007, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
WindowsConsoleChannel.h | WindowsConsoleChannel.h | |||
---|---|---|---|---|
// | // | |||
// WindowsConsoleChannel.h | // WindowsConsoleChannel.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/WindowsConsoleChannel.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/WindowsConsoleChannel.h#1 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Logging | // Package: Logging | |||
// Module: WindowsConsoleChannel | // Module: WindowsConsoleChannel | |||
// | // | |||
// Definition of the WindowsConsoleChannel class. | // Definition of the WindowsConsoleChannel class. | |||
// | // | |||
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2007, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 81 | skipping to change at line 81 | |||
/// Logs the given message to the channel's stream. | /// Logs the given message to the channel's stream. | |||
protected: | protected: | |||
~WindowsConsoleChannel(); | ~WindowsConsoleChannel(); | |||
private: | private: | |||
HANDLE _hConsole; | HANDLE _hConsole; | |||
bool _isFile; | bool _isFile; | |||
}; | }; | |||
class Foundation_API WindowsColorConsoleChannel: public Channel | ||||
/// A channel that writes to the Windows console. | ||||
/// | ||||
/// Only the message's text is written, followed | ||||
/// by a newline. | ||||
/// | ||||
/// If POCO has been compiled with POCO_WIN32_UTF8, | ||||
/// log messages are assumed to be UTF-8 encoded, and | ||||
/// are converted to UTF-16 prior to writing them to the | ||||
/// console. This is the main difference to the ConsoleChannel | ||||
/// class, which cannot handle UTF-8 encoded messages on Windows. | ||||
/// | ||||
/// Messages can be colored depending on priority. | ||||
/// | ||||
/// To enable message coloring, set the "enableColors" | ||||
/// property to true (default). Furthermore, colors can be | ||||
/// configured by setting the following properties | ||||
/// (default values are given in parenthesis): | ||||
/// | ||||
/// * traceColor (gray) | ||||
/// * debugColor (gray) | ||||
/// * informationColor (default) | ||||
/// * noticeColor (default) | ||||
/// * warningColor (yellow) | ||||
/// * errorColor (lightRed) | ||||
/// * criticalColor (lightRed) | ||||
/// * fatalColor (lightRed) | ||||
/// | ||||
/// The following color values are supported: | ||||
/// | ||||
/// * default | ||||
/// * black | ||||
/// * red | ||||
/// * green | ||||
/// * brown | ||||
/// * blue | ||||
/// * magenta | ||||
/// * cyan | ||||
/// * gray | ||||
/// * darkgray | ||||
/// * lightRed | ||||
/// * lightGreen | ||||
/// * yellow | ||||
/// * lightBlue | ||||
/// * lightMagenta | ||||
/// * lightCyan | ||||
/// * white | ||||
/// | ||||
/// Chain this channel to a FormattingChannel with an | ||||
/// appropriate Formatter to control what is contained | ||||
/// in the text. | ||||
/// | ||||
/// Only available on Windows platforms. | ||||
{ | ||||
public: | ||||
WindowsColorConsoleChannel(); | ||||
/// Creates the WindowsConsoleChannel. | ||||
void log(const Message& msg); | ||||
/// Logs the given message to the channel's stream. | ||||
void setProperty(const std::string& name, const std::string& value); | ||||
/// Sets the property with the given name. | ||||
/// | ||||
/// The following properties are supported: | ||||
/// * enableColors: Enable or disable colors. | ||||
/// * traceColor: Specify color for trace messages. | ||||
/// * debugColor: Specify color for debug messages. | ||||
/// * informationColor: Specify color for information mes | ||||
sages. | ||||
/// * noticeColor: Specify color for notice messages | ||||
. | ||||
/// * warningColor: Specify color for warning message | ||||
s. | ||||
/// * errorColor: Specify color for error messages. | ||||
/// * criticalColor: Specify color for critical messag | ||||
es. | ||||
/// * fatalColor: Specify color for fatal messages. | ||||
/// | ||||
/// See the class documentation for a list of supported colo | ||||
r values. | ||||
std::string getProperty(const std::string& name) const; | ||||
/// Returns the value of the property with the given name. | ||||
/// See setProperty() for a description of the supported | ||||
/// properties. | ||||
protected: | ||||
enum Color | ||||
{ | ||||
CC_BLACK = 0x0000, | ||||
CC_RED = 0x0004, | ||||
CC_GREEN = 0x0002, | ||||
CC_BROWN = 0x0006, | ||||
CC_BLUE = 0x0001, | ||||
CC_MAGENTA = 0x0005, | ||||
CC_CYAN = 0x0003, | ||||
CC_GRAY = 0x0007, | ||||
CC_DARKGRAY = 0x0008, | ||||
CC_LIGHTRED = 0x000C, | ||||
CC_LIGHTGREEN = 0x000A, | ||||
CC_YELLOW = 0x000E, | ||||
CC_LIGHTBLUE = 0x0009, | ||||
CC_LIGHTMAGENTA = 0x000D, | ||||
CC_LIGHTCYAN = 0x000B, | ||||
CC_WHITE = 0x000F | ||||
}; | ||||
~WindowsColorConsoleChannel(); | ||||
WORD parseColor(const std::string& color) const; | ||||
std::string formatColor(WORD color) const; | ||||
void initColors(); | ||||
private: | ||||
bool _enableColors; | ||||
HANDLE _hConsole; | ||||
bool _isFile; | ||||
WORD _colors[9]; | ||||
}; | ||||
} // namespace Poco | } // namespace Poco | |||
#endif // Foundation_WindowsConsoleChannel_INCLUDED | #endif // Foundation_WindowsConsoleChannel_INCLUDED | |||
End of changes. 2 change blocks. | ||||
121 lines changed or deleted | 1 lines changed or added | |||
XMLWriter.h | XMLWriter.h | |||
---|---|---|---|---|
// | // | |||
// XMLWriter.h | // XMLWriter.h | |||
// | // | |||
// $Id: //poco/1.4/XML/include/Poco/XML/XMLWriter.h#5 $ | // $Id: //poco/1.4/XML/include/Poco/XML/XMLWriter.h#1 $ | |||
// | // | |||
// Library: XML | // Library: XML | |||
// Package: XML | // Package: XML | |||
// Module: XMLWriter | // Module: XMLWriter | |||
// | // | |||
// Definition of the XMLWriter class. | // Definition of the XMLWriter class. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 277 | skipping to change at line 277 | |||
// DTDHandler | // DTDHandler | |||
void notationDecl(const XMLString& name, const XMLString* publicId, const XMLString* systemId); | void notationDecl(const XMLString& name, const XMLString* publicId, const XMLString* systemId); | |||
void unparsedEntityDecl(const XMLString& name, const XMLString* publ icId, const XMLString& systemId, const XMLString& notationName); | void unparsedEntityDecl(const XMLString& name, const XMLString* publ icId, const XMLString& systemId, const XMLString& notationName); | |||
static const std::string NEWLINE_DEFAULT; | static const std::string NEWLINE_DEFAULT; | |||
static const std::string NEWLINE_CR; | static const std::string NEWLINE_CR; | |||
static const std::string NEWLINE_CRLF; | static const std::string NEWLINE_CRLF; | |||
static const std::string NEWLINE_LF; | static const std::string NEWLINE_LF; | |||
// Namespace support. | ||||
XMLString uniquePrefix(); | ||||
/// Creates and returns a unique namespace prefix that | ||||
/// can be used with startPrefixMapping(). | ||||
bool isNamespaceMapped(const XMLString& namespc) const; | ||||
/// Returns true if the given namespace has been mapped | ||||
/// to a prefix in the current element or its ancestors. | ||||
// Misc. | ||||
int depth() const; | ||||
/// Return the number of nested XML elements. | ||||
/// | ||||
/// Will be -1 if no document or fragment has been started, | ||||
/// 0 if the document or fragment has been started, | ||||
/// 1 if the document element has been written and | ||||
/// > 1 for every element nested within the document element | ||||
. | ||||
protected: | protected: | |||
typedef std::map<XMLString, XMLString> AttributeMap; | typedef std::map<XMLString, XMLString> AttributeMap; | |||
void writeStartElement(const XMLString& namespaceURI, const XMLStrin g& localName, const XMLString& qname, const Attributes& attributes); | void writeStartElement(const XMLString& namespaceURI, const XMLStrin g& localName, const XMLString& qname, const Attributes& attributes); | |||
void writeEndElement(const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname); | void writeEndElement(const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname); | |||
void writeMarkup(const std::string& str) const; | void writeMarkup(const std::string& str) const; | |||
void writeXML(const XMLString& str) const; | void writeXML(const XMLString& str) const; | |||
void writeXML(XMLChar ch) const; | void writeXML(XMLChar ch) const; | |||
void writeNewLine() const; | void writeNewLine() const; | |||
void writeIndent() const; | void writeIndent() const; | |||
void writeIndent(int indent) const; | void writeIndent(int indent) const; | |||
void writeName(const XMLString& prefix, const XMLString& localName); | void writeName(const XMLString& prefix, const XMLString& localName); | |||
void writeXMLDeclaration(); | void writeXMLDeclaration(); | |||
void closeStartTag(); | void closeStartTag(); | |||
void declareAttributeNamespaces(const Attributes& attributes); | void declareAttributeNamespaces(const Attributes& attributes); | |||
void addNamespaceAttributes(AttributeMap& attributeMap); | void addNamespaceAttributes(AttributeMap& attributeMap); | |||
void addAttributes(AttributeMap& attributeMap, const Attributes& att ributes, const XMLString& elementNamespaceURI); | void addAttributes(AttributeMap& attributeMap, const Attributes& att ributes, const XMLString& elementNamespaceURI); | |||
void writeAttributes(const AttributeMap& attributeMap); | void writeAttributes(const AttributeMap& attributeMap); | |||
void prettyPrint() const; | void prettyPrint() const; | |||
XMLString newPrefix(); | ||||
static std::string nameToString(const XMLString& localName, const XM LString& qname); | static std::string nameToString(const XMLString& localName, const XM LString& qname); | |||
private: | private: | |||
struct Namespace | struct Namespace | |||
{ | { | |||
Namespace(const XMLString& thePrefix, const XMLString& theNa mespaceURI): | Namespace(const XMLString& thePrefix, const XMLString& theNa mespaceURI): | |||
prefix(thePrefix), | prefix(thePrefix), | |||
namespaceURI(theNamespaceURI) | namespaceURI(theNamespaceURI) | |||
{ | { | |||
} | } | |||
skipping to change at line 351 | skipping to change at line 334 | |||
bool _inInternalDTD; | bool _inInternalDTD; | |||
bool _contentWritten; | bool _contentWritten; | |||
bool _unclosedStartTag; | bool _unclosedStartTag; | |||
ElementStack _elementStack; | ElementStack _elementStack; | |||
NamespaceSupport _namespaces; | NamespaceSupport _namespaces; | |||
int _prefix; | int _prefix; | |||
bool _nsContextPushed; | bool _nsContextPushed; | |||
std::string _indent; | std::string _indent; | |||
static const std::string MARKUP_QUOTENC; | static const std::string MARKUP_QUOTENC; | |||
static const std::string MARKUP_APOSENC; | ||||
static const std::string MARKUP_AMPENC; | static const std::string MARKUP_AMPENC; | |||
static const std::string MARKUP_LTENC; | static const std::string MARKUP_LTENC; | |||
static const std::string MARKUP_GTENC; | static const std::string MARKUP_GTENC; | |||
static const std::string MARKUP_TABENC; | static const std::string MARKUP_TABENC; | |||
static const std::string MARKUP_CRENC; | static const std::string MARKUP_CRENC; | |||
static const std::string MARKUP_LFENC; | static const std::string MARKUP_LFENC; | |||
static const std::string MARKUP_LT; | static const std::string MARKUP_LT; | |||
static const std::string MARKUP_GT; | static const std::string MARKUP_GT; | |||
static const std::string MARKUP_SLASHGT; | static const std::string MARKUP_SLASHGT; | |||
static const std::string MARKUP_LTSLASH; | static const std::string MARKUP_LTSLASH; | |||
static const std::string MARKUP_COLON; | static const std::string MARKUP_COLON; | |||
static const std::string MARKUP_EQQUOT; | static const std::string MARKUP_EQQUOT; | |||
static const std::string MARKUP_QUOT; | static const std::string MARKUP_QUOT; | |||
static const std::string MARKUP_SPACE; | static const std::string MARKUP_SPACE; | |||
static const std::string MARKUP_TAB; | static const std::string MARKUP_TAB; | |||
static const std::string MARKUP_BEGIN_CDATA; | static const std::string MARKUP_BEGIN_CDATA; | |||
static const std::string MARKUP_END_CDATA; | static const std::string MARKUP_END_CDATA; | |||
}; | }; | |||
// | ||||
// inlines | ||||
// | ||||
inline int XMLWriter::depth() const | ||||
{ | ||||
return _depth; | ||||
} | ||||
} } // namespace Poco::XML | } } // namespace Poco::XML | |||
#endif // XML_XMLWriter_INCLUDED | #endif // XML_XMLWriter_INCLUDED | |||
End of changes. 5 change blocks. | ||||
28 lines changed or deleted | 3 lines changed or added | |||
expat.h | expat.h | |||
---|---|---|---|---|
skipping to change at line 740 | skipping to change at line 740 | |||
XML_GetSpecifiedAttributeCount(XML_Parser parser); | XML_GetSpecifiedAttributeCount(XML_Parser parser); | |||
/* Returns the index of the ID attribute passed in the last call to | /* Returns the index of the ID attribute passed in the last call to | |||
XML_StartElementHandler, or -1 if there is no ID attribute. Each | XML_StartElementHandler, or -1 if there is no ID attribute. Each | |||
attribute/value pair counts as 2; thus this correspondds to an | attribute/value pair counts as 2; thus this correspondds to an | |||
index into the atts array passed to the XML_StartElementHandler. | index into the atts array passed to the XML_StartElementHandler. | |||
*/ | */ | |||
XMLPARSEAPI(int) | XMLPARSEAPI(int) | |||
XML_GetIdAttributeIndex(XML_Parser parser); | XML_GetIdAttributeIndex(XML_Parser parser); | |||
#ifdef XML_ATTR_INFO | ||||
/* Source file byte offsets for the start and end of attribute names and va | ||||
lues. | ||||
The value indices are exclusive of surrounding quotes; thus in a UTF-8 s | ||||
ource | ||||
file an attribute value of "blah" will yield: | ||||
info->valueEnd - info->valueStart = 4 bytes. | ||||
*/ | ||||
typedef struct { | ||||
XML_Index nameStart; /* Offset to beginning of the attribute name. */ | ||||
XML_Index nameEnd; /* Offset after the attribute name's last byte. */ | ||||
XML_Index valueStart; /* Offset to beginning of the attribute value. */ | ||||
XML_Index valueEnd; /* Offset after the attribute value's last byte. * | ||||
/ | ||||
} XML_AttrInfo; | ||||
/* Returns an array of XML_AttrInfo structures for the attribute/value pair | ||||
s | ||||
passed in last call to the XML_StartElementHandler that were specified | ||||
in the start-tag rather than defaulted. Each attribute/value pair counts | ||||
as 1; thus the number of entries in the array is | ||||
XML_GetSpecifiedAttributeCount(parser) / 2. | ||||
*/ | ||||
XMLPARSEAPI(const XML_AttrInfo *) | ||||
XML_GetAttributeInfo(XML_Parser parser); | ||||
#endif | ||||
/* Parses some input. Returns XML_STATUS_ERROR if a fatal error is | /* Parses some input. Returns XML_STATUS_ERROR if a fatal error is | |||
detected. The last call to XML_Parse must have isFinal true; len | detected. The last call to XML_Parse must have isFinal true; len | |||
may be zero for this call (or any other). | may be zero for this call (or any other). | |||
Though the return values for these functions has always been | Though the return values for these functions has always been | |||
described as a Boolean value, the implementation, at least for the | described as a Boolean value, the implementation, at least for the | |||
1.95.x series, has always returned exactly one of the XML_Status | 1.95.x series, has always returned exactly one of the XML_Status | |||
values. | values. | |||
*/ | */ | |||
XMLPARSEAPI(enum XML_Status) | XMLPARSEAPI(enum XML_Status) | |||
skipping to change at line 904 | skipping to change at line 881 | |||
entity parsing (ie without XML_DTD being defined), then | entity parsing (ie without XML_DTD being defined), then | |||
XML_SetParamEntityParsing will return 0 if parsing of parameter | XML_SetParamEntityParsing will return 0 if parsing of parameter | |||
entities is requested; otherwise it will return non-zero. | entities is requested; otherwise it will return non-zero. | |||
Note: If XML_SetParamEntityParsing is called after XML_Parse or | Note: If XML_SetParamEntityParsing is called after XML_Parse or | |||
XML_ParseBuffer, then it has no effect and will always return 0. | XML_ParseBuffer, then it has no effect and will always return 0. | |||
*/ | */ | |||
XMLPARSEAPI(int) | XMLPARSEAPI(int) | |||
XML_SetParamEntityParsing(XML_Parser parser, | XML_SetParamEntityParsing(XML_Parser parser, | |||
enum XML_ParamEntityParsing parsing); | enum XML_ParamEntityParsing parsing); | |||
/* Sets the hash salt to use for internal hash calculations. | ||||
Helps in preventing DoS attacks based on predicting hash | ||||
function behavior. This must be called before parsing is started. | ||||
Returns 1 if successful, 0 when called after parsing has started. | ||||
*/ | ||||
XMLPARSEAPI(int) | ||||
XML_SetHashSalt(XML_Parser parser, | ||||
unsigned long hash_salt); | ||||
/* If XML_Parse or XML_ParseBuffer have returned XML_STATUS_ERROR, then | /* If XML_Parse or XML_ParseBuffer have returned XML_STATUS_ERROR, then | |||
XML_GetErrorCode returns information about the error. | XML_GetErrorCode returns information about the error. | |||
*/ | */ | |||
XMLPARSEAPI(enum XML_Error) | XMLPARSEAPI(enum XML_Error) | |||
XML_GetErrorCode(XML_Parser parser); | XML_GetErrorCode(XML_Parser parser); | |||
/* These functions return information about the current parse | /* These functions return information about the current parse | |||
location. They may be called from any callback called to report | location. They may be called from any callback called to report | |||
some parse event; in this case the location is the location of the | some parse event; in this case the location is the location of the | |||
first of the sequence of characters that generated the event. When | first of the sequence of characters that generated the event. When | |||
skipping to change at line 1014 | skipping to change at line 982 | |||
enum XML_FeatureEnum { | enum XML_FeatureEnum { | |||
XML_FEATURE_END = 0, | XML_FEATURE_END = 0, | |||
XML_FEATURE_UNICODE, | XML_FEATURE_UNICODE, | |||
XML_FEATURE_UNICODE_WCHAR_T, | XML_FEATURE_UNICODE_WCHAR_T, | |||
XML_FEATURE_DTD, | XML_FEATURE_DTD, | |||
XML_FEATURE_CONTEXT_BYTES, | XML_FEATURE_CONTEXT_BYTES, | |||
XML_FEATURE_MIN_SIZE, | XML_FEATURE_MIN_SIZE, | |||
XML_FEATURE_SIZEOF_XML_CHAR, | XML_FEATURE_SIZEOF_XML_CHAR, | |||
XML_FEATURE_SIZEOF_XML_LCHAR, | XML_FEATURE_SIZEOF_XML_LCHAR, | |||
XML_FEATURE_NS, | XML_FEATURE_NS, | |||
XML_FEATURE_LARGE_SIZE, | XML_FEATURE_LARGE_SIZE | |||
XML_FEATURE_ATTR_INFO | ||||
/* Additional features must be added to the end of this enum. */ | /* Additional features must be added to the end of this enum. */ | |||
}; | }; | |||
typedef struct { | typedef struct { | |||
enum XML_FeatureEnum feature; | enum XML_FeatureEnum feature; | |||
const XML_LChar *name; | const XML_LChar *name; | |||
long int value; | long int value; | |||
} XML_Feature; | } XML_Feature; | |||
XMLPARSEAPI(const XML_Feature *) | XMLPARSEAPI(const XML_Feature *) | |||
XML_GetFeatureList(void); | XML_GetFeatureList(void); | |||
/* Expat follows the GNU/Linux convention of odd number minor version for | /* Expat follows the GNU/Linux convention of odd number minor version for | |||
beta/development releases and even number minor version for stable | beta/development releases and even number minor version for stable | |||
releases. Micro is bumped with each release, and set to 0 with each | releases. Micro is bumped with each release, and set to 0 with each | |||
change to major or minor version. | change to major or minor version. | |||
*/ | */ | |||
#define XML_MAJOR_VERSION 2 | #define XML_MAJOR_VERSION 2 | |||
#define XML_MINOR_VERSION 1 | #define XML_MINOR_VERSION 0 | |||
#define XML_MICRO_VERSION 0 | #define XML_MICRO_VERSION 1 | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* not Expat_INCLUDED */ | #endif /* not Expat_INCLUDED */ | |||
End of changes. 4 change blocks. | ||||
40 lines changed or deleted | 3 lines changed or added | |||
zconf.h | zconf.h | |||
---|---|---|---|---|
/* zconf.h -- configuration of the zlib compression library | /* zconf.h -- configuration of the zlib compression library | |||
* Copyright (C) 1995-2013 Jean-loup Gailly. | * Copyright (C) 1995-2012 Jean-loup Gailly. | |||
* For conditions of distribution and use, see copyright notice in zlib.h | * For conditions of distribution and use, see copyright notice in zlib.h | |||
*/ | */ | |||
/* @(#) $Id: //poco/1.4/Foundation/include/Poco/zconf.h#5 $ */ | /* @(#) $Id$ */ | |||
#ifndef ZCONF_H | #ifndef ZCONF_H | |||
#define ZCONF_H | #define ZCONF_H | |||
/* | /* | |||
* If you *really* need a unique prefix for all types and library functions , | * If you *really* need a unique prefix for all types and library functions , | |||
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. | * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. | |||
* Even better than compiling with -DZ_PREFIX would be to use configure to set | * Even better than compiling with -DZ_PREFIX would be to use configure to set | |||
* this permanently in zconf.h using "./configure --zprefix". | * this permanently in zconf.h using "./configure --zprefix". | |||
*/ | */ | |||
#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ | #ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ | |||
# define Z_PREFIX_SET | # define Z_PREFIX_SET | |||
/* all linked symbols */ | /* all linked symbols */ | |||
# define _dist_code z__dist_code | # define _dist_code z__dist_code | |||
# define _length_code z__length_code | # define _length_code z__length_code | |||
# define _tr_align z__tr_align | # define _tr_align z__tr_align | |||
# define _tr_flush_bits z__tr_flush_bits | ||||
# define _tr_flush_block z__tr_flush_block | # define _tr_flush_block z__tr_flush_block | |||
# define _tr_init z__tr_init | # define _tr_init z__tr_init | |||
# define _tr_stored_block z__tr_stored_block | # define _tr_stored_block z__tr_stored_block | |||
# define _tr_tally z__tr_tally | # define _tr_tally z__tr_tally | |||
# define adler32 z_adler32 | # define adler32 z_adler32 | |||
# define adler32_combine z_adler32_combine | # define adler32_combine z_adler32_combine | |||
# define adler32_combine64 z_adler32_combine64 | # define adler32_combine64 z_adler32_combine64 | |||
# ifndef Z_SOLO | # ifndef Z_SOLO | |||
# define compress z_compress | # define compress z_compress | |||
# define compress2 z_compress2 | # define compress2 z_compress2 | |||
skipping to change at line 81 | skipping to change at line 80 | |||
# define gzgetc_ z_gzgetc_ | # define gzgetc_ z_gzgetc_ | |||
# define gzgets z_gzgets | # define gzgets z_gzgets | |||
# define gzoffset z_gzoffset | # define gzoffset z_gzoffset | |||
# define gzoffset64 z_gzoffset64 | # define gzoffset64 z_gzoffset64 | |||
# define gzopen z_gzopen | # define gzopen z_gzopen | |||
# define gzopen64 z_gzopen64 | # define gzopen64 z_gzopen64 | |||
# ifdef _WIN32 | # ifdef _WIN32 | |||
# define gzopen_w z_gzopen_w | # define gzopen_w z_gzopen_w | |||
# endif | # endif | |||
# define gzprintf z_gzprintf | # define gzprintf z_gzprintf | |||
# define gzvprintf z_gzvprintf | ||||
# define gzputc z_gzputc | # define gzputc z_gzputc | |||
# define gzputs z_gzputs | # define gzputs z_gzputs | |||
# define gzread z_gzread | # define gzread z_gzread | |||
# define gzrewind z_gzrewind | # define gzrewind z_gzrewind | |||
# define gzseek z_gzseek | # define gzseek z_gzseek | |||
# define gzseek64 z_gzseek64 | # define gzseek64 z_gzseek64 | |||
# define gzsetparams z_gzsetparams | # define gzsetparams z_gzsetparams | |||
# define gztell z_gztell | # define gztell z_gztell | |||
# define gztell64 z_gztell64 | # define gztell64 z_gztell64 | |||
# define gzungetc z_gzungetc | # define gzungetc z_gzungetc | |||
skipping to change at line 108 | skipping to change at line 106 | |||
# define inflateCopy z_inflateCopy | # define inflateCopy z_inflateCopy | |||
# define inflateEnd z_inflateEnd | # define inflateEnd z_inflateEnd | |||
# define inflateGetHeader z_inflateGetHeader | # define inflateGetHeader z_inflateGetHeader | |||
# define inflateInit2_ z_inflateInit2_ | # define inflateInit2_ z_inflateInit2_ | |||
# define inflateInit_ z_inflateInit_ | # define inflateInit_ z_inflateInit_ | |||
# define inflateMark z_inflateMark | # define inflateMark z_inflateMark | |||
# define inflatePrime z_inflatePrime | # define inflatePrime z_inflatePrime | |||
# define inflateReset z_inflateReset | # define inflateReset z_inflateReset | |||
# define inflateReset2 z_inflateReset2 | # define inflateReset2 z_inflateReset2 | |||
# define inflateSetDictionary z_inflateSetDictionary | # define inflateSetDictionary z_inflateSetDictionary | |||
# define inflateGetDictionary z_inflateGetDictionary | ||||
# define inflateSync z_inflateSync | # define inflateSync z_inflateSync | |||
# define inflateSyncPoint z_inflateSyncPoint | # define inflateSyncPoint z_inflateSyncPoint | |||
# define inflateUndermine z_inflateUndermine | # define inflateUndermine z_inflateUndermine | |||
# define inflateResetKeep z_inflateResetKeep | # define inflateResetKeep z_inflateResetKeep | |||
# define inflate_copyright z_inflate_copyright | # define inflate_copyright z_inflate_copyright | |||
# define inflate_fast z_inflate_fast | # define inflate_fast z_inflate_fast | |||
# define inflate_table z_inflate_table | # define inflate_table z_inflate_table | |||
# ifndef Z_SOLO | # ifndef Z_SOLO | |||
# define uncompress z_uncompress | # define uncompress z_uncompress | |||
# endif | # endif | |||
skipping to change at line 394 | skipping to change at line 391 | |||
#ifdef STDC | #ifdef STDC | |||
typedef void const *voidpc; | typedef void const *voidpc; | |||
typedef void FAR *voidpf; | typedef void FAR *voidpf; | |||
typedef void *voidp; | typedef void *voidp; | |||
#else | #else | |||
typedef Byte const *voidpc; | typedef Byte const *voidpc; | |||
typedef Byte FAR *voidpf; | typedef Byte FAR *voidpf; | |||
typedef Byte *voidp; | typedef Byte *voidp; | |||
#endif | #endif | |||
/* ./configure may #define Z_U4 here */ | ||||
#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) | #if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) | |||
# include <limits.h> | # include <limits.h> | |||
# if (UINT_MAX == 0xffffffffUL) | # if (UINT_MAX == 0xffffffffUL) | |||
# define Z_U4 unsigned | # define Z_U4 unsigned | |||
# elif (ULONG_MAX == 0xffffffffUL) | # else | |||
# define Z_U4 unsigned long | # if (ULONG_MAX == 0xffffffffUL) | |||
# elif (USHRT_MAX == 0xffffffffUL) | # define Z_U4 unsigned long | |||
# define Z_U4 unsigned short | # else | |||
# if (USHRT_MAX == 0xffffffffUL) | ||||
# define Z_U4 unsigned short | ||||
# endif | ||||
# endif | ||||
# endif | # endif | |||
#endif | #endif | |||
#ifdef Z_U4 | #ifdef Z_U4 | |||
typedef Z_U4 z_crc_t; | typedef Z_U4 z_crc_t; | |||
#else | #else | |||
typedef unsigned long z_crc_t; | typedef unsigned long z_crc_t; | |||
#endif | #endif | |||
#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */ | #ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */ | |||
# define Z_HAVE_UNISTD_H | # define Z_HAVE_UNISTD_H | |||
#endif | #endif | |||
#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */ | #ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */ | |||
# define Z_HAVE_STDARG_H | # define Z_HAVE_STDARG_H | |||
#endif | #endif | |||
#ifndef _WIN32_WCE | ||||
#ifdef STDC | #ifdef STDC | |||
# ifndef Z_SOLO | # ifndef Z_SOLO | |||
# include <sys/types.h> /* for off_t */ | # ifndef _WIN32_WCE | |||
# endif | # include <sys/types.h> /* for off_t */ | |||
#endif | # endif | |||
#endif | ||||
#if defined(STDC) || defined(Z_HAVE_STDARG_H) | ||||
# ifndef Z_SOLO | ||||
# include <stdarg.h> /* for va_list */ | ||||
# endif | # endif | |||
#endif | #endif | |||
#ifdef _WIN32 | #ifdef _WIN32 | |||
# ifndef Z_SOLO | # include <stddef.h> /* for wchar_t */ | |||
# include <stddef.h> /* for wchar_t */ | ||||
# endif | ||||
#endif | #endif | |||
/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and | /* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and | |||
* "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even | * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even | |||
* though the former does not conform to the LFS document), but considering | * though the former does not conform to the LFS document), but considering | |||
* both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as | * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as | |||
* equivalently requesting no 64-bit operations | * equivalently requesting no 64-bit operations | |||
*/ | */ | |||
#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 | #if defined(LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 | |||
# undef _LARGEFILE64_SOURCE | # undef _LARGEFILE64_SOURCE | |||
#endif | #endif | |||
#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) | #if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) | |||
# define Z_HAVE_UNISTD_H | # define Z_HAVE_UNISTD_H | |||
#endif | #endif | |||
#ifndef Z_SOLO | #ifndef Z_SOLO | |||
# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) | # if defined(Z_HAVE_UNISTD_H) || defined(LARGEFILE64_SOURCE) | |||
# include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ | # include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ | |||
# ifdef VMS | # ifdef VMS | |||
# include <unixio.h> /* for off_t */ | # include <unixio.h> /* for off_t */ | |||
# endif | # endif | |||
# ifndef z_off_t | # ifndef z_off_t | |||
# define z_off_t off_t | # define z_off_t off_t | |||
# endif | # endif | |||
# endif | # endif | |||
#endif | #endif | |||
End of changes. 12 change blocks. | ||||
23 lines changed or deleted | 18 lines changed or added | |||
zlib.h | zlib.h | |||
---|---|---|---|---|
/* zlib.h -- interface of the 'zlib' general purpose compression library | /* zlib.h -- interface of the 'zlib' general purpose compression library | |||
version 1.2.8, April 28th, 2013 | version 1.2.7, May 2nd, 2012 | |||
Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler | Copyright (C) 1995-2012 Jean-loup Gailly and Mark Adler | |||
This software is provided 'as-is', without any express or implied | This software is provided 'as-is', without any express or implied | |||
warranty. In no event will the authors be held liable for any damages | warranty. In no event will the authors be held liable for any damages | |||
arising from the use of this software. | arising from the use of this software. | |||
Permission is granted to anyone to use this software for any purpose, | Permission is granted to anyone to use this software for any purpose, | |||
including commercial applications, and to alter it and redistribute it | including commercial applications, and to alter it and redistribute it | |||
freely, subject to the following restrictions: | freely, subject to the following restrictions: | |||
1. The origin of this software must not be misrepresented; you must not | 1. The origin of this software must not be misrepresented; you must not | |||
skipping to change at line 39 | skipping to change at line 39 | |||
#ifndef ZLIB_H | #ifndef ZLIB_H | |||
#define ZLIB_H | #define ZLIB_H | |||
#include "zconf.h" | #include "zconf.h" | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
#define ZLIB_VERSION "1.2.8" | #define ZLIB_VERSION "1.2.7" | |||
#define ZLIB_VERNUM 0x1280 | #define ZLIB_VERNUM 0x1270 | |||
#define ZLIB_VER_MAJOR 1 | #define ZLIB_VER_MAJOR 1 | |||
#define ZLIB_VER_MINOR 2 | #define ZLIB_VER_MINOR 2 | |||
#define ZLIB_VER_REVISION 8 | #define ZLIB_VER_REVISION 7 | |||
#define ZLIB_VER_SUBREVISION 0 | #define ZLIB_VER_SUBREVISION 0 | |||
/* | /* | |||
The 'zlib' compression library provides in-memory compression and | The 'zlib' compression library provides in-memory compression and | |||
decompression functions, including integrity checks of the uncompressed d ata. | decompression functions, including integrity checks of the uncompressed d ata. | |||
This version of the library supports only one compression method (deflati on) | This version of the library supports only one compression method (deflati on) | |||
but other algorithms will be added later and will have the same stream | but other algorithms will be added later and will have the same stream | |||
interface. | interface. | |||
Compression can be done in a single step if the buffers are large enoug h, | Compression can be done in a single step if the buffers are large enoug h, | |||
skipping to change at line 834 | skipping to change at line 834 | |||
that was used for compression is provided. | that was used for compression is provided. | |||
inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a | inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a | |||
parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is | parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is | |||
inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the | inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the | |||
expected one (incorrect adler32 value). inflateSetDictionary does not | expected one (incorrect adler32 value). inflateSetDictionary does not | |||
perform any decompression: this will be done by subsequent calls of | perform any decompression: this will be done by subsequent calls of | |||
inflate(). | inflate(). | |||
*/ | */ | |||
ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm, | ||||
Bytef *dictionary, | ||||
uInt *dictLength)); | ||||
/* | ||||
Returns the sliding dictionary being maintained by inflate. dictLengt | ||||
h is | ||||
set to the number of bytes in the dictionary, and that many bytes are co | ||||
pied | ||||
to dictionary. dictionary must have enough space, where 32768 bytes is | ||||
always enough. If inflateGetDictionary() is called with dictionary equa | ||||
l to | ||||
Z_NULL, then only the dictionary length is returned, and nothing is copi | ||||
ed. | ||||
Similary, if dictLength is Z_NULL, then it is not set. | ||||
inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the | ||||
stream state is inconsistent. | ||||
*/ | ||||
ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); | ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); | |||
/* | /* | |||
Skips invalid compressed data until a possible full flush point (see a bove | Skips invalid compressed data until a possible full flush point (see a bove | |||
for the description of deflate with Z_FULL_FLUSH) can be found, or until all | for the description of deflate with Z_FULL_FLUSH) can be found, or until all | |||
available input is skipped. No output is provided. | available input is skipped. No output is provided. | |||
inflateSync searches for a 00 00 FF FF pattern in the compressed data. | inflateSync searches for a 00 00 FF FF pattern in the compressed data. | |||
All full flush points have this pattern, but not all occurrences of this | All full flush points have this pattern, but not all occurences of this | |||
pattern are full flush points. | pattern are full flush points. | |||
inflateSync returns Z_OK if a possible full flush point has been found , | inflateSync returns Z_OK if a possible full flush point has been found , | |||
Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush poin t | Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush poin t | |||
has been found, or Z_STREAM_ERROR if the stream structure was inconsiste nt. | has been found, or Z_STREAM_ERROR if the stream structure was inconsiste nt. | |||
In the success case, the application may save the current current value of | In the success case, the application may save the current current value of | |||
total_in which indicates where valid compressed data was found. In the | total_in which indicates where valid compressed data was found. In the | |||
error case, the application may repeatedly call inflateSync, providing m ore | error case, the application may repeatedly call inflateSync, providing m ore | |||
input each time, until success or end of the input data. | input each time, until success or end of the input data. | |||
*/ | */ | |||
skipping to change at line 1017 | skipping to change at line 1002 | |||
deflate streams. | deflate streams. | |||
See inflateBack() for the usage of these routines. | See inflateBack() for the usage of these routines. | |||
inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of | inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of | |||
the parameters are invalid, Z_MEM_ERROR if the internal state could not be | the parameters are invalid, Z_MEM_ERROR if the internal state could not be | |||
allocated, or Z_VERSION_ERROR if the version of the library does not mat ch | allocated, or Z_VERSION_ERROR if the version of the library does not mat ch | |||
the version of the header file. | the version of the header file. | |||
*/ | */ | |||
typedef unsigned (*in_func) OF((void FAR *, | typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *)); | |||
z_const unsigned char FAR * FAR *)); | ||||
typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); | typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); | |||
ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, | ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, | |||
in_func in, void FAR *in_desc, | in_func in, void FAR *in_desc, | |||
out_func out, void FAR *out_desc)); | out_func out, void FAR *out_desc)); | |||
/* | /* | |||
inflateBack() does a raw inflate with a single call using a call-back | inflateBack() does a raw inflate with a single call using a call-back | |||
interface for input and output. This is potentially more efficient than | interface for input and output. This is more efficient than inflate() f | |||
inflate() for file i/o applications, in that it avoids copying between t | or | |||
he | file i/o applications in that it avoids copying between the output and t | |||
output and the sliding window by simply making the window itself the out | he | |||
put | sliding window by simply making the window itself the output buffer. Th | |||
buffer. inflate() can be faster on modern CPUs when used with large | is | |||
buffers. inflateBack() trusts the application to not change the output | function trusts the application to not change the output buffer passed b | |||
buffer passed by the output function, at least until inflateBack() retur | y | |||
ns. | the output function, at least until inflateBack() returns. | |||
inflateBackInit() must be called first to allocate the internal state | inflateBackInit() must be called first to allocate the internal state | |||
and to initialize the state with the user-provided window buffer. | and to initialize the state with the user-provided window buffer. | |||
inflateBack() may then be used multiple times to inflate a complete, raw | inflateBack() may then be used multiple times to inflate a complete, raw | |||
deflate stream with each call. inflateBackEnd() is then called to free the | deflate stream with each call. inflateBackEnd() is then called to free the | |||
allocated state. | allocated state. | |||
A raw deflate stream is one with no zlib or gzip header or trailer. | A raw deflate stream is one with no zlib or gzip header or trailer. | |||
This routine would normally be used in a utility that reads zip or gzip | This routine would normally be used in a utility that reads zip or gzip | |||
files and writes out uncompressed files. The utility would decode the | files and writes out uncompressed files. The utility would decode the | |||
skipping to change at line 1747 | skipping to change at line 1730 | |||
ZEXTERN const char * ZEXPORT zError OF((int)); | ZEXTERN const char * ZEXPORT zError OF((int)); | |||
ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); | ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); | |||
ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void)); | ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void)); | |||
ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); | ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); | |||
ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp)); | ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp)); | |||
ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp)); | ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp)); | |||
#if defined(_WIN32) && !defined(Z_SOLO) | #if defined(_WIN32) && !defined(Z_SOLO) | |||
ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path, | ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path, | |||
const char *mode)); | const char *mode)); | |||
#endif | #endif | |||
#if defined(STDC) || defined(Z_HAVE_STDARG_H) | ||||
# ifndef Z_SOLO | ||||
ZEXTERN int ZEXPORTVA gzvprintf Z_ARG((gzFile file, | ||||
const char *format, | ||||
va_list va)); | ||||
# endif | ||||
#endif | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* ZLIB_H */ | #endif /* ZLIB_H */ | |||
End of changes. 9 change blocks. | ||||
43 lines changed or deleted | 16 lines changed or added | |||