Code

SP_DT_DOCUMENT -> sp_desktop_document
[inkscape.git] / src / jabber_whiteboard / node-tracker-event-tracker.h
1 /**
2  * Tracks node add/remove events to an XMLNodeTracker, and eliminates cases such as
3  * consecutive add/remove.
4  *
5  * Authors:
6  * David Yip <yipdw@rose-hulman.edu>
7  *
8  * Copyright (c) 2005 Authors
9  *
10  * Released under GNU GPL, read the file 'COPYING' for more information
11  */
13 #ifndef __WHITEBOARD_NODE_TRACKER_EVENT_TRACKER_H__
14 #define __WHITEBOARD_NODE_TRACKER_EVENT_TRACKER_H__
16 #include <map>
18 #include "jabber_whiteboard/typedefs.h"
20 namespace Inkscape {
22 namespace Whiteboard {
24 typedef std::pair< XML::Node*, std::string > NodeKeyPair;
25 typedef std::map< XML::Node*, NodeTrackerAction > NodeActionMap;
27 class NodeTrackerEventTracker {
28 public:
29         NodeTrackerEventTracker() { }
30         ~NodeTrackerEventTracker() { }
31         bool tryToTrack(XML::Node* node, NodeTrackerAction action);
33         NodeTrackerAction getAction(XML::Node const* node)
34         {
35                 NodeActionMap::iterator i = this->_actions.find(const_cast< XML::Node* >(node));
36                 if (i != this->_actions.end()) {
37                         return i->second;
38                 } else {
39                         return NODE_UNKNOWN;
40                 }
41         }
43         void clear()
44         {
45                 this->_actions.clear();
46         }
47 private:
48         NodeActionMap _actions;
49 };
51 }
53 }
55 #endif
57 /*
58   Local Variables:
59   mode:c++
60   c-file-style:"stroustrup"
61   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
62   indent-tabs-mode:nil
63   fill-column:99
64   End:
65 */
66 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :