-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFile.h
43 lines (33 loc) · 934 Bytes
/
File.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
#ifndef FILE_H_12122013
#define FILE_H_12122013
#include <string>
#include "Node.h"
#include "Visitor.h"
class Directory;
class File : public Node {
std::string name;
std::string date_created;
int file_size;
File(const File&); // can't have duplicate files
public:
File(const std::string& file_name, const std::string& created_date, int size) : name(file_name), date_created(created_date), file_size(size)
{
}
virtual std::string getName() const throw(node_logic_error)
{
return name;
}
virtual std::string getDateCreated() const throw(node_logic_error)
{
return date_created;
}
virtual long getSize() const throw(node_logic_error)
{
return file_size;
}
virtual void accept(Visitor &v) const //++
{
v.visit(this); // implies that visit() has a prototype of "visit(const Node&)"
}
};
#endif