blob: 02fea00502c6173e659105762717e4de04680272 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
/**
* Whiteboard session manager
* XML node tracking facility
*
* Authors:
* David Yip <yipdw@rose-hulman.edu>
*
* Copyright (c) 2005 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifndef __WHITEBOARD_TRACKER_NODE_H__
#define __WHITEBOARD_TRACKER_NODE_H__
#include "xml/node.h"
#include "gc-managed.h"
#include "gc-finalized.h"
#include <glibmm.h>
#include <bitset>
namespace Inkscape {
namespace Whiteboard {
// set _size in TrackerNode private members if you add or delete
// any more listeners
enum ListenerType {
ATTR_CHANGED,
CHILD_ADDED,
CHILD_REMOVED,
CHILD_ORDER_CHANGED,
CONTENT_CHANGED
};
struct TrackerNode : public GC::Managed<> {
public:
TrackerNode(XML::Node const* n) : _node(n)
{
}
virtual ~TrackerNode()
{
}
void lock(ListenerType listener)
{
if (listener < _size) {
this->_listener_locks.set(listener, true);
}
}
void unlock(ListenerType listener)
{
if (listener < _size) {
this->_listener_locks.set(listener, false);
}
}
bool isLocked(ListenerType listener)
{
return (this->_listener_locks[listener]);
}
XML::Node const* _node;
private:
// change this if any other flags are added
static unsigned short const _size = 5;
std::bitset< _size > _listener_locks;
// noncopyable, nonassignable
TrackerNode(TrackerNode const&);
TrackerNode& operator=(TrackerNode const&);
};
}
}
#endif
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
|