Code

Changes to the document are registered through inkboard-session, inkboard-node extend...
[inkscape.git] / src / jabber_whiteboard / keynode.h
1 /**
2  * Inkscape::Whiteboard::KeyNodeTable - structure for lookup of values from keys
3  * and vice versa
4  *
5  * Authors:
6  * Bob Jamison
7  *
8  * Copyright (c) 2005 Authors
9  */
10 #ifndef __KEY_NODE_H__
11 #define __KEY_NODE_H__
13 #include <glibmm.h>
15 #include <vector>
17 #include "xml/node.h"
20 namespace Inkscape
21 {
22 namespace Whiteboard
23 {
26 class KeyNodePair
27 {
28 public:
29    KeyNodePair(const Glib::ustring &keyArg, const XML::Node *nodeArg)
30        {
31        key  = keyArg; 
32        node = (XML::Node *)nodeArg;
33        }
34    KeyNodePair(const KeyNodePair &other)
35        {
36        key  = other.key; 
37        node = other.node;
38        }
39    virtual ~KeyNodePair()
40        {}
41    Glib::ustring key;
42    XML::Node *node;
43 };
45 class KeyNodeTable
46 {
47 public:
49     KeyNodeTable()
50         { this->counter = 0; }
52     KeyNodeTable(const KeyNodeTable &other)
53         {
54         items = other.items;
55         this->counter = 0;
56         }
58     virtual ~KeyNodeTable()
59         {}
61     virtual void clear();
63     virtual void append(const KeyNodeTable &other);
65     virtual void put(const KeyNodePair &pair);
67     virtual void put(const Glib::ustring &key, const XML::Node *node);
69     virtual XML::Node * get(const Glib::ustring &key) const;
71     virtual void remove(const Glib::ustring &key);
73     virtual Glib::ustring get(XML::Node *node) const;
75     virtual void remove(XML::Node *node);
77     virtual unsigned int size() const;
79     virtual KeyNodePair item(unsigned int index) const;
81     virtual Glib::ustring generateKey(Glib::ustring);
83 private:
85     std::vector<KeyNodePair> items;
87     unsigned int counter;
89 };
93 } // namespace Whiteboard
95 } // namespace Inkscape
98 #endif /* __KEY_NODE_H__ */