コード例 #1
0
ファイル: test.cpp プロジェクト: marigostra/deepsolver
void processProvidesFile(const std::string& fileName)
{
  std::cout << "Reading " << fileName << "..." << std::endl;
  std::auto_ptr<AbstractTextFileReader> reader = openIndexFile(fileName);
  std::string line, provideName;
  bool wasEmpty = 1;
  while(reader->readLine(line))
    {
      if (line.empty())
	{
	  wasEmpty = 1;
	  continue;
	}
      if (wasEmpty && line.length() > 2 && line[0] == '[' && line[line.length() - 1] == ']')
	{
	  provideName.resize(line.length() - 2);
	  for(std::string::size_type i = 1;i < line.length() - 1;i++)
	    provideName[i - 1] = line[i];
	  wasEmpty = 0;
	  continue;
	}
      assert(!provideName.empty());
      list2.push_back(MapItem(line, provideName));
      wasEmpty = 0;
    }
}
コード例 #2
0
ファイル: test.cpp プロジェクト: marigostra/deepsolver
void processPkgFile(const std::string& fileName)
{
  std::cout << "Reading " << fileName << "..." << std::endl;
  std::auto_ptr<AbstractTextFileReader> reader = openIndexFile(fileName);
  std::string line, name;
  while(reader->readLine(line))
    {
      std::string tail;
      if (stringBegins(line, "n=", tail))
	{
	  name = tail;
	  continue;
	}
      if (stringBegins(line, "p:", tail))
	{
	  std::string pkgName = extractPackageName(tail);
	  assert(!pkgName.empty());
	  list1.push_back(MapItem(name, pkgName));
	}
    }
}