Code

manually merging the INKBOARD_PEDRO branch into trunk
[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         {}
51     
52     KeyNodeTable(const KeyNodeTable &other)
53         {
54         items = other.items;
55         }
56         
57     virtual ~KeyNodeTable()
58         {}
59         
60     virtual void clear();
61         
62     virtual void append(const KeyNodeTable &other);
64     virtual void put(const KeyNodePair &pair);
65     
66     virtual void put(const Glib::ustring &key, const XML::Node *node);
67     
68     virtual XML::Node * get(const Glib::ustring &key) const;
69     
70     virtual void remove(const Glib::ustring &key);
72     virtual Glib::ustring get(XML::Node *node) const;
73     
74     virtual void remove(XML::Node *node);
76     virtual unsigned int size() const;
77     
78     virtual KeyNodePair item(unsigned int index) const;
80 private:
82     std::vector<KeyNodePair> items;
84 };
88 } // namespace Whiteboard
90 } // namespace Inkscape
93 #endif /* __KEY_NODE_H__ */