next up previous contents
Next: PkgDebian Up: Definizioni delle classi Previous: PKGFS   Indice

PkgMgr

/*
 * pkgmgr.h
 * Copyright (C) 2004 Luca Ferroni <fferroni@cs.unibo.it>
 *
 * The PkgManager class provides the interface to package management.
 * It implements the virtual abstraction layer.
 *
 * This file is released under the GPL v2.
 * This file may be redistributed under the terms of the GNU Public
 * License. 
 *
 */
#ifndef _PKGMGR_H_
#define _PKGMGR_H_

#include <string>

//Struct to save status constant of the specific package manager
struct status {
	const char *installed;
	const char *notinstalled;
	const char *hold;
	const char *notavailable;
};

using namespace std;

class PkgManager {

   public:

        PkgManager() { };
        virtual ~PkgManager() { };

        virtual bool readCache() = 0;
        virtual void closeCache() = 0;

        //! (Void *) is a pointer to the pkg entry found in the cache
        virtual int findPkg(string,void **) = 0;
	
        //! Return the package manager cache file
        virtual string CachePath() const = 0;
	
        //! Return the initial cache state
        virtual int getInitCache(string &) = 0;
	
        //! Return the package manager sections and priorities
        virtual string Sections(int) = 0;
        virtual string Priorities(int) = 0;
	
        virtual string checkstatus(void *) = 0;
        virtual string getRealPath(void *) = 0;
	
        //! The first parameter of the next methods
        //! is a ptr to an instance of the package found in the cache
        virtual int getInfo(void *, string &) = 0;
        virtual int getDepends(void *,string &) = 0;
        virtual int getRDepends(void *,string &) = 0;
        virtual int getOwnedFiles(string,string &) = 0;
        virtual bool isRDepToRemove(string) = 0;
	
        virtual int install(string) = 0;
        virtual int remove(string) = 0;
	
        //! Update and upgrade the system
        virtual int update() = 0;
        virtual int upgrade() = 0;

        virtual int getNumAvail() = 0 ;
	
};

#endif


2004-11-19