TEST(customer, DualNewReleaseStatement) { Customer customer("Fred"); customer.addRental(Rental(Movie ("The Cell", Movie::NEW_RELEASE), 3)); customer.addRental(Rental(Movie ("The Tigger Movie", Movie::NEW_RELEASE), 3)); EXPECT_STREQ("Rental Record for Fred\n\tThe Cell\t9.0\n\tThe Tigger Movie\t9.0\nYou owed 18.0\nYou earned 4 frequent renter points\n", customer.statment().c_str()); }
void Store::loadMovies(){ string line; ifstream file ("src/movies.txt"); if (file.is_open()){ int input = 0; Movie aMovie = Movie(); while (getline(file,line,';')) { if(input > 6) { this->rentals.insert(aMovie); aMovie = Movie(); input = 0; } switch(input) { case 0: aMovie.setTitle(line); break; case 1: aMovie.setReleased(line); break; case 2: aMovie.setGenre(line); break; case 3: aMovie.setDuration(line); break; case 4: aMovie.setDirector(line); break; case 5: aMovie.setRating(line); break; case 6: aMovie.setStars(line); break; } ++input; } file.close(); } else cout << "Unable to open file"; } // end Store::loadMovies();
TEST(customer, MultipleRegularStatement) { Customer customer("Fred"); customer.addRental(Rental(Movie ("Plan 9 from Outer Space", Movie::REGULAR), 1)); customer.addRental(Rental(Movie ("8 1/2", Movie::REGULAR), 2)); customer.addRental(Rental(Movie ("Eraserhead", Movie::REGULAR), 3)); EXPECT_STREQ("Rental Record for Fred\n\tPlan 9 from Outer Space\t2.0\n\t8 1/2\t2.0\n\tEraserhead\t3.5\nYou owed 7.5\nYou earned 3 frequent renter points\n", customer.statment().c_str()); }
bool Box::createdMovie(const string& title) { bool found = false; for (int i = 0; i < movieClub.size(); i++) if (movieClub[i].getTitle() == title) { found = true; break; } for (int i = 0; i < seenMovies.size(); i++) if (seenMovies[i].getTitle() == title) { found = true; break; } if (found) return false; else { Movie mtemp = Movie(title, 0.0); movieClub.push_back(mtemp); sort(movieClub.begin(), movieClub.end()); return true; } }
void CHolly_Theora_Video::AddFrame( float fDelta, Holly::ColorMode::ENUM colormode, void* pData, unsigned int iFlags ) { ProcessFrame( false ); Movie()->Utility()->Convert( pData, Width(), Height(), colormode, Holly::ColorMode::YUV, m_Frame[0].data, m_Frame[1].data, m_Frame[2].data, iFlags ); m_bFrameWaiting = true; }
void FetchMetadataQuery::sendPrimaryRequest(QString title) { // We start another cycle, so we first make sure that m_movie is empty m_movie = Movie(); connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(on_primaryRequestResponse(QNetworkReply*))); QNetworkRequest l_request; l_request.setUrl(QUrl("http://api.themoviedb.org/3/search/movie" "?api_key="+ m_app->tmdbkey() +"&query="+ title , QUrl::TolerantMode)); m_networkManager->get(l_request); Macaw::DEBUG("[FetchMetadataQuery] Primary request sent"); }
string Theater::GetMovieForHour(int Hour) { string movie; for (int i = 0; i < counter; i++) { if (Hour == timeKeeper[i]) { movie= movieTitleKeeper[i]; i = counter + 1; } else if ((i == counter && Hour != timeKeeper[counter]) &&(Hour<0 || Hour>24) ) movie= Movie().GetTitle(); } return movie; }
Movie LoadMovie(std::istream& is) { boost::iostreams::filtering_streambuf<boost::iostreams::input> in; in.push(boost::iostreams::gzip_decompressor()); in.push(is); boost::archive::binary_iarchive ia(in); auto movie = Movie(); ia >> movie; return movie; /* boost::archive::text_iarchive ia(is); auto movie = Movie(); ia >> movie; return movie; */ }
TEST(customer, SingleChildrensStatement) { Customer customer("Fred"); customer.addRental(Rental(Movie ("The Tigger Movie", Movie::CHILDRENS), 3)); EXPECT_STREQ("Rental Record for Fred\n\tThe Tigger Movie\t1.5\nYou owed 1.5\nYou earned 1 frequent renter points\n", customer.statment().c_str()); }
// ---------------------------------------------------------------------------- // constructor // default constructor for class DramaMovie // ---------------------------------------------------------------------------- DramaMovie::DramaMovie() { Movie(); //empty DramaMovie }
bool Box::updateMovie(const string& title, const Movie& movie, float cost) { if (title != movie.getTitle()) { bool found1 = false; bool found2 = false; int pos; for (int i = 0; i < movieClub.size(); i++) if (movieClub[i].getTitle() == title) return false; else if (movie == movieClub[i]) { found1 = true; pos = i; } for (int i = 0; i < seenMovies.size(); i++) if (seenMovies[i].getTitle() == title) return false; else if (movie == seenMovies[i]) { found2 = true; pos = i; } if (found1) { movieClub[pos] = Movie(title, cost); sort(movieClub.begin(), movieClub.end()); } else if (found2) { seenMovies[pos] = Movie(title, cost); sort(seenMovies.begin(), seenMovies.end()); } } else { bool found1 = false; bool found2 = false; int pos; for (int i = 0; i < movieClub.size(); i++) if (movie == movieClub[i]) { found1 = true; pos = i; } for (int i = 0; i < seenMovies.size(); i++) if (movie == seenMovies[i]) { found2 = true; pos = i; } if (found1) { movieClub[pos] = Movie(title, cost); } else if (found2) { seenMovies[pos] = Movie(title, cost); } } return true; }
bool Box::load() { authorized = false; ifstream fin; fin.open("Box.txt"); if (fin.fail()) return false; int passlength; fin >> passlength; vector<int> encrypted; string passtemp; passtemp.resize(passlength); while (passlength > 0) { int temp; fin >> temp; encrypted.push_back(temp); passlength--; } int numchannels, nummovieclub, numseenmovies, numrecorded, key; fin >> numchannels >> nummovieclub >> numseenmovies >> numrecorded >> total_money_spent >> key; for (int i = 0; i < passtemp.length(); i++) passtemp[i] = encrypted[i] ^ key; this->password = passtemp; fin.ignore(100); fin.close(); fin.open("Channels.txt"); if (fin.fail()) return false; for (; numchannels > 0; numchannels--) { string stemp; getline(fin, stemp); Channel ctemp(stemp); while (fin.peek() != '\n') { string name; getline(fin, name); string type; getline(fin, type); int duration; fin >> duration; fin.ignore(); string day; getline(fin, day); int hour, minutes; fin >> hour >> minutes; fin.ignore(); Program ptemp = Program(name, type, stemp, duration, day, hour, minutes); ctemp.addProgram(ptemp); } channels.push_back(ctemp); fin.ignore(); } fin.close(); sort(this->channels.begin(), this->channels.end()); fin.open("MovieClub.txt"); if (fin.fail()) return false; for (; nummovieclub > 0; nummovieclub--) { string title; float cost; getline(fin, title); fin >> cost; fin.ignore(); Movie mtemp = Movie(title, cost); movieClub.push_back(mtemp); } fin.close(); sort(this->movieClub.begin(), this->movieClub.end()); fin.open("SeenMovies.txt"); if (fin.fail()) return false; for (; numseenmovies > 0; numseenmovies--) { string title; float cost; unsigned timesrented; getline(fin, title); fin >> cost >> timesrented; fin.ignore(); Movie mtemp = Movie(title, cost); mtemp.settimesRented(timesrented); seenMovies.push_back(mtemp); } fin.close(); sort(this->seenMovies.begin(), this->seenMovies.end()); fin.open("RecordedPrograms.txt"); if (fin.fail()) return false; vector<Program*> v; for (; numrecorded > 0; numrecorded--) { string channelname; string day; int hour, minutes; getline(fin, channelname); getline(fin, day); fin >> hour >> minutes; Date dtemp(day, hour, minutes); fin.ignore(); for (int i = 0; i < channels.size(); i++) if (channelname == channels[i].getName()) for (int j = 0; j < channels[i].programs.size(); j++) if (dtemp == channels[i].programs[j].getDate()) { if (channels[i].programs[j].getDate() < this->currentDate) channels[i].setRecorded(j); toBeRecorded.push_back(channels[i].programs[j]); } } sort(toBeRecorded.begin(), toBeRecorded.end()); fin.close(); return true; }