movie.cpp File Reference
`#include "movie.h"`

## Functions

string | getMovieByPosition (int position, filemanip &file)
| Finds a movie in position position of a file and returns the name of the movie. More...
string | getMovieByName (string moviename, filemanip &file)
| Finds the information of a movie given its name. More...
void | showMovie (string movieinfo)
| Display the movie information of a | separated line with movie info. Example line: Ninja Turtles: The Next Mutation, Vol. 1|Shout! Factory||Out|2.0|4:3|19.93|NR|1997|. More...
void | showMovies (filemanip &file, int start, int end)
| Display the information of the movies in a file from line start to line end. More...
void | showMovies (filemanip &file, string keyword)
| Display the information of the movies whose name contains a given keyword. More...
string | getMovieName (string movieinfo)
| Given a movie line from the file returns the movie name. More...
string | getMovieRating (string movieinfo)
| Given a movie line from the file returns the movie rating. More...
string | getMovieYear (string movieinfo)
| Given a movie line from the file returns the movie release year. More...
string | getMovieGenre (string movieinfo)
| Given a movie line from the file returns the movie genre. More...
void | getMovieInfo (string movieinfo, string &name, string &rating, string &year, string &genre)
| Given a movie line from the file returns by reference the movie name, rating, year, and genre. More...
string | getMovieStudio (string movieinfo)
| Given a movie line from the file returns the movie studio. Answer to (Exercise 3, question 1) More...
void | getMovieInfo (string movieinfo, string &name, string &rating, string &year, string &genre, string &studio)
| Given a movie line from the file returns by reference the movie name, rating, year, genre, and studio. Answer to (Exercise 3, question 2) More...
void | showMovieInLine (string movieinfo)
| Display the movie information of a | separated line with movie info. The info is displayed in one line identified by its fields. Answer to (Exercise 3, question 3) More...
void | showMoviesInLine (filemanip &file, int start, int end)
| Display the information of the movies in a file from line start to line end. The information is displayed in one line. Answer to (Exercise 3, question 4) More...

## Function Documentation

string getMovieByName | ( | string | moviename,
|  | filemanip & | file
| ) |  |

Finds the information of a movie given its name.

Parameters

  moviename | The name of the movie
  file | A file pointer

Returns
  One line with the information of the movie separated by | (pipes)

string getMovieByPosition | ( | int | position,
|  | filemanip & | file
| ) |  |

Finds a movie in position position of a file and returns the name of the movie.

Parameters

  position | Position of the movie in the file
  file | A file pointer

Returns
  The name of the movie

string getMovieGenre | ( | string | movieinfo | ) |

Given a movie line from the file returns the movie genre.

Parameters

  movieinfo | The information of the movie in one line separated by |

Returns
  The movie genre.

void getMovieInfo | ( | string | movieinfo,
|  | string & | name,
|  | string & | rating,
|  | string & | year,
|  | string & | genre
| ) |  |

Given a movie line from the file returns by reference the movie name, rating, year, and genre.

Parameters

  movieinfo | The information of the movie in one line separated by |

void getMovieInfo | ( | string | movieinfo,
|  | string & | name,
|  | string & | rating,
|  | string & | year,
|  | string & | genre,
|  | string & | studio
| ) |  |

Given a movie line from the file returns by reference the movie name, rating, year, genre, and studio. Answer to (Exercise 3, question 2)

Parameters

  movieinfo | The information of the movie in one line separated by |

string getMovieName | ( | string | movieinfo | ) |

Given a movie line from the file returns the movie name.

Parameters

  movieinfo | The information of the movie in one line separated by |

Returns
  Movie name

string getMovieRating | ( | string | movieinfo | ) |

Given a movie line from the file returns the movie rating.

Parameters

  movieinfo | The information of the movie in one line separated by |

Returns
  The movie rating

string getMovieStudio | ( | string | movieinfo | ) |

Given a movie line from the file returns the movie studio. Answer to (Exercise 3, question 1)

Parameters

  movieinfo | The information of the movie in one line separated by |

Returns
  The movie studio.

string getMovieYear | ( | string | movieinfo | ) |

Given a movie line from the file returns the movie release year.

Parameters

  movieinfo | The information of the movie in one line separated by |

Returns
  The movie release year.

void showMovie | ( | string | movieinfo | ) |

Display the movie information of a | separated line with movie info. Example line: Ninja Turtles: The Next Mutation, Vol. 1|Shout! Factory||Out|2.0|4:3|19.93|NR|1997|.

Parameters

  movieinfo | The information of the movie in one line separated by |

void showMovieInLine | ( | string | movieinfo | ) |

Display the movie information of a | separated line with movie info. The info is displayed in one line identified by its fields. Answer to (Exercise 3, question 3)

Parameters

  movieinfo | The information of the movie in one line separated by |

void showMovies | ( | filemanip & | file,
|  | int | start,
|  | int | end
| ) |  |

Display the information of the movies in a file from line start to line end.

Parameters

  file | Pointer to a file.
  start | Line in the file to start showing movie info.
  end | Line in the file to stop showing movie information.

void showMovies | ( | filemanip & | file,
|  | string | keyword
| ) |  |

Display the information of the movies whose name contains a given keyword.

Parameters

  file | Pointer to a file.
  keyword | Keyword to search in the name of the movies.

void showMoviesInLine | ( | filemanip & | file,
|  | int | start,
|  | int | end
| ) |  |

Display the information of the movies in a file from line start to line end. The information is displayed in one line. Answer to (Exercise 3, question 4)

Parameters

  file | Pointer to a file.
  start | Line in the file to start showing movie info.
  end | Line in the file to stop showing movie information.