Esempio n. 1
0
INXObjList* EditList::LoadTemp() {	
	ConData* blob;
	long int id = 0;
	INXObjList* temp = new INXObjList;

	// Copy the condata list to the flattened list
	// save the condata list and then load it back in to flattened
	// Alternatively could use a copy constructor
	temp->RemoveAll();
	//SaveProg(workDir + TEMPDIR + "temp");
	ifstream datafile(workDir + TEMPDIR + "temp");
	char type[256];

	while ((!datafile.eof()) && (!datafile.fail())) {
		datafile >> type;
		if (strcmp(type,"END_OF_BLOCKS")==0) break;
		else
		if (strcmp(type,"BEGIN_BLOCK")==0) 
		{
			blob = new ConData;
			
			if(blob)
			{	blob->Load(&datafile);
				temp->AddTail((CObject*) blob);
				id = blob->identnum;
			}
			else
			{
				//delete blob;
				break;
			}
		}
	}
	
	// set the uniqueidgenerator to the identnum of the last icon
	// This is necessary as it is possible that this value may be greater than
	// the number of icons loaded, due to icons being deleted previously. This
	// prevents icon IDs being duplicated
	// Need to add 1, since uniqueidgenerator is incremented after a new icon is
	// instantiated.
	//id++;
	//ConData::uniqueidgenerator = id;
	return temp;
}