-
Notifications
You must be signed in to change notification settings - Fork 0
/
repository.h
67 lines (57 loc) · 1.7 KB
/
repository.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
#pragma once
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include "recording.h"
using namespace std;
class Repository {
protected:
vector<Recording> watch_list;
unsigned int selected_recording;
public:
virtual void add(Recording r) = 0;
virtual void remove(string title) = 0;
virtual vector<Recording> get_watchlist() = 0;
virtual string next() = 0;
virtual void save() = 0;
virtual ~Repository() {}
};
class MemoryRepository: public Repository {
private:
vector<Recording> container;
public:
MemoryRepository();
void add(Recording r);
vector<Recording> get_container();
void remove(string title);
string next();
void save();
vector<Recording> get_watchlist();
bool search(string title);
~MemoryRepository();
};
class FileRepository: public Repository {
private:
string filename, watchlist_filename;
unsigned int number_of_elements;
public:
FileRepository(string filename);
void add(Recording r);
void remove(string title);
string next();
void save();
vector<Recording> get_watchlist();
bool search(string title);
string get_filename();
void set_filename(string new_filename);
string get_watchlist_filename();
void set_watchlist_filename(string new_filename);
vector<string> tokenize(string line, char delimiter);
std::string strip(std::string str);
int get_number_of_elements();
void update_watchlist_html_file();
void update_watchlist_csv_file();
friend ostream& operator<<(ostream& out, Recording& recording);
~FileRepository();
};