Logo Search packages:      
Sourcecode: packagesearch version File versions

const set< string > & PackageSearchImpl::packages (  )  [virtual]

Returns a list of all packages available.

Only real packages will be listed here i.e. no virtuals, or missing dependencies.

Implements NPlugin::IProvider.

Definition at line 173 of file packagesearchimpl.cpp.

References _packages, NApplication::RunCommandForOutput::getOutput(), and NApplication::RunCommandForOutput::run().

Referenced by initialize().

      static bool initialized = false;
      if (!initialized)
            // I used to use the real apt code here, but I gained only around 400ms this is not worth the
            // effort...
            QTime t;
            initialized = true;
            NApplication::RunCommandForOutput ro("");
            ro.run("apt-cache pkgnames --no-all-names");
            QStringList packages = ro.getOutput();
            for(QStringList::iterator it = packages.begin(); it != packages.end(); ++it)
            // code directly taken from apt-cache ShowPkgNames and main
/*          CacheAccess ca;
            pkgCache::PkgIterator I = ca.pCache()->PkgBegin();
            // Show all pkgs
            for (;I.end() != true; I++)
                  if (I->VersionList == 0)      // if it is not a real package
            qDebug("creating package list: %d ms", t.elapsed());*/
      return _packages;

Generated by  Doxygen 1.6.0   Back to index