[72806] contrib/MacPorts_Framework
juanger at macports.org
juanger at macports.org
Wed Oct 27 12:53:40 PDT 2010
Revision: 72806
http://trac.macports.org/changeset/72806
Author: juanger at macports.org
Date: 2010-10-27 12:53:38 -0700 (Wed, 27 Oct 2010)
Log Message:
-----------
New method for faster listing of available ports.
Modified Paths:
--------------
contrib/MacPorts_Framework/MPMacPorts.h
contrib/MacPorts_Framework/MPMacPorts.m
Modified: contrib/MacPorts_Framework/MPMacPorts.h
===================================================================
--- contrib/MacPorts_Framework/MPMacPorts.h 2010-10-27 19:53:33 UTC (rev 72805)
+++ contrib/MacPorts_Framework/MPMacPorts.h 2010-10-27 19:53:38 UTC (rev 72806)
@@ -99,8 +99,12 @@
*/
- (void)selfUpdate:(NSError **)sError;
+/*!
+ @brief Returns an NSDictionary of all the ports in the indices.
+ @discussion Faster than search:MPPortsAll. Uses mpportlistall
+ */
+- (NSDictionary *)listAll;
-
/*!
@brief Returns an NSDictionary of ports. Calls [self search:query caseSensiitve:YES].
@param query An NSString containing name or partial name of port being searched.
Modified: contrib/MacPorts_Framework/MPMacPorts.m
===================================================================
--- contrib/MacPorts_Framework/MPMacPorts.m 2010-10-27 19:53:33 UTC (rev 72805)
+++ contrib/MacPorts_Framework/MPMacPorts.m 2010-10-27 19:53:38 UTC (rev 72806)
@@ -164,6 +164,27 @@
[[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"MacPorts_selfupdate_Finished" object:nil];
}
+- (NSDictionary *)listAll{
+
+ NSMutableDictionary *result, *newResult;
+ NSEnumerator *enumerator;
+ id key;
+ NSError * sError;
+
+ result = [NSMutableDictionary dictionaryWithDictionary:
+ [interpreter dictionaryFromTclListAsString:
+ [interpreter evaluateStringAsString:@"return [mportlistall]"
+ error:&sError]]];
+
+ newResult = [NSMutableDictionary dictionaryWithCapacity:[result count]];
+ enumerator = [result keyEnumerator];
+ while (key = [enumerator nextObject]) {
+ [newResult setObject:[[MPPort alloc] initWithTclListAsString:[result objectForKey:key]] forKey:key];
+ }
+
+
+ return [NSDictionary dictionaryWithDictionary:newResult];
+}
- (NSDictionary *)search:(NSString *)query {
return [self search:query caseSensitive:YES];
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20101027/11557a88/attachment.html>
More information about the macports-changes
mailing list