-
Notifications
You must be signed in to change notification settings - Fork 2
/
Link.h
75 lines (57 loc) · 1.68 KB
/
Link.h
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
#ifndef Link_h_adlkskjflsd
#define Link_h_adlkskjflsd
#include "Node.h"
class Link : public Node {
private:
Node *pSubject;
Node *operator->();
public:
Link(const std::string& name, Node *p);
Node *getRealSubject() const;
// fwd all other operations to pSubject
void adopt(Node* p) throw(node_logic_error);
void orphan(Node *pnode) throw(node_logic_error, std::invalid_argument);
Node *getChild(int i) throw(node_logic_error, std::out_of_range);
std::string getName() const throw(node_logic_error);
std::string getDateCreated() const throw(node_logic_error);
long getSize() const throw(node_logic_error);
void accept(Visitor& v);
};
inline Link::Link(const std::string& name, Node *p) : pSubject(p) {}
inline Node* Link::getRealSubject() const
{
return pSubject;
}
inline Node *Link::operator->()
{
return getRealSubject();
}
inline void Link::adopt(Node* p) throw(node_logic_error)
{
return getRealSubject()->adopt(p);
}
inline void Link::orphan(Node *pnode) throw(node_logic_error, std::invalid_argument)
{
return getRealSubject()->orphan(pnode);
}
inline Node *Link::getChild(int i) throw(node_logic_error, std::out_of_range)
{
return getRealSubject()->getChild(i);
}
inline std::string Link::getName() const throw(node_logic_error)
{
return getRealSubject()->getName();
}
inline std::string Link::getDateCreated() const throw(node_logic_error)
{
return getRealSubject()->getDateCreated();
}
inline long Link::getSize() const throw(node_logic_error)
{
return getRealSubject()->getSize();
}
inline void Link::accept(Visitor& v)
{
return getRealSubject()->accept(v);
}
#endif