| AbstractContainerNode.h | | AbstractContainerNode.h | |
| // | | // | |
| // AbstractContainerNode.h | | // AbstractContainerNode.h | |
| // | | // | |
|
| // $Id: //poco/1.4/XML/include/Poco/DOM/AbstractContainerNode.h#1 $ | | // $Id: //poco/1.4/XML/include/Poco/DOM/AbstractContainerNode.h#2 $ | |
| // | | // | |
| // Library: XML | | // Library: XML | |
| // Package: DOM | | // Package: DOM | |
| // Module: DOM | | // Module: DOM | |
| // | | // | |
| // Definition of the AbstractContainerNode class. | | // Definition of the AbstractContainerNode 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 63 | | skipping to change at line 63 | |
| public: | | public: | |
| // Node | | // Node | |
| Node* firstChild() const; | | Node* firstChild() const; | |
| Node* lastChild() const; | | Node* lastChild() const; | |
| Node* insertBefore(Node* newChild, Node* refChild); | | Node* insertBefore(Node* newChild, Node* refChild); | |
| Node* replaceChild(Node* newChild, Node* oldChild); | | Node* replaceChild(Node* newChild, Node* oldChild); | |
| Node* removeChild(Node* oldChild); | | Node* removeChild(Node* oldChild); | |
| Node* appendChild(Node* newChild); | | Node* appendChild(Node* newChild); | |
| bool hasChildNodes() const; | | bool hasChildNodes() const; | |
| bool hasAttributes() const; | | bool hasAttributes() const; | |
|
| | | Node* getNodeByPath(const XMLString& path) const; | |
| | | Node* getNodeByPathNS(const XMLString& path, const NSMap& nsMap) con | |
| | | st; | |
| | | | |
| protected: | | protected: | |
| AbstractContainerNode(Document* pOwnerDocument); | | AbstractContainerNode(Document* pOwnerDocument); | |
| AbstractContainerNode(Document* pOwnerDocument, const AbstractContai
nerNode& node); | | AbstractContainerNode(Document* pOwnerDocument, const AbstractContai
nerNode& node); | |
| ~AbstractContainerNode(); | | ~AbstractContainerNode(); | |
| | | | |
| void dispatchNodeRemovedFromDocument(); | | void dispatchNodeRemovedFromDocument(); | |
| void dispatchNodeInsertedIntoDocument(); | | void dispatchNodeInsertedIntoDocument(); | |
| | | | |
|
| | | static const Node* findNode(XMLString::const_iterator& it, const XML | |
| | | String::const_iterator& end, const Node* pNode, const NSMap* pNSMap); | |
| | | static const Node* findElement(const XMLString& name, const Node* pN | |
| | | ode, const NSMap* pNSMap); | |
| | | static const Node* findElement(int index, const Node* pNode, const N | |
| | | SMap* pNSMap); | |
| | | static const Node* findElement(const XMLString& attr, const XMLStrin | |
| | | g& value, const Node* pNode, const NSMap* pNSMap); | |
| | | static const Attr* findAttribute(const XMLString& name, const Node* | |
| | | pNode, const NSMap* pNSMap); | |
| | | bool hasAttributeValue(const XMLString& name, const XMLString& value | |
| | | , const NSMap* pNSMap) const; | |
| | | static bool namesAreEqual(const Node* pNode1, const Node* pNode2, co | |
| | | nst NSMap* pNSMap); | |
| | | static bool namesAreEqual(const Node* pNode, const XMLString& name, | |
| | | const NSMap* pNSMap); | |
| | | | |
| private: | | private: | |
| AbstractNode* _pFirstChild; | | AbstractNode* _pFirstChild; | |
| | | | |
| friend class AbstractNode; | | friend class AbstractNode; | |
| friend class NodeAppender; | | friend class NodeAppender; | |
| }; | | }; | |
| | | | |
| } } // namespace Poco::XML | | } } // namespace Poco::XML | |
| | | | |
| #endif // DOM_AbstractContainerNode_INCLUDED | | #endif // DOM_AbstractContainerNode_INCLUDED | |
| | | | |
End of changes. 3 change blocks. |
| 1 lines changed or deleted | | 21 lines changed or added | |
|
| AbstractDelegate.h | | AbstractDelegate.h | |
| // | | // | |
| // AbstractDelegate.h | | // AbstractDelegate.h | |
| // | | // | |
|
| // $Id: //poco/1.4/Foundation/include/Poco/AbstractDelegate.h#1 $ | | // $Id: //poco/1.4/Foundation/include/Poco/AbstractDelegate.h#4 $ | |
| // | | // | |
| // Library: Foundation | | // Library: Foundation | |
| // Package: Events | | // Package: Events | |
| // Module: AbstractDelegate | | // Module: AbstractDelegate | |
| // | | // | |
| // Implementation of the AbstractDelegate template. | | // Implementation of the AbstractDelegate template. | |
| // | | // | |
|
| // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | | // Copyright (c) 2006-2011, 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 47 | | skipping to change at line 47 | |
| | | | |
| #ifndef Foundation_AbstractDelegate_INCLUDED | | #ifndef Foundation_AbstractDelegate_INCLUDED | |
| #define Foundation_AbstractDelegate_INCLUDED | | #define Foundation_AbstractDelegate_INCLUDED | |
| | | | |
| #include "Poco/Foundation.h" | | #include "Poco/Foundation.h" | |
| | | | |
| namespace Poco { | | namespace Poco { | |
| | | | |
| template <class TArgs> | | template <class TArgs> | |
| class AbstractDelegate | | class AbstractDelegate | |
|
| /// Interface for Delegate and Expire | | /// Base class for Delegate and Expire. | |
| /// Very similar to AbstractPriorityDelegate but having two separate | | | |
| files (no inheritance) | | | |
| /// allows one to have compile-time checks when registering an obser | | | |
| ver | | | |
| /// instead of run-time checks. | | | |
| { | | { | |
| public: | | public: | |
|
| AbstractDelegate(void* pTarget): _pTarget(pTarget) | | AbstractDelegate() | |
| { | | { | |
|
| poco_assert_dbg (_pTarget != 0); | | | |
| } | | } | |
| | | | |
|
| AbstractDelegate(const AbstractDelegate& del): _pTarget(del._pTarget
) | | AbstractDelegate(const AbstractDelegate& del) | |
| { | | { | |
|
| poco_assert_dbg (_pTarget != 0); | | | |
| } | | } | |
| | | | |
| virtual ~AbstractDelegate() | | virtual ~AbstractDelegate() | |
| { | | { | |
| } | | } | |
| | | | |
| virtual bool notify(const void* sender, TArgs& arguments) = 0; | | virtual bool notify(const void* sender, TArgs& arguments) = 0; | |
|
| /// Returns false, if the Delegate is no longer valid, thus | | /// Invokes the delegate's callback function. | |
| indicating an expire. | | /// Returns true if successful, or false if the delegate | |
| | | /// has been disabled or has expired. | |
| | | | |
| | | virtual bool equals(const AbstractDelegate& other) const = 0; | |
| | | /// Compares the AbstractDelegate with the other one for equ | |
| | | ality. | |
| | | | |
| virtual AbstractDelegate* clone() const = 0; | | virtual AbstractDelegate* clone() const = 0; | |
|
| /// Returns a deep-copy of the AbstractDelegate | | /// Returns a deep copy of the AbstractDelegate. | |
| | | | |
|
| bool operator < (const AbstractDelegate<TArgs>& other) const | | virtual void disable() = 0; | |
| /// For comparing AbstractDelegates in a collection. | | /// Disables the delegate, which is done prior to removal. | |
| { | | | |
| return _pTarget < other._pTarget; | | | |
| } | | | |
| | | | |
|
| void* target() const | | virtual const AbstractDelegate* unwrap() const | |
| | | /// Returns the unwrapped delegate. Must be overridden by de | |
| | | corators | |
| | | /// like Expire. | |
| { | | { | |
|
| return _pTarget; | | return this; | |
| } | | } | |
|
| | | | |
| protected: | | | |
| void* _pTarget; | | | |
| }; | | }; | |
| | | | |
| } // namespace Poco | | } // namespace Poco | |
| | | | |
| #endif // Foundation_AbstractDelegate_INCLUDED | | #endif // Foundation_AbstractDelegate_INCLUDED | |
| | | | |
End of changes. 13 change blocks. |
| 25 lines changed or deleted | | 20 lines changed or added | |
|
| AbstractPriorityDelegate.h | | AbstractPriorityDelegate.h | |
| // | | // | |
| // AbstractPriorityDelegate.h | | // AbstractPriorityDelegate.h | |
| // | | // | |
|
| // $Id: //poco/1.4/Foundation/include/Poco/AbstractPriorityDelegate.h#1 $ | | // $Id: //poco/1.4/Foundation/include/Poco/AbstractPriorityDelegate.h#3 $ | |
| // | | // | |
| // Library: Foundation | | // Library: Foundation | |
| // Package: Events | | // Package: Events | |
| // Module: AbstractPriorityDelegate | | // Module: AbstractPriorityDelegate | |
| // | | // | |
| // Implementation of the AbstractPriorityDelegate template. | | // Implementation of the AbstractPriorityDelegate template. | |
| // | | // | |
|
| // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | | // Copyright (c) 2006-2011, 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_AbstractPriorityDelegate_INCLUDED | | #ifndef Foundation_AbstractPriorityDelegate_INCLUDED | |
| #define Foundation_AbstractPriorityDelegate_INCLUDED | | #define Foundation_AbstractPriorityDelegate_INCLUDED | |
| | | | |
| #include "Poco/Foundation.h" | | #include "Poco/Foundation.h" | |
|
| | | #include "Poco/AbstractDelegate.h" | |
| | | | |
| namespace Poco { | | namespace Poco { | |
| | | | |
| template <class TArgs> | | template <class TArgs> | |
|
| class AbstractPriorityDelegate | | class AbstractPriorityDelegate: public AbstractDelegate<TArgs> | |
| /// Interface for PriorityDelegate and PriorityExpire. | | /// Base class for PriorityDelegate and PriorityExpire. | |
| /// Very similar to AbstractDelegate but having two separate files ( | | /// | |
| no inheritance) | | /// Extends AbstractDelegate with a priority value. | |
| /// allows to have compile-time checks when registering an observer | | | |
| /// instead of run-time checks. | | | |
| { | | { | |
| public: | | public: | |
|
| AbstractPriorityDelegate(void* pTarget, int prio): | | AbstractPriorityDelegate(int prio): | |
| _pTarget(pTarget), | | | |
| _priority(prio) | | _priority(prio) | |
| { | | { | |
| } | | } | |
| | | | |
| AbstractPriorityDelegate(const AbstractPriorityDelegate& del): | | AbstractPriorityDelegate(const AbstractPriorityDelegate& del): | |
|
| _pTarget(del._pTarget), | | AbstractDelegate<TArgs>(del), | |
| _priority(del._priority) | | _priority(del._priority) | |
| { | | { | |
| } | | } | |
| | | | |
| virtual ~AbstractPriorityDelegate() | | virtual ~AbstractPriorityDelegate() | |
| { | | { | |
| } | | } | |
| | | | |
|
| virtual bool notify(const void* sender, TArgs & arguments) = 0; | | | |
| /// Returns false, if the Delegate is no longer valid, thus | | | |
| indicating an expire | | | |
| | | | |
| virtual AbstractPriorityDelegate* clone() const = 0; | | | |
| // Returns a deep-copy of the object. | | | |
| | | | |
| bool operator < (const AbstractPriorityDelegate<TArgs>& other) const | | | |
| /// Operator used for comparing AbstractPriorityDelegates in | | | |
| a collection. | | | |
| { | | | |
| if (_priority == other._priority) | | | |
| { | | | |
| return _pTarget < other._pTarget; | | | |
| } | | | |
| | | | |
| return (_priority < other._priority); | | | |
| } | | | |
| | | | |
| void* target() const | | | |
| { | | | |
| return _pTarget; | | | |
| } | | | |
| | | | |
| int priority() const | | int priority() const | |
| { | | { | |
| return _priority; | | return _priority; | |
| } | | } | |
| | | | |
| protected: | | protected: | |
|
| void* _pTarget; | | int _priority; | |
| int _priority; | | | |
| }; | | }; | |
| | | | |
| } // namespace Poco | | } // namespace Poco | |
| | | | |
| #endif // Foundation_AbstractPriorityDelegate_INCLUDED | | #endif // Foundation_AbstractPriorityDelegate_INCLUDED | |
| | | | |
End of changes. 8 change blocks. |
| 37 lines changed or deleted | | 10 lines changed or added | |
|
| Application.h | | Application.h | |
| // | | // | |
| // Application.h | | // Application.h | |
| // | | // | |
|
| // $Id: //poco/1.4/Util/include/Poco/Util/Application.h#2 $ | | // $Id: //poco/1.4/Util/include/Poco/Util/Application.h#4 $ | |
| // | | // | |
| // Library: Util | | // Library: Util | |
| // Package: Application | | // Package: Application | |
| // Module: Application | | // Module: Application | |
| // | | // | |
| // Definition of the Application class. | | // Definition of the Application 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 211 | | skipping to change at line 211 | |
| /// ends with a 'd', a config file without the 'd' ending it
s base name is | | /// ends with a 'd', a config file without the 'd' ending it
s base name is | |
| /// also found. | | /// also found. | |
| /// | | /// | |
| /// Example: Given the application "SampleAppd.exe", built i
n debug mode. | | /// Example: Given the application "SampleAppd.exe", built i
n debug mode. | |
| /// Then loadConfiguration() will automatically find a confi
guration file | | /// Then loadConfiguration() will automatically find a confi
guration file | |
| /// named "SampleApp.properties" if it exists and if "Sample
Appd.properties" | | /// named "SampleApp.properties" if it exists and if "Sample
Appd.properties" | |
| /// cannot be found. | | /// cannot be found. | |
| /// | | /// | |
| /// Returns the number of configuration files loaded, which
may be zero. | | /// Returns the number of configuration files loaded, which
may be zero. | |
| /// | | /// | |
|
| /// This method must not be called before initialize(argc, a
rgv) | | /// This method must not be called before init(argc, argv) | |
| /// has been called. | | /// has been called. | |
| | | | |
| void loadConfiguration(const std::string& path, int priority = PRIO_
DEFAULT); | | void loadConfiguration(const std::string& path, int priority = PRIO_
DEFAULT); | |
| /// Loads configuration information from the file specified
by | | /// Loads configuration information from the file specified
by | |
| /// the given path. The file type is determined by the file | | /// the given path. The file type is determined by the file | |
| /// extension. The following extensions are supported: | | /// extension. The following extensions are supported: | |
| /// - .properties - properties file (PropertyFileConfigura
tion) | | /// - .properties - properties file (PropertyFileConfigura
tion) | |
| /// - .ini - initialization file (IniFileConfigurat
ion) | | /// - .ini - initialization file (IniFileConfigurat
ion) | |
| /// - .xml - XML file (XMLConfiguration) | | /// - .xml - XML file (XMLConfiguration) | |
| /// | | /// | |
| /// Extensions are not case sensitive. | | /// Extensions are not case sensitive. | |
| /// | | /// | |
| /// The configuration will be added to the application's | | /// The configuration will be added to the application's | |
| /// LayeredConfiguration with the given priority. | | /// LayeredConfiguration with the given priority. | |
|
| /// | | | |
| | | | |
| template <class C> C& getSubsystem() const; | | template <class C> C& getSubsystem() const; | |
| /// Returns a reference to the subsystem of the class | | /// Returns a reference to the subsystem of the class | |
| /// given as template argument. | | /// given as template argument. | |
| /// | | /// | |
| /// Throws a NotFoundException if such a subsystem has | | /// Throws a NotFoundException if such a subsystem has | |
| /// not been registered. | | /// not been registered. | |
| | | | |
| virtual int run(); | | virtual int run(); | |
| /// Runs the application by performing additional initializa
tions | | /// Runs the application by performing additional initializa
tions | |
| | | | |
| skipping to change at line 387 | | skipping to change at line 386 | |
| SubsystemVec _subsystems; | | SubsystemVec _subsystems; | |
| bool _initialized; | | bool _initialized; | |
| std::string _command; | | std::string _command; | |
| ArgVec _args; | | ArgVec _args; | |
| OptionSet _options; | | OptionSet _options; | |
| bool _unixOptions; | | bool _unixOptions; | |
| Poco::Logger* _pLogger; | | Poco::Logger* _pLogger; | |
| Poco::Timestamp _startTime; | | Poco::Timestamp _startTime; | |
| bool _stopOptionsProcessing; | | bool _stopOptionsProcessing; | |
| | | | |
|
| | | #if defined(POCO_OS_FAMILY_UNIX) && !defined(POCO_VXWORKS) | |
| | | std::string _workingDirAtLaunch; | |
| | | #endif | |
| | | | |
| static Application* _pInstance; | | static Application* _pInstance; | |
| | | | |
| friend class LoggingSubsystem; | | friend class LoggingSubsystem; | |
| | | | |
| Application(const Application&); | | Application(const Application&); | |
| Application& operator = (const Application&); | | Application& operator = (const Application&); | |
| }; | | }; | |
| | | | |
| // | | // | |
| // inlines | | // inlines | |
| | | | |
End of changes. 4 change blocks. |
| 3 lines changed or deleted | | 6 lines changed or added | |
|
| AtomicCounter.h | | AtomicCounter.h | |
| // | | // | |
| // AtomicCounter.h | | // AtomicCounter.h | |
| // | | // | |
|
| // $Id: //poco/1.4/Foundation/include/Poco/AtomicCounter.h#1 $ | | // $Id: //poco/1.4/Foundation/include/Poco/AtomicCounter.h#2 $ | |
| // | | // | |
| // 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 155 | | skipping to change at line 155 | |
| return _counter; | | return _counter; | |
| } | | } | |
| | | | |
| inline AtomicCounter::ValueType AtomicCounter::operator ++ () // prefix | | inline AtomicCounter::ValueType AtomicCounter::operator ++ () // prefix | |
| { | | { | |
| return InterlockedIncrement(&_counter); | | return InterlockedIncrement(&_counter); | |
| } | | } | |
| | | | |
| inline AtomicCounter::ValueType AtomicCounter::operator ++ (int) // postfix | | inline AtomicCounter::ValueType AtomicCounter::operator ++ (int) // postfix | |
| { | | { | |
|
| ValueType result(_counter); | | ValueType result = InterlockedIncrement(&_counter); | |
| InterlockedIncrement(&_counter); | | return --result; | |
| return result; | | | |
| } | | } | |
| | | | |
| inline AtomicCounter::ValueType AtomicCounter::operator -- () // prefix | | inline AtomicCounter::ValueType AtomicCounter::operator -- () // prefix | |
| { | | { | |
| return InterlockedDecrement(&_counter); | | return InterlockedDecrement(&_counter); | |
| } | | } | |
| | | | |
| inline AtomicCounter::ValueType AtomicCounter::operator -- (int) // postfix | | inline AtomicCounter::ValueType AtomicCounter::operator -- (int) // postfix | |
| { | | { | |
|
| ValueType result(_counter); | | ValueType result = InterlockedDecrement(&_counter); | |
| InterlockedDecrement(&_counter); | | return ++result; | |
| return result; | | | |
| } | | } | |
| | | | |
| inline bool AtomicCounter::operator ! () const | | inline bool AtomicCounter::operator ! () const | |
| { | | { | |
| return _counter == 0; | | return _counter == 0; | |
| } | | } | |
| | | | |
| #elif POCO_OS == POCO_OS_MAC_OS_X | | #elif POCO_OS == POCO_OS_MAC_OS_X | |
| // | | // | |
| // Mac OS X | | // Mac OS X | |
| | | | |
| skipping to change at line 198 | | skipping to change at line 196 | |
| return _counter; | | return _counter; | |
| } | | } | |
| | | | |
| inline AtomicCounter::ValueType AtomicCounter::operator ++ () // prefix | | inline AtomicCounter::ValueType AtomicCounter::operator ++ () // prefix | |
| { | | { | |
| return OSAtomicIncrement32(&_counter); | | return OSAtomicIncrement32(&_counter); | |
| } | | } | |
| | | | |
| inline AtomicCounter::ValueType AtomicCounter::operator ++ (int) // postfix | | inline AtomicCounter::ValueType AtomicCounter::operator ++ (int) // postfix | |
| { | | { | |
|
| ValueType result(_counter); | | ValueType result = OSAtomicIncrement32(&_counter); | |
| OSAtomicIncrement32(&_counter); | | return --result; | |
| return result; | | | |
| } | | } | |
| | | | |
| inline AtomicCounter::ValueType AtomicCounter::operator -- () // prefix | | inline AtomicCounter::ValueType AtomicCounter::operator -- () // prefix | |
| { | | { | |
| return OSAtomicDecrement32(&_counter); | | return OSAtomicDecrement32(&_counter); | |
| } | | } | |
| | | | |
| inline AtomicCounter::ValueType AtomicCounter::operator -- (int) // postfix | | inline AtomicCounter::ValueType AtomicCounter::operator -- (int) // postfix | |
| { | | { | |
|
| ValueType result(_counter); | | ValueType result = OSAtomicDecrement32(&_counter); | |
| OSAtomicDecrement32(&_counter); | | return ++result; | |
| return result; | | | |
| } | | } | |
| | | | |
| inline bool AtomicCounter::operator ! () const | | inline bool AtomicCounter::operator ! () const | |
| { | | { | |
| return _counter == 0; | | return _counter == 0; | |
| } | | } | |
| | | | |
| #else | | #else | |
| // | | // | |
| // Generic implementation based on FastMutex | | // Generic implementation based on FastMutex | |
| | | | |
End of changes. 5 change blocks. |
| 13 lines changed or deleted | | 9 lines changed or added | |
|
| BasicEvent.h | | BasicEvent.h | |
| // | | // | |
| // BasicEvent.h | | // BasicEvent.h | |
| // | | // | |
|
| // $Id: //poco/1.4/Foundation/include/Poco/BasicEvent.h#1 $ | | // $Id: //poco/1.4/Foundation/include/Poco/BasicEvent.h#2 $ | |
| // | | // | |
| // Library: Foundation | | // Library: Foundation | |
| // Package: Events | | // Package: Events | |
| // Module: BasicEvent | | // Module: BasicEvent | |
| // | | // | |
| // Implementation of the BasicEvent template. | | // Implementation of the BasicEvent template. | |
| // | | // | |
|
| // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | | // Copyright (c) 2006-2011, 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 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_BasicEvent_INCLUDED | | #ifndef Foundation_BasicEvent_INCLUDED | |
| #define Foundation_BasicEvent_INCLUDED | | #define Foundation_BasicEvent_INCLUDED | |
| | | | |
| #include "Poco/AbstractEvent.h" | | #include "Poco/AbstractEvent.h" | |
| #include "Poco/DefaultStrategy.h" | | #include "Poco/DefaultStrategy.h" | |
| #include "Poco/AbstractDelegate.h" | | #include "Poco/AbstractDelegate.h" | |
|
| #include "Poco/CompareFunctions.h" | | #include "Poco/Mutex.h" | |
| | | | |
| namespace Poco { | | namespace Poco { | |
| | | | |
| template <class TArgs, class TMutex = FastMutex> | | template <class TArgs, class TMutex = FastMutex> | |
| class BasicEvent: public AbstractEvent < | | class BasicEvent: public AbstractEvent < | |
|
| TArgs, DefaultStrategy<TArgs, AbstractDelegate<TArgs>, p_less<Abstra
ctDelegate<TArgs> > >, | | TArgs, DefaultStrategy<TArgs, AbstractDelegate<TArgs> >, | |
| AbstractDelegate<TArgs>, | | AbstractDelegate<TArgs>, | |
| TMutex | | TMutex | |
| > | | > | |
|
| /// A BasicEvent uses internally a DefaultStrategy which | | /// A BasicEvent uses the DefaultStrategy which | |
| /// invokes delegates in an arbitrary manner. | | /// invokes delegates in the order they have been registered. | |
| /// Note that one object can only register one method to a BasicEven | | | |
| t. | | | |
| /// Subsequent registrations will overwrite the existing delegate. | | | |
| /// For example: | | | |
| /// BasicEvent<int> event; | | | |
| /// MyClass myObject; | | | |
| /// event += delegate(&myObject, &MyClass::myMethod1); | | | |
| /// event += delegate(&myObject, &MyClass::myMethod2); | | | |
| /// | | /// | |
|
| /// The second registration will overwrite the first one. The reason | | /// Please see the AbstractEvent class template documentation | |
| is simply that | | /// for more information. | |
| /// function pointers can only be compared by equality but not by lo | | | |
| wer than. | | | |
| { | | { | |
| public: | | public: | |
| BasicEvent() | | BasicEvent() | |
| { | | { | |
| } | | } | |
| | | | |
| ~BasicEvent() | | ~BasicEvent() | |
| { | | { | |
| } | | } | |
| | | | |
| | | | |
End of changes. 6 change blocks. |
| 18 lines changed or deleted | | 8 lines changed or added | |
|
| DNS.h | | DNS.h | |
| // | | // | |
| // DNS.h | | // DNS.h | |
| // | | // | |
|
| // $Id: //poco/1.4/Net/include/Poco/Net/DNS.h#1 $ | | // $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 46 | | skipping to change at line 46 | |
| // | | // | |
| | | | |
| #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" | | #include "Poco/Mutex.h" | |
|
| #include <map> | | | |
| | | | |
| 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. | |
| { | | { | |
| public: | | public: | |
|
| static const HostEntry& hostByName(const std::string& hostname); | | static HostEntry hostByName(const std::string& hostname); | |
| /// Returns a HostEntry object containing the DNS informatio
n | | /// Returns a HostEntry object containing the DNS informatio
n | |
| /// for the host with the given name. | | /// for the host with the given name. | |
| /// | | /// | |
| /// Throws a HostNotFoundException if a host with the given | | /// Throws a HostNotFoundException if a host with the given | |
| /// name cannot be found. | | /// name cannot be found. | |
| /// | | /// | |
| /// Throws a NoAddressFoundException if no address can be | | /// Throws a NoAddressFoundException if no address can be | |
| /// found for the hostname. | | /// found for the hostname. | |
| /// | | /// | |
| /// 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 const HostEntry& hostByAddress(const IPAddress& address); | | static HostEntry hostByAddress(const IPAddress& address); | |
| /// Returns a HostEntry object containing the DNS informatio
n | | /// Returns a HostEntry object containing the DNS informatio
n | |
| /// for the host with the given IP address. | | /// for the host with the given IP address. | |
| /// | | /// | |
| /// Throws a HostNotFoundException if a host with the given | | /// Throws a HostNotFoundException if a host with the given | |
| /// name cannot be found. | | /// name cannot be found. | |
| /// | | /// | |
| /// 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 const HostEntry& resolve(const std::string& address); | | static HostEntry resolve(const std::string& address); | |
| /// Returns a HostEntry object containing the DNS informatio
n | | /// Returns a HostEntry object containing the DNS informatio
n | |
| /// for the host with the given IP address or host name. | | /// for the host with the given IP address or host name. | |
| /// | | /// | |
| /// Throws a HostNotFoundException if a host with the given | | /// Throws a HostNotFoundException if a host with the given | |
| /// name cannot be found. | | /// name cannot be found. | |
| /// | | /// | |
| /// Throws a NoAddressFoundException if no address can be | | /// Throws a NoAddressFoundException if no address can be | |
| /// found for the hostname. | | /// found for the hostname. | |
| /// | | /// | |
| /// 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 IPAddress resolveOne(const std::string& address); | | static IPAddress resolveOne(const std::string& address); | |
| /// Convenience method that calls resolve(address) and retur
ns | | /// Convenience method that calls resolve(address) and retur
ns | |
| /// the first address from the HostInfo. | | /// the first address from the HostInfo. | |
| | | | |
|
| static const HostEntry& thisHost(); | | static HostEntry thisHost(); | |
| /// Returns a HostEntry object containing the DNS informatio
n | | /// Returns a HostEntry object containing the DNS informatio
n | |
| /// for this host. | | /// for this host. | |
| /// | | /// | |
| /// 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. | |
| | | | |
|
| | | //@ 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 | |
| | | /// 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. | |
| | | | |
| protected: | | protected: | |
| static int lastError(); | | static int lastError(); | |
| /// Returns the code of the last error. | | /// Returns the code of the last error. | |
| | | | |
| static void error(int code, const std::string& arg); | | static void error(int code, const std::string& arg); | |
| /// Throws an exception according to the error code. | | /// Throws an exception according to the error code. | |
| | | | |
|
| private: | | static void aierror(int code, const std::string& arg); | |
| typedef std::map<std::string, HostEntry> DNSCache; | | /// Throws an exception according to the getaddrinfo() error | |
| | | code. | |
| static DNSCache _cache; | | | |
| static Poco::FastMutex _mutex; | | | |
| }; | | }; | |
| | | | |
| } } // namespace Poco::Net | | } } // namespace Poco::Net | |
| | | | |
| #endif // Net_DNS_INCLUDED | | #endif // Net_DNS_INCLUDED | |
| | | | |
End of changes. 9 change blocks. |
| 11 lines changed or deleted | | 12 lines changed or added | |
|
| DateTimeFormatter.h | | DateTimeFormatter.h | |
| // | | // | |
| // DateTimeFormatter.h | | // DateTimeFormatter.h | |
| // | | // | |
|
| // $Id: //poco/1.4/Foundation/include/Poco/DateTimeFormatter.h#1 $ | | // $Id: //poco/1.4/Foundation/include/Poco/DateTimeFormatter.h#2 $ | |
| // | | // | |
| // Library: Foundation | | // Library: Foundation | |
| // Package: DateTime | | // Package: DateTime | |
| // Module: DateTimeFormatter | | // Module: DateTimeFormatter | |
| // | | // | |
| // Definition of the DateTimeFormatter class. | | // Definition of the DateTimeFormatter 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 90 | | skipping to change at line 90 | |
| /// * %n - month (1 .. 12) | | /// * %n - month (1 .. 12) | |
| /// * %o - space-padded month ( 1 .. 12) | | /// * %o - space-padded month ( 1 .. 12) | |
| /// * %y - year without century (70) | | /// * %y - year without century (70) | |
| /// * %Y - year with century (1970) | | /// * %Y - year with century (1970) | |
| /// * %H - hour (00 .. 23) | | /// * %H - hour (00 .. 23) | |
| /// * %h - hour (00 .. 12) | | /// * %h - hour (00 .. 12) | |
| /// * %a - am/pm | | /// * %a - am/pm | |
| /// * %A - AM/PM | | /// * %A - AM/PM | |
| /// * %M - minute (00 .. 59) | | /// * %M - minute (00 .. 59) | |
| /// * %S - second (00 .. 59) | | /// * %S - second (00 .. 59) | |
|
| | | /// * %s - seconds and microseconds (equivalent to %S.%F) | |
| /// * %i - millisecond (000 .. 999) | | /// * %i - millisecond (000 .. 999) | |
| /// * %c - centisecond (0 .. 9) | | /// * %c - centisecond (0 .. 9) | |
| /// * %F - fractional seconds/microseconds (000000 - 99999
9) | | /// * %F - fractional seconds/microseconds (000000 - 99999
9) | |
|
| /// * %z - time zone differential in ISO 8601 format (Z or
+NN.NN). | | /// * %z - time zone differential in ISO 8601 format (Z or
+NN.NN) | |
| /// * %Z - time zone differential in RFC format (GMT or +N
NNN) | | /// * %Z - time zone differential in RFC format (GMT or +N
NNN) | |
| /// * %% - percent sign | | /// * %% - percent sign | |
| /// | | /// | |
| /// Class DateTimeFormat defines format strings for various
standard date/time formats. | | /// Class DateTimeFormat defines format strings for various
standard date/time formats. | |
| | | | |
| static std::string format(const DateTime& dateTime, const std::strin
g& fmt, int timeZoneDifferential = UTC); | | static std::string format(const DateTime& dateTime, const std::strin
g& fmt, int timeZoneDifferential = UTC); | |
| /// Formats the given date and time according to the given f
ormat. | | /// Formats the given date and time according to the given f
ormat. | |
| /// See format(const Timestamp&, const std::string&, int) fo
r more information. | | /// See format(const Timestamp&, const std::string&, int) fo
r more information. | |
| | | | |
| static std::string format(const LocalDateTime& dateTime, const std::
string& fmt); | | static std::string format(const LocalDateTime& dateTime, const std::
string& fmt); | |
| | | | |
End of changes. 3 change blocks. |
| 2 lines changed or deleted | | 3 lines changed or added | |
|
| DefaultStrategy.h | | DefaultStrategy.h | |
| // | | // | |
| // DefaultStrategy.h | | // DefaultStrategy.h | |
| // | | // | |
|
| // $Id: //poco/1.4/Foundation/include/Poco/DefaultStrategy.h#1 $ | | // $Id: //poco/1.4/Foundation/include/Poco/DefaultStrategy.h#3 $ | |
| // | | // | |
| // Library: Foundation | | // Library: Foundation | |
| // Package: Events | | // Package: Events | |
| // Module: DefaultStrategy | | // Module: DefaultStrategy | |
| // | | // | |
| // Implementation of the DefaultStrategy template. | | // Implementation of the DefaultStrategy template. | |
| // | | // | |
|
| // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | | // Copyright (c) 2006-2011, 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_DefaultStrategy_INCLUDED | | #ifndef Foundation_DefaultStrategy_INCLUDED | |
| #define Foundation_DefaultStrategy_INCLUDED | | #define Foundation_DefaultStrategy_INCLUDED | |
| | | | |
| #include "Poco/NotificationStrategy.h" | | #include "Poco/NotificationStrategy.h" | |
|
| #include <memory> | | #include "Poco/SharedPtr.h" | |
| #include <set> | | | |
| #include <vector> | | #include <vector> | |
| | | | |
| namespace Poco { | | namespace Poco { | |
| | | | |
|
| template <class TArgs, class TDelegate, class TCompare> | | template <class TArgs, class TDelegate> | |
| class DefaultStrategy: public NotificationStrategy<TArgs, TDelegate> | | class DefaultStrategy: public NotificationStrategy<TArgs, TDelegate> | |
|
| /// Default notification strategy. Allows one observer | | /// Default notification strategy. | |
| /// to register exactly once. The observer must provide an | | /// | |
| /// < (less-than) operator. | | /// Internally, a std::vector<> is used to store | |
| | | /// delegate objects. Delegates are invoked in the | |
| | | /// order in which they have been registered. | |
| { | | { | |
| public: | | public: | |
|
| typedef std::set<TDelegate*, TCompare> Delegates; | | typedef SharedPtr<TDelegate> DelegatePtr; | |
| typedef typename Delegates::iterator Iterator; | | typedef std::vector<DelegatePtr> Delegates; | |
| typedef typename Delegates::const_iterator ConstIterator; | | typedef typename Delegates::iterator Iterator; | |
| | | | |
| public: | | public: | |
| DefaultStrategy() | | DefaultStrategy() | |
| { | | { | |
| } | | } | |
| | | | |
|
| DefaultStrategy(const DefaultStrategy& s) | | DefaultStrategy(const DefaultStrategy& s): | |
| | | _delegates(s._delegates) | |
| { | | { | |
|
| operator = (s); | | | |
| } | | } | |
| | | | |
| ~DefaultStrategy() | | ~DefaultStrategy() | |
| { | | { | |
|
| clear(); | | | |
| } | | } | |
| | | | |
| void notify(const void* sender, TArgs& arguments) | | void notify(const void* sender, TArgs& arguments) | |
| { | | { | |
|
| std::vector<Iterator> delMe; | | for (Iterator it = _delegates.begin(); it != _delegates.end( | |
| | | ); ++it) | |
| for (Iterator it = _observers.begin(); it != _observers.end( | | | |
| ); ++it) | | | |
| { | | | |
| if (!(*it)->notify(sender, arguments)) | | | |
| { | | | |
| // schedule for deletion | | | |
| delMe.push_back(it); | | | |
| } | | | |
| } | | | |
| | | | |
| while (!delMe.empty()) | | | |
| { | | { | |
|
| typename std::vector<Iterator>::iterator vit = delMe | | (*it)->notify(sender, arguments); | |
| .end(); | | | |
| --vit; | | | |
| delete **vit; | | | |
| _observers.erase(*vit); | | | |
| delMe.pop_back(); | | | |
| } | | } | |
| } | | } | |
| | | | |
| void add(const TDelegate& delegate) | | void add(const TDelegate& delegate) | |
| { | | { | |
|
| Iterator it = _observers.find(const_cast<TDelegate*>(&delega | | _delegates.push_back(DelegatePtr(static_cast<TDelegate*>(del | |
| te)); | | egate.clone()))); | |
| if (it != _observers.end()) | | | |
| { | | | |
| delete *it; | | | |
| _observers.erase(it); | | | |
| } | | | |
| std::auto_ptr<TDelegate> pDelegate(delegate.clone()); | | | |
| bool tmp = _observers.insert(pDelegate.get()).second; | | | |
| poco_assert (tmp); | | | |
| pDelegate.release(); | | | |
| } | | } | |
| | | | |
| void remove(const TDelegate& delegate) | | void remove(const TDelegate& delegate) | |
| { | | { | |
|
| Iterator it = _observers.find(const_cast<TDelegate*>(&delega | | for (Iterator it = _delegates.begin(); it != _delegates.end( | |
| te)); | | ); ++it) | |
| if (it != _observers.end()) | | | |
| { | | { | |
|
| delete *it; | | if (delegate.equals(**it)) | |
| _observers.erase(it); | | { | |
| | | (*it)->disable(); | |
| | | _delegates.erase(it); | |
| | | return; | |
| | | } | |
| } | | } | |
| } | | } | |
| | | | |
| DefaultStrategy& operator = (const DefaultStrategy& s) | | DefaultStrategy& operator = (const DefaultStrategy& s) | |
| { | | { | |
| if (this != &s) | | if (this != &s) | |
| { | | { | |
|
| for (ConstIterator it = s._observers.begin(); it != | | _delegates = s._delegates; | |
| s._observers.end(); ++it) | | | |
| { | | | |
| add(**it); | | | |
| } | | | |
| } | | } | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| void clear() | | void clear() | |
| { | | { | |
|
| for (Iterator it = _observers.begin(); it != _observers.end(
); ++it) | | for (Iterator it = _delegates.begin(); it != _delegates.end(
); ++it) | |
| { | | { | |
|
| delete *it; | | (*it)->disable(); | |
| } | | } | |
|
| _observers.clear(); | | _delegates.clear(); | |
| } | | } | |
| | | | |
| bool empty() const | | bool empty() const | |
| { | | { | |
|
| return _observers.empty(); | | return _delegates.empty(); | |
| } | | } | |
| | | | |
| protected: | | protected: | |
|
| Delegates _observers; | | Delegates _delegates; | |
| }; | | }; | |
| | | | |
| } // namespace Poco | | } // namespace Poco | |
| | | | |
| #endif // Foundation_DefaultStrategy_INCLUDED | | #endif // Foundation_DefaultStrategy_INCLUDED | |
| | | | |
End of changes. 20 change blocks. |
| 59 lines changed or deleted | | 33 lines changed or added | |
|
| Delegate.h | | Delegate.h | |
| // | | // | |
| // Delegate.h | | // Delegate.h | |
| // | | // | |
|
| // $Id: //poco/1.4/Foundation/include/Poco/Delegate.h#1 $ | | // $Id: //poco/1.4/Foundation/include/Poco/Delegate.h#5 $ | |
| // | | // | |
| // Library: Foundation | | // Library: Foundation | |
| // Package: Events | | // Package: Events | |
| // Module: Delegate | | // Module: Delegate | |
| // | | // | |
| // Implementation of the Delegate template. | | // Implementation of the Delegate template. | |
| // | | // | |
|
| // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | | // Copyright (c) 2006-2011, 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 45 | | skipping to change at line 45 | |
| // DEALINGS IN THE SOFTWARE. | | // DEALINGS IN THE SOFTWARE. | |
| // | | // | |
| | | | |
| #ifndef Foundation_Delegate_INCLUDED | | #ifndef Foundation_Delegate_INCLUDED | |
| #define Foundation_Delegate_INCLUDED | | #define Foundation_Delegate_INCLUDED | |
| | | | |
| #include "Poco/Foundation.h" | | #include "Poco/Foundation.h" | |
| #include "Poco/AbstractDelegate.h" | | #include "Poco/AbstractDelegate.h" | |
| #include "Poco/FunctionDelegate.h" | | #include "Poco/FunctionDelegate.h" | |
| #include "Poco/Expire.h" | | #include "Poco/Expire.h" | |
|
| | | #include "Poco/Mutex.h" | |
| | | | |
| namespace Poco { | | namespace Poco { | |
| | | | |
|
| template <class TObj, class TArgs, bool withSender=true> | | template <class TObj, class TArgs, bool withSender = true> | |
| class Delegate: public AbstractDelegate<TArgs> | | class Delegate: public AbstractDelegate<TArgs> | |
| { | | { | |
| public: | | public: | |
| typedef void (TObj::*NotifyMethod)(const void*, TArgs&); | | typedef void (TObj::*NotifyMethod)(const void*, TArgs&); | |
| | | | |
| Delegate(TObj* obj, NotifyMethod method): | | Delegate(TObj* obj, NotifyMethod method): | |
|
| AbstractDelegate<TArgs>(obj), | | | |
| _receiverObject(obj), | | _receiverObject(obj), | |
| _receiverMethod(method) | | _receiverMethod(method) | |
| { | | { | |
| } | | } | |
| | | | |
| Delegate(const Delegate& delegate): | | Delegate(const Delegate& delegate): | |
| AbstractDelegate<TArgs>(delegate), | | AbstractDelegate<TArgs>(delegate), | |
| _receiverObject(delegate._receiverObject), | | _receiverObject(delegate._receiverObject), | |
| _receiverMethod(delegate._receiverMethod) | | _receiverMethod(delegate._receiverMethod) | |
| { | | { | |
| } | | } | |
| | | | |
| ~Delegate() | | ~Delegate() | |
| { | | { | |
| } | | } | |
| | | | |
| Delegate& operator = (const Delegate& delegate) | | Delegate& operator = (const Delegate& delegate) | |
| { | | { | |
| if (&delegate != this) | | if (&delegate != this) | |
| { | | { | |
|
| this->_pTarget = delegate._pTarget; | | | |
| this->_receiverObject = delegate._receiverObject; | | this->_receiverObject = delegate._receiverObject; | |
| this->_receiverMethod = delegate._receiverMethod; | | this->_receiverMethod = delegate._receiverMethod; | |
| } | | } | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| bool notify(const void* sender, TArgs& arguments) | | bool notify(const void* sender, TArgs& arguments) | |
| { | | { | |
|
| (_receiverObject->*_receiverMethod)(sender, arguments); | | Mutex::ScopedLock lock(_mutex); | |
| return true; // a "standard" delegate never expires | | if (_receiverObject) | |
| | | { | |
| | | (_receiverObject->*_receiverMethod)(sender, argument | |
| | | s); | |
| | | return true; | |
| | | } | |
| | | else return false; | |
| | | } | |
| | | | |
| | | bool equals(const AbstractDelegate<TArgs>& other) const | |
| | | { | |
| | | const Delegate* pOtherDelegate = reinterpret_cast<const Dele | |
| | | gate*>(other.unwrap()); | |
| | | return pOtherDelegate && _receiverObject == pOtherDelegate-> | |
| | | _receiverObject && _receiverMethod == pOtherDelegate->_receiverMethod; | |
| } | | } | |
| | | | |
| AbstractDelegate<TArgs>* clone() const | | AbstractDelegate<TArgs>* clone() const | |
| { | | { | |
| return new Delegate(*this); | | return new Delegate(*this); | |
| } | | } | |
| | | | |
|
| | | void disable() | |
| | | { | |
| | | Mutex::ScopedLock lock(_mutex); | |
| | | _receiverObject = 0; | |
| | | } | |
| | | | |
| protected: | | protected: | |
| TObj* _receiverObject; | | TObj* _receiverObject; | |
| NotifyMethod _receiverMethod; | | NotifyMethod _receiverMethod; | |
|
| | | Mutex _mutex; | |
| | | | |
| private: | | private: | |
| Delegate(); | | Delegate(); | |
| }; | | }; | |
| | | | |
| template <class TObj, class TArgs> | | template <class TObj, class TArgs> | |
| class Delegate<TObj, TArgs, false>: public AbstractDelegate<TArgs> | | class Delegate<TObj, TArgs, false>: public AbstractDelegate<TArgs> | |
| { | | { | |
| public: | | public: | |
| typedef void (TObj::*NotifyMethod)(TArgs&); | | typedef void (TObj::*NotifyMethod)(TArgs&); | |
| | | | |
| Delegate(TObj* obj, NotifyMethod method): | | Delegate(TObj* obj, NotifyMethod method): | |
|
| AbstractDelegate<TArgs>(obj), | | | |
| _receiverObject(obj), | | _receiverObject(obj), | |
| _receiverMethod(method) | | _receiverMethod(method) | |
| { | | { | |
| } | | } | |
| | | | |
| Delegate(const Delegate& delegate): | | Delegate(const Delegate& delegate): | |
| AbstractDelegate<TArgs>(delegate), | | AbstractDelegate<TArgs>(delegate), | |
| _receiverObject(delegate._receiverObject), | | _receiverObject(delegate._receiverObject), | |
| _receiverMethod(delegate._receiverMethod) | | _receiverMethod(delegate._receiverMethod) | |
| { | | { | |
| | | | |
| skipping to change at line 139 | | skipping to change at line 155 | |
| { | | { | |
| this->_pTarget = delegate._pTarget; | | this->_pTarget = delegate._pTarget; | |
| this->_receiverObject = delegate._receiverObject; | | this->_receiverObject = delegate._receiverObject; | |
| this->_receiverMethod = delegate._receiverMethod; | | this->_receiverMethod = delegate._receiverMethod; | |
| } | | } | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| bool notify(const void*, TArgs& arguments) | | bool notify(const void*, TArgs& arguments) | |
| { | | { | |
|
| (_receiverObject->*_receiverMethod)(arguments); | | Mutex::ScopedLock lock(_mutex); | |
| return true; // a "standard" delegate never expires | | if (_receiverObject) | |
| | | { | |
| | | (_receiverObject->*_receiverMethod)(arguments); | |
| | | return true; | |
| | | } | |
| | | else return false; | |
| | | } | |
| | | | |
| | | bool equals(const AbstractDelegate<TArgs>& other) const | |
| | | { | |
| | | const Delegate* pOtherDelegate = reinterpret_cast<const Dele | |
| | | gate*>(other.unwrap()); | |
| | | return pOtherDelegate && _receiverObject == pOtherDelegate-> | |
| | | _receiverObject && _receiverMethod == pOtherDelegate->_receiverMethod; | |
| } | | } | |
| | | | |
| AbstractDelegate<TArgs>* clone() const | | AbstractDelegate<TArgs>* clone() const | |
| { | | { | |
| return new Delegate(*this); | | return new Delegate(*this); | |
| } | | } | |
| | | | |
|
| | | void disable() | |
| | | { | |
| | | Mutex::ScopedLock lock(_mutex); | |
| | | _receiverObject = 0; | |
| | | } | |
| | | | |
| protected: | | protected: | |
| TObj* _receiverObject; | | TObj* _receiverObject; | |
| NotifyMethod _receiverMethod; | | NotifyMethod _receiverMethod; | |
|
| | | Mutex _mutex; | |
| | | | |
| private: | | private: | |
| Delegate(); | | Delegate(); | |
| }; | | }; | |
| | | | |
| template <class TObj, class TArgs> | | template <class TObj, class TArgs> | |
| static Delegate<TObj, TArgs, true> delegate(TObj* pObj, void (TObj::*Notify
Method)(const void*, TArgs&)) | | static Delegate<TObj, TArgs, true> delegate(TObj* pObj, void (TObj::*Notify
Method)(const void*, TArgs&)) | |
| { | | { | |
| return Delegate<TObj, TArgs, true>(pObj, NotifyMethod); | | return Delegate<TObj, TArgs, true>(pObj, NotifyMethod); | |
| } | | } | |
| | | | |
| skipping to change at line 195 | | skipping to change at line 229 | |
| | | | |
| template <class TArgs> | | template <class TArgs> | |
| static Expire<TArgs> delegate(void (*NotifyMethod)(void*, TArgs&), Timestam
p::TimeDiff expireMillisecs) | | static Expire<TArgs> delegate(void (*NotifyMethod)(void*, TArgs&), Timestam
p::TimeDiff expireMillisecs) | |
| { | | { | |
| return Expire<TArgs>(FunctionDelegate<TArgs, true, false>(NotifyMeth
od), expireMillisecs); | | return Expire<TArgs>(FunctionDelegate<TArgs, true, false>(NotifyMeth
od), expireMillisecs); | |
| } | | } | |
| | | | |
| template <class TArgs> | | template <class TArgs> | |
| static Expire<TArgs> delegate(void (*NotifyMethod)(TArgs&), Timestamp::Time
Diff expireMillisecs) | | static Expire<TArgs> delegate(void (*NotifyMethod)(TArgs&), Timestamp::Time
Diff expireMillisecs) | |
| { | | { | |
|
| return Expire<TArgs>(FunctionDelegate<TArgs, false>( NotifyMethod),
expireMillisecs); | | return Expire<TArgs>(FunctionDelegate<TArgs, false>(NotifyMethod), e
xpireMillisecs); | |
| } | | } | |
| | | | |
| template <class TArgs> | | template <class TArgs> | |
| static FunctionDelegate<TArgs, true, true> delegate(void (*NotifyMethod)(co
nst void*, TArgs&)) | | static FunctionDelegate<TArgs, true, true> delegate(void (*NotifyMethod)(co
nst void*, TArgs&)) | |
| { | | { | |
| return FunctionDelegate<TArgs, true, true>(NotifyMethod); | | return FunctionDelegate<TArgs, true, true>(NotifyMethod); | |
| } | | } | |
| | | | |
| template <class TArgs> | | template <class TArgs> | |
| static FunctionDelegate<TArgs, true, false> delegate(void (*NotifyMethod)(v
oid*, TArgs&)) | | static FunctionDelegate<TArgs, true, false> delegate(void (*NotifyMethod)(v
oid*, TArgs&)) | |
| | | | |
End of changes. 14 change blocks. |
| 11 lines changed or deleted | | 50 lines changed or added | |
|
| Document.h | | Document.h | |
| // | | // | |
| // Document.h | | // Document.h | |
| // | | // | |
|
| // $Id: //poco/1.4/XML/include/Poco/DOM/Document.h#1 $ | | // $Id: //poco/1.4/XML/include/Poco/DOM/Document.h#2 $ | |
| // | | // | |
| // Library: XML | | // Library: XML | |
| // Package: DOM | | // Package: DOM | |
| // Module: DOM | | // Module: DOM | |
| // | | // | |
| // Definition of the DOM Document class. | | // Definition of the DOM Document 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 244 | | skipping to change at line 244 | |
| /// has the given elementId. If no such element exists, retu
rns null. | | /// has the given elementId. If no such element exists, retu
rns null. | |
| /// | | /// | |
| /// This method is an extension to the W3C Document Object M
odel. | | /// This method is an extension to the W3C Document Object M
odel. | |
| | | | |
| Element* getElementByIdNS(const XMLString& elementId, const XMLStrin
g& idAttributeURI, const XMLString& idAttributeLocalName) const; | | Element* getElementByIdNS(const XMLString& elementId, const XMLStrin
g& idAttributeURI, const XMLString& idAttributeLocalName) const; | |
| /// Returns the first Element whose ID attribute (given in i
dAttributeURI and idAttributeLocalName) | | /// Returns the first Element whose ID attribute (given in i
dAttributeURI and idAttributeLocalName) | |
| /// has the given elementId. If no such element exists, retu
rns null. | | /// has the given elementId. If no such element exists, retu
rns null. | |
| /// | | /// | |
| /// This method is an extension to the W3C Document Object M
odel. | | /// This method is an extension to the W3C Document Object M
odel. | |
| | | | |
|
| Node* getNodeByPath(const XMLString& path); | | | |
| /// Searches a node (element or attribute) based on a simpli | | | |
| fied XPath | | | |
| /// expression. | | | |
| /// | | | |
| /// Only simple XPath expressions are supported. These are t | | | |
| he slash | | | |
| /// notation for specifying paths to elements, and the squar | | | |
| e bracket | | | |
| /// expression for finding elements by their index, by attri | | | |
| bute value, | | | |
| /// or finding attributes by names. | | | |
| /// | | | |
| /// The slash at the beginning is optional, the evaluation a | | | |
| lways starts | | | |
| /// at the document element. | | | |
| /// | | | |
| /// Examples: | | | |
| /// /elem1/elem2/elem3 | | | |
| /// /elem1/elem2[1] | | | |
| /// /elem1/elem2[@attr1] | | | |
| /// /elem1/elem2[@attr1='value'] | | | |
| /// | | | |
| /// This method is an extension to the W3C Document Object M | | | |
| odel. | | | |
| | | | |
| Node* getNodeByPathNS(const XMLString& path, const Element::NSMap& n | | | |
| sMap); | | | |
| /// Searches a node (element or attribute) based on a simpli | | | |
| fied XPath | | | |
| /// expression. The given NSMap must contain mappings from n | | | |
| amespace | | | |
| /// prefixes to namespace URIs for all namespace prefixes us | | | |
| ed in | | | |
| /// the path expression. | | | |
| /// | | | |
| /// Only simple XPath expressions are supported. These are t | | | |
| he slash | | | |
| /// notation for specifying paths to elements, and the squar | | | |
| e bracket | | | |
| /// expression for finding elements by their index, by attri | | | |
| bute value, | | | |
| /// or finding attributes by names. | | | |
| /// | | | |
| /// The slash at the beginning is optional, the evaluation a | | | |
| lways starts | | | |
| /// at the document element. | | | |
| /// | | | |
| /// Examples: | | | |
| /// /ns1:elem1/ns2:elem2/ns2:elem3 | | | |
| /// /ns1:elem1/ns2:elem2[1] | | | |
| /// /ns1:elem1/ns2:elem2[@attr1] | | | |
| /// /ns1:elem1/ns2:elem2[@attr1='value'] | | | |
| /// | | | |
| /// This method is an extension to the W3C Document Object M | | | |
| odel. | | | |
| | | | |
| protected: | | protected: | |
| ~Document(); | | ~Document(); | |
| | | | |
| Node* copyNode(bool deep, Document* pOwnerDocument) const; | | Node* copyNode(bool deep, Document* pOwnerDocument) const; | |
| | | | |
| DocumentType* getDoctype(); | | DocumentType* getDoctype(); | |
| void setDoctype(DocumentType* pDoctype); | | void setDoctype(DocumentType* pDoctype); | |
| | | | |
| private: | | private: | |
| DocumentType* _pDocumentType; | | DocumentType* _pDocumentType; | |
| | | | |
End of changes. 2 change blocks. |
| 58 lines changed or deleted | | 1 lines changed or added | |
|
| Element.h | | Element.h | |
| // | | // | |
| // Element.h | | // Element.h | |
| // | | // | |
|
| // $Id: //poco/1.4/XML/include/Poco/DOM/Element.h#1 $ | | // $Id: //poco/1.4/XML/include/Poco/DOM/Element.h#2 $ | |
| // | | // | |
| // Library: XML | | // Library: XML | |
| // Package: DOM | | // Package: DOM | |
| // Module: DOM | | // Module: DOM | |
| // | | // | |
| // Definition of the DOM Element class. | | // Definition of the DOM Element 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 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 DOM_Element_INCLUDED | | #ifndef DOM_Element_INCLUDED | |
| #define DOM_Element_INCLUDED | | #define DOM_Element_INCLUDED | |
| | | | |
| #include "Poco/XML/XML.h" | | #include "Poco/XML/XML.h" | |
| #include "Poco/DOM/AbstractContainerNode.h" | | #include "Poco/DOM/AbstractContainerNode.h" | |
| #include "Poco/XML/Name.h" | | #include "Poco/XML/Name.h" | |
|
| #include "Poco/SAX/NamespaceSupport.h" | | | |
| | | | |
| namespace Poco { | | namespace Poco { | |
| namespace XML { | | namespace XML { | |
| | | | |
| class Attr; | | class Attr; | |
| class NodeList; | | class NodeList; | |
| class Document; | | class Document; | |
| | | | |
| class XML_API Element: public AbstractContainerNode | | class XML_API Element: public AbstractContainerNode | |
| /// The Element interface represents an element in an XML document. | | /// The Element interface represents an element in an XML document. | |
| | | | |
| skipping to change at line 174 | | skipping to change at line 173 | |
| /// | | /// | |
| /// The special value "*" matches all namespaces, or local n
ames respectively. | | /// The special value "*" matches all namespaces, or local n
ames respectively. | |
| /// | | /// | |
| /// The returned NodeList must be released with a call | | /// The returned NodeList must be released with a call | |
| /// to release() when no longer needed. | | /// to release() when no longer needed. | |
| | | | |
| const XMLString& namespaceURI() const; | | const XMLString& namespaceURI() const; | |
| XMLString prefix() const; | | XMLString prefix() const; | |
| const XMLString& localName() const; | | const XMLString& localName() const; | |
| bool hasAttributes() const; | | bool hasAttributes() const; | |
|
| | | | |
| // Non-standard extensions | | | |
| typedef Poco::XML::NamespaceSupport NSMap; | | | |
| | | | |
| XMLString innerText() const; | | XMLString innerText() const; | |
| | | | |
| Element* getChildElement(const XMLString& name) const; | | Element* getChildElement(const XMLString& name) const; | |
| /// Returns the first child element with the given name, or
null | | /// Returns the first child element with the given name, or
null | |
| /// if such an element does not exist. | | /// if such an element does not exist. | |
| /// | | /// | |
| /// This method is an extension to the W3C Document Object M
odel. | | /// This method is an extension to the W3C Document Object M
odel. | |
| | | | |
| Element* getChildElementNS(const XMLString& namespaceURI, const XMLS
tring& localName) const; | | Element* getChildElementNS(const XMLString& namespaceURI, const XMLS
tring& localName) const; | |
| /// Returns the first child element with the given namespace
URI and localName, | | /// Returns the first child element with the given namespace
URI and localName, | |
| | | | |
| skipping to change at line 204 | | skipping to change at line 199 | |
| /// has the given elementId. If no such element exists, retu
rns null. | | /// has the given elementId. If no such element exists, retu
rns null. | |
| /// | | /// | |
| /// This method is an extension to the W3C Document Object M
odel. | | /// This method is an extension to the W3C Document Object M
odel. | |
| | | | |
| Element* getElementByIdNS(const XMLString& elementId, const XMLStrin
g& idAttributeURI, const XMLString& idAttributeLocalName) const; | | Element* getElementByIdNS(const XMLString& elementId, const XMLStrin
g& idAttributeURI, const XMLString& idAttributeLocalName) const; | |
| /// Returns the first Element whose ID attribute (given in i
dAttributeURI and idAttributeLocalName) | | /// Returns the first Element whose ID attribute (given in i
dAttributeURI and idAttributeLocalName) | |
| /// has the given elementId. If no such element exists, retu
rns null. | | /// has the given elementId. If no such element exists, retu
rns null. | |
| /// | | /// | |
| /// This method is an extension to the W3C Document Object M
odel. | | /// This method is an extension to the W3C Document Object M
odel. | |
| | | | |
|
| Node* getNodeByPath(const XMLString& path); | | | |
| /// Searches a node (element or attribute) based on a simpli | | | |
| fied XPath | | | |
| /// expression. | | | |
| /// | | | |
| /// Only simple XPath expressions are supported. These are t | | | |
| he slash | | | |
| /// notation for specifying paths to elements, and the squar | | | |
| e bracket | | | |
| /// expression for finding elements by their index, by attri | | | |
| bute value, | | | |
| /// or finding attributes by names. | | | |
| /// | | | |
| /// The slash at the beginning is optional, the evaluation a | | | |
| lways starts | | | |
| /// at this element. | | | |
| /// | | | |
| /// Examples: | | | |
| /// /elem1/elem2/elem3 | | | |
| /// /elem1/elem2[1] | | | |
| /// /elem1/elem2[@attr1] | | | |
| /// /elem1/elem2[@attr1='value'] | | | |
| /// | | | |
| /// This method is an extension to the W3C Document Object M | | | |
| odel. | | | |
| | | | |
| Node* getNodeByPathNS(const XMLString& path, const NSMap& nsMap); | | | |
| /// Searches a node (element or attribute) based on a simpli | | | |
| fied XPath | | | |
| /// expression. The given NSMap must contain mappings from n | | | |
| amespace | | | |
| /// prefixes to namespace URIs for all namespace prefixes us | | | |
| ed in | | | |
| /// the path expression. | | | |
| /// | | | |
| /// Only simple XPath expressions are supported. These are t | | | |
| he slash | | | |
| /// notation for specifying paths to elements, and the squar | | | |
| e bracket | | | |
| /// expression for finding elements by their index, by attri | | | |
| bute value, | | | |
| /// or finding attributes by names. | | | |
| /// | | | |
| /// The slash at the beginning is optional, the evaluation a | | | |
| lways starts | | | |
| /// at this element. | | | |
| /// | | | |
| /// Examples: | | | |
| /// /ns1:elem1/ns2:elem2/ns2:elem3 | | | |
| /// /ns1:elem1/ns2:elem2[1] | | | |
| /// /ns1:elem1/ns2:elem2[@attr1] | | | |
| /// /ns1:elem1/ns2:elem2[@attr1='value'] | | | |
| /// | | | |
| /// This method is an extension to the W3C Document Object M | | | |
| odel. | | | |
| | | | |
| // Node | | // Node | |
| const XMLString& nodeName() const; | | const XMLString& nodeName() const; | |
| NamedNodeMap* attributes() const; | | NamedNodeMap* attributes() const; | |
| unsigned short nodeType() const; | | unsigned short nodeType() const; | |
| | | | |
| protected: | | protected: | |
| Element(Document* pOwnerDocument, const XMLString& namespaceURI, con
st XMLString& localName, const XMLString& qname); | | Element(Document* pOwnerDocument, const XMLString& namespaceURI, con
st XMLString& localName, const XMLString& qname); | |
| Element(Document* pOwnerDocument, const Element& elem); | | Element(Document* pOwnerDocument, const Element& elem); | |
| ~Element(); | | ~Element(); | |
| | | | |
| Node* copyNode(bool deep, Document* pOwnerDocument) const; | | Node* copyNode(bool deep, Document* pOwnerDocument) const; | |
| | | | |
| void dispatchNodeRemovedFromDocument(); | | void dispatchNodeRemovedFromDocument(); | |
| void dispatchNodeInsertedIntoDocument(); | | void dispatchNodeInsertedIntoDocument(); | |
| | | | |
|
| static Node* findNode(XMLString::const_iterator& it, const XMLString | | | |
| ::const_iterator& end, Node* pNode, const NSMap* pNSMap); | | | |
| static Node* findElement(const XMLString& name, Node* pNode, const N | | | |
| SMap* pNSMap); | | | |
| static Node* findElement(int index, Node* pNode, const NSMap* pNSMap | | | |
| ); | | | |
| static Node* findElement(const XMLString& attr, const XMLString& val | | | |
| ue, Node* pNode, const NSMap* pNSMap); | | | |
| static Attr* findAttribute(const XMLString& name, Node* pNode, const | | | |
| NSMap* pNSMap); | | | |
| bool hasAttributeValue(const XMLString& name, const XMLString& value | | | |
| , const NSMap* pNSMap); | | | |
| static bool namesAreEqual(Node* pNode1, Node* pNode2, const NSMap* p | | | |
| NSMap); | | | |
| static bool namesAreEqual(Node* pNode, const XMLString& name, const | | | |
| NSMap* pNSMap); | | | |
| | | | |
| private: | | private: | |
| const Name& _name; | | const Name& _name; | |
| Attr* _pFirstAttr; | | Attr* _pFirstAttr; | |
| | | | |
| friend class Attr; | | friend class Attr; | |
| friend class Document; | | friend class Document; | |
| friend class AttrMap; | | friend class AttrMap; | |
| }; | | }; | |
| | | | |
| // | | // | |
| | | | |
End of changes. 5 change blocks. |
| 79 lines changed or deleted | | 1 lines changed or added | |
|
| ElementsByTagNameList.h | | ElementsByTagNameList.h | |
| // | | // | |
| // ElementsByTagNameList.h | | // ElementsByTagNameList.h | |
| // | | // | |
|
| // $Id: //poco/1.4/XML/include/Poco/DOM/ElementsByTagNameList.h#1 $ | | // $Id: //poco/1.4/XML/include/Poco/DOM/ElementsByTagNameList.h#2 $ | |
| // | | // | |
| // Library: XML | | // Library: XML | |
| // Package: DOM | | // Package: DOM | |
| // Module: DOM | | // Module: DOM | |
| // | | // | |
| // Definition of the ElementsByTagNameList and ElementsByTagNameListNS clas
ses. | | // Definition of the ElementsByTagNameList and ElementsByTagNameListNS clas
ses. | |
| // | | // | |
| // 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 | |
| protected: | | protected: | |
| ElementsByTagNameList(const Node* pParent, const XMLString& name); | | ElementsByTagNameList(const Node* pParent, const XMLString& name); | |
| ~ElementsByTagNameList(); | | ~ElementsByTagNameList(); | |
| | | | |
| Node* find(const Node* pParent, unsigned long index) const; | | Node* find(const Node* pParent, unsigned long index) const; | |
| | | | |
| const Node* _pParent; | | const Node* _pParent; | |
| XMLString _name; | | XMLString _name; | |
| mutable unsigned long _count; | | mutable unsigned long _count; | |
| | | | |
|
| | | friend class AbstractContainerNode; | |
| friend class Element; | | friend class Element; | |
| friend class Document; | | friend class Document; | |
| }; | | }; | |
| | | | |
| class XML_API ElementsByTagNameListNS: public NodeList | | class XML_API ElementsByTagNameListNS: public NodeList | |
| // This implementation of NodeList is returned | | // This implementation of NodeList is returned | |
| // by Document::getElementsByTagNameNS() and | | // by Document::getElementsByTagNameNS() and | |
| // Element::getElementsByTagNameNS(). | | // Element::getElementsByTagNameNS(). | |
| { | | { | |
| public: | | public: | |
| | | | |
| skipping to change at line 93 | | skipping to change at line 94 | |
| ElementsByTagNameListNS(const Node* pParent, const XMLString& namesp
aceURI, const XMLString& localName); | | ElementsByTagNameListNS(const Node* pParent, const XMLString& namesp
aceURI, const XMLString& localName); | |
| ~ElementsByTagNameListNS(); | | ~ElementsByTagNameListNS(); | |
| | | | |
| Node* find(const Node* pParent, unsigned long index) const; | | Node* find(const Node* pParent, unsigned long index) const; | |
| | | | |
| const Node* _pParent; | | const Node* _pParent; | |
| XMLString _localName; | | XMLString _localName; | |
| XMLString _namespaceURI; | | XMLString _namespaceURI; | |
| mutable unsigned long _count; | | mutable unsigned long _count; | |
| | | | |
|
| | | friend class AbstractContainerNode; | |
| friend class Element; | | friend class Element; | |
| friend class Document; | | friend class Document; | |
| }; | | }; | |
| | | | |
| } } // namespace Poco::XML | | } } // namespace Poco::XML | |
| | | | |
| #endif // DOM_ElementsByTagNameList_INCLUDED | | #endif // DOM_ElementsByTagNameList_INCLUDED | |
| | | | |
End of changes. 3 change blocks. |
| 1 lines changed or deleted | | 3 lines changed or added | |
|
| EventArgs.h | | EventArgs.h | |
| // | | // | |
| // EventArgs.h | | // EventArgs.h | |
| // | | // | |
|
| // $Id: //poco/1.4/Foundation/include/Poco/EventArgs.h#1 $ | | // $Id: //poco/1.4/Foundation/include/Poco/EventArgs.h#2 $ | |
| // | | // | |
| // Library: Foundation | | // Library: Foundation | |
| // Package: Events | | // Package: Events | |
| // Module: EventArgs | | // Module: EventArgs | |
| // | | // | |
| // Definition of EventArgs. | | // Definition of EventArgs. | |
| // | | // | |
|
| // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | | // Copyright (c) 2006-2011, 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 48 | | skipping to change at line 48 | |
| #ifndef Foundation_EventArgs_INCLUDED | | #ifndef Foundation_EventArgs_INCLUDED | |
| #define Foundation_EventArgs_INCLUDED | | #define Foundation_EventArgs_INCLUDED | |
| | | | |
| #include "Poco/Foundation.h" | | #include "Poco/Foundation.h" | |
| | | | |
| namespace Poco { | | namespace Poco { | |
| | | | |
| class Foundation_API EventArgs | | class Foundation_API EventArgs | |
| /// The purpose of the EventArgs class is to be used as parameter | | /// The purpose of the EventArgs class is to be used as parameter | |
| /// when one doesn't want to send any data. | | /// when one doesn't want to send any data. | |
|
| /// One can use EventArgs as a super-class for one's own event argum | | /// | |
| ents | | /// One can use EventArgs as a base class for one's own event argume | |
| | | nts | |
| /// but with the arguments being a template parameter this is not | | /// but with the arguments being a template parameter this is not | |
| /// necessary. | | /// necessary. | |
| { | | { | |
| public: | | public: | |
| EventArgs(); | | EventArgs(); | |
| | | | |
| virtual ~EventArgs(); | | virtual ~EventArgs(); | |
| }; | | }; | |
| | | | |
| } // namespace Poco | | } // namespace Poco | |
| | | | |
End of changes. 3 change blocks. |
| 4 lines changed or deleted | | 5 lines changed or added | |
|
| Exception.h | | Exception.h | |
| // | | // | |
| // Exception.h | | // Exception.h | |
| // | | // | |
|
| // $Id: //poco/1.4/Foundation/include/Poco/Exception.h#1 $ | | // $Id: //poco/1.4/Foundation/include/Poco/Exception.h#2 $ | |
| // | | // | |
| // Library: Foundation | | // Library: Foundation | |
| // Package: Core | | // Package: Core | |
| // Module: Exception | | // Module: Exception | |
| // | | // | |
| // Definition of various Poco exception classes. | | // Definition of various Poco exception 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 153 | | skipping to change at line 153 | |
| { | | { | |
| return _code; | | return _code; | |
| } | | } | |
| | | | |
| // | | // | |
| // Macros for quickly declaring and implementing exception classes. | | // Macros for quickly declaring and implementing exception classes. | |
| // Unfortunately, we cannot use a template here because character | | // Unfortunately, we cannot use a template here because character | |
| // pointers (which we need for specifying the exception name) | | // pointers (which we need for specifying the exception name) | |
| // are not allowed as template arguments. | | // are not allowed as template arguments. | |
| // | | // | |
|
| #define POCO_DECLARE_EXCEPTION(API, CLS, BASE) \ | | #define POCO_DECLARE_EXCEPTION_CODE(API, CLS, BASE, CODE) \ | |
| class API CLS: public BASE
\ | | class API CLS: public BASE
\ | |
| {
\ | | {
\ | |
| public:
\ | | public:
\ | |
|
| CLS(int code = 0); | | CLS(int code = CODE); | |
| | | \ | |
| \ | | CLS(const std::string& msg, int code = CODE); | |
| CLS(const std::string& msg, int code = 0); | | \ | |
| \ | | CLS(const std::string& msg, const std::string& arg, int code | |
| CLS(const std::string& msg, const std::string& arg, int code | | = CODE); \ | |
| = 0); \ | | CLS(const std::string& msg, const Poco::Exception& exc, int | |
| CLS(const std::string& msg, const Poco::Exception& exc, int | | code = CODE); \ | |
| code = 0); \ | | | |
| CLS(const CLS& exc);
\ | | CLS(const CLS& exc);
\ | |
| ~CLS() throw();
\ | | ~CLS() throw();
\ | |
| CLS& operator = (const CLS& exc);
\ | | CLS& operator = (const CLS& exc);
\ | |
| const char* name() const throw();
\ | | const char* name() const throw();
\ | |
| const char* className() const throw();
\ | | const char* className() const throw();
\ | |
| Poco::Exception* clone() const;
\ | | Poco::Exception* clone() const;
\ | |
| void rethrow() const;
\ | | void rethrow() const;
\ | |
| }; | | }; | |
| | | | |
|
| | | #define POCO_DECLARE_EXCEPTION(API, CLS, BASE) \ | |
| | | POCO_DECLARE_EXCEPTION_CODE(API, CLS, BASE, 0) | |
| | | | |
| #define POCO_IMPLEMENT_EXCEPTION(CLS, BASE, NAME)
\ | | #define POCO_IMPLEMENT_EXCEPTION(CLS, BASE, NAME)
\ | |
| CLS::CLS(int code): BASE(code)
\ | | CLS::CLS(int code): BASE(code)
\ | |
| {
\ | | {
\ | |
| }
\ | | }
\ | |
| CLS::CLS(const std::string& msg, int code): BASE(msg, code)
\ | | CLS::CLS(const std::string& msg, int code): BASE(msg, code)
\ | |
| {
\ | | {
\ | |
| }
\ | | }
\ | |
| CLS::CLS(const std::string& msg, const std::string& arg, int code):
BASE(msg, arg, code) \ | | CLS::CLS(const std::string& msg, const std::string& arg, int code):
BASE(msg, arg, code) \ | |
| {
\ | | {
\ | |
| }
\ | | }
\ | |
| | | | |
End of changes. 4 change blocks. |
| 11 lines changed or deleted | | 13 lines changed or added | |
|
| Expire.h | | Expire.h | |
| // | | // | |
| // Expire.h | | // Expire.h | |
| // | | // | |
|
| // $Id: //poco/1.4/Foundation/include/Poco/Expire.h#1 $ | | // $Id: //poco/1.4/Foundation/include/Poco/Expire.h#3 $ | |
| // | | // | |
| // Library: Foundation | | // Library: Foundation | |
| // Package: Events | | // Package: Events | |
| // Module: Expire | | // Module: Expire | |
| // | | // | |
| // Implementation of the Expire template. | | // Implementation of the Expire template. | |
| // | | // | |
|
| // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | | // Copyright (c) 2006-2011, 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 50 | | skipping to change at line 50 | |
| | | | |
| #include "Poco/Foundation.h" | | #include "Poco/Foundation.h" | |
| #include "Poco/AbstractDelegate.h" | | #include "Poco/AbstractDelegate.h" | |
| #include "Poco/Timestamp.h" | | #include "Poco/Timestamp.h" | |
| | | | |
| namespace Poco { | | namespace Poco { | |
| | | | |
| template <class TArgs> | | template <class TArgs> | |
| class Expire: public AbstractDelegate<TArgs> | | class Expire: public AbstractDelegate<TArgs> | |
| /// Decorator for AbstractDelegate adding automatic | | /// Decorator for AbstractDelegate adding automatic | |
|
| /// expiring of registrations to AbstractDelegates. | | /// expiration of registrations to AbstractDelegate's. | |
| { | | { | |
| public: | | public: | |
| Expire(const AbstractDelegate<TArgs>& p, Timestamp::TimeDiff expireM
illisecs): | | Expire(const AbstractDelegate<TArgs>& p, Timestamp::TimeDiff expireM
illisecs): | |
|
| AbstractDelegate<TArgs>(p), | | | |
| _pDelegate(p.clone()), | | _pDelegate(p.clone()), | |
| _expire(expireMillisecs*1000) | | _expire(expireMillisecs*1000) | |
| { | | { | |
| } | | } | |
| | | | |
| Expire(const Expire& expire): | | Expire(const Expire& expire): | |
| AbstractDelegate<TArgs>(expire), | | AbstractDelegate<TArgs>(expire), | |
| _pDelegate(expire._pDelegate->clone()), | | _pDelegate(expire._pDelegate->clone()), | |
| _expire(expire._expire), | | _expire(expire._expire), | |
| _creationTime(expire._creationTime) | | _creationTime(expire._creationTime) | |
| { | | { | |
| } | | } | |
| | | | |
| ~Expire() | | ~Expire() | |
| { | | { | |
|
| destroy(); | | delete _pDelegate; | |
| } | | } | |
| | | | |
| Expire& operator = (const Expire& expire) | | Expire& operator = (const Expire& expire) | |
| { | | { | |
| if (&expire != this) | | if (&expire != this) | |
| { | | { | |
| delete this->_pDelegate; | | delete this->_pDelegate; | |
| this->_pDelegate = expire._pDelegate->clone(); | | this->_pDelegate = expire._pDelegate->clone(); | |
| this->_expire = expire._expire; | | this->_expire = expire._expire; | |
| this->_creationTime = expire._creationTime; | | this->_creationTime = expire._creationTime; | |
| | | | |
| skipping to change at line 94 | | skipping to change at line 93 | |
| } | | } | |
| | | | |
| bool notify(const void* sender, TArgs& arguments) | | bool notify(const void* sender, TArgs& arguments) | |
| { | | { | |
| if (!expired()) | | if (!expired()) | |
| return this->_pDelegate->notify(sender, arguments); | | return this->_pDelegate->notify(sender, arguments); | |
| else | | else | |
| return false; | | return false; | |
| } | | } | |
| | | | |
|
| | | bool equals(const AbstractDelegate<TArgs>& other) const | |
| | | { | |
| | | return other.equals(*_pDelegate); | |
| | | } | |
| | | | |
| AbstractDelegate<TArgs>* clone() const | | AbstractDelegate<TArgs>* clone() const | |
| { | | { | |
| return new Expire(*this); | | return new Expire(*this); | |
| } | | } | |
| | | | |
|
| void destroy() | | void disable() | |
| { | | { | |
|
| delete this->_pDelegate; | | _pDelegate->disable(); | |
| this->_pDelegate = 0; | | | |
| } | | } | |
| | | | |
|
| const AbstractDelegate<TArgs>& getDelegate() const | | const AbstractDelegate<TArgs>* unwrap() const | |
| { | | { | |
|
| return *this->_pDelegate; | | return this->_pDelegate; | |
| } | | } | |
| | | | |
| protected: | | protected: | |
| bool expired() const | | bool expired() const | |
| { | | { | |
| return _creationTime.isElapsed(_expire); | | return _creationTime.isElapsed(_expire); | |
| } | | } | |
| | | | |
| AbstractDelegate<TArgs>* _pDelegate; | | AbstractDelegate<TArgs>* _pDelegate; | |
| Timestamp::TimeDiff _expire; | | Timestamp::TimeDiff _expire; | |
| | | | |
End of changes. 10 change blocks. |
| 10 lines changed or deleted | | 13 lines changed or added | |
|
| FIFOEvent.h | | FIFOEvent.h | |
| // | | // | |
| // FIFOEvent.h | | // FIFOEvent.h | |
| // | | // | |
|
| // $Id: //poco/1.4/Foundation/include/Poco/FIFOEvent.h#1 $ | | // $Id: //poco/1.4/Foundation/include/Poco/FIFOEvent.h#2 $ | |
| // | | // | |
| // Library: Foundation | | // Library: Foundation | |
| // Package: Events | | // Package: Events | |
| // Module: FIFOEvent | | // Module: FIFOEvent | |
| // | | // | |
| // Implementation of the FIFOEvent template. | | // Implementation of the FIFOEvent template. | |
| // | | // | |
|
| // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | | // Copyright (c) 2006-2011, 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 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_FIFOEvent_INCLUDED | | #ifndef Foundation_FIFOEvent_INCLUDED | |
| #define Foundation_FIFOEvent_INCLUDED | | #define Foundation_FIFOEvent_INCLUDED | |
| | | | |
| #include "Poco/AbstractEvent.h" | | #include "Poco/AbstractEvent.h" | |
| #include "Poco/FIFOStrategy.h" | | #include "Poco/FIFOStrategy.h" | |
| #include "Poco/AbstractDelegate.h" | | #include "Poco/AbstractDelegate.h" | |
|
| #include "Poco/CompareFunctions.h" | | | |
| | | | |
| namespace Poco { | | namespace Poco { | |
| | | | |
|
| | | //@ deprecated | |
| template <class TArgs, class TMutex = FastMutex> | | template <class TArgs, class TMutex = FastMutex> | |
| class FIFOEvent: public AbstractEvent < | | class FIFOEvent: public AbstractEvent < | |
| TArgs, | | TArgs, | |
|
| FIFOStrategy<TArgs, AbstractDelegate<TArgs>, p_less<AbstractDelegate
<TArgs> > >, | | FIFOStrategy<TArgs, AbstractDelegate<TArgs> >, | |
| AbstractDelegate<TArgs>, | | AbstractDelegate<TArgs>, | |
| TMutex | | TMutex | |
| > | | > | |
| /// A FIFOEvent uses internally a FIFOStrategy which guarantees | | /// A FIFOEvent uses internally a FIFOStrategy which guarantees | |
| /// that delegates are invoked in the order they were added to | | /// that delegates are invoked in the order they were added to | |
| /// the event. | | /// the event. | |
| /// | | /// | |
|
| /// Note that one object can only register one method to a FIFOEvent | | /// Note that as of release 1.4.2, this is the default behavior | |
| . | | /// implemented by BasicEvent, so this class is provided | |
| /// Subsequent registrations will overwrite the existing delegate. | | /// for backwards compatibility only. | |
| /// For example: | | | |
| /// FIFOEvent<int> tmp; | | | |
| /// MyClass myObject; | | | |
| /// tmp += delegate(&myObject, &MyClass::myMethod1); | | | |
| /// tmp += delegate(&myObject, &MyClass::myMethod2); | | | |
| /// | | | |
| /// The second registration will overwrite the first one. | | | |
| { | | { | |
| public: | | public: | |
| FIFOEvent() | | FIFOEvent() | |
| { | | { | |
| } | | } | |
| | | | |
| ~FIFOEvent() | | ~FIFOEvent() | |
| { | | { | |
| } | | } | |
| | | | |
| | | | |
End of changes. 6 change blocks. |
| 14 lines changed or deleted | | 7 lines changed or added | |
|
| FIFOStrategy.h | | FIFOStrategy.h | |
| // | | // | |
| // FIFOStrategy.h | | // FIFOStrategy.h | |
| // | | // | |
|
| // $Id: //poco/1.4/Foundation/include/Poco/FIFOStrategy.h#1 $ | | // $Id: //poco/1.4/Foundation/include/Poco/FIFOStrategy.h#3 $ | |
| // | | // | |
| // Library: Foundation | | // Library: Foundation | |
| // Package: Events | | // Package: Events | |
| // Module: FIFOStragegy | | // Module: FIFOStragegy | |
| // | | // | |
| // Implementation of the FIFOStrategy template. | | // Implementation of the FIFOStrategy template. | |
| // | | // | |
|
| // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | | // Copyright (c) 2006-2011, 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 | |
| // 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_FIFOStrategy_INCLUDED | | #ifndef Foundation_FIFOStrategy_INCLUDED | |
| #define Foundation_FIFOStrategy_INCLUDED | | #define Foundation_FIFOStrategy_INCLUDED | |
| | | | |
|
| #include "Poco/NotificationStrategy.h" | | #include "Poco/DefaultStrategy.h" | |
| #include <map> | | | |
| #include <list> | | | |
| #include <memory> | | | |
| | | | |
| namespace Poco { | | namespace Poco { | |
| | | | |
|
| template <class TArgs, class TDelegate, class TCompare> | | //@ deprecated | |
| class FIFOStrategy: public NotificationStrategy<TArgs, TDelegate> | | template <class TArgs, class TDelegate> | |
| | | class FIFOStrategy: public DefaultStrategy<TArgs, TDelegate> | |
| | | /// Note: As of release 1.4.2, DefaultStrategy already | |
| | | /// implements FIFO behavior, so this class is provided | |
| | | /// for backwards compatibility only. | |
| { | | { | |
| public: | | public: | |
|
| typedef std::list<TDelegate*> Delegates; | | | |
| typedef typename Delegates::iterator Iterator; | | | |
| typedef typename Delegates::const_iterator ConstIterator; | | | |
| typedef std::map<TDelegate*, Iterator, TCompare> DelegateIndex; | | | |
| typedef typename DelegateIndex::iterator IndexIterator; | | | |
| typedef typename DelegateIndex::const_iterator ConstIndexIterator; | | | |
| | | | |
| FIFOStrategy() | | FIFOStrategy() | |
| { | | { | |
| } | | } | |
| | | | |
|
| FIFOStrategy(const FIFOStrategy& s) | | FIFOStrategy(const FIFOStrategy& s): | |
| | | DefaultStrategy<TArgs, TDelegate>(s) | |
| { | | { | |
|
| operator = (s); | | | |
| } | | } | |
| | | | |
| ~FIFOStrategy() | | ~FIFOStrategy() | |
| { | | { | |
|
| clear(); | | | |
| } | | | |
| | | | |
| void notify(const void* sender, TArgs& arguments) | | | |
| { | | | |
| std::vector<Iterator> delMe; | | | |
| Iterator it = _observers.begin(); | | | |
| Iterator itEnd = _observers.end(); | | | |
| | | | |
| for (; it != itEnd; ++it) | | | |
| { | | | |
| if (!(*it)->notify(sender, arguments)) | | | |
| { | | | |
| // schedule for deletion | | | |
| delMe.push_back(it); | | | |
| } | | | |
| } | | | |
| | | | |
| while (!delMe.empty()) | | | |
| { | | | |
| typename std::vector<Iterator>::iterator vit = delMe | | | |
| .end(); | | | |
| --vit; | | | |
| delete **vit; | | | |
| _observers.erase(*vit); | | | |
| delMe.pop_back(); | | | |
| } | | | |
| } | | | |
| | | | |
| void add(const TDelegate& delegate) | | | |
| { | | | |
| IndexIterator it = _observerIndex.find(const_cast<TDelegate* | | | |
| >(&delegate)); | | | |
| if (it != _observerIndex.end()) | | | |
| { | | | |
| delete *it->second; | | | |
| _observers.erase(it->second); | | | |
| _observerIndex.erase(it); | | | |
| } | | | |
| std::auto_ptr<TDelegate> pDelegate(delegate.clone()); | | | |
| _observers.push_back(pDelegate.get()); | | | |
| bool tmp = _observerIndex.insert(std::make_pair(pDelegate.ge | | | |
| t(), --_observers.end())).second; | | | |
| poco_assert (tmp); | | | |
| pDelegate.release(); | | | |
| } | | | |
| | | | |
| void remove(const TDelegate& delegate) | | | |
| { | | | |
| IndexIterator it = _observerIndex.find(const_cast<TDelegate* | | | |
| >(&delegate)); | | | |
| | | | |
| if (it != _observerIndex.end()) | | | |
| { | | | |
| delete *it->second; | | | |
| _observers.erase(it->second); | | | |
| _observerIndex.erase(it); | | | |
| } | | | |
| } | | } | |
| | | | |
| FIFOStrategy& operator = (const FIFOStrategy& s) | | FIFOStrategy& operator = (const FIFOStrategy& s) | |
| { | | { | |
|
| if (this != &s) | | DefaultStrategy<TArgs, TDelegate>::operator = (s); | |
| { | | | |
| for (ConstIterator it = s._observers.begin(); it != | | | |
| s._observers.end(); ++it) | | | |
| { | | | |
| add(**it); | | | |
| } | | | |
| } | | | |
| return *this; | | return *this; | |
| } | | } | |
|
| | | | |
| void clear() | | | |
| { | | | |
| for (Iterator it = _observers.begin(); it != _observers.end( | | | |
| ); ++it) | | | |
| { | | | |
| delete *it; | | | |
| } | | | |
| | | | |
| _observers.clear(); | | | |
| _observerIndex.clear(); | | | |
| } | | | |
| | | | |
| bool empty() const | | | |
| { | | | |
| return _observers.empty(); | | | |
| } | | | |
| | | | |
| protected: | | | |
| Delegates _observers; /// Stores the delegates in the order | | | |
| they were added. | | | |
| DelegateIndex _observerIndex; /// For faster lookup when add/remove | | | |
| is used. | | | |
| }; | | }; | |
| | | | |
| } // namespace Poco | | } // namespace Poco | |
| | | | |
| #endif // Foundation_FIFOStrategy_INCLUDED | | #endif // Foundation_FIFOStrategy_INCLUDED | |
| | | | |
End of changes. 10 change blocks. |
| 106 lines changed or deleted | | 12 lines changed or added | |
|
| File.h | | File.h | |
| // | | // | |
| // File.h | | // File.h | |
| // | | // | |
|
| // $Id: //poco/1.4/Foundation/include/Poco/File.h#2 $ | | // $Id: //poco/1.4/Foundation/include/Poco/File.h#3 $ | |
| // | | // | |
| // Library: Foundation | | // Library: Foundation | |
| // Package: Filesystem | | // Package: Filesystem | |
| // Module: File | | // Module: File | |
| // | | // | |
| // Definition of the File class. | | // Definition of the File 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 | |
| /// | | /// | |
| /// Not all platforms or filesystems (e.g. Linux and most Un
ix | | /// Not all platforms or filesystems (e.g. Linux and most Un
ix | |
| /// platforms with the exception of FreeBSD and Mac OS X) | | /// platforms with the exception of FreeBSD and Mac OS X) | |
| /// maintain the creation date of a file. | | /// maintain the creation date of a file. | |
| /// On such platforms, created() returns | | /// On such platforms, created() returns | |
| /// the time of the last inode modification. | | /// the time of the last inode modification. | |
| | | | |
| Timestamp getLastModified() const; | | Timestamp getLastModified() const; | |
| /// Returns the modification date of the file. | | /// Returns the modification date of the file. | |
| | | | |
|
| void setLastModified(const Timestamp& ts); | | File& setLastModified(const Timestamp& ts); | |
| /// Sets the modification date of the file. | | /// Sets the modification date of the file. | |
| | | | |
| FileSize getSize() const; | | FileSize getSize() const; | |
| /// Returns the size of the file in bytes. | | /// Returns the size of the file in bytes. | |
| | | | |
|
| void setSize(FileSize size); | | File& setSize(FileSize size); | |
| /// Sets the size of the file in bytes. Can be used | | /// Sets the size of the file in bytes. Can be used | |
| /// to truncate a file. | | /// to truncate a file. | |
| | | | |
|
| void setWriteable(bool flag = true); | | File& setWriteable(bool flag = true); | |
| /// Makes the file writeable (if flag is true), or | | /// Makes the file writeable (if flag is true), or | |
| /// non-writeable (if flag is false) by setting the | | /// non-writeable (if flag is false) by setting the | |
| /// file's flags in the filesystem accordingly. | | /// file's flags in the filesystem accordingly. | |
| | | | |
|
| void setReadOnly(bool flag = true); | | File& setReadOnly(bool flag = true); | |
| /// Makes the file non-writeable (if flag is true), or | | /// Makes the file non-writeable (if flag is true), or | |
| /// writeable (if flag is false) by setting the | | /// writeable (if flag is false) by setting the | |
| /// file's flags in the filesystem accordingly. | | /// file's flags in the filesystem accordingly. | |
| | | | |
|
| void setExecutable(bool flag = true); | | File& setExecutable(bool flag = true); | |
| /// Makes the file executable (if flag is true), or | | /// Makes the file executable (if flag is true), or | |
| /// non-executable (if flag is false) by setting | | /// non-executable (if flag is false) by setting | |
| /// the file's permission bits accordingly. | | /// the file's permission bits accordingly. | |
| /// | | /// | |
| /// Does nothing on Windows and OpenVMS. | | /// Does nothing on Windows and OpenVMS. | |
| | | | |
| void copyTo(const std::string& path) const; | | void copyTo(const std::string& path) const; | |
| /// Copies the file (or directory) to the given path. | | /// Copies the file (or directory) to the given path. | |
| /// The target path can be a directory. | | /// The target path can be a directory. | |
| /// | | /// | |
| | | | |
End of changes. 6 change blocks. |
| 6 lines changed or deleted | | 6 lines changed or added | |
|
| FunctionDelegate.h | | FunctionDelegate.h | |
| // | | // | |
| // FunctionDelegate.h | | // FunctionDelegate.h | |
| // | | // | |
|
| // $Id: //poco/1.4/Foundation/include/Poco/FunctionDelegate.h#1 $ | | // $Id: //poco/1.4/Foundation/include/Poco/FunctionDelegate.h#4 $ | |
| // | | // | |
| // Library: Foundation | | // Library: Foundation | |
| // Package: Events | | // Package: Events | |
| // Module: FunctionDelegate | | // Module: FunctionDelegate | |
| // | | // | |
| // Implementation of the FunctionDelegate template. | | // Implementation of the FunctionDelegate template. | |
| // | | // | |
|
| // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | | // Copyright (c) 2006-2011, 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 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_FunctionDelegate_INCLUDED | | #ifndef Foundation_FunctionDelegate_INCLUDED | |
| #define Foundation_FunctionDelegate_INCLUDED | | #define Foundation_FunctionDelegate_INCLUDED | |
| | | | |
| #include "Poco/Foundation.h" | | #include "Poco/Foundation.h" | |
| #include "Poco/AbstractDelegate.h" | | #include "Poco/AbstractDelegate.h" | |
|
| | | #include "Poco/Mutex.h" | |
| | | | |
| namespace Poco { | | namespace Poco { | |
| | | | |
| template <class TArgs, bool hasSender = true, bool senderIsConst = true> | | template <class TArgs, bool hasSender = true, bool senderIsConst = true> | |
| class FunctionDelegate: public AbstractDelegate<TArgs> | | class FunctionDelegate: public AbstractDelegate<TArgs> | |
|
| /// Wraps a C style function (or a C++ static function) to be used a | | /// Wraps a freestanding function or static member function | |
| s | | /// for use as a Delegate. | |
| /// a delegate | | | |
| { | | { | |
| public: | | public: | |
| typedef void (*NotifyMethod)(const void*, TArgs&); | | typedef void (*NotifyMethod)(const void*, TArgs&); | |
| | | | |
| FunctionDelegate(NotifyMethod method): | | FunctionDelegate(NotifyMethod method): | |
|
| AbstractDelegate<TArgs>(*reinterpret_cast<void**>(&method)), | | | |
| _receiverMethod(method) | | _receiverMethod(method) | |
| { | | { | |
| } | | } | |
| | | | |
| FunctionDelegate(const FunctionDelegate& delegate): | | FunctionDelegate(const FunctionDelegate& delegate): | |
| AbstractDelegate<TArgs>(delegate), | | AbstractDelegate<TArgs>(delegate), | |
| _receiverMethod(delegate._receiverMethod) | | _receiverMethod(delegate._receiverMethod) | |
| { | | { | |
| } | | } | |
| | | | |
| | | | |
| skipping to change at line 82 | | skipping to change at line 82 | |
| if (&delegate != this) | | if (&delegate != this) | |
| { | | { | |
| this->_pTarget = delegate._pTarget; | | this->_pTarget = delegate._pTarget; | |
| this->_receiverMethod = delegate._receiverMethod; | | this->_receiverMethod = delegate._receiverMethod; | |
| } | | } | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| bool notify(const void* sender, TArgs& arguments) | | bool notify(const void* sender, TArgs& arguments) | |
| { | | { | |
|
| (*_receiverMethod)(sender, arguments); | | Mutex::ScopedLock lock(_mutex); | |
| return true; // a "standard" delegate never expires | | if (_receiverMethod) | |
| | | { | |
| | | (*_receiverMethod)(sender, arguments); | |
| | | return true; | |
| | | } | |
| | | else return false; | |
| | | } | |
| | | | |
| | | bool equals(const AbstractDelegate<TArgs>& other) const | |
| | | { | |
| | | const FunctionDelegate* pOtherDelegate = dynamic_cast<const | |
| | | FunctionDelegate*>(other.unwrap()); | |
| | | return pOtherDelegate && _receiverMethod == pOtherDelegate-> | |
| | | _receiverMethod; | |
| } | | } | |
| | | | |
| AbstractDelegate<TArgs>* clone() const | | AbstractDelegate<TArgs>* clone() const | |
| { | | { | |
| return new FunctionDelegate(*this); | | return new FunctionDelegate(*this); | |
| } | | } | |
| | | | |
|
| | | void disable() | |
| | | { | |
| | | Mutex::ScopedLock lock(_mutex); | |
| | | _receiverMethod = 0; | |
| | | } | |
| | | | |
| protected: | | protected: | |
| NotifyMethod _receiverMethod; | | NotifyMethod _receiverMethod; | |
|
| | | Mutex _mutex; | |
| | | | |
| private: | | private: | |
| FunctionDelegate(); | | FunctionDelegate(); | |
| }; | | }; | |
| | | | |
| template <class TArgs> | | template <class TArgs> | |
| class FunctionDelegate<TArgs, true, false>: public AbstractDelegate<TArgs> | | class FunctionDelegate<TArgs, true, false>: public AbstractDelegate<TArgs> | |
| { | | { | |
| public: | | public: | |
| typedef void (*NotifyMethod)(void*, TArgs&); | | typedef void (*NotifyMethod)(void*, TArgs&); | |
| | | | |
| FunctionDelegate(NotifyMethod method): | | FunctionDelegate(NotifyMethod method): | |
|
| AbstractDelegate<TArgs>(*reinterpret_cast<void**>(&method)), | | | |
| _receiverMethod(method) | | _receiverMethod(method) | |
| { | | { | |
| } | | } | |
| | | | |
| FunctionDelegate(const FunctionDelegate& delegate): | | FunctionDelegate(const FunctionDelegate& delegate): | |
| AbstractDelegate<TArgs>(delegate), | | AbstractDelegate<TArgs>(delegate), | |
| _receiverMethod(delegate._receiverMethod) | | _receiverMethod(delegate._receiverMethod) | |
| { | | { | |
| } | | } | |
| | | | |
| | | | |
| skipping to change at line 132 | | skipping to change at line 149 | |
| if (&delegate != this) | | if (&delegate != this) | |
| { | | { | |
| this->_pTarget = delegate._pTarget; | | this->_pTarget = delegate._pTarget; | |
| this->_receiverMethod = delegate._receiverMethod; | | this->_receiverMethod = delegate._receiverMethod; | |
| } | | } | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| bool notify(const void* sender, TArgs& arguments) | | bool notify(const void* sender, TArgs& arguments) | |
| { | | { | |
|
| (*_receiverMethod)(const_cast<void*>(sender), arguments); | | Mutex::ScopedLock lock(_mutex); | |
| return true; // a "standard" delegate never expires | | if (_receiverMethod) | |
| | | { | |
| | | (*_receiverMethod)(const_cast<void*>(sender), argume | |
| | | nts); | |
| | | return true; | |
| | | } | |
| | | else return false; | |
| | | } | |
| | | | |
| | | bool equals(const AbstractDelegate<TArgs>& other) const | |
| | | { | |
| | | const FunctionDelegate* pOtherDelegate = dynamic_cast<const | |
| | | FunctionDelegate*>(other.unwrap()); | |
| | | return pOtherDelegate && _receiverMethod == pOtherDelegate-> | |
| | | _receiverMethod; | |
| } | | } | |
| | | | |
| AbstractDelegate<TArgs>* clone() const | | AbstractDelegate<TArgs>* clone() const | |
| { | | { | |
| return new FunctionDelegate(*this); | | return new FunctionDelegate(*this); | |
| } | | } | |
| | | | |
|
| | | void disable() | |
| | | { | |
| | | Mutex::ScopedLock lock(_mutex); | |
| | | _receiverMethod = 0; | |
| | | } | |
| | | | |
| protected: | | protected: | |
| NotifyMethod _receiverMethod; | | NotifyMethod _receiverMethod; | |
|
| | | Mutex _mutex; | |
| | | | |
| private: | | private: | |
| FunctionDelegate(); | | FunctionDelegate(); | |
| }; | | }; | |
| | | | |
| template <class TArgs, bool senderIsConst> | | template <class TArgs, bool senderIsConst> | |
| class FunctionDelegate<TArgs, false, senderIsConst>: public AbstractDelegat
e<TArgs> | | class FunctionDelegate<TArgs, false, senderIsConst>: public AbstractDelegat
e<TArgs> | |
| { | | { | |
| public: | | public: | |
| typedef void (*NotifyMethod)(TArgs&); | | typedef void (*NotifyMethod)(TArgs&); | |
| | | | |
| FunctionDelegate(NotifyMethod method): | | FunctionDelegate(NotifyMethod method): | |
|
| AbstractDelegate<TArgs>(*reinterpret_cast<void**>(&method)), | | | |
| _receiverMethod(method) | | _receiverMethod(method) | |
| { | | { | |
| } | | } | |
| | | | |
| FunctionDelegate(const FunctionDelegate& delegate): | | FunctionDelegate(const FunctionDelegate& delegate): | |
| AbstractDelegate<TArgs>(delegate), | | AbstractDelegate<TArgs>(delegate), | |
| _receiverMethod(delegate._receiverMethod) | | _receiverMethod(delegate._receiverMethod) | |
| { | | { | |
| } | | } | |
| | | | |
| | | | |
| skipping to change at line 182 | | skipping to change at line 216 | |
| if (&delegate != this) | | if (&delegate != this) | |
| { | | { | |
| this->_pTarget = delegate._pTarget; | | this->_pTarget = delegate._pTarget; | |
| this->_receiverMethod = delegate._receiverMethod; | | this->_receiverMethod = delegate._receiverMethod; | |
| } | | } | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| bool notify(const void* sender, TArgs& arguments) | | bool notify(const void* sender, TArgs& arguments) | |
| { | | { | |
|
| (*_receiverMethod)(arguments); | | Mutex::ScopedLock lock(_mutex); | |
| return true; // a "standard" delegate never expires | | if (_receiverMethod) | |
| | | { | |
| | | (*_receiverMethod)(arguments); | |
| | | return true; | |
| | | } | |
| | | else return false; | |
| | | } | |
| | | | |
| | | bool equals(const AbstractDelegate<TArgs>& other) const | |
| | | { | |
| | | const FunctionDelegate* pOtherDelegate = dynamic_cast<const | |
| | | FunctionDelegate*>(other.unwrap()); | |
| | | return pOtherDelegate && _receiverMethod == pOtherDelegate-> | |
| | | _receiverMethod; | |
| } | | } | |
| | | | |
| AbstractDelegate<TArgs>* clone() const | | AbstractDelegate<TArgs>* clone() const | |
| { | | { | |
| return new FunctionDelegate(*this); | | return new FunctionDelegate(*this); | |
| } | | } | |
| | | | |
|
| | | void disable() | |
| | | { | |
| | | Mutex::ScopedLock lock(_mutex); | |
| | | _receiverMethod = 0; | |
| | | } | |
| | | | |
| protected: | | protected: | |
| NotifyMethod _receiverMethod; | | NotifyMethod _receiverMethod; | |
|
| | | Mutex _mutex; | |
| | | | |
| private: | | private: | |
| FunctionDelegate(); | | FunctionDelegate(); | |
| }; | | }; | |
| | | | |
| } // namespace Poco | | } // namespace Poco | |
| | | | |
| #endif // Foundation_FunctionDelegate_INCLUDED | | #endif // Foundation_FunctionDelegate_INCLUDED | |
| | | | |
End of changes. 16 change blocks. |
| 14 lines changed or deleted | | 72 lines changed or added | |
|
| FunctionPriorityDelegate.h | | FunctionPriorityDelegate.h | |
| // | | // | |
| // FunctionPriorityDelegate.h | | // FunctionPriorityDelegate.h | |
| // | | // | |
|
| // $Id: //poco/1.4/Foundation/include/Poco/FunctionPriorityDelegate.h#1 $ | | // $Id: //poco/1.4/Foundation/include/Poco/FunctionPriorityDelegate.h#5 $ | |
| // | | // | |
| // Library: Foundation | | // Library: Foundation | |
| // Package: Events | | // Package: Events | |
| // Module: FunctionPriorityDelegate | | // Module: FunctionPriorityDelegate | |
| // | | // | |
| // Implementation of the FunctionPriorityDelegate template. | | // Implementation of the FunctionPriorityDelegate template. | |
| // | | // | |
|
| // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | | // Copyright (c) 2006-2011, 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 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_FunctionPriorityDelegate_INCLUDED | | #ifndef Foundation_FunctionPriorityDelegate_INCLUDED | |
| #define Foundation_FunctionPriorityDelegate_INCLUDED | | #define Foundation_FunctionPriorityDelegate_INCLUDED | |
| | | | |
| #include "Poco/Foundation.h" | | #include "Poco/Foundation.h" | |
| #include "Poco/AbstractPriorityDelegate.h" | | #include "Poco/AbstractPriorityDelegate.h" | |
|
| | | #include "Poco/Mutex.h" | |
| | | | |
| namespace Poco { | | namespace Poco { | |
| | | | |
| template <class TArgs, bool useSender = true, bool senderIsConst = true> | | template <class TArgs, bool useSender = true, bool senderIsConst = true> | |
| class FunctionPriorityDelegate: public AbstractPriorityDelegate<TArgs> | | class FunctionPriorityDelegate: public AbstractPriorityDelegate<TArgs> | |
|
| /// Wraps a C style function (or a C++ static fucntion) to be used a | | /// Wraps a freestanding function or static member function | |
| s | | /// for use as a PriorityDelegate. | |
| /// a priority delegate | | | |
| { | | { | |
| public: | | public: | |
| typedef void (*NotifyMethod)(const void*, TArgs&); | | typedef void (*NotifyMethod)(const void*, TArgs&); | |
| | | | |
| FunctionPriorityDelegate(NotifyMethod method, int prio): | | FunctionPriorityDelegate(NotifyMethod method, int prio): | |
|
| AbstractPriorityDelegate<TArgs>(*reinterpret_cast<void**>(&m
ethod), prio), | | AbstractPriorityDelegate<TArgs>(prio), | |
| _receiverMethod(method) | | _receiverMethod(method) | |
| { | | { | |
| } | | } | |
| | | | |
| FunctionPriorityDelegate(const FunctionPriorityDelegate& delegate): | | FunctionPriorityDelegate(const FunctionPriorityDelegate& delegate): | |
|
| AbstractPriorityDelegate<TArgs>(delegate._pTarget, delegate.
_priority), | | AbstractPriorityDelegate<TArgs>(delegate), | |
| _receiverMethod(delegate._receiverMethod) | | _receiverMethod(delegate._receiverMethod) | |
| { | | { | |
| } | | } | |
| | | | |
| FunctionPriorityDelegate& operator = (const FunctionPriorityDelegate
& delegate) | | FunctionPriorityDelegate& operator = (const FunctionPriorityDelegate
& delegate) | |
| { | | { | |
| if (&delegate != this) | | if (&delegate != this) | |
| { | | { | |
| this->_pTarget = delegate._pTarget; | | this->_pTarget = delegate._pTarget; | |
| this->_receiverMethod = delegate._receiverMethod; | | this->_receiverMethod = delegate._receiverMethod; | |
| | | | |
| skipping to change at line 83 | | skipping to change at line 84 | |
| } | | } | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| ~FunctionPriorityDelegate() | | ~FunctionPriorityDelegate() | |
| { | | { | |
| } | | } | |
| | | | |
| bool notify(const void* sender, TArgs& arguments) | | bool notify(const void* sender, TArgs& arguments) | |
| { | | { | |
|
| (*_receiverMethod)(sender, arguments); | | Mutex::ScopedLock lock(_mutex); | |
| return true; // per default the delegate never expires | | if (_receiverMethod) | |
| | | { | |
| | | (*_receiverMethod)(sender, arguments); | |
| | | return true; | |
| | | } | |
| | | else return false; | |
| } | | } | |
| | | | |
|
| AbstractPriorityDelegate<TArgs>* clone() const | | bool equals(const AbstractDelegate<TArgs>& other) const | |
| | | { | |
| | | const FunctionPriorityDelegate* pOtherDelegate = dynamic_cas | |
| | | t<const FunctionPriorityDelegate*>(other.unwrap()); | |
| | | return pOtherDelegate && this->priority() == pOtherDelegate- | |
| | | >priority() && _receiverMethod == pOtherDelegate->_receiverMethod; | |
| | | } | |
| | | | |
| | | AbstractDelegate<TArgs>* clone() const | |
| { | | { | |
| return new FunctionPriorityDelegate(*this); | | return new FunctionPriorityDelegate(*this); | |
| } | | } | |
| | | | |
|
| | | void disable() | |
| | | { | |
| | | Mutex::ScopedLock lock(_mutex); | |
| | | _receiverMethod = 0; | |
| | | } | |
| | | | |
| protected: | | protected: | |
| NotifyMethod _receiverMethod; | | NotifyMethod _receiverMethod; | |
|
| | | Mutex _mutex; | |
| | | | |
| private: | | private: | |
| FunctionPriorityDelegate(); | | FunctionPriorityDelegate(); | |
| }; | | }; | |
| | | | |
| template <class TArgs> | | template <class TArgs> | |
| class FunctionPriorityDelegate<TArgs, true, false>: public AbstractPriority
Delegate<TArgs> | | class FunctionPriorityDelegate<TArgs, true, false>: public AbstractPriority
Delegate<TArgs> | |
| { | | { | |
| public: | | public: | |
| typedef void (*NotifyMethod)(void*, TArgs&); | | typedef void (*NotifyMethod)(void*, TArgs&); | |
| | | | |
| FunctionPriorityDelegate(NotifyMethod method, int prio): | | FunctionPriorityDelegate(NotifyMethod method, int prio): | |
|
| AbstractPriorityDelegate<TArgs>(*reinterpret_cast<void**>(&m
ethod), prio), | | AbstractPriorityDelegate<TArgs>(prio), | |
| _receiverMethod(method) | | _receiverMethod(method) | |
| { | | { | |
| } | | } | |
| | | | |
| FunctionPriorityDelegate(const FunctionPriorityDelegate& delegate): | | FunctionPriorityDelegate(const FunctionPriorityDelegate& delegate): | |
|
| AbstractPriorityDelegate<TArgs>(delegate._pTarget, delegate.
_priority), | | AbstractPriorityDelegate<TArgs>(delegate), | |
| _receiverMethod(delegate._receiverMethod) | | _receiverMethod(delegate._receiverMethod) | |
| { | | { | |
| } | | } | |
| | | | |
| FunctionPriorityDelegate& operator = (const FunctionPriorityDelegate
& delegate) | | FunctionPriorityDelegate& operator = (const FunctionPriorityDelegate
& delegate) | |
| { | | { | |
| if (&delegate != this) | | if (&delegate != this) | |
| { | | { | |
| this->_pTarget = delegate._pTarget; | | this->_pTarget = delegate._pTarget; | |
| this->_receiverMethod = delegate._receiverMethod; | | this->_receiverMethod = delegate._receiverMethod; | |
| | | | |
| skipping to change at line 134 | | skipping to change at line 153 | |
| } | | } | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| ~FunctionPriorityDelegate() | | ~FunctionPriorityDelegate() | |
| { | | { | |
| } | | } | |
| | | | |
| bool notify(const void* sender, TArgs& arguments) | | bool notify(const void* sender, TArgs& arguments) | |
| { | | { | |
|
| (*_receiverMethod)(const_cast<void*>(sender), arguments); | | Mutex::ScopedLock lock(_mutex); | |
| return true; // per default the delegate never expires | | if (_receiverMethod) | |
| | | { | |
| | | (*_receiverMethod)(const_cast<void*>(sender), argume | |
| | | nts); | |
| | | return true; | |
| | | } | |
| | | else return false; | |
| } | | } | |
| | | | |
|
| AbstractPriorityDelegate<TArgs>* clone() const | | bool equals(const AbstractDelegate<TArgs>& other) const | |
| | | { | |
| | | const FunctionPriorityDelegate* pOtherDelegate = dynamic_cas | |
| | | t<const FunctionPriorityDelegate*>(other.unwrap()); | |
| | | return pOtherDelegate && this->priority() == pOtherDelegate- | |
| | | >priority() && _receiverMethod == pOtherDelegate->_receiverMethod; | |
| | | } | |
| | | | |
| | | AbstractDelegate<TArgs>* clone() const | |
| { | | { | |
| return new FunctionPriorityDelegate(*this); | | return new FunctionPriorityDelegate(*this); | |
| } | | } | |
| | | | |
|
| | | void disable() | |
| | | { | |
| | | Mutex::ScopedLock lock(_mutex); | |
| | | _receiverMethod = 0; | |
| | | } | |
| | | | |
| protected: | | protected: | |
| NotifyMethod _receiverMethod; | | NotifyMethod _receiverMethod; | |
|
| | | Mutex _mutex; | |
| | | | |
| private: | | private: | |
| FunctionPriorityDelegate(); | | FunctionPriorityDelegate(); | |
| }; | | }; | |
| | | | |
| template <class TArgs> | | template <class TArgs> | |
| class FunctionPriorityDelegate<TArgs, false>: public AbstractPriorityDelega
te<TArgs> | | class FunctionPriorityDelegate<TArgs, false>: public AbstractPriorityDelega
te<TArgs> | |
| { | | { | |
| public: | | public: | |
| typedef void (*NotifyMethod)(TArgs&); | | typedef void (*NotifyMethod)(TArgs&); | |
| | | | |
| FunctionPriorityDelegate(NotifyMethod method, int prio): | | FunctionPriorityDelegate(NotifyMethod method, int prio): | |
|
| AbstractPriorityDelegate<TArgs>(*reinterpret_cast<void**>(&m
ethod), prio), | | AbstractPriorityDelegate<TArgs>(prio), | |
| _receiverMethod(method) | | _receiverMethod(method) | |
| { | | { | |
| } | | } | |
| | | | |
| FunctionPriorityDelegate(const FunctionPriorityDelegate& delegate): | | FunctionPriorityDelegate(const FunctionPriorityDelegate& delegate): | |
|
| AbstractPriorityDelegate<TArgs>(delegate._pTarget, delegate.
_priority), | | AbstractPriorityDelegate<TArgs>(delegate), | |
| _receiverMethod(delegate._receiverMethod) | | _receiverMethod(delegate._receiverMethod) | |
| { | | { | |
| } | | } | |
| | | | |
| FunctionPriorityDelegate& operator = (const FunctionPriorityDelegate
& delegate) | | FunctionPriorityDelegate& operator = (const FunctionPriorityDelegate
& delegate) | |
| { | | { | |
| if (&delegate != this) | | if (&delegate != this) | |
| { | | { | |
| this->_pTarget = delegate._pTarget; | | this->_pTarget = delegate._pTarget; | |
| this->_receiverMethod = delegate._receiverMethod; | | this->_receiverMethod = delegate._receiverMethod; | |
| | | | |
| skipping to change at line 185 | | skipping to change at line 222 | |
| } | | } | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| ~FunctionPriorityDelegate() | | ~FunctionPriorityDelegate() | |
| { | | { | |
| } | | } | |
| | | | |
| bool notify(const void* sender, TArgs& arguments) | | bool notify(const void* sender, TArgs& arguments) | |
| { | | { | |
|
| (*_receiverMethod)(arguments); | | Mutex::ScopedLock lock(_mutex); | |
| return true; // per default the delegate never expires | | if (_receiverMethod) | |
| | | { | |
| | | (*_receiverMethod)(arguments); | |
| | | return true; | |
| | | } | |
| | | else return false; | |
| } | | } | |
| | | | |
|
| AbstractPriorityDelegate<TArgs>* clone() const | | bool equals(const AbstractDelegate<TArgs>& other) const | |
| | | { | |
| | | const FunctionPriorityDelegate* pOtherDelegate = dynamic_cas | |
| | | t<const FunctionPriorityDelegate*>(other.unwrap()); | |
| | | return pOtherDelegate && this->priority() == pOtherDelegate- | |
| | | >priority() && _receiverMethod == pOtherDelegate->_receiverMethod; | |
| | | } | |
| | | | |
| | | AbstractDelegate<TArgs>* clone() const | |
| { | | { | |
| return new FunctionPriorityDelegate(*this); | | return new FunctionPriorityDelegate(*this); | |
| } | | } | |
| | | | |
|
| | | void disable() | |
| | | { | |
| | | Mutex::ScopedLock lock(_mutex); | |
| | | _receiverMethod = 0; | |
| | | } | |
| | | | |
| protected: | | protected: | |
| NotifyMethod _receiverMethod; | | NotifyMethod _receiverMethod; | |
|
| | | Mutex _mutex; | |
| | | | |
| private: | | private: | |
| FunctionPriorityDelegate(); | | FunctionPriorityDelegate(); | |
| }; | | }; | |
| | | | |
| } // namespace Poco | | } // namespace Poco | |
| | | | |
| #endif // Foundation_FunctionPriorityDelegate_INCLUDED | | #endif // Foundation_FunctionPriorityDelegate_INCLUDED | |
| | | | |
End of changes. 22 change blocks. |
| 20 lines changed or deleted | | 81 lines changed or added | |
|
| HTTPMessage.h | | HTTPMessage.h | |
| // | | // | |
| // HTTPMessage.h | | // HTTPMessage.h | |
| // | | // | |
|
| // $Id: //poco/1.4/Net/include/Poco/Net/HTTPMessage.h#1 $ | | // $Id: //poco/1.4/Net/include/Poco/Net/HTTPMessage.h#2 $ | |
| // | | // | |
| // 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. | |
| // | | // | |
| | | | |
| skipping to change at line 63 | | skipping to change at line 63 | |
| /// These are version, content length, content type | | /// These are version, content length, content type | |
| /// and transfer encoding. | | /// and transfer encoding. | |
| { | | { | |
| public: | | public: | |
| void setVersion(const std::string& version); | | void setVersion(const std::string& version); | |
| /// Sets the HTTP version for this message. | | /// Sets the HTTP version for this message. | |
| | | | |
| const std::string& getVersion() const; | | const std::string& getVersion() const; | |
| /// Returns the HTTP version for this message. | | /// Returns the HTTP version for this message. | |
| | | | |
|
| void setContentLength(int length); | | void setContentLength(std::streamsize length); | |
| /// Sets the Content-Length header. | | /// Sets the Content-Length header. | |
| /// | | /// | |
| /// If length is UNKNOWN_CONTENT_LENGTH, removes | | /// If length is UNKNOWN_CONTENT_LENGTH, removes | |
| /// the Content-Length header. | | /// the Content-Length header. | |
| | | | |
|
| int getContentLength() const; | | std::streamsize getContentLength() const; | |
| /// Returns the content length for this message, | | /// Returns the content length for this message, | |
| /// which may be UNKNOWN_CONTENT_LENGTH if | | /// which may be UNKNOWN_CONTENT_LENGTH if | |
| /// no Content-Length header is present. | | /// no Content-Length header is present. | |
| | | | |
| void setTransferEncoding(const std::string& transferEncoding); | | void setTransferEncoding(const std::string& transferEncoding); | |
| /// Sets the transfer encoding for this message. | | /// Sets the transfer encoding for this message. | |
| /// | | /// | |
| /// The value should be either IDENTITY_TRANSFER_CODING | | /// The value should be either IDENTITY_TRANSFER_CODING | |
| /// or CHUNKED_TRANSFER_CODING. | | /// or CHUNKED_TRANSFER_CODING. | |
| | | | |
| | | | |
End of changes. 3 change blocks. |
| 3 lines changed or deleted | | 3 lines changed or added | |
|
| IPAddress.h | | IPAddress.h | |
| // | | // | |
| // IPAddress.h | | // IPAddress.h | |
| // | | // | |
|
| // $Id: //poco/1.4/Net/include/Poco/Net/IPAddress.h#1 $ | | // $Id: //poco/1.4/Net/include/Poco/Net/IPAddress.h#2 $ | |
| // | | // | |
| // Library: Net | | // Library: Net | |
| // Package: NetCore | | // Package: NetCore | |
| // Module: IPAddress | | // Module: IPAddress | |
| // | | // | |
| // Definition of the IPAddress class. | | // Definition of the IPAddress class. | |
| // | | // | |
|
| // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | | // Copyright (c) 2005-2011, 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 107 | | skipping to change at line 107 | |
| IPAddress(const std::string& addr, Family family); | | IPAddress(const std::string& addr, Family family); | |
| /// Creates an IPAddress from the string containing | | /// Creates an IPAddress from the string containing | |
| /// an IP address in presentation format (dotted decimal | | /// an IP address in presentation format (dotted decimal | |
| /// for IPv4, hex string for IPv6). | | /// for IPv4, hex string for IPv6). | |
| | | | |
| IPAddress(const void* addr, poco_socklen_t length); | | IPAddress(const void* addr, poco_socklen_t length); | |
| /// 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. | | /// passed. | |
| | | | |
|
| | | IPAddress(const void* addr, poco_socklen_t length, Poco::UInt32 scop | |
| | | e); | |
| | | /// Creates an IPAddress from a native internet address. | |
| | | /// A pointer to a in_addr or a in6_addr structure may be | |
| | | /// passed. Additionally, for an IPv6 address, a scope ID | |
| | | /// may be specified. The scope ID will be ignored if an IPv | |
| | | 4 | |
| | | /// address is specified. | |
| | | | |
| ~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; | |
| /// Returns the address family (IPv4 or IPv6) of the address
. | | /// Returns the address family (IPv4 or IPv6) of the address
. | |
| | | | |
|
| | | Poco::UInt32 scope() const; | |
| | | /// Returns the IPv6 scope identifier of the address. Return | |
| | | s 0 if | |
| | | /// the address is an IPv4 address, or the address is an | |
| | | /// IPv6 address but does not have a scope identifier. | |
| | | | |
| std::string toString() const; | | std::string toString() const; | |
| /// Returns a string containing a representation of the addr
ess | | /// Returns a string containing a representation of the addr
ess | |
| /// in presentation format. | | /// in presentation format. | |
| /// | | /// | |
| /// For IPv4 addresses the result will be in dotted-decimal | | /// For IPv4 addresses the result will be in dotted-decimal | |
| /// (d.d.d.d) notation. | | /// (d.d.d.d) notation. | |
| /// | | /// | |
| /// Textual representation of IPv6 address is one of the fol
lowing forms: | | /// Textual representation of IPv6 address is one of the fol
lowing forms: | |
| /// | | /// | |
| /// The preferred form is x:x:x:x:x:x:x:x, where the 'x's ar
e the hexadecimal | | /// The preferred form is x:x:x:x:x:x:x:x, where the 'x's ar
e the hexadecimal | |
| | | | |
| skipping to change at line 146 | | skipping to change at line 158 | |
| /// In order to make writing addresses containing zero bits
easier, a special syntax is | | /// In order to make writing addresses containing zero bits
easier, a special syntax is | |
| /// available to compress the zeros. The use of "::" indicat
es multiple groups of 16-bits of zeros. | | /// available to compress the zeros. The use of "::" indicat
es multiple groups of 16-bits of zeros. | |
| /// The "::" can only appear once in an address. The "::" ca
n also be used to compress the leading | | /// The "::" can only appear once in an address. The "::" ca
n also be used to compress the leading | |
| /// and/or trailing zeros in an address. Example: 1080::8:60
0:200A:425C | | /// and/or trailing zeros in an address. Example: 1080::8:60
0:200A:425C | |
| /// | | /// | |
| /// For dealing with IPv4 compatible addresses in a mixed en
vironment, | | /// For dealing with IPv4 compatible addresses in a mixed en
vironment, | |
| /// a special syntax is available: x:x:x:x:x:x:d.d.d.d, wher
e the 'x's are the | | /// a special syntax is available: x:x:x:x:x:x:d.d.d.d, wher
e the 'x's are the | |
| /// hexadecimal values of the six high-order 16-bit pieces o
f the address, | | /// hexadecimal values of the six high-order 16-bit pieces o
f the address, | |
| /// and the 'd's are the decimal values of the four low-order 8-bit
pieces of the | | /// and the 'd's are the decimal values of the four low-order 8-bit
pieces of the | |
| /// standard IPv4 representation address. Example: ::FFFF:192.168.1
.120 | | /// standard IPv4 representation address. Example: ::FFFF:192.168.1
.120 | |
|
| | | /// | |
| | | /// If an IPv6 address contains a non-zero scope identifier, it is | |
| | | added | |
| | | /// to the string, delimited by a percent character. On Windows pla | |
| | | tforms, | |
| | | /// the numeric value (which specifies an interface index) is direc | |
| | | tly | |
| | | /// appended. On Unix platforms, the name of the interface correspo | |
| | | nding | |
| | | /// to the index (interpretation of the scope identifier) is added. | |
| | | | |
| 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. | |
| | | | |
End of changes. 5 change blocks. |
| 2 lines changed or deleted | | 27 lines changed or added | |
|
| NObserver.h | | NObserver.h | |
| // | | // | |
| // NObserver.h | | // NObserver.h | |
| // | | // | |
|
| // $Id: //poco/1.4/Foundation/include/Poco/NObserver.h#1 $ | | // $Id: //poco/1.4/Foundation/include/Poco/NObserver.h#2 $ | |
| // | | // | |
| // Library: Foundation | | // Library: Foundation | |
| // Package: Notifications | | // Package: Notifications | |
| // Module: NotificationCenter | | // Module: NotificationCenter | |
| // | | // | |
| // Definition of the NObserver class template. | | // Definition of the NObserver class template. | |
| // | | // | |
| // 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 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_NObserver_INCLUDED | | #ifndef Foundation_NObserver_INCLUDED | |
| #define Foundation_NObserver_INCLUDED | | #define Foundation_NObserver_INCLUDED | |
| | | | |
| #include "Poco/Foundation.h" | | #include "Poco/Foundation.h" | |
| #include "Poco/AbstractObserver.h" | | #include "Poco/AbstractObserver.h" | |
|
| | | #include "Poco/Mutex.h" | |
| | | | |
| namespace Poco { | | namespace Poco { | |
| | | | |
| template <class C, class N> | | template <class C, class N> | |
| class NObserver: public AbstractObserver | | class NObserver: public AbstractObserver | |
| /// This template class implements an adapter that sits between | | /// This template class implements an adapter that sits between | |
| /// a NotificationCenter and an object receiving notifications | | /// a NotificationCenter and an object receiving notifications | |
| /// from it. It is quite similar in concept to the | | /// from it. It is quite similar in concept to the | |
| /// RunnableAdapter, but provides some NotificationCenter | | /// RunnableAdapter, but provides some NotificationCenter | |
| /// specific additional methods. | | /// specific additional methods. | |
| | | | |
| skipping to change at line 95 | | skipping to change at line 96 | |
| if (&observer != this) | | if (&observer != this) | |
| { | | { | |
| _pObject = observer._pObject; | | _pObject = observer._pObject; | |
| _method = observer._method; | | _method = observer._method; | |
| } | | } | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| void notify(Notification* pNf) const | | void notify(Notification* pNf) const | |
| { | | { | |
|
| N* pCastNf = dynamic_cast<N*>(pNf); | | Poco::Mutex::ScopedLock lock(_mutex); | |
| if (pCastNf) | | | |
| | | if (_pObject) | |
| { | | { | |
|
| NotificationPtr ptr(pCastNf, true); | | N* pCastNf = dynamic_cast<N*>(pNf); | |
| (_pObject->*_method)(ptr); | | if (pCastNf) | |
| | | { | |
| | | NotificationPtr ptr(pCastNf, true); | |
| | | (_pObject->*_method)(ptr); | |
| | | } | |
| } | | } | |
| } | | } | |
| | | | |
| bool equals(const AbstractObserver& abstractObserver) const | | bool equals(const AbstractObserver& abstractObserver) const | |
| { | | { | |
| const NObserver* pObs = dynamic_cast<const NObserver*>(&abst
ractObserver); | | const NObserver* pObs = dynamic_cast<const NObserver*>(&abst
ractObserver); | |
| return pObs && pObs->_pObject == _pObject && pObs->_method =
= _method; | | return pObs && pObs->_pObject == _pObject && pObs->_method =
= _method; | |
| } | | } | |
| | | | |
| bool accepts(Notification* pNf) const | | bool accepts(Notification* pNf) const | |
| { | | { | |
| return dynamic_cast<N*>(pNf) != 0; | | return dynamic_cast<N*>(pNf) != 0; | |
| } | | } | |
| | | | |
| AbstractObserver* clone() const | | AbstractObserver* clone() const | |
| { | | { | |
| return new NObserver(*this); | | return new NObserver(*this); | |
| } | | } | |
| | | | |
|
| | | void disable() | |
| | | { | |
| | | Poco::Mutex::ScopedLock lock(_mutex); | |
| | | | |
| | | _pObject = 0; | |
| | | } | |
| | | | |
| private: | | private: | |
| NObserver(); | | NObserver(); | |
| | | | |
| C* _pObject; | | C* _pObject; | |
| Callback _method; | | Callback _method; | |
|
| | | mutable Poco::Mutex _mutex; | |
| }; | | }; | |
| | | | |
| } // namespace Poco | | } // namespace Poco | |
| | | | |
| #endif // Foundation_NObserver_INCLUDED | | #endif // Foundation_NObserver_INCLUDED | |
| | | | |
End of changes. 6 change blocks. |
| 5 lines changed or deleted | | 19 lines changed or added | |
|
| NetworkInterface.h | | NetworkInterface.h | |
| // | | // | |
| // NetworkInterface.h | | // NetworkInterface.h | |
| // | | // | |
|
| // $Id: //poco/1.4/Net/include/Poco/Net/NetworkInterface.h#1 $ | | // $Id: //poco/1.4/Net/include/Poco/Net/NetworkInterface.h#2 $ | |
| // | | // | |
| // Library: Net | | // Library: Net | |
| // Package: Sockets | | // Package: Sockets | |
| // Module: NetworkInterface | | // Module: NetworkInterface | |
| // | | // | |
| // Definition of the NetworkInterface class. | | // Definition of the NetworkInterface 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 57 | | skipping to change at line 57 | |
| 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 | |
| | | /// enumerating or searching network interfaces. | |
| { | | { | |
| public: | | public: | |
| typedef std::vector<NetworkInterface> NetworkInterfaceList; | | typedef std::vector<NetworkInterface> NetworkInterfaceList; | |
| | | | |
| 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 | |
| }; | | }; | |
| | | | |
| skipping to change at line 132 | | skipping to change at line 135 | |
| /// | | /// | |
| /// 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); | |
| /// Returns the NetworkInterface for the given name. | | /// Returns the NetworkInterface for the given name. | |
| /// | | /// | |
|
| /// If requireIPv6 is false, an IPv4 interface is returned. | | /// The ipVersion argument can be used to specify whether | |
| /// Otherwise, an IPv6 interface is returned. | | /// an IPv4 (IPv4_ONLY) or IPv6 (IPv6_ONLY) interface is req | |
| /// | | uired, | |
| /// Throws an InterfaceNotFoundException if an interface | | /// or whether the caller does not care (IPv4_OR_IPv6). | |
| /// with the give name does not exist. | | | |
| | | | |
| 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(int 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 | |
| | | | |
End of changes. 3 change blocks. |
| 6 lines changed or deleted | | 8 lines changed or added | |
|
| Node.h | | Node.h | |
| // | | // | |
| // Node.h | | // Node.h | |
| // | | // | |
|
| // $Id: //poco/1.4/XML/include/Poco/DOM/Node.h#1 $ | | // $Id: //poco/1.4/XML/include/Poco/DOM/Node.h#2 $ | |
| // | | // | |
| // Library: XML | | // Library: XML | |
| // Package: DOM | | // Package: DOM | |
| // Module: DOM | | // Module: DOM | |
| // | | // | |
| // Definition of the DOM Node interface. | | // Definition of the DOM Node interface. | |
| // | | // | |
| // 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 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 DOM_Node_INCLUDED | | #ifndef DOM_Node_INCLUDED | |
| #define DOM_Node_INCLUDED | | #define DOM_Node_INCLUDED | |
| | | | |
| #include "Poco/XML/XML.h" | | #include "Poco/XML/XML.h" | |
| #include "Poco/DOM/EventTarget.h" | | #include "Poco/DOM/EventTarget.h" | |
| #include "Poco/XML/XMLString.h" | | #include "Poco/XML/XMLString.h" | |
|
| | | #include "Poco/SAX/NamespaceSupport.h" | |
| | | | |
| namespace Poco { | | namespace Poco { | |
| namespace XML { | | namespace XML { | |
| | | | |
| class NamedNodeMap; | | class NamedNodeMap; | |
| class Document; | | class Document; | |
| class NodeList; | | class NodeList; | |
| | | | |
| class XML_API Node: public EventTarget | | class XML_API Node: public EventTarget | |
| /// The Node interface is the primary datatype for the entire Docume
nt Object | | /// The Node interface is the primary datatype for the entire Docume
nt Object | |
| | | | |
| skipping to change at line 227 | | skipping to change at line 228 | |
| virtual XMLString prefix() const = 0; | | virtual XMLString prefix() const = 0; | |
| /// Returns the namespace prefix from the qualified name of
the node. | | /// Returns the namespace prefix from the qualified name of
the node. | |
| | | | |
| virtual const XMLString& localName() const = 0; | | virtual const XMLString& localName() const = 0; | |
| /// Returns the local name of the node. | | /// Returns the local name of the node. | |
| | | | |
| virtual bool hasAttributes() const = 0; | | virtual bool hasAttributes() const = 0; | |
| /// Returns whether this node (if it is an element) has any
attributes. | | /// Returns whether this node (if it is an element) has any
attributes. | |
| | | | |
| // Extensions | | // Extensions | |
|
| | | typedef Poco::XML::NamespaceSupport NSMap; | |
| | | | |
| virtual XMLString innerText() const = 0; | | virtual XMLString innerText() const = 0; | |
| /// Returns a string containing the concatenated values of t
he node | | /// Returns a string containing the concatenated values of t
he node | |
| /// and all its child nodes. | | /// and all its child nodes. | |
| /// | | /// | |
| /// This method is not part of the W3C Document Object Model
. | | /// This method is not part of the W3C Document Object Model
. | |
| | | | |
|
| | | virtual Node* getNodeByPath(const XMLString& path) const = 0; | |
| | | /// Searches a node (element or attribute) based on a simpli | |
| | | fied XPath | |
| | | /// expression. | |
| | | /// | |
| | | /// Only simple XPath expressions are supported. These are t | |
| | | he slash | |
| | | /// notation for specifying paths to elements, and the squar | |
| | | e bracket | |
| | | /// expression for finding elements by their index, by attri | |
| | | bute value, | |
| | | /// or finding attributes by names. | |
| | | /// | |
| | | /// The slash at the beginning is optional, the evaluation a | |
| | | lways starts | |
| | | /// at this element. A double-slash at the beginning recursi | |
| | | vely searches | |
| | | /// the entire subtree for the first element. | |
| | | /// | |
| | | /// Examples: | |
| | | /// elem1/elem2/elem3 | |
| | | /// /elem1/elem2/elem3 | |
| | | /// /elem1/elem2[1] | |
| | | /// /elem1/elem2[@attr1] | |
| | | /// /elem1/elem2[@attr1='value'] | |
| | | /// //elem2[@attr1='value'] | |
| | | /// //[@attr1='value'] | |
| | | /// | |
| | | /// This method is an extension to the W3C Document Object M | |
| | | odel. | |
| | | | |
| | | virtual Node* getNodeByPathNS(const XMLString& path, const NSMap& ns | |
| | | Map) const = 0; | |
| | | /// Searches a node (element or attribute) based on a simpli | |
| | | fied XPath | |
| | | /// expression. The given NSMap must contain mappings from n | |
| | | amespace | |
| | | /// prefixes to namespace URIs for all namespace prefixes us | |
| | | ed in | |
| | | /// the path expression. | |
| | | /// | |
| | | /// Only simple XPath expressions are supported. These are t | |
| | | he slash | |
| | | /// notation for specifying paths to elements, and the squar | |
| | | e bracket | |
| | | /// expression for finding elements by their index, by attri | |
| | | bute value, | |
| | | /// or finding attributes by names. | |
| | | /// | |
| | | /// The slash at the beginning is optional, the evaluation a | |
| | | lways starts | |
| | | /// at this element. A double-slash at the beginning recursi | |
| | | vely searches | |
| | | /// the entire subtree for the first element. | |
| | | /// | |
| | | /// Examples: | |
| | | /// /ns1:elem1/ns2:elem2/ns2:elem3 | |
| | | /// /ns1:elem1/ns2:elem2[1] | |
| | | /// /ns1:elem1/ns2:elem2[@attr1] | |
| | | /// /ns1:elem1/ns2:elem2[@attr1='value'] | |
| | | /// //ns2:elem2[@ns1:attr1='value'] | |
| | | /// //[@ns1:attr1='value'] | |
| | | /// | |
| | | /// This method is an extension to the W3C Document Object M | |
| | | odel. | |
| | | | |
| protected: | | protected: | |
| virtual ~Node(); | | virtual ~Node(); | |
| }; | | }; | |
| | | | |
| // | | // | |
| // inlines | | // inlines | |
| // | | // | |
| inline const XMLString& Node::nodeValue() const | | inline const XMLString& Node::nodeValue() const | |
| { | | { | |
| return getNodeValue(); | | return getNodeValue(); | |
| | | | |
End of changes. 4 change blocks. |
| 1 lines changed or deleted | | 70 lines changed or added | |
|
| NotificationStrategy.h | | NotificationStrategy.h | |
| // | | // | |
| // NotificationStrategy.h | | // NotificationStrategy.h | |
| // | | // | |
|
| // $Id: //poco/1.4/Foundation/include/Poco/NotificationStrategy.h#1 $ | | // $Id: //poco/1.4/Foundation/include/Poco/NotificationStrategy.h#2 $ | |
| // | | // | |
| // Library: Foundation | | // Library: Foundation | |
| // Package: Events | | // Package: Events | |
| // Module: NotificationStrategy | | // Module: NotificationStrategy | |
| // | | // | |
| // Definition of the NotificationStrategy interface. | | // Definition of the NotificationStrategy interface. | |
| // | | // | |
|
| // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | | // Copyright (c) 2006-2011, 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 49 | | skipping to change at line 49 | |
| #define Foundation_NotificationStrategy_INCLUDED | | #define Foundation_NotificationStrategy_INCLUDED | |
| | | | |
| #include "Poco/Foundation.h" | | #include "Poco/Foundation.h" | |
| | | | |
| namespace Poco { | | namespace Poco { | |
| | | | |
| template <class TArgs, class TDelegate> | | template <class TArgs, class TDelegate> | |
| class NotificationStrategy | | class NotificationStrategy | |
| /// The interface that all notification strategies must implement. | | /// The interface that all notification strategies must implement. | |
| /// | | /// | |
|
| /// Note: Event is based on policy-driven design, so your strategy i | | /// Note: Event is based on policy-driven design, so every strategy | |
| mplementation | | implementation | |
| /// must offer all the methods from this interface (otherwise: compi | | /// must provide all the methods from this interface (otherwise: com | |
| le errors) | | pile errors) | |
| /// but you don't need to inherit from NotificationStrategy. | | /// but does not need to inherit from NotificationStrategy. | |
| { | | { | |
| public: | | public: | |
| NotificationStrategy() | | NotificationStrategy() | |
| { | | { | |
| } | | } | |
| | | | |
| virtual ~NotificationStrategy() | | virtual ~NotificationStrategy() | |
| { | | { | |
| } | | } | |
| | | | |
| virtual void notify(const void* sender, TArgs& arguments) = 0; | | virtual void notify(const void* sender, TArgs& arguments) = 0; | |
|
| /// Sends a notification to all registered delegates, | | /// Sends a notification to all registered delegates. | |
| | | | |
|
| virtual void add(const TDelegate& pDelegate) = 0; | | virtual void add(const TDelegate& delegate) = 0; | |
| /// Adds a delegate to the strategy, if the delegate is not | | /// Adds a delegate to the strategy. | |
| yet present | | | |
| | | | |
|
| virtual void remove(const TDelegate& pDelegate) = 0; | | virtual void remove(const TDelegate& delegate) = 0; | |
| /// Removes a delegate from the strategy if found. | | /// Removes a delegate from the strategy, if found. | |
| | | /// Does nothing if the delegate has not been added. | |
| | | | |
| virtual void clear() = 0; | | virtual void clear() = 0; | |
| /// Removes all delegates from the strategy. | | /// Removes all delegates from the strategy. | |
| | | | |
| virtual bool empty() const = 0; | | virtual bool empty() const = 0; | |
| /// Returns false if the strategy contains at least one dele
gate. | | /// Returns false if the strategy contains at least one dele
gate. | |
| }; | | }; | |
| | | | |
| } // namespace Poco | | } // namespace Poco | |
| | | | |
| | | | |
End of changes. 6 change blocks. |
| 13 lines changed or deleted | | 13 lines changed or added | |
|
| Observer.h | | Observer.h | |
| // | | // | |
| // Observer.h | | // Observer.h | |
| // | | // | |
|
| // $Id: //poco/1.4/Foundation/include/Poco/Observer.h#1 $ | | // $Id: //poco/1.4/Foundation/include/Poco/Observer.h#2 $ | |
| // | | // | |
| // Library: Foundation | | // Library: Foundation | |
| // Package: Notifications | | // Package: Notifications | |
| // Module: NotificationCenter | | // Module: NotificationCenter | |
| // | | // | |
| // Definition of the Observer class template. | | // Definition of the Observer class template. | |
| // | | // | |
| // 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 | |
| // 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_Observer_INCLUDED | | #ifndef Foundation_Observer_INCLUDED | |
| #define Foundation_Observer_INCLUDED | | #define Foundation_Observer_INCLUDED | |
| | | | |
| #include "Poco/Foundation.h" | | #include "Poco/Foundation.h" | |
| #include "Poco/AbstractObserver.h" | | #include "Poco/AbstractObserver.h" | |
|
| | | #include "Poco/Mutex.h" | |
| | | | |
| namespace Poco { | | namespace Poco { | |
| | | | |
| template <class C, class N> | | template <class C, class N> | |
| class Observer: public AbstractObserver | | class Observer: public AbstractObserver | |
| /// This template class implements an adapter that sits between | | /// This template class implements an adapter that sits between | |
| /// a NotificationCenter and an object receiving notifications | | /// a NotificationCenter and an object receiving notifications | |
| /// from it. It is quite similar in concept to the | | /// from it. It is quite similar in concept to the | |
| /// RunnableAdapter, but provides some NotificationCenter | | /// RunnableAdapter, but provides some NotificationCenter | |
| /// specific additional methods. | | /// specific additional methods. | |
| | | | |
| skipping to change at line 93 | | skipping to change at line 94 | |
| if (&observer != this) | | if (&observer != this) | |
| { | | { | |
| _pObject = observer._pObject; | | _pObject = observer._pObject; | |
| _method = observer._method; | | _method = observer._method; | |
| } | | } | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| void notify(Notification* pNf) const | | void notify(Notification* pNf) const | |
| { | | { | |
|
| N* pCastNf = dynamic_cast<N*>(pNf); | | Poco::Mutex::ScopedLock lock(_mutex); | |
| if (pCastNf) | | | |
| | | if (_pObject) | |
| { | | { | |
|
| pCastNf->duplicate(); | | N* pCastNf = dynamic_cast<N*>(pNf); | |
| (_pObject->*_method)(pCastNf); | | if (pCastNf) | |
| | | { | |
| | | pCastNf->duplicate(); | |
| | | (_pObject->*_method)(pCastNf); | |
| | | } | |
| } | | } | |
| } | | } | |
| | | | |
| bool equals(const AbstractObserver& abstractObserver) const | | bool equals(const AbstractObserver& abstractObserver) const | |
| { | | { | |
| const Observer* pObs = dynamic_cast<const Observer*>(&abstra
ctObserver); | | const Observer* pObs = dynamic_cast<const Observer*>(&abstra
ctObserver); | |
| return pObs && pObs->_pObject == _pObject && pObs->_method =
= _method; | | return pObs && pObs->_pObject == _pObject && pObs->_method =
= _method; | |
| } | | } | |
| | | | |
| bool accepts(Notification* pNf) const | | bool accepts(Notification* pNf) const | |
| { | | { | |
| return dynamic_cast<N*>(pNf) != 0; | | return dynamic_cast<N*>(pNf) != 0; | |
| } | | } | |
| | | | |
| AbstractObserver* clone() const | | AbstractObserver* clone() const | |
| { | | { | |
| return new Observer(*this); | | return new Observer(*this); | |
| } | | } | |
| | | | |
|
| | | void disable() | |
| | | { | |
| | | Poco::Mutex::ScopedLock lock(_mutex); | |
| | | | |
| | | _pObject = 0; | |
| | | } | |
| | | | |
| private: | | private: | |
| Observer(); | | Observer(); | |
| | | | |
| C* _pObject; | | C* _pObject; | |
| Callback _method; | | Callback _method; | |
|
| | | mutable Poco::Mutex _mutex; | |
| }; | | }; | |
| | | | |
| } // namespace Poco | | } // namespace Poco | |
| | | | |
| #endif // Foundation_Observer_INCLUDED | | #endif // Foundation_Observer_INCLUDED | |
| | | | |
End of changes. 6 change blocks. |
| 5 lines changed or deleted | | 19 lines changed or added | |
|
| Path.h | | Path.h | |
| // | | // | |
| // Path.h | | // Path.h | |
| // | | // | |
|
| // $Id: //poco/1.4/Foundation/include/Poco/Path.h#1 $ | | // $Id: //poco/1.4/Foundation/include/Poco/Path.h#3 $ | |
| // | | // | |
| // Library: Foundation | | // Library: Foundation | |
| // Package: Filesystem | | // Package: Filesystem | |
| // Module: Path | | // Module: Path | |
| // | | // | |
| // Definition of the Path class. | | // Definition of the Path 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 208 | | skipping to change at line 208 | |
| /// Returns true iff the path is relative. | | /// Returns true iff the path is relative. | |
| | | | |
| bool isDirectory() const; | | bool isDirectory() const; | |
| /// Returns true iff the path references a directory | | /// Returns true iff the path references a directory | |
| /// (the filename part is empty). | | /// (the filename part is empty). | |
| | | | |
| bool isFile() const; | | bool isFile() const; | |
| /// Returns true iff the path references a file | | /// Returns true iff the path references a file | |
| /// (the filename part is not empty). | | /// (the filename part is not empty). | |
| | | | |
|
| void setNode(const std::string& node); | | Path& setNode(const std::string& node); | |
| /// Sets the node name. | | /// Sets the node name. | |
| /// Setting a non-empty node automatically makes | | /// Setting a non-empty node automatically makes | |
| /// the path an absolute one. | | /// the path an absolute one. | |
| | | | |
| const std::string& getNode() const; | | const std::string& getNode() const; | |
| /// Returns the node name. | | /// Returns the node name. | |
| | | | |
|
| void setDevice(const std::string& device); | | Path& setDevice(const std::string& device); | |
| /// Sets the device name. | | /// Sets the device name. | |
| /// Setting a non-empty device automatically makes | | /// Setting a non-empty device automatically makes | |
| /// the path an absolute one. | | /// the path an absolute one. | |
| | | | |
| const std::string& getDevice() const; | | const std::string& getDevice() const; | |
| /// Returns the device name. | | /// Returns the device name. | |
| | | | |
| int depth() const; | | int depth() const; | |
| /// Returns the number of directories in the directory list. | | /// Returns the number of directories in the directory list. | |
| | | | |
| const std::string& directory(int n) const; | | const std::string& directory(int n) const; | |
| /// Returns the n'th directory in the directory list. | | /// Returns the n'th directory in the directory list. | |
| /// If n == depth(), returns the filename. | | /// If n == depth(), returns the filename. | |
| | | | |
| const std::string& operator [] (int n) const; | | const std::string& operator [] (int n) const; | |
| /// Returns the n'th directory in the directory list. | | /// Returns the n'th directory in the directory list. | |
| /// If n == depth(), returns the filename. | | /// If n == depth(), returns the filename. | |
| | | | |
|
| void pushDirectory(const std::string& dir); | | Path& pushDirectory(const std::string& dir); | |
| /// Adds a directory to the directory list. | | /// Adds a directory to the directory list. | |
| | | | |
|
| void popDirectory(); | | Path& popDirectory(); | |
| /// Removes the last directory from the directory list. | | /// Removes the last directory from the directory list. | |
| | | | |
|
| void setFileName(const std::string& name); | | Path& popFrontDirectory(); | |
| | | /// Removes the first directory from the directory list. | |
| | | | |
| | | Path& setFileName(const std::string& name); | |
| /// Sets the filename. | | /// Sets the filename. | |
| | | | |
| const std::string& getFileName() const; | | const std::string& getFileName() const; | |
| /// Returns the filename. | | /// Returns the filename. | |
| | | | |
|
| void setBaseName(const std::string& name); | | Path& setBaseName(const std::string& name); | |
| /// Sets the basename part of the filename and | | /// Sets the basename part of the filename and | |
| /// does not change the extension. | | /// does not change the extension. | |
| | | | |
| std::string getBaseName() const; | | std::string getBaseName() const; | |
| /// Returns the basename (the filename sans | | /// Returns the basename (the filename sans | |
| /// extension) of the path. | | /// extension) of the path. | |
| | | | |
|
| void setExtension(const std::string& extension); | | Path& setExtension(const std::string& extension); | |
| /// Sets the filename extension. | | /// Sets the filename extension. | |
| | | | |
| std::string getExtension() const; | | std::string getExtension() const; | |
| /// Returns the filename extension. | | /// Returns the filename extension. | |
| | | | |
| const std::string& version() const; | | const std::string& version() const; | |
| /// Returns the file version. VMS only. | | /// Returns the file version. VMS only. | |
| | | | |
|
| void clear(); | | Path& clear(); | |
| /// Clears all components. | | /// Clears all components. | |
| | | | |
| Path parent() const; | | Path parent() const; | |
| /// Returns a path referring to the path's | | /// Returns a path referring to the path's | |
| /// directory. | | /// directory. | |
| | | | |
| Path absolute() const; | | Path absolute() const; | |
| /// Returns an absolute variant of the path, | | /// Returns an absolute variant of the path, | |
| /// taking the current working directory as base. | | /// taking the current working directory as base. | |
| | | | |
| | | | |
End of changes. 9 change blocks. |
| 9 lines changed or deleted | | 12 lines changed or added | |
|
| PatternFormatter.h | | PatternFormatter.h | |
| // | | // | |
| // PatternFormatter.h | | // PatternFormatter.h | |
| // | | // | |
|
| // $Id: //poco/1.4/Foundation/include/Poco/PatternFormatter.h#1 $ | | // $Id: //poco/1.4/Foundation/include/Poco/PatternFormatter.h#2 $ | |
| // | | // | |
| // Library: Foundation | | // Library: Foundation | |
| // Package: Logging | | // Package: Logging | |
| // Module: PatternFormatter | | // Module: PatternFormatter | |
| // | | // | |
| // Definition of the PatternFormatter class. | | // Definition of the PatternFormatter 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 87 | | skipping to change at line 87 | |
| /// * %Y - message date/time year with century (1970) | | /// * %Y - message date/time year with century (1970) | |
| /// * %H - message date/time hour (00 .. 23) | | /// * %H - message date/time hour (00 .. 23) | |
| /// * %h - message date/time hour (00 .. 12) | | /// * %h - message date/time hour (00 .. 12) | |
| /// * %a - message date/time am/pm | | /// * %a - message date/time am/pm | |
| /// * %A - message date/time AM/PM | | /// * %A - message date/time AM/PM | |
| /// * %M - message date/time minute (00 .. 59) | | /// * %M - message date/time minute (00 .. 59) | |
| /// * %S - message date/time second (00 .. 59) | | /// * %S - message date/time second (00 .. 59) | |
| /// * %i - message date/time millisecond (000 .. 999) | | /// * %i - message date/time millisecond (000 .. 999) | |
| /// * %c - message date/time centisecond (0 .. 9) | | /// * %c - message date/time centisecond (0 .. 9) | |
| /// * %F - message date/time fractional seconds/microseconds (0000
00 - 999999) | | /// * %F - message date/time fractional seconds/microseconds (0000
00 - 999999) | |
|
| /// * %z - time zone differential in ISO 8601 format (Z or +NN.NN)
. | | /// * %z - time zone differential in ISO 8601 format (Z or +NN.NN) | |
| /// * %Z - time zone differential in RFC format (GMT or +NNNN) | | /// * %Z - time zone differential in RFC format (GMT or +NNNN) | |
|
| | | /// * %E - epoch time (UTC, seconds since midnight, January 1, 197
0) | |
| /// * %[name] - the value of the message parameter with the given
name | | /// * %[name] - the value of the message parameter with the given
name | |
| /// * %% - percent sign | | /// * %% - percent sign | |
| | | | |
| { | | { | |
| public: | | public: | |
| PatternFormatter(); | | PatternFormatter(); | |
| /// Creates a PatternFormatter. | | /// Creates a PatternFormatter. | |
| /// The format pattern must be specified with | | /// The format pattern must be specified with | |
| /// a call to setProperty. | | /// a call to setProperty. | |
| | | | |
| | | | |
End of changes. 3 change blocks. |
| 2 lines changed or deleted | | 3 lines changed or added | |
|
| Platform.h | | Platform.h | |
| // | | // | |
| // Platform.h | | // Platform.h | |
| // | | // | |
|
| // $Id: //poco/1.4/Foundation/include/Poco/Platform.h#3 $ | | // $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 138 | | skipping to change at line 138 | |
| #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 | |
| | | | |
| #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 192 | | skipping to change at line 193 | |
| #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) | | #elif defined(__sh__) || defined(__sh) | |
| #define POCO_ARCH POCO_ARCH_SH | | #define POCO_ARCH POCO_ARCH_SH | |
| #if defined(__LITTLE_ENDIAN__) | | #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__) | |
| | | #define POCO_ARCH POCO_ARCH_NIOS2 | |
| | | #if defined(__nios2_little_endian) || defined(nios2_little_endian) || d | |
| | | efined(__nios2_little_endian__) | |
| | | #define POCO_ARCH_LITTLE_ENDIAN 1 | |
| | | #else | |
| | | #define POCO_ARCH_BIG_ENDIAN 1 | |
| | | #endif | |
| | | | |
| #endif | | #endif | |
| | | | |
| #endif // Foundation_Platform_INCLUDED | | #endif // Foundation_Platform_INCLUDED | |
| | | | |
End of changes. 3 change blocks. |
| 1 lines changed or deleted | | 11 lines changed or added | |
|
| PriorityDelegate.h | | PriorityDelegate.h | |
| // | | // | |
| // PriorityDelegate.h | | // PriorityDelegate.h | |
| // | | // | |
|
| // $Id: //poco/1.4/Foundation/include/Poco/PriorityDelegate.h#1 $ | | // $Id: //poco/1.4/Foundation/include/Poco/PriorityDelegate.h#5 $ | |
| // | | // | |
| // Library: Foundation | | // Library: Foundation | |
| // Package: Events | | // Package: Events | |
| // Module: PriorityDelegate | | // Module: PriorityDelegate | |
| // | | // | |
| // Implementation of the PriorityDelegate template. | | // Implementation of the PriorityDelegate template. | |
| // | | // | |
|
| // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | | // Copyright (c) 2006-2011, 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 45 | | skipping to change at line 45 | |
| // DEALINGS IN THE SOFTWARE. | | // DEALINGS IN THE SOFTWARE. | |
| // | | // | |
| | | | |
| #ifndef Foundation_PriorityDelegate_INCLUDED | | #ifndef Foundation_PriorityDelegate_INCLUDED | |
| #define Foundation_PriorityDelegate_INCLUDED | | #define Foundation_PriorityDelegate_INCLUDED | |
| | | | |
| #include "Poco/Foundation.h" | | #include "Poco/Foundation.h" | |
| #include "Poco/AbstractPriorityDelegate.h" | | #include "Poco/AbstractPriorityDelegate.h" | |
| #include "Poco/PriorityExpire.h" | | #include "Poco/PriorityExpire.h" | |
| #include "Poco/FunctionPriorityDelegate.h" | | #include "Poco/FunctionPriorityDelegate.h" | |
|
| | | #include "Poco/Mutex.h" | |
| | | | |
| namespace Poco { | | namespace Poco { | |
| | | | |
| template <class TObj, class TArgs, bool useSender = true> | | template <class TObj, class TArgs, bool useSender = true> | |
| class PriorityDelegate: public AbstractPriorityDelegate<TArgs> | | class PriorityDelegate: public AbstractPriorityDelegate<TArgs> | |
| { | | { | |
| public: | | public: | |
| typedef void (TObj::*NotifyMethod)(const void*, TArgs&); | | typedef void (TObj::*NotifyMethod)(const void*, TArgs&); | |
| | | | |
| PriorityDelegate(TObj* obj, NotifyMethod method, int prio): | | PriorityDelegate(TObj* obj, NotifyMethod method, int prio): | |
|
| AbstractPriorityDelegate<TArgs>(obj, prio), | | AbstractPriorityDelegate<TArgs>(prio), | |
| _receiverObject(obj), | | _receiverObject(obj), | |
| _receiverMethod(method) | | _receiverMethod(method) | |
| { | | { | |
| } | | } | |
| | | | |
| PriorityDelegate(const PriorityDelegate& delegate): | | PriorityDelegate(const PriorityDelegate& delegate): | |
|
| AbstractPriorityDelegate<TArgs>(delegate._pTarget, delegate.
_priority), | | AbstractPriorityDelegate<TArgs>(delegate), | |
| _receiverObject(delegate._receiverObject), | | _receiverObject(delegate._receiverObject), | |
| _receiverMethod(delegate._receiverMethod) | | _receiverMethod(delegate._receiverMethod) | |
| { | | { | |
| } | | } | |
| | | | |
| PriorityDelegate& operator = (const PriorityDelegate& delegate) | | PriorityDelegate& operator = (const PriorityDelegate& delegate) | |
| { | | { | |
| if (&delegate != this) | | if (&delegate != this) | |
| { | | { | |
| this->_pTarget = delegate._pTarget; | | this->_pTarget = delegate._pTarget; | |
| | | | |
| skipping to change at line 86 | | skipping to change at line 87 | |
| } | | } | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| ~PriorityDelegate() | | ~PriorityDelegate() | |
| { | | { | |
| } | | } | |
| | | | |
| bool notify(const void* sender, TArgs& arguments) | | bool notify(const void* sender, TArgs& arguments) | |
| { | | { | |
|
| (_receiverObject->*_receiverMethod)(sender, arguments); | | Mutex::ScopedLock lock(_mutex); | |
| return true; // per default the delegate never expires | | if (_receiverObject) | |
| | | { | |
| | | (_receiverObject->*_receiverMethod)(sender, argument | |
| | | s); | |
| | | return true; | |
| | | } | |
| | | else return false; | |
| } | | } | |
| | | | |
|
| AbstractPriorityDelegate<TArgs>* clone() const | | bool equals(const AbstractDelegate<TArgs>& other) const | |
| | | { | |
| | | const PriorityDelegate* pOtherDelegate = dynamic_cast<const | |
| | | PriorityDelegate*>(other.unwrap()); | |
| | | return pOtherDelegate && this->priority() == pOtherDelegate- | |
| | | >priority() && _receiverObject == pOtherDelegate->_receiverObject && _recei | |
| | | verMethod == pOtherDelegate->_receiverMethod; | |
| | | } | |
| | | | |
| | | AbstractDelegate<TArgs>* clone() const | |
| { | | { | |
| return new PriorityDelegate(*this); | | return new PriorityDelegate(*this); | |
| } | | } | |
| | | | |
|
| | | void disable() | |
| | | { | |
| | | Mutex::ScopedLock lock(_mutex); | |
| | | _receiverObject = 0; | |
| | | } | |
| | | | |
| protected: | | protected: | |
| TObj* _receiverObject; | | TObj* _receiverObject; | |
| NotifyMethod _receiverMethod; | | NotifyMethod _receiverMethod; | |
|
| | | Mutex _mutex; | |
| | | | |
| private: | | private: | |
| PriorityDelegate(); | | PriorityDelegate(); | |
| }; | | }; | |
| | | | |
| template <class TObj, class TArgs> | | template <class TObj, class TArgs> | |
| class PriorityDelegate<TObj, TArgs, false>: public AbstractPriorityDelegate
<TArgs> | | class PriorityDelegate<TObj, TArgs, false>: public AbstractPriorityDelegate
<TArgs> | |
| { | | { | |
| public: | | public: | |
| typedef void (TObj::*NotifyMethod)(TArgs&); | | typedef void (TObj::*NotifyMethod)(TArgs&); | |
| | | | |
| PriorityDelegate(TObj* obj, NotifyMethod method, int prio): | | PriorityDelegate(TObj* obj, NotifyMethod method, int prio): | |
|
| AbstractPriorityDelegate<TArgs>(obj, prio), | | AbstractPriorityDelegate<TArgs>(prio), | |
| _receiverObject(obj), | | _receiverObject(obj), | |
| _receiverMethod(method) | | _receiverMethod(method) | |
| { | | { | |
| } | | } | |
| | | | |
| PriorityDelegate(const PriorityDelegate& delegate): | | PriorityDelegate(const PriorityDelegate& delegate): | |
|
| AbstractPriorityDelegate<TArgs>(delegate._pTarget, delegate.
_priority), | | AbstractPriorityDelegate<TArgs>(delegate), | |
| _receiverObject(delegate._receiverObject), | | _receiverObject(delegate._receiverObject), | |
| _receiverMethod(delegate._receiverMethod) | | _receiverMethod(delegate._receiverMethod) | |
| { | | { | |
| } | | } | |
| | | | |
| PriorityDelegate& operator = (const PriorityDelegate& delegate) | | PriorityDelegate& operator = (const PriorityDelegate& delegate) | |
| { | | { | |
| if (&delegate != this) | | if (&delegate != this) | |
| { | | { | |
| this->_pTarget = delegate._pTarget; | | this->_pTarget = delegate._pTarget; | |
| | | | |
| skipping to change at line 141 | | skipping to change at line 160 | |
| } | | } | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| ~PriorityDelegate() | | ~PriorityDelegate() | |
| { | | { | |
| } | | } | |
| | | | |
| bool notify(const void* sender, TArgs& arguments) | | bool notify(const void* sender, TArgs& arguments) | |
| { | | { | |
|
| (_receiverObject->*_receiverMethod)(arguments); | | Mutex::ScopedLock lock(_mutex); | |
| return true; // per default the delegate never expires | | if (_receiverObject) | |
| | | { | |
| | | (_receiverObject->*_receiverMethod)(arguments); | |
| | | return true; | |
| | | } | |
| | | return false; | |
| } | | } | |
| | | | |
|
| AbstractPriorityDelegate<TArgs>* clone() const | | bool equals(const AbstractDelegate<TArgs>& other) const | |
| | | { | |
| | | const PriorityDelegate* pOtherDelegate = dynamic_cast<const | |
| | | PriorityDelegate*>(other.unwrap()); | |
| | | return pOtherDelegate && this->priority() == pOtherDelegate- | |
| | | >priority() && _receiverObject == pOtherDelegate->_receiverObject && _recei | |
| | | verMethod == pOtherDelegate->_receiverMethod; | |
| | | } | |
| | | | |
| | | AbstractDelegate<TArgs>* clone() const | |
| { | | { | |
| return new PriorityDelegate(*this); | | return new PriorityDelegate(*this); | |
| } | | } | |
| | | | |
|
| | | void disable() | |
| | | { | |
| | | Mutex::ScopedLock lock(_mutex); | |
| | | _receiverObject = 0; | |
| | | } | |
| | | | |
| protected: | | protected: | |
| TObj* _receiverObject; | | TObj* _receiverObject; | |
| NotifyMethod _receiverMethod; | | NotifyMethod _receiverMethod; | |
|
| | | Mutex _mutex; | |
| | | | |
| private: | | private: | |
| PriorityDelegate(); | | PriorityDelegate(); | |
| }; | | }; | |
| | | | |
| template <class TObj, class TArgs> | | template <class TObj, class TArgs> | |
| static PriorityDelegate<TObj, TArgs, true> priorityDelegate(TObj* pObj, voi
d (TObj::*NotifyMethod)(const void*, TArgs&), int prio) | | static PriorityDelegate<TObj, TArgs, true> priorityDelegate(TObj* pObj, voi
d (TObj::*NotifyMethod)(const void*, TArgs&), int prio) | |
| { | | { | |
| return PriorityDelegate<TObj, TArgs, true>(pObj, NotifyMethod, prio)
; | | return PriorityDelegate<TObj, TArgs, true>(pObj, NotifyMethod, prio)
; | |
| } | | } | |
| | | | |
End of changes. 15 change blocks. |
| 12 lines changed or deleted | | 56 lines changed or added | |
|
| PriorityEvent.h | | PriorityEvent.h | |
| // | | // | |
| // PriorityEvent.h | | // PriorityEvent.h | |
| // | | // | |
|
| // $Id: //poco/1.4/Foundation/include/Poco/PriorityEvent.h#1 $ | | // $Id: //poco/1.4/Foundation/include/Poco/PriorityEvent.h#2 $ | |
| // | | // | |
| // Library: Foundation | | // Library: Foundation | |
| // Package: Events | | // Package: Events | |
| // Module: PriorityEvent | | // Module: PriorityEvent | |
| // | | // | |
| // Implementation of the PriorityEvent template. | | // Implementation of the PriorityEvent template. | |
| // | | // | |
|
| // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | | // Copyright (c) 2006-2011, 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_PriorityEvent_INCLUDED | | #ifndef Foundation_PriorityEvent_INCLUDED | |
| #define Foundation_PriorityEvent_INCLUDED | | #define Foundation_PriorityEvent_INCLUDED | |
| | | | |
| #include "Poco/AbstractEvent.h" | | #include "Poco/AbstractEvent.h" | |
|
| #include "Poco/DefaultStrategy.h" | | #include "Poco/PriorityStrategy.h" | |
| #include "Poco/AbstractPriorityDelegate.h" | | #include "Poco/AbstractPriorityDelegate.h" | |
|
| #include "Poco/CompareFunctions.h" | | | |
| | | | |
| namespace Poco { | | namespace Poco { | |
| | | | |
| template <class TArgs, class TMutex = FastMutex> | | template <class TArgs, class TMutex = FastMutex> | |
| class PriorityEvent: public AbstractEvent < | | class PriorityEvent: public AbstractEvent < | |
| TArgs, | | TArgs, | |
|
| DefaultStrategy<TArgs, AbstractPriorityDelegate<TArgs>, p_less<Abstr
actPriorityDelegate<TArgs> > >, | | PriorityStrategy<TArgs, AbstractPriorityDelegate<TArgs> >, | |
| AbstractPriorityDelegate<TArgs>, | | AbstractPriorityDelegate<TArgs>, | |
| TMutex | | TMutex | |
| > | | > | |
|
| /// A PriorityEvent uses internally a DefaultStrategy which | | /// A PriorityEvent uses internally a PriorityStrategy which | |
| /// invokes delegates in a manner determined by the priority field | | /// invokes delegates in order of priority (lower priorities first). | |
| /// in the PriorityDelegates (lower priorities first). | | /// PriorityEvent's can only be used together with PriorityDelegate' | |
| /// PriorityEvents can only be used together with PriorityDelegates. | | s. | |
| /// PriorityDelegates are sorted according to the priority value, wh | | /// PriorityDelegate's are sorted according to the priority value, w | |
| en | | hen | |
| /// two delegates have the same priority, they are invoked in | | /// two delegates have the same priority, they are invoked in | |
| /// an arbitrary manner. | | /// an arbitrary manner. | |
|
| /// Note that one object can register several methods as long as the | | | |
| y differ | | | |
| /// in their priority value: | | | |
| /// PriorityEvent<int> tmp; | | | |
| /// MyClass myObject; | | | |
| /// tmp += priorityDelegate(&myObject, &MyClass::myMethod1, 1); | | | |
| /// tmp += priorityDelegate(&myObject, &MyClass::myMethod2, 2); | | | |
| { | | { | |
| public: | | public: | |
| PriorityEvent() | | PriorityEvent() | |
| { | | { | |
| } | | } | |
| | | | |
| ~PriorityEvent() | | ~PriorityEvent() | |
| { | | { | |
| } | | } | |
| | | | |
| | | | |
End of changes. 7 change blocks. |
| 18 lines changed or deleted | | 10 lines changed or added | |
|
| PriorityExpire.h | | PriorityExpire.h | |
| // | | // | |
| // PriorityExpire.h | | // PriorityExpire.h | |
| // | | // | |
|
| // $Id: //poco/1.4/Foundation/include/Poco/PriorityExpire.h#1 $ | | // $Id: //poco/1.4/Foundation/include/Poco/PriorityExpire.h#3 $ | |
| // | | // | |
| // Library: Foundation | | // Library: Foundation | |
| // Package: Events | | // Package: Events | |
| // Module: PriorityExpire | | // Module: PriorityExpire | |
| // | | // | |
| // Implementation of the PriorityExpire template. | | // Implementation of the PriorityExpire template. | |
| // | | // | |
|
| // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | | // Copyright (c) 2006-2011, 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 55 | | skipping to change at line 55 | |
| namespace Poco { | | namespace Poco { | |
| | | | |
| template <class TArgs> | | template <class TArgs> | |
| class PriorityExpire: public AbstractPriorityDelegate<TArgs> | | class PriorityExpire: public AbstractPriorityDelegate<TArgs> | |
| /// Decorator for AbstractPriorityDelegate adding automatic | | /// Decorator for AbstractPriorityDelegate adding automatic | |
| /// expiring of registrations to AbstractPriorityDelegate. | | /// expiring of registrations to AbstractPriorityDelegate. | |
| { | | { | |
| public: | | public: | |
| PriorityExpire(const AbstractPriorityDelegate<TArgs>& p, Timestamp::
TimeDiff expireMilliSec): | | PriorityExpire(const AbstractPriorityDelegate<TArgs>& p, Timestamp::
TimeDiff expireMilliSec): | |
| AbstractPriorityDelegate<TArgs>(p), | | AbstractPriorityDelegate<TArgs>(p), | |
|
| _pDelegate(p.clone()), | | _pDelegate(static_cast<AbstractPriorityDelegate<TArgs>*>(p.c
lone())), | |
| _expire(expireMilliSec*1000) | | _expire(expireMilliSec*1000) | |
| { | | { | |
| } | | } | |
| | | | |
| PriorityExpire(const PriorityExpire& expire): | | PriorityExpire(const PriorityExpire& expire): | |
| AbstractPriorityDelegate<TArgs>(expire), | | AbstractPriorityDelegate<TArgs>(expire), | |
|
| _pDelegate(expire._pDelegate->clone()), | | _pDelegate(static_cast<AbstractPriorityDelegate<TArgs>*>(exp
ire._pDelegate->clone())), | |
| _expire(expire._expire), | | _expire(expire._expire), | |
| _creationTime(expire._creationTime) | | _creationTime(expire._creationTime) | |
| { | | { | |
| } | | } | |
| | | | |
| ~PriorityExpire() | | ~PriorityExpire() | |
| { | | { | |
|
| destroy(); | | delete _pDelegate; | |
| } | | } | |
| | | | |
| PriorityExpire& operator = (const PriorityExpire& expire) | | PriorityExpire& operator = (const PriorityExpire& expire) | |
| { | | { | |
| if (&expire != this) | | if (&expire != this) | |
| { | | { | |
| delete this->_pDelegate; | | delete this->_pDelegate; | |
| this->_pTarget = expire._pTarget; | | this->_pTarget = expire._pTarget; | |
| this->_pDelegate = expire._pDelegate->clone(); | | this->_pDelegate = expire._pDelegate->clone(); | |
| this->_expire = expire._expire; | | this->_expire = expire._expire; | |
| | | | |
| skipping to change at line 94 | | skipping to change at line 94 | |
| } | | } | |
| | | | |
| bool notify(const void* sender, TArgs& arguments) | | bool notify(const void* sender, TArgs& arguments) | |
| { | | { | |
| if (!expired()) | | if (!expired()) | |
| return this->_pDelegate->notify(sender, arguments); | | return this->_pDelegate->notify(sender, arguments); | |
| else | | else | |
| return false; | | return false; | |
| } | | } | |
| | | | |
|
| | | bool equals(const AbstractDelegate<TArgs>& other) const | |
| | | { | |
| | | return other.equals(*_pDelegate); | |
| | | } | |
| | | | |
| AbstractPriorityDelegate<TArgs>* clone() const | | AbstractPriorityDelegate<TArgs>* clone() const | |
| { | | { | |
| return new PriorityExpire(*this); | | return new PriorityExpire(*this); | |
| } | | } | |
| | | | |
|
| void destroy() | | void disable() | |
| { | | { | |
|
| delete this->_pDelegate; | | _pDelegate->disable(); | |
| this->_pDelegate = 0; | | | |
| } | | } | |
| | | | |
|
| const AbstractPriorityDelegate<TArgs>& getDelegate() const | | const AbstractPriorityDelegate<TArgs>* unwrap() const | |
| { | | { | |
|
| return *this->_pDelegate; | | return this->_pDelegate; | |
| } | | } | |
| | | | |
| protected: | | protected: | |
| bool expired() const | | bool expired() const | |
| { | | { | |
| return _creationTime.isElapsed(_expire); | | return _creationTime.isElapsed(_expire); | |
| } | | } | |
| | | | |
| AbstractPriorityDelegate<TArgs>* _pDelegate; | | AbstractPriorityDelegate<TArgs>* _pDelegate; | |
| Timestamp::TimeDiff _expire; | | Timestamp::TimeDiff _expire; | |
| | | | |
End of changes. 10 change blocks. |
| 10 lines changed or deleted | | 14 lines changed or added | |
|
| RegularExpression.h | | RegularExpression.h | |
| // | | // | |
| // RegularExpression.h | | // RegularExpression.h | |
| // | | // | |
|
| // $Id: //poco/1.4/Foundation/include/Poco/RegularExpression.h#1 $ | | // $Id: //poco/1.4/Foundation/include/Poco/RegularExpression.h#2 $ | |
| // | | // | |
| // Library: Foundation | | // Library: Foundation | |
| // Package: RegExp | | // Package: RegExp | |
| // Module: RegularExpression | | // Module: RegularExpression | |
| // | | // | |
| // Definitions of class RegularExpression. | | // Definitions of class RegularExpression. | |
| // | | // | |
| // A wrapper class for Philip Hazel's PCRE - Perl Compatible Regular Expres
sions | | // A wrapper class for Philip Hazel's PCRE - Perl Compatible Regular Expres
sions | |
| // library (http://www.pcre.org). | | // library (http://www.pcre.org). | |
| // | | // | |
| | | | |
| skipping to change at line 81 | | skipping to change at line 81 | |
| /// | | /// | |
| /// * Options marked [ctor] can be passed to the construct
or. | | /// * Options marked [ctor] can be passed to the construct
or. | |
| /// * Options marked [match] can be passed to match, extra
ct, split and subst. | | /// * Options marked [match] can be passed to match, extra
ct, split and subst. | |
| /// * Options marked [subst] can be passed to subst. | | /// * Options marked [subst] can be passed to subst. | |
| /// | | /// | |
| /// See the PCRE documentation for more information. | | /// See the PCRE documentation for more information. | |
| { | | { | |
| RE_CASELESS = 0x00000001, /// case insensitive matchi
ng (/i) [ctor] | | RE_CASELESS = 0x00000001, /// case insensitive matchi
ng (/i) [ctor] | |
| RE_MULTILINE = 0x00000002, /// enable multi-line mode;
affects ^ and $ (/m) [ctor] | | RE_MULTILINE = 0x00000002, /// enable multi-line mode;
affects ^ and $ (/m) [ctor] | |
| RE_DOTALL = 0x00000004, /// dot matches all charact
ers, including newline (/s) [ctor] | | RE_DOTALL = 0x00000004, /// dot matches all charact
ers, including newline (/s) [ctor] | |
|
| RE_EXTENDED = 0x00000004, /// totally ignore whitespa
ce (/x) [ctor] | | RE_EXTENDED = 0x00000008, /// totally ignore whitespa
ce (/x) [ctor] | |
| RE_ANCHORED = 0x00000010, /// treat pattern as if it
starts with a ^ [ctor, match] | | RE_ANCHORED = 0x00000010, /// treat pattern as if it
starts with a ^ [ctor, match] | |
| RE_DOLLAR_ENDONLY = 0x00000020, /// dollar matches end-of-s
tring only, not last newline in string [ctor] | | RE_DOLLAR_ENDONLY = 0x00000020, /// dollar matches end-of-s
tring only, not last newline in string [ctor] | |
| RE_EXTRA = 0x00000040, /// enable optional PCRE fu
nctionality [ctor] | | RE_EXTRA = 0x00000040, /// enable optional PCRE fu
nctionality [ctor] | |
| RE_NOTBOL = 0x00000080, /// circumflex does not mat
ch beginning of string [match] | | RE_NOTBOL = 0x00000080, /// circumflex does not mat
ch beginning of string [match] | |
| RE_NOTEOL = 0x00000100, /// $ does not match end of
string [match] | | RE_NOTEOL = 0x00000100, /// $ does not match end of
string [match] | |
| RE_UNGREEDY = 0x00000200, /// make quantifiers ungree
dy [ctor] | | RE_UNGREEDY = 0x00000200, /// make quantifiers ungree
dy [ctor] | |
| RE_NOTEMPTY = 0x00000400, /// empty string never matc
hes [match] | | RE_NOTEMPTY = 0x00000400, /// empty string never matc
hes [match] | |
| RE_UTF8 = 0x00000800, /// assume pattern and subj
ect is UTF-8 encoded [ctor] | | RE_UTF8 = 0x00000800, /// assume pattern and subj
ect is UTF-8 encoded [ctor] | |
| RE_NO_AUTO_CAPTURE = 0x00001000, /// disable numbered captur
ing parentheses [ctor, match] | | RE_NO_AUTO_CAPTURE = 0x00001000, /// disable numbered captur
ing parentheses [ctor, match] | |
| RE_NO_UTF8_CHECK = 0x00002000, /// do not check validity o
f UTF-8 code sequences [match] | | RE_NO_UTF8_CHECK = 0x00002000, /// do not check validity o
f UTF-8 code sequences [match] | |
| | | | |
End of changes. 2 change blocks. |
| 2 lines changed or deleted | | 2 lines changed or added | |
|
| RemoteSyslogChannel.h | | RemoteSyslogChannel.h | |
| // | | // | |
| // RemoteSyslogChannel.h | | // RemoteSyslogChannel.h | |
| // | | // | |
|
| // $Id: //poco/1.4/Net/include/Poco/Net/RemoteSyslogChannel.h#1 $ | | // $Id: //poco/1.4/Net/include/Poco/Net/RemoteSyslogChannel.h#2 $ | |
| // | | // | |
| // Library: Net | | // Library: Net | |
| // Package: Logging | | // Package: Logging | |
| // Module: RemoteSyslogChannel | | // Module: RemoteSyslogChannel | |
| // | | // | |
| // Definition of the RemoteSyslogChannel class. | | // Definition of the RemoteSyslogChannel 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 52 | | skipping to change at line 52 | |
| #include "Poco/Channel.h" | | #include "Poco/Channel.h" | |
| #include "Poco/Mutex.h" | | #include "Poco/Mutex.h" | |
| #include "Poco/Net/DatagramSocket.h" | | #include "Poco/Net/DatagramSocket.h" | |
| #include "Poco/Net/SocketAddress.h" | | #include "Poco/Net/SocketAddress.h" | |
| | | | |
| namespace Poco { | | namespace Poco { | |
| namespace Net { | | namespace Net { | |
| | | | |
| class Net_API RemoteSyslogChannel: public Poco::Channel | | class Net_API RemoteSyslogChannel: public Poco::Channel | |
| /// This Channel implements remote syslog logging over UDP according | | /// This Channel implements remote syslog logging over UDP according | |
|
| /// to the syslog Working Group Internet Draft: | | /// to RFC 5424 "The Syslog Protocol" | |
| /// "The syslog Protocol" <http://www.ietf.org/internet-drafts/draft | | /// and RFC 5426 "Transmission of syslog messages over UDP". | |
| -ietf-syslog-protocol-17.txt>, | | | |
| /// and "Transmission of syslog messages over UDP" <http://www.ietf. | | | |
| org/internet-drafts/draft-ietf-syslog-transport-udp-07.txt>. | | | |
| /// | | /// | |
|
| /// In addition, RemoteSyslogChannel also supports the "old" BSD sys
log | | /// In addition, RemoteSyslogListener also supports the "old" BSD sy
slog | |
| /// protocol, as described in RFC 3164. | | /// protocol, as described in RFC 3164. | |
| { | | { | |
| public: | | public: | |
| static const std::string BSD_TIMEFORMAT; | | static const std::string BSD_TIMEFORMAT; | |
| static const std::string SYSLOG_TIMEFORMAT; | | static const std::string SYSLOG_TIMEFORMAT; | |
| | | | |
| enum Severity | | enum Severity | |
| { | | { | |
| SYSLOG_EMERGENCY = 0, /// Emergency: system is unusable | | SYSLOG_EMERGENCY = 0, /// Emergency: system is unusable | |
| SYSLOG_ALERT = 1, /// Alert: action must be taken im
mediately | | SYSLOG_ALERT = 1, /// Alert: action must be taken im
mediately | |
| | | | |
| skipping to change at line 131 | | skipping to change at line 130 | |
| void log(const Message& msg); | | void log(const Message& msg); | |
| /// Sends the message's text to the syslog service. | | /// Sends the message's text to the syslog service. | |
| | | | |
| 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 value. | | /// Sets the property with the given value. | |
| /// | | /// | |
| /// The following properties are supported: | | /// The following properties are supported: | |
| /// * name: The name used to identify the source of
log messages. | | /// * name: The name used to identify the source of
log messages. | |
| /// * facility: The facility added to each log message.
See the Facility enumeration for a list of supported values. | | /// * facility: The facility added to each log message.
See the Facility enumeration for a list of supported values. | |
| /// The LOG_ prefix can be omitted and valu
es are case insensitive (e.g. a facility value "mail" is recognized as SYSL
OG_MAIL) | | /// The LOG_ prefix can be omitted and valu
es are case insensitive (e.g. a facility value "mail" is recognized as SYSL
OG_MAIL) | |
|
| /// * format: "bsd" (RFC 3164 format) or "new" (defau
lt) | | /// * format: "bsd"/"rfc3164" (RFC 3164 format) or "n
ew"/"rfc5424" (default) | |
| /// * loghost: The target IP address or host name wher
e log messages are sent. Optionally, a port number (separated | | /// * loghost: The target IP address or host name wher
e log messages are sent. Optionally, a port number (separated | |
| /// by a colon) can also be specified. | | /// by a colon) can also be specified. | |
| /// * host: (optional) Host name included in syslog
messages. If not specified, the host's real domain name or | | /// * host: (optional) Host name included in syslog
messages. If not specified, the host's real domain name or | |
| /// IP address will be used. | | /// IP address will be used. | |
| | | | |
| 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. | |
| | | | |
| static void registerChannel(); | | static void registerChannel(); | |
| /// Registers the channel with the global LoggingFactory. | | /// Registers the channel with the global LoggingFactory. | |
| | | | |
End of changes. 4 change blocks. |
| 8 lines changed or deleted | | 5 lines changed or added | |
|
| RemoteSyslogListener.h | | RemoteSyslogListener.h | |
| // | | // | |
| // RemoteSyslogListener.h | | // RemoteSyslogListener.h | |
| // | | // | |
|
| // $Id: //poco/1.4/Net/include/Poco/Net/RemoteSyslogListener.h#1 $ | | // $Id: //poco/1.4/Net/include/Poco/Net/RemoteSyslogListener.h#5 $ | |
| // | | // | |
| // Library: Net | | // Library: Net | |
| // Package: Logging | | // Package: Logging | |
| // Module: RemoteSyslogListener | | // Module: RemoteSyslogListener | |
| // | | // | |
| // Definition of the RemoteSyslogListener class. | | // Definition of the RemoteSyslogListener class. | |
| // | | // | |
|
| // Copyright (c) 2007, Applied Informatics Software Engineering GmbH. | | // Copyright (c) 2007-2011, 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 Net_RemoteSyslogListener_INCLUDED | | #ifndef Net_RemoteSyslogListener_INCLUDED | |
| #define Net_RemoteSyslogListener_INCLUDED | | #define Net_RemoteSyslogListener_INCLUDED | |
| | | | |
| #include "Poco/Net/Net.h" | | #include "Poco/Net/Net.h" | |
|
| #include "Poco/Thread.h" | | #include "Poco/Net/SocketAddress.h" | |
| | | #include "Poco/ThreadPool.h" | |
| #include "Poco/SplitterChannel.h" | | #include "Poco/SplitterChannel.h" | |
| #include "Poco/NotificationQueue.h" | | #include "Poco/NotificationQueue.h" | |
| | | | |
| namespace Poco { | | namespace Poco { | |
| namespace Net { | | namespace Net { | |
| | | | |
| class RemoteUDPListener; | | class RemoteUDPListener; | |
| class SyslogParser; | | class SyslogParser; | |
| | | | |
| class Net_API RemoteSyslogListener: public Poco::SplitterChannel | | class Net_API RemoteSyslogListener: public Poco::SplitterChannel | |
| /// RemoteSyslogListener implents listening for syslog messages | | /// RemoteSyslogListener implents listening for syslog messages | |
|
| /// sent over UDP, according to the syslog Working Group Internet Dr | | /// sent over UDP, according to RFC 5424 "The Syslog Protocol" | |
| aft: | | /// and RFC 5426 "Transmission of syslog messages over UDP". | |
| /// "The syslog Protocol" <http://www.ietf.org/internet-drafts/draft | | | |
| -ietf-syslog-protocol-17.txt>, | | | |
| /// and "Transmission of syslog messages over UDP" <http://www.ietf. | | | |
| org/internet-drafts/draft-ietf-syslog-transport-udp-07.txt>. | | | |
| /// | | /// | |
| /// In addition, RemoteSyslogListener also supports the "old" BSD sy
slog | | /// In addition, RemoteSyslogListener also supports the "old" BSD sy
slog | |
| /// protocol, as described in RFC 3164. | | /// protocol, as described in RFC 3164. | |
| /// | | /// | |
| /// The RemoteSyslogListener is a subclass of Poco::SplitterChannel. | | /// The RemoteSyslogListener is a subclass of Poco::SplitterChannel. | |
| /// Every received log message is sent to the channels registered | | /// Every received log message is sent to the channels registered | |
| /// with addChannel() or the "channel" property. | | /// with addChannel() or the "channel" property. | |
|
| | | /// | |
| | | /// Poco::Message objects created by RemoteSyslogListener will have | |
| | | /// the following named parameters: | |
| | | /// - addr: IP address of the host/interface sending the message. | |
| | | /// - host: host name; only for "new" syslog messages. | |
| | | /// - app: application name; only for "new" syslog messages. | |
| { | | { | |
| public: | | public: | |
| RemoteSyslogListener(); | | RemoteSyslogListener(); | |
| /// Creates the RemoteSyslogListener. | | /// Creates the RemoteSyslogListener. | |
| | | | |
| RemoteSyslogListener(Poco::UInt16 port); | | RemoteSyslogListener(Poco::UInt16 port); | |
|
| /// Creates the RemoteSyslogListener. | | /// Creates the RemoteSyslogListener, listening on the given | |
| | | port number. | |
| | | | |
| | | RemoteSyslogListener(Poco::UInt16 port, int threads); | |
| | | /// Creates the RemoteSyslogListener, listening on the given | |
| | | port number | |
| | | /// and using the number of threads for message processing. | |
| | | | |
| 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 value. | | /// Sets the property with the given value. | |
| /// | | /// | |
| /// The following properties are supported: | | /// The following properties are supported: | |
|
| /// * port: The UDP port number where to listen for UDP. | | /// * port: The UDP port number where to listen for UDP | |
| | | packets | |
| | | /// containing syslog messages. If 0 is specified, doe | |
| | | s not | |
| | | /// listen for UDP messages. | |
| | | /// * threads: The number of parser threads processing | |
| | | /// received syslog messages. Defaults to 1. A maximum | |
| | | /// of 16 threads is supported. | |
| | | | |
| 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. | |
| | | | |
| void open(); | | void open(); | |
| /// Starts the listener. | | /// Starts the listener. | |
| | | | |
| void close(); | | void close(); | |
| /// Stops the listener. | | /// Stops the listener. | |
| | | | |
|
| | | void processMessage(const std::string& messageText); | |
| | | /// Parses a single line of text containing a syslog message | |
| | | /// and sends it down the filter chain. | |
| | | | |
| | | void enqueueMessage(const std::string& messageText, const Poco::Net: | |
| | | :SocketAddress& senderAddress); | |
| | | /// Enqueues a single line of text containing a syslog messa | |
| | | ge | |
| | | /// for asynchronous processing by a parser thread. | |
| | | | |
| static void registerChannel(); | | static void registerChannel(); | |
| /// Registers the channel with the global LoggingFactory. | | /// Registers the channel with the global LoggingFactory. | |
| | | | |
| static const std::string PROP_PORT; | | static const std::string PROP_PORT; | |
|
| | | static const std::string PROP_THREADS; | |
| | | | |
| protected: | | protected: | |
| ~RemoteSyslogListener(); | | ~RemoteSyslogListener(); | |
| /// Destroys the RemoteSyslogListener. | | /// Destroys the RemoteSyslogListener. | |
| | | | |
| private: | | private: | |
| RemoteUDPListener* _pListener; | | RemoteUDPListener* _pListener; | |
| SyslogParser* _pParser; | | SyslogParser* _pParser; | |
|
| Poco::Thread _listener; | | Poco::ThreadPool _threadPool; | |
| Poco::Thread _parser; | | | |
| Poco::NotificationQueue _queue; | | Poco::NotificationQueue _queue; | |
| Poco::UInt16 _port; | | Poco::UInt16 _port; | |
|
| | | int _threads; | |
| }; | | }; | |
| | | | |
| } } // namespace Poco::Net | | } } // namespace Poco::Net | |
| | | | |
| #endif // Net_RemoteSyslogListener_INCLUDED | | #endif // Net_RemoteSyslogListener_INCLUDED | |
| | | | |
End of changes. 11 change blocks. |
| 13 lines changed or deleted | | 40 lines changed or added | |
|
| ServerApplication.h | | ServerApplication.h | |
| // | | // | |
| // ServerApplication.h | | // ServerApplication.h | |
| // | | // | |
|
| // $Id: //poco/1.4/Util/include/Poco/Util/ServerApplication.h#2 $ | | // $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 96 | | skipping to change at line 96 | |
| /// or as a service. | | /// or as a service. | |
| /// | | /// | |
| /// To run an application as a Windows service, it must be registere
d | | /// To run an application as a Windows service, it must be registere
d | |
| /// with the Windows Service Control Manager (SCM). To do this, the
application | | /// with the Windows Service Control Manager (SCM). To do this, the
application | |
| /// can be started from the command line, with the /registerService
option | | /// can be started from the command line, with the /registerService
option | |
| /// specified. This causes the application to register itself with t
he | | /// specified. This causes the application to register itself with t
he | |
| /// SCM, and then exit. Similarly, an application registered as a se
rvice can | | /// SCM, and then exit. Similarly, an application registered as a se
rvice can | |
| /// be unregistered, by specifying the /unregisterService option. | | /// be unregistered, by specifying the /unregisterService option. | |
| /// The file name of the application executable (excluding the .exe
suffix) | | /// The file name of the application executable (excluding the .exe
suffix) | |
| /// is used as the service name. Additionally, a more user-friendly
name can be | | /// is used as the service name. Additionally, a more user-friendly
name can be | |
|
| /// specified, using the /displayName option (e.g., /displayName="De | | /// specified, using the /displayName option (e.g., /displayName="De | |
| mo Service"). | | mo Service") | |
| | | /// and a service description can be added with the /description opt | |
| | | ion. | |
| /// The startup mode (automatic or manual) for the service can be sp
ecified | | /// The startup mode (automatic or manual) for the service can be sp
ecified | |
| /// with the /startup option. | | /// with the /startup option. | |
| /// | | /// | |
| /// An application can determine whether it is running as a service
by checking | | /// An application can determine whether it is running as a service
by checking | |
| /// for the "application.runAsService" configuration property. | | /// for the "application.runAsService" configuration property. | |
| /// | | /// | |
| /// if (config().getBool("application.runAsService", false)) | | /// if (config().getBool("application.runAsService", false)) | |
| /// { | | /// { | |
| /// // do service specific things | | /// // do service specific things | |
| /// } | | /// } | |
| | | | |
| skipping to change at line 218 | | skipping to change at line 219 | |
| #endif | | #endif | |
| | | | |
| bool hasConsole(); | | bool hasConsole(); | |
| bool isService(); | | bool isService(); | |
| void beService(); | | void beService(); | |
| void registerService(); | | void registerService(); | |
| void unregisterService(); | | void unregisterService(); | |
| void handleRegisterService(const std::string& name, const std::strin
g& value); | | void handleRegisterService(const std::string& name, const std::strin
g& value); | |
| void handleUnregisterService(const std::string& name, const std::str
ing& value); | | void handleUnregisterService(const std::string& name, const std::str
ing& value); | |
| void handleDisplayName(const std::string& name, const std::string& v
alue); | | void handleDisplayName(const std::string& name, const std::string& v
alue); | |
|
| | | void handleDescription(const std::string& name, const std::string& v
alue); | |
| void handleStartup(const std::string& name, const std::string& value
); | | void handleStartup(const std::string& name, const std::string& value
); | |
| | | | |
| Action _action; | | Action _action; | |
| std::string _displayName; | | std::string _displayName; | |
|
| | | std::string _description; | |
| std::string _startup; | | std::string _startup; | |
| | | | |
| static Poco::Event _terminated; | | static Poco::Event _terminated; | |
| static SERVICE_STATUS _serviceStatus; | | static SERVICE_STATUS _serviceStatus; | |
| static SERVICE_STATUS_HANDLE _serviceStatusHandle; | | static SERVICE_STATUS_HANDLE _serviceStatusHandle; | |
| #endif // _WIN32_WCE | | #endif // _WIN32_WCE | |
| static Poco::NamedEvent _terminate; | | static Poco::NamedEvent _terminate; | |
| #endif | | #endif | |
| }; | | }; | |
| | | | |
| | | | |
End of changes. 4 change blocks. |
| 3 lines changed or deleted | | 7 lines changed or added | |
|
| ServerSocket.h | | ServerSocket.h | |
| // | | // | |
| // ServerSocket.h | | // ServerSocket.h | |
| // | | // | |
|
| // $Id: //poco/1.4/Net/include/Poco/Net/ServerSocket.h#1 $ | | // $Id: //poco/1.4/Net/include/Poco/Net/ServerSocket.h#2 $ | |
| // | | // | |
| // Library: Net | | // Library: Net | |
| // Package: Sockets | | // Package: Sockets | |
| // Module: ServerSocket | | // Module: ServerSocket | |
| // | | // | |
| // Definition of the ServerSocket class. | | // Definition of the ServerSocket 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 110 | | skipping to change at line 110 | |
| | | | |
| virtual void bind(Poco::UInt16 port, bool reuseAddress = false); | | virtual void bind(Poco::UInt16 port, bool reuseAddress = false); | |
| /// Bind a local port to the socket. | | /// Bind a local port to the socket. | |
| /// | | /// | |
| /// This is usually only done when establishing a server | | /// This is usually only done when establishing a server | |
| /// socket. | | /// socket. | |
| /// | | /// | |
| /// If reuseAddress is true, sets the SO_REUSEADDR | | /// If reuseAddress is true, sets the SO_REUSEADDR | |
| /// socket option. | | /// socket option. | |
| | | | |
|
| | | virtual void bind6(const SocketAddress& address, bool reuseAddress = | |
| | | false, bool ipV6Only = false); | |
| | | /// Bind a local IPv6 address to the socket. | |
| | | /// | |
| | | /// This is usually only done when establishing a server | |
| | | /// socket. TCP clients should not bind a socket to a | |
| | | /// specific address. | |
| | | /// | |
| | | /// If reuseAddress is true, sets the SO_REUSEADDR | |
| | | /// socket option. | |
| | | /// | |
| | | /// The given address must be an IPv6 address. The | |
| | | /// IPPROTO_IPV6/IPV6_V6ONLY option is set on the socket | |
| | | /// according to the ipV6Only parameter. | |
| | | /// | |
| | | /// If the library has not been built with IPv6 support, | |
| | | /// a Poco::NotImplementedException will be thrown. | |
| | | | |
| | | virtual void bind6(Poco::UInt16 port, bool reuseAddress = false, boo | |
| | | l ipV6Only = false); | |
| | | /// Bind a local IPv6 port to the socket. | |
| | | /// | |
| | | /// This is usually only done when establishing a server | |
| | | /// socket. | |
| | | /// | |
| | | /// If reuseAddress is true, sets the SO_REUSEADDR | |
| | | /// socket option. | |
| | | /// | |
| | | /// The given address must be an IPv6 address. The | |
| | | /// IPPROTO_IPV6/IPV6_V6ONLY option is set on the socket | |
| | | /// according to the ipV6Only parameter. | |
| | | /// | |
| | | /// If the library has not been built with IPv6 support, | |
| | | /// a Poco::NotImplementedException will be thrown. | |
| | | | |
| virtual void listen(int backlog = 64); | | virtual void listen(int backlog = 64); | |
| /// Puts the socket into listening state. | | /// Puts the socket into listening state. | |
| /// | | /// | |
| /// The socket becomes a passive socket that | | /// The socket becomes a passive socket that | |
| /// can accept incoming connection requests. | | /// can accept incoming connection requests. | |
| /// | | /// | |
| /// The backlog argument specifies the maximum | | /// The backlog argument specifies the maximum | |
| /// number of connections that can be queued | | /// number of connections that can be queued | |
| /// for this socket. | | /// for this socket. | |
| | | | |
| | | | |
End of changes. 2 change blocks. |
| 1 lines changed or deleted | | 36 lines changed or added | |
|
| SocketDefs.h | | SocketDefs.h | |
| // | | // | |
| // SocketDefs.h | | // SocketDefs.h | |
| // | | // | |
|
| // $Id: //poco/1.4/Net/include/Poco/Net/SocketDefs.h#2 $ | | // $Id: //poco/1.4/Net/include/Poco/Net/SocketDefs.h#3 $ | |
| // | | // | |
| // 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 48 | | skipping to change at line 48 | |
| #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_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 | |
| | | | |
| skipping to change at line 101 | | skipping to change at line 102 | |
| #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_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 | |
| | | | |
| skipping to change at line 169 | | skipping to change at line 171 | |
| #if defined(POCO_OS_FAMILY_UNIX) | | #if defined(POCO_OS_FAMILY_UNIX) | |
| #include <net/if.h> | | #include <net/if.h> | |
| #endif | | #endif | |
| #if defined(sun) || defined(__APPLE__) | | #if defined(sun) || defined(__APPLE__) | |
| #include <sys/sockio.h> | | #include <sys/sockio.h> | |
| #include <sys/filio.h> | | #include <sys/filio.h> | |
| #endif | | #endif | |
| #define POCO_INVALID_SOCKET -1 | | #define POCO_INVALID_SOCKET -1 | |
| #define poco_socket_t int | | #define poco_socket_t int | |
| #define poco_socklen_t socklen_t | | #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 | |
| #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 | |
| | | | |
End of changes. 4 change blocks. |
| 1 lines changed or deleted | | 8 lines changed or added | |
|
| SocketImpl.h | | SocketImpl.h | |
| // | | // | |
| // SocketImpl.h | | // SocketImpl.h | |
| // | | // | |
|
| // $Id: //poco/1.4/Net/include/Poco/Net/SocketImpl.h#1 $ | | // $Id: //poco/1.4/Net/include/Poco/Net/SocketImpl.h#4 $ | |
| // | | // | |
| // Library: Net | | // Library: Net | |
| // Package: Sockets | | // Package: Sockets | |
| // Module: SocketImpl | | // Module: SocketImpl | |
| // | | // | |
| // Definition of the SocketImpl class. | | // Definition of the SocketImpl 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 105 | | skipping to change at line 105 | |
| virtual void bind(const SocketAddress& address, bool reuseAddress =
false); | | virtual void bind(const SocketAddress& address, bool reuseAddress =
false); | |
| /// Bind a local address to the socket. | | /// Bind a local address to the socket. | |
| /// | | /// | |
| /// This is usually only done when establishing a server | | /// This is usually only done when establishing a server | |
| /// socket. TCP clients should not bind a socket to a | | /// socket. TCP clients should not bind a socket to a | |
| /// specific address. | | /// specific address. | |
| /// | | /// | |
| /// If reuseAddress is true, sets the SO_REUSEADDR | | /// If reuseAddress is true, sets the SO_REUSEADDR | |
| /// socket option. | | /// socket option. | |
| | | | |
|
| | | virtual void bind6(const SocketAddress& address, bool reuseAddress = | |
| | | false, bool ipV6Only = false); | |
| | | /// Bind a local IPv6 address to the socket. | |
| | | /// | |
| | | /// This is usually only done when establishing a server | |
| | | /// socket. TCP clients should not bind a socket to a | |
| | | /// specific address. | |
| | | /// | |
| | | /// If reuseAddress is true, sets the SO_REUSEADDR | |
| | | /// socket option. | |
| | | /// | |
| | | /// The given address must be an IPv6 address. The | |
| | | /// IPPROTO_IPV6/IPV6_V6ONLY option is set on the socket | |
| | | /// according to the ipV6Only parameter. | |
| | | /// | |
| | | /// If the library has not been built with IPv6 support, | |
| | | /// a Poco::NotImplementedException will be thrown. | |
| | | | |
| virtual void listen(int backlog = 64); | | virtual void listen(int backlog = 64); | |
| /// Puts the socket into listening state. | | /// Puts the socket into listening state. | |
| /// | | /// | |
| /// The socket becomes a passive socket that | | /// The socket becomes a passive socket that | |
| /// can accept incoming connection requests. | | /// can accept incoming connection requests. | |
| /// | | /// | |
| /// The backlog argument specifies the maximum | | /// The backlog argument specifies the maximum | |
| /// number of connections that can be queued | | /// number of connections that can be queued | |
| /// for this socket. | | /// for this socket. | |
| | | | |
| | | | |
| skipping to change at line 348 | | skipping to change at line 365 | |
| /// Returns true iff the socket's connection is secure | | /// Returns true iff the socket's connection is secure | |
| /// (using SSL or TLS). | | /// (using SSL or TLS). | |
| | | | |
| int socketError(); | | int socketError(); | |
| /// Returns the value of the SO_ERROR socket option. | | /// Returns the value of the SO_ERROR socket option. | |
| | | | |
| 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(int 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(int 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. | |
| | | | |
| 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); | |
| | | | |
| skipping to change at line 393 | | skipping to change at line 410 | |
| /// AF_INET6. | | /// AF_INET6. | |
| /// | | /// | |
| /// The second argument, type, specifies the type of the | | /// The second argument, type, specifies the type of the | |
| /// socket, which can be one of SOCK_STREAM, SOCK_DGRAM | | /// socket, which can be one of SOCK_STREAM, SOCK_DGRAM | |
| /// or SOCK_RAW. | | /// or SOCK_RAW. | |
| /// | | /// | |
| /// The third argument, proto, is normally set to 0, | | /// The third argument, proto, is normally set to 0, | |
| /// except for raw sockets. | | /// except for raw sockets. | |
| | | | |
| void reset(poco_socket_t fd = POCO_INVALID_SOCKET); | | void reset(poco_socket_t fd = POCO_INVALID_SOCKET); | |
|
| /// Allows subclasses to set the socket manually, iff no val
id socket is set yet! | | /// Allows subclasses to set the socket manually, iff no val
id socket is set yet. | |
| | | | |
| static int lastError(); | | static int lastError(); | |
| /// Returns the last error code. | | /// Returns the last error code. | |
| | | | |
| static void error(); | | static void error(); | |
| /// Throws an appropriate exception for the last error. | | /// Throws an appropriate exception for the last error. | |
| | | | |
| static void error(const std::string& arg); | | static void error(const std::string& arg); | |
| /// Throws an appropriate exception for the last error. | | /// Throws an appropriate exception for the last error. | |
| | | | |
| | | | |
End of changes. 5 change blocks. |
| 4 lines changed or deleted | | 22 lines changed or added | |
|
| TemporaryFile.h | | TemporaryFile.h | |
| // | | // | |
| // TemporaryFile.h | | // TemporaryFile.h | |
| // | | // | |
|
| // $Id: //poco/1.4/Foundation/include/Poco/TemporaryFile.h#1 $ | | // $Id: //poco/1.4/Foundation/include/Poco/TemporaryFile.h#2 $ | |
| // | | // | |
| // Library: Foundation | | // Library: Foundation | |
| // Package: Filesystem | | // Package: Filesystem | |
| // Module: TemporaryFile | | // Module: TemporaryFile | |
| // | | // | |
| // Definition of the TemporaryFile class. | | // Definition of the TemporaryFile 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 | |
| /// 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); | |
| | | /// 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 | |
| /// the destructor. | | /// the destructor. | |
| | | | |
| void keepUntilExit(); | | void keepUntilExit(); | |
| /// Disables automatic deletion of the file in | | /// Disables automatic deletion of the file in | |
| /// the destructor, but registers the file | | /// the destructor, but registers the file | |
| /// for deletion at process termination. | | /// for deletion at process termination. | |
| | | | |
| static void registerForDeletion(const std::string& path); | | static void registerForDeletion(const std::string& path); | |
| /// Registers the given file for deletion | | /// Registers the given file for deletion | |
| /// at process termination. | | /// at process termination. | |
| | | | |
|
| static std::string tempName(); | | static std::string tempName(const std::string& tempDir = ""); | |
| /// Returns a unique path name for a temporary | | /// Returns a unique path name for a temporary | |
|
| /// file in the system's scratch directory | | /// file in the system's scratch directory (see Path::temp() | |
| /// (see Path::temp()). | | ) | |
| | | /// if tempDir is empty or in the directory specified in tem | |
| | | pDir | |
| | | /// otherwise. | |
| | | | |
| private: | | private: | |
| bool _keep; | | bool _keep; | |
| }; | | }; | |
| | | | |
| } // namespace Poco | | } // namespace Poco | |
| | | | |
| #endif // Foundation_TemporaryFile_INCLUDED | | #endif // Foundation_TemporaryFile_INCLUDED | |
| | | | |
End of changes. 4 change blocks. |
| 4 lines changed or deleted | | 10 lines changed or added | |
|
| Thread.h | | Thread.h | |
| // | | // | |
| // Thread.h | | // Thread.h | |
| // | | // | |
|
| // $Id: //poco/1.4/Foundation/include/Poco/Thread.h#1 $ | | // $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 50 | | skipping to change at line 50 | |
| | | | |
| #include "Poco/Foundation.h" | | #include "Poco/Foundation.h" | |
| #include "Poco/Mutex.h" | | #include "Poco/Mutex.h" | |
| | | | |
| #if defined(POCO_OS_FAMILY_WINDOWS) | | #if defined(POCO_OS_FAMILY_WINDOWS) | |
| #if defined(_WIN32_WCE) | | #if defined(_WIN32_WCE) | |
| #include "Poco/Thread_WINCE.h" | | #include "Poco/Thread_WINCE.h" | |
| #else | | #else | |
| #include "Poco/Thread_WIN32.h" | | #include "Poco/Thread_WIN32.h" | |
| #endif | | #endif | |
|
| | | #elif defined(POCO_VXWORKS) | |
| | | #include "Poco/Thread_VX.h" | |
| #else | | #else | |
| #include "Poco/Thread_POSIX.h" | | #include "Poco/Thread_POSIX.h" | |
| #endif | | #endif | |
| | | | |
| namespace Poco { | | namespace Poco { | |
| | | | |
| class Runnable; | | class Runnable; | |
| class ThreadLocalStorage; | | class ThreadLocalStorage; | |
| | | | |
| class Foundation_API Thread: private ThreadImpl | | class Foundation_API Thread: private ThreadImpl | |
| | | | |
| skipping to change at line 102 | | skipping to change at line 104 | |
| int id() const; | | int id() const; | |
| /// Returns the unique thread ID of the thread. | | /// Returns the unique thread ID of the thread. | |
| | | | |
| TID tid() const; | | TID tid() const; | |
| /// Returns the native thread ID of the thread. | | /// Returns the native thread ID of the thread. | |
| | | | |
| std::string name() const; | | std::string name() const; | |
| /// Returns the name of the thread. | | /// Returns the name of the thread. | |
| | | | |
| std::string getName() const; | | std::string getName() const; | |
|
| /// Returns teh name of the thread. | | /// Returns the name of the thread. | |
| | | | |
| void setName(const std::string& name); | | void setName(const std::string& name); | |
| /// Sets the name of the thread. | | /// Sets the name of the thread. | |
| | | | |
| void setPriority(Priority prio); | | void setPriority(Priority prio); | |
| /// Sets the thread's priority. | | /// Sets the thread's priority. | |
| /// | | /// | |
| /// Some platform only allow changing a thread's priority | | /// Some platform only allow changing a thread's priority | |
| /// if the process has certain privileges. | | /// if the process has certain privileges. | |
| | | | |
| | | | |
End of changes. 3 change blocks. |
| 2 lines changed or deleted | | 4 lines changed or added | |
|
| Version.h | | Version.h | |
| // | | // | |
| // Version.h | | // Version.h | |
| // | | // | |
|
| // $Id: //poco/1.4/Foundation/include/Poco/Version.h#4 $ | | // $Id: //poco/1.4/Foundation/include/Poco/Version.h#7 $ | |
| // | | // | |
| // 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-2010, Applied Informatics Software Engineering GmbH. | | // Copyright (c) 2004-2011, 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 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 0x01040100 | | #define POCO_VERSION 0x01040200 | |
| | | | |
| #endif // Foundation_Version_INCLUDED | | #endif // Foundation_Version_INCLUDED | |
| | | | |
End of changes. 3 change blocks. |
| 3 lines changed or deleted | | 3 lines changed or added | |
|