Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=cfpm.git;a=commitdiff;h=9fe413ffe5d246fa9a30badf4f1318761d525ac3

commit 9fe413ffe5d246fa9a30badf4f1318761d525ac3
Author: James Buren <r...@frugalware.org>
Date:   Fri May 29 14:57:59 2009 -0500

pacman.cc
* add package

diff --git a/pacman.cc b/pacman.cc
index 92465de..316769f 100644
--- a/pacman.cc
+++ b/pacman.cc
@@ -17,9 +17,34 @@ Database::Database(void) { db = NULL; }
Database::~Database(void) { unload(); }
PM_DB *Database::get_db(void) { return db; }
bool Database::isvalid(void) { return (db) ? true : false; }
-bool Database::unload(void) { pacman_db_unregister(db); return isvalid(); }
+
+bool Database::unload(void)
+{
+       pacman_db_unregister(db);
+       db = NULL;
+       return isvalid();
+}
+
bool Database::load(const std::string &name)
{
db = pacman_db_register( (char *) name.c_str() );
return isvalid();
}
+
+Package::Package(void) { pkg = NULL; }
+Package::~Package(void) { unload(); }
+PM_PKG *Package::get_pkg(void) { return pkg; }
+bool Package::isvalid(void) { return (pkg) ? true : false; }
+
+bool Package::unload(void)
+{
+       pacman_pkg_free(pkg);
+       pkg = NULL;
+       return isvalid();
+}
+
+bool Package::load(const std::string &name)
+{
+       pacman_pkg_load( (char *) name.c_str(), &pkg );
+       return isvalid();
+}
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to