~valavanisalex/ubuntu/precise/inkscape/fix-943984

« back to all changes in this revision

Viewing changes to inkscape-0.47pre1/src/jabber_whiteboard/tracker-node.h

  • Committer: Bazaar Package Importer
  • Author(s): Bryce Harrington
  • Date: 2009-07-02 17:09:45 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20090702170945-nn6d6zswovbwju1t
Tags: 0.47~pre1-0ubuntu1
* New upstream release.
  - Don't constrain maximization on small resolution devices (pre0)
    (LP: #348842)
  - Fixes segfault on startup (pre0)
    (LP: #391149)

Show diffs side-by-side

added added

removed removed

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