-
Notifications
You must be signed in to change notification settings - Fork 0
/
Movie.h
95 lines (73 loc) · 2.64 KB
/
Movie.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#pragma once
#include <iostream>
#include <vector>
# include <string>
#include <fstream>
#include <sstream>
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <stdexcept>
#include <cctype>
//creating Movie class
/*
* the excel file contains database for movies including:
* 1- movie name
* 2- Year
* 3- Genres
* 4- Runtime
* 5- Rating
* 6- movie poster link
* 7- writers
* 8- cast
*/
class Movie
{
std::string movieName;
int year;
std::string genre;
int RunTime;
double rate;
std::string writers;
std::string summary;
public:
//declaring a constructor to take the information for the movie object
Movie(std::string& movieName, int year, std::string& genre, int RunTime, double rate, std::string& writres, std::string& summary);
// declare getters
std:: string getMovieName() const;
int getYear() const;
std::string getGenre() const;
int getRuntime() const;
double getRating() const;
std::string getWriters() const;
std::string getSummary() const;
// declare setters
void setMovieName(const std::string& movieName);
void setYear(int year);
void setGenre(const std::string& genre);
void setRuntime(int RunTime);
void setRate(double rate);
void setWriters(const std::string& writers);
void setSummary(const std::string& summgary);
// friend function to be able to access the class private attributes
friend void printMovieList(const std::vector<Movie*>& movies);
};
// read movie data function declaration
std::vector<Movie*> ReadMoviesFromFile(const std::string& filename);
//printing the movie list function declaration
void printMovieList(const std::vector<Movie*>& movies);
//print movie details
void printMovieDetails(const Movie* movie);
//function to get random movie and retuuns a pointer to that movie
Movie* generateRandomMovie(const std::vector<Movie*>& movies);
//function to return top 10 movies by rating of a given year
std::vector<Movie*> GetTopRatedMoviesByYear(const std::vector<Movie*>& movies);
// function that return a movie depending on user preference on genre and year
Movie* GenerateRandomMovieByGenreAndYear(const std::vector<Movie*>& movies);
// function to search in the vector depeending on the user choice
std::vector<Movie*> searchMovies(const std::vector<Movie*>& movieList);
// valid year check
int get_ValidYear();
// functions to handle the user interface, showing the menu of options available and handling the choice of the user
int viewMenu();
bool handleMenu(int choice, std::vector<Movie*>& movies);