AssemblageHelper::E_FileStatus AssemblageReader::parseFile( Recipe** out_recipe, ifstream* p_file )
{
	Recipe* recipe = NULL;
	char prefix = ' ';
	string entityName = "";
	AssemblageHelper::E_FileStatus status = AssemblageHelper::readLineFromStream( &prefix, &entityName, p_file );

	if( status == AssemblageHelper::FileStatus_OK )
	{
		if( prefix != 'e' )
		{
			status = AssemblageHelper::FileStatus_WRONG_FILE_FORMAT;
		}

		recipe = new Recipe( entityName );
		status = parseRecipe( recipe, p_file );
	}

	if( status == AssemblageHelper::FileStatus_OK ||
		status == AssemblageHelper::FileStatus_END_OF_FILE )
	{
		*out_recipe = recipe;
	}
	else
	{
		delete recipe;
		recipe = NULL;
	}

	return status;
}
示例#2
0
void RecipeLoader::loadRecipeByURL(QString url)
{
    //qDebug() << "Loader get URL: "+url;
    HttpConnect *newConnect = new HttpConnect();
    newConnect->downloadContent(url,CBT_BUFFER,CSM_LOUD);
    connect(newConnect,SIGNAL(contentFinished(QString)),this,SLOT(parseRecipe(QString)));
}