pkgset.cc
来自「About: Paco (pacKAGE oRGANIZER) is a si」· CC 代码 · 共 84 行
CC
84 行
//=======================================================================// PkgSet.cc//-----------------------------------------------------------------------// This file is part of the package paco// Copyright (C) 2004-2007 David Rosal <david.3r@gmail.com>// For more information visit http://paco.sourceforge.net//=======================================================================#include "config.h"#include "Config.h"#include "Pkg.h"#include "PkgSet.h"#include "util.h"using namespace Gpaco;PkgSet::PkgSet(): mSizeInst(0){ try { Glib::Dir dir(Config::logdir()); for (Glib::Dir::iterator d = dir.begin(); d != dir.end(); ++d) { try { *this += new Pkg(*d); } catch (Paco::X& x) { errorDialog(NULL, x.what(), true); } catch (...) { } } } catch (Glib::Error& x) { errorDialog(NULL, x.what(), true); }}PkgSet::~PkgSet(){ for (iterator p = begin(); p != end(); ++p) { g_assert(*p != NULL); if (*p) { delete *p; *p = NULL; } }}bool PkgSet::hasPkg(std::string const& pkgName){ for (iterator p = begin(); p != end(); ++p) { if ((*p)->name() == pkgName) return true; } return false;}PkgSet& PkgSet::operator+=(Pkg* pkg){ g_assert(pkg != NULL); push_back(pkg); mSizeInst += pkg->sizeInst(); return *this;}PkgSet& PkgSet::operator-=(Pkg* pkg){ g_assert(pkg != NULL); iterator i = std::remove(begin(), end(), pkg); if (i != end()) { mSizeInst -= pkg->sizeInst(); delete pkg; pkg = NULL; erase(i, end()); } return *this;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?