bool CzDataInput::getNextQuotedString(CzString *pString) { char buffer[2048]; if (getNextQuotedString(buffer, 2048)) { pString->Copy(buffer); return true; } return false; }
bool CzDataInput::getNextQuotedStringAsint(int *pNum) { CzString num; if (getNextQuotedString(&num)) { *pNum = num.getAsInt(); return true; } return false; }
void MXPImporter::loadInstructions( QTextStream &stream, Recipe &recipe ) { //==========================instructions ( along with other optional fields... mxp format doesn't define end of ingredients and start of other fields )==============// stream.skipWhiteSpace(); QString current = stream.readLine().trimmed(); while ( !current.contains( "- - - -" ) && !stream.atEnd() ) { if ( current.trimmed() == "Source:" ) { Element new_author( getNextQuotedString( stream ) ); recipe.authorList.append( new_author ); //kDebug()<<"Found source: "<<new_author.name<<" (adding as author)"; } else if ( current.trimmed() == "Description:" ) { QString description = getNextQuotedString( stream ); //kDebug()<<"Found description: "<<m_description<<" (adding to end of instructions)"; recipe.instructions += "\n\nDescription: " + description; } else if ( current.trimmed() == "S(Internet Address):" ) { QString internet = getNextQuotedString( stream ); //kDebug()<<"Found internet address: "<<m_internet<<" (adding to end of instructions)"; recipe.instructions += "\n\nInternet address: " + internet; } else if ( current.trimmed() == "Yield:" ) { recipe.yield.setAmount(getNextQuotedString( stream ).trimmed().toInt()); recipe.yield.setType(i18n("servings")); //kDebug()<<"Found yield: "<<recipe.yield.amount<<" (adding as servings)"; } else if ( current.trimmed() == "T(Cook Time):" ) { ( void ) getNextQuotedString( stream ); //this would be prep time, but we don't use prep time at the moment //kDebug()<<"Found cook time: "<<m_prep_time<<" (adding as prep time)"; } else if ( current.trimmed() == "Cuisine:" ) { Element new_cat( getNextQuotedString( stream ) ); recipe.categoryList.append( new_cat ); //kDebug()<<"Found cuisine (adding as category): "<<new_cat.name; } else recipe.instructions += current + '\n'; current = stream.readLine().trimmed(); } recipe.instructions = recipe.instructions.trimmed(); //kDebug()<<"Found instructions: "<<m_instructions; }