I have built a method that receives a line and the line is in the next format:
name, id, type, videos list
name, id and type are fixed but my problem is that there are more then 1 video and I want to enter them into a list. I know how to enter them to a list but my question is how can Iterate over the line from the start of the videos list string to the end of it.
So far my code is:
Client* deseriallize_client(std::string str)
{
int index = str.find(",");
std::string name = str.substr(0, index);
str.erase(0, index + 1);
index = str.find(",");
std::string id = str.substr(0, index);
str.erase(0, index + 1);
index = str.find(",");
std::string type = str.substr(0, index);
str.erase(0, index + 1);
Client *new_client = new Client(name,id,type);
I build the Client class and it also has a method called add_vid.
so for example lets say the text contains :
User,300,vip,Fight Club, The shawshank redemption,Lucky number slevin ,seven
I want to know how to write an iteration which will do:
new_client.add_vid(Fight Club)
new_client.add_vid(The shawshank redemption)
....