void VbpValidator::start() {

	MessageBox(NULL, "Select a .vbp file to check for registry errors", "VBAutoRegister", MB_OK);

	char fileToOpen[MAX_PATH] = { 0 };
	getVbpFileLocation(fileToOpen);

	loadReferences(fileToOpen);
	processReferences();

	std::string reportString = this->generateReportString();

	MessageBox(NULL, reportString.c_str(), "VBAutoRegister", MB_OK);
}
Пример #2
0
void CMIRIAMInfo::load(const std::string& key)
{
  pdelete(mpRDFGraph);

  mKey = key;
  CCopasiObject * pCopasiObject = dynamic_cast< CCopasiObject * >(CCopasiRootContainer::getKeyFactory()->get(mKey));

  if (pCopasiObject != NULL)
    {
      const std::string * pMiriamAnnotation = NULL;

      CAnnotation * pAnnotation = CAnnotation::castObject(pCopasiObject);

      if (pAnnotation != NULL)
        {
          pMiriamAnnotation = &pAnnotation->getMiriamAnnotation();
        }

      if (pMiriamAnnotation && *pMiriamAnnotation != "")
        mpRDFGraph = CRDFParser::graphFromXml(*pMiriamAnnotation);
    }

  if (mpRDFGraph == NULL)
    mpRDFGraph = new CRDFGraph;

  // We make sure that we always have an about node.

  if (pCopasiObject != NULL)
    mTriplet.pObject = mpRDFGraph->createAboutNode(pCopasiObject->getKey());
  else
    mTriplet.pObject = mpRDFGraph->createAboutNode("");

  // Load the created date if set;
  CRDFPredicate::Path Path = mTriplet.pObject->getPath();
  std::set< CRDFTriplet > Triples =
    mTriplet.pObject->getDescendantsWithPredicate(CRDFPredicate::dcterms_created);

  if (Triples.size() > 0)
    mCreated = *Triples.begin();
  else
    mCreated = CRDFTriplet(); // This is an invalid triplet, i.e., !mCreated is true.

  loadCreators();
  loadReferences();
  loadModifications();
  loadBiologicalDescriptions();

  return;
}
void RezkonvImporter::readRecipe( const QStringList &raw_recipe )
{
    kapp->processEvents(); //don't want the user to think its frozen... especially for files with thousands of recipes

    Recipe recipe;

    QStringList::const_iterator text_it = raw_recipe.begin();
    m_end_it = raw_recipe.end();

    //title (Titel)
    text_it++;
    recipe.title = ( *text_it ).mid( ( *text_it ).indexOf( ":" ) + 1, ( *text_it ).length() ).trimmed();
    kDebug() << "Found title: " << recipe.title ;

    //categories (Kategorien):
    text_it++;
    QStringList categories;
    if ( ( *text_it ).mid( ( *text_it ).indexOf( ":" ) + 1, ( *text_it ).length() ).isEmpty() )
        categories = QStringList();
    else
        categories = ( *text_it ).mid( ( *text_it ).indexOf( ":" ) + 1, ( *text_it ).length() ).split( ',', QString::SkipEmptyParts );

    for ( QStringList::const_iterator it = categories.constBegin(); it != categories.constEnd(); ++it ) {
        Element new_cat;
        new_cat.name = QString( *it ).trimmed();
        kDebug() << "Found category: " << new_cat.name ;
        recipe.categoryList.append( new_cat );
    }

    //yield (Menge)
    text_it++;
    //get the number between the ":" and the next space after it
    QString yield_str = ( *text_it ).trimmed();
    yield_str.remove( QRegExp( "^Menge:\\s*" ) );
    int sep_index = yield_str.indexOf( ' ' );
    if ( sep_index != -1 )
        recipe.yield.setType(yield_str.mid( sep_index+1 ));
    double amount = 0.0, amountOffset = 0.0;
    readRange( yield_str.mid( 0, sep_index ), amount, amountOffset );
    recipe.yield.setAmount(amount);
    recipe.yield.setAmountOffset(amountOffset);
    kDebug() << "Found yield: " << recipe.yield.amount();

    bool is_sub = false;
    bool last_line_empty = false;
    text_it++;
    while ( text_it != raw_recipe.end() ) {
        if ( ( *text_it ).isEmpty() ) {
            last_line_empty = true;
            text_it++;
            continue;
        }

        if ( ( *text_it ).contains( QRegExp( "^=====.*=$" ) ) )  //is a header
        {
            if ( ( *text_it ).contains( "quelle", Qt::CaseInsensitive ) )
            {
                loadReferences( text_it, recipe );
                break; //reference lines are the last before the instructions
            }
            else
                loadIngredientHeader( *text_it, recipe );
        }

        //if it has no more than two spaces followed by a non-digit
        //then we'll assume it is a direction line
        else if ( last_line_empty && ( *text_it ).contains( QRegExp( "^\\s{0,2}[^\\d\\s=]" ) ) )
            break;
        else
            loadIngredient( *text_it, recipe, is_sub );

        last_line_empty = false;
        text_it++;
    }

    loadInstructions( text_it, recipe );

    add
    ( recipe );

    current_header.clear();
}