/* * Set the range of the simulation. * * INPUT: &cnfg Config file to store ranges to * INPUT: c Character to indicate whether to parse X or Y coordinates */ void reader::set_range(config &cnfg, char c) { // Find the range keyword int indx1; if (c == 'x' || c == 'X') indx1 = data.find("Xrange"); else indx1 = data.find("Yrange"); // Find the end of the keyword statement int indx2 = data.find(";", indx1+1); // Parse the integers out of it istringstream stream(data.substr(indx1+6, indx2-indx1)); int low, high; stream >> low >> high; // Save to config class if (c == 'x' || c == 'X') cnfg.setX(low, high); else cnfg.setY(low, high); return; }