Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=cfpm.git;a=commitdiff;h=ec054e8fd8d6f1feac70c2ab7375d34f3a8dc0e1
commit ec054e8fd8d6f1feac70c2ab7375d34f3a8dc0e1 Author: Priyank <priy...@frugalware.org> Date: Thu Jun 4 15:21:25 2009 +0530 new methods * Database: Added ReadPackage method * Package: Added initWithPkg method diff --git a/pm.h b/pm.h index aaa091e..f18edda 100644 --- a/pm.h +++ b/pm.h @@ -22,6 +22,7 @@ - Register: (STR) s; - Unregister; - Update: (int) f; +- ReadPackage: (STR) name; - free; @end @@ -30,6 +31,7 @@ { PM_PKG *pkg; /* package pointer */ } +- (id) initWithPkg: (PM_PKG *) p; - (STR) Name; - (STR) Version; - (STR) Description; diff --git a/pm.m b/pm.m index 4c30a7d..7f585da 100644 --- a/pm.m +++ b/pm.m @@ -39,6 +39,16 @@ [self _set_status]; return self; } +- ReadPackage: (STR) name +{ + id p; + PM_PKG *pkg = NULL; + if( (pkg=pacman_db_readpkg(db,name))!=NULL ) + { + p = [[Package new] initWithPkg:pkg]; + } + return p; +} - free { [self Unregister]; @@ -48,6 +58,11 @@ @end @implementation Package +- (id) initWithPkg: (PM_PKG *) p +{ + pkg = p; + return self; +} - (void*) _info: (char) param { void *ret = NULL; _______________________________________________ Frugalware-git mailing list Frugalware-git@frugalware.org http://frugalware.org/mailman/listinfo/frugalware-git