blob: 64c8207329b6aaa35499dc7a8e6736d32a47acb1 (
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
/**
* Inkscape::Whiteboard::KeyNodeTable - structure for lookup of values from keys
* and vice versa
*
* Authors:
* Bob Jamison
*
* Copyright (c) 2005 Authors
*/
#ifndef __KEY_NODE_H__
#define __KEY_NODE_H__
#include <glibmm.h>
#include <vector>
#include "xml/node.h"
#include "jabber_whiteboard/defines.h"
namespace Inkscape
{
namespace Whiteboard
{
class KeyNodePair
{
public:
KeyNodePair(const Glib::ustring &keyArg, const XML::Node *nodeArg)
{
this->key = keyArg;
this->node = (XML::Node *)nodeArg;
this->version = 0;
this->index = 0;
this->history.push_back(Configure("",""));
}
KeyNodePair(const Glib::ustring &keyArg, const XML::Node *nodeArg,
unsigned int version, signed int index)
{
this->key = keyArg;
this->node = (XML::Node *)nodeArg;
this->version = version;
this->index = index;
this->history.push_back(Configure("",""));
}
KeyNodePair(const KeyNodePair &other)
{
this->key = other.key;
this->node = other.node;
this->version = other.version;
this->index = other.index;
this->history = other.history;
}
virtual ~KeyNodePair() {}
Glib::ustring key;
XML::Node *node;
unsigned int version;
signed int index;
std::list< Configure > history;
};
class KeyNodeTable
{
public:
KeyNodeTable()
{ this->counter = 0; }
KeyNodeTable(const KeyNodeTable &other)
{
items = other.items;
this->counter = 0;
}
virtual ~KeyNodeTable()
{}
virtual void clear();
virtual void append(const KeyNodeTable &other);
virtual void put(const KeyNodePair &pair);
virtual void put(const Glib::ustring &key, const XML::Node *node);
virtual XML::Node * get(const Glib::ustring &key) const;
virtual void remove(const Glib::ustring &key);
virtual Glib::ustring get(XML::Node *node) const;
virtual void remove(XML::Node *node);
virtual unsigned int size() const;
virtual KeyNodePair item(unsigned int index) const;
virtual Glib::ustring generateKey(Glib::ustring);
virtual unsigned int getVersion(XML::Node *node);
virtual unsigned int incrementVersion(XML::Node *node);
virtual void addHistory(XML::Node *node, Glib::ustring attribute, Glib::ustring value);
virtual Glib::ustring getLastHistory(XML::Node *node, Glib::ustring attribute);
private:
std::vector<KeyNodePair> items;
unsigned int counter;
};
} // namespace Whiteboard
} // namespace Inkscape
#endif /* __KEY_NODE_H__ */
|