⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 basepkg.h

📁 About: Paco (pacKAGE oRGANIZER) is a simple, yet powerful tool to aid package management when insta
💻 H
字号:
//=======================================================================// BasePkg.h//-----------------------------------------------------------------------// 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//=======================================================================#ifndef LIBPACO_BASE_PKG_H#define LIBPACO_BASE_PKG_H#include "paco.h"#include "File.h"#include <iosfwd>#include <vector>namespace Paco{class BasePkg : public std::vector<File*>{	public:	// Types and consts	//-----------------	static int const NO_FILES			= 0;	static int const INSTALLED_FILES	= (1 << 0);	static int const MISSING_FILES		= (1 << 1);	static int const ALL_FILES			= (INSTALLED_FILES | MISSING_FILES);	enum ConstructorError { };	// Inspectors	//-----------	std::string const& name() const		{ return mName; }	std::string const& log() const		{ return mLog; }	std::string const& confOpts() const	{ return mConfOpts; }	int date() const					{ return mDate; }	long sizeInst() const				{ return mSizeInst; }	long sizeMiss() const				{ return mSizeMiss; }	long filesInst() const				{ return mFilesInst; }	long filesMiss() const				{ return mFilesMiss; }		// Public member functions	//------------------------	void sort(SortType type = SORT_NAME, bool reverse = false);	void getFiles(int type = ALL_FILES);	bool hasFile(File*);	bool hasFile(std::string const& path)	{		File file(path, 0);		return hasFile(&file);	}		// Test whether our package shares the @file with any package in @pkgs	template <typename T>	// T = {Paco,Gpaco}::PkgSet	bool shares(File* file, T& pkgs)	{		for (typename T::iterator p = pkgs.begin(); p != pkgs.end(); ++p) {			if ((*p)->name() != mName && (*p)->hasFile(file))				return true;		}		return false;	}	// Public static member functions	//-------------------------------	static bool updateLog(std::string const& log);	static bool getSize(long&, std::string const&, std::string const& = "");	protected:	BasePkg(std::string const&);	virtual ~BasePkg();	// Protected member data	//----------------------	std::string const mName;	std::string const mLog;	int mDate;	long mSizeInst;	long mSizeMiss;	long mFilesInst;	long mFilesMiss;	SortType mSortType;	bool mSortReverse;	std::string mConfOpts;	// This nested class is used to sort the files of the package	class Sorter	{		public:		Sorter(SortType type = SORT_NAME);		bool operator()(File* left, File* right) const;		private:		bool (Sorter::*mSortFunc)(File* , File*) const;		bool sortByName(File* left, File* right) const;		bool sortBySize(File* left, File* right) const;	};	// class Pkg::Sorter	private:	// Prevent copies	BasePkg(BasePkg const&);	BasePkg& operator=(BasePkg const&);};	// class Pkg}	// namespace Paco#endif  // LIBPACO_BASE_PKG_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -