Modified: contrib/MacPorts_Framework/MPMacPorts.h (72805 => 72806)
--- 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 (72805 => 72806)
--- 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];