-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_dictionary.hpp
48 lines (41 loc) · 1.06 KB
/
main_dictionary.hpp
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
#ifndef MAIN_DICTIONARY_H_
#define MAIN_DICTIONARY_H_
#include "dictionary.hpp"
class Dictionaries
{
private:
std::vector<Dictionary*> arr;
Dictionary* data = nullptr;
bool rebuild_mode = true;
public:
Dictionaries() = default;
~Dictionaries()
{
if (rebuild_mode)
{
for (unsigned long long i = 0; i < arr.size(); i++)
delete arr[i];
}
else
delete data;
}
void switch_dataset(std::string new_dir, char delim)
{
if (rebuild_mode)
{
if (data && new_dir != data->pathCurrentDataset)
delete data;
data = new Dictionary(new_dir, delim);
}
else if (!rebuild_mode)
{
for (unsigned long long i = 0; i < arr.size(); i++)
{
if (arr[i]->pathCurrentDataset == new_dir)
return;
}
arr.push_back(new Dictionary(new_dir, delim));
}
}
};
#endif // !MAIN_DICTIONARY