-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTitlesClass_Constructor.cpp
48 lines (46 loc) · 1.14 KB
/
TitlesClass_Constructor.cpp
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
#include <fstream>
#include <string>
#include "Prototypes.h"
#include "TitlesClass.h"
TitlesClass::TitlesClass
(const char* Filename_Titles, const char* Filename_Titles_Actors)
{
NAME_TYPE LastName;
TITLE_TYPE LastTitle,
MaxTitle = 0;
ifstream File(Filename_Titles);
string Word;
File.ignore(MAX_LINE_LENGTH,'\n');
while(File >> Word)
{
LastTitle = GetTitle(Word);
if(LastTitle > MaxTitle) MaxTitle = LastTitle;
File >> Word;
if(IsMovie(Word))
{
#ifdef FILTER_ADULT
File.ignore();
File.ignore(MAX_LINE_LENGTH,'\t');
File.ignore(MAX_LINE_LENGTH,'\t');
if(File.get() == '0') RealMovies.push_back(LastTitle);
#else
RealMovies.push_back(LastTitle);
#endif
}
File.ignore(MAX_LINE_LENGTH,'\n');
}
File.close();
Array = new vector<NAME_TYPE>[MaxTitle];
File.open(Filename_Titles_Actors);
File.ignore(MAX_LINE_LENGTH,'\n');
while(File >> Word)
{
LastTitle = GetTitle(Word);
File >> Word;
File >> Word;
LastName = GetName(Word);
File >> Word;
if(IsActorOrActress(Word)) Array[LastTitle].push_back(LastName);
File.ignore(MAX_LINE_LENGTH,'\n');
}
}