Question: / / Complete me #include customparser.h #include #include using namespace std; const char * error _ msg _ 1 = Cannot read integer n
Complete me #include "customparser.h #include #include using namespace std; const char errormsg "Cannot read integer n; const char errormsg "Error in content parsing"; const char errormsg "Error in user parsing"; To Do Complete this function void CustomFormatParser::parsestd::istream& is std::vector& content, std::vector& usersseparatte into parts, the first bullet point the second the third int n; ifis n throw ParserErrorerrormsg; string line; getlineisline; to move on to next forint i ; i n; i int id type,numReviews,totalStars,rating,numEpisodes; std::string name, viewersline; std::vectorviewers; ifisidtype throw ParserErrorerrormsg; std::getlineisline; std::getlineisstd::wsname; ifisnumReviewstotalStarsrating throw ParserErrorerrormsg; iftype ifis numEpisodes throw ParserErrorerrormsg; std::getlineisstd::wsviewersline; ifviewersline.empty std::stringstream viewerStream viewersline; std::string viewer; whileviewerStream viewer viewers.pushbackviewer; Content newContent nullptr; iftype newContent new Movieidname,numReviews,totalStars,rating; else iftype newContent new Seriesidname,numReviews,totalStars,rating,numEpisodes; content.pushbacknewContent; whilegetlineisstd::wsline std::string username; ifis username break; int ratingLimit; ifisratingLimit throw ParserErrorerrormsg; User newUser new UserusernameratingLimit; users.pushbacknewUser;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
