-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProxy.cpp
More file actions
86 lines (66 loc) · 1.32 KB
/
Proxy.cpp
File metadata and controls
86 lines (66 loc) · 1.32 KB
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
#include "Proxy.h"
#include "AbstractFileVisitor.h"
#include<iostream>
using namespace std;
Proxy::Proxy(AbstractFile* af) : name(af->getName()),file(af), parent(nullptr)
{
count = new int(1);
cout << *count << endl;
}
Proxy::Proxy(Proxy* pf) : name(pf->getName()),file(pf->file), parent(nullptr)
{
//count = new int(pf->getCount() + 1);
count = pf->getCount();
(*count)++;
}
Proxy::~Proxy()
{
(*count)--;
if ((*count) == 0) {
delete file;
}
}
unsigned int Proxy::getSize() {
return file->getSize();
}
string Proxy::getName() {
return file->getName();
}
vector<char> Proxy::read() {
return file->read();
}
void Proxy::accept(AbstractFileVisitor* fv) {
file->accept(fv);
}
int Proxy::write(vector<char> data) {
return file->write(data);
}
int Proxy::append(vector<char> data) {
return unabletoappend;
}
/*
size_t Proxy::coordsToIndex(size_t x, size_t y) {
return file->coordsToIndex(x, y);
}*/
int Proxy::addChild(AbstractFile*) {
return notacomposite;
}
int Proxy::removeChild(string name) {
return notacomposite;
}
AbstractFile* Proxy::getChild(std::string name) {
return nullptr;
}
AbstractFile* Proxy::getParent() {
return parent;
}
void Proxy::setParent(AbstractFile* p) {
parent = p;
}
Proxy* Proxy::clone() {
Proxy* temp = new Proxy(this);
return temp;
}
int* Proxy::getCount() {
return count;
}