Exemplo n.º 1
0
/*
 * Sets the name of the simulation. If no name is specified in
 * the .aut file, the .aut filename is used instead.
 * 
 * INPUT: &cnfg Config class to store name
 * INPUT: *fname Name of the .aut file
 */
void reader::set_name(config &cnfg, char *fname)
{
	// Find the name keyword
	int indx1 = data.find("Name");
	if (indx1 == string::npos) {
		cnfg.set_name(fname);
		return;
	}
	
	// Find start and ending quotes
	indx1 = data.find("\"", indx1+1);
	int indx2 = data.find("\"", indx1+1);

	// Parse the name out
	const char *name = data.substr(indx1+1, indx2-indx1-1).c_str();

	// Save to config
	cnfg.set_name(name);
}