[30757] users/rhwood/MacPorts.Framework

source_changes at macosforge.org source_changes at macosforge.org
Tue Nov 6 02:21:28 PST 2007


Revision: 30757
          http://trac.macosforge.org/projects/macports/changeset/30757
Author:   rhwood at macports.org
Date:     2007-11-06 02:21:28 -0800 (Tue, 06 Nov 2007)

Log Message:
-----------
Subclass MPMutableDictionary instead of NSMutableDictionary

Modified Paths:
--------------
    users/rhwood/MacPorts.Framework/MPIndex.h
    users/rhwood/MacPorts.Framework/MPIndex.m
    users/rhwood/MacPorts.Framework/MPPort.h
    users/rhwood/MacPorts.Framework/MPPort.m

Modified: users/rhwood/MacPorts.Framework/MPIndex.h
===================================================================
--- users/rhwood/MacPorts.Framework/MPIndex.h	2007-11-06 10:13:12 UTC (rev 30756)
+++ users/rhwood/MacPorts.Framework/MPIndex.h	2007-11-06 10:21:28 UTC (rev 30757)
@@ -38,10 +38,8 @@
 #import "MPPort.h"
 
 
- at interface MPIndex : NSMutableDictionary {
+ at interface MPIndex : MPMutableDictionary {
 
-	NSMutableDictionary *embeddedDictionary;
-
 }
 
 - (NSArray *)ports;
@@ -55,12 +53,6 @@
 - (void)removePort:(NSString *)name;
 - (void)setPort:(MPPort *)port;
 
-- (unsigned)count;
-- (NSEnumerator *)keyEnumerator;
-- (id)objectForKey:(id)aKey;
-- (void)removeObjectForKey:(id)aKey;
-- (void)setObject:(id)anObject forKey:(id)aKey;
-
 + (Class)classForKeyedUnarchiver;
 - (Class)classForKeyedArchiver;
 

Modified: users/rhwood/MacPorts.Framework/MPIndex.m
===================================================================
--- users/rhwood/MacPorts.Framework/MPIndex.m	2007-11-06 10:13:12 UTC (rev 30756)
+++ users/rhwood/MacPorts.Framework/MPIndex.m	2007-11-06 10:21:28 UTC (rev 30757)
@@ -26,8 +26,8 @@
  *	ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  *	LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  *	CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-						   *	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-						   *	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ *	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  *	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  *	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  *	POSSIBILITY OF SUCH DAMAGE.
@@ -41,23 +41,20 @@
 - (id)init {
 	self = [super init];
 	if (self != nil) {
-		embeddedDictionary = [[NSMutableDictionary alloc] init];
 		[self setIndex];
 	}
 	return self;
 }
 
 - (id)initWithCapacity:(unsigned)numItems {
-	self = [super init];
+	self = [super initWithCapacity:numItems];
 	if (self != nil) {
-		embeddedDictionary = [[NSMutableDictionary alloc] initWithCapacity:numItems];
 		[self setIndex];
 	}
 	return self;
 }
 
 - (void)dealloc {
-	[embeddedDictionary release];
 	[super dealloc];
 }
 
@@ -115,30 +112,6 @@
 	[self setObject:port forKey:[port name]];
 }
 
-#pragma NSMutableDictionary Protocal
-
-- (unsigned)count {
-	return [embeddedDictionary count];
-}
-
-- (NSEnumerator *)keyEnumerator {
-	return [embeddedDictionary keyEnumerator];
-}
-
-- (id)objectForKey:(id)aKey {
-	return [embeddedDictionary objectForKey:aKey];
-}
-
-- (void)removeObjectForKey:(id)aKey {
-	[embeddedDictionary removeObjectForKey:aKey];
-}
-
-- (void)setObject:(id)anObject forKey:(id)aKey {
-	[self willChangeValueForKey:aKey];
-	[embeddedDictionary setObject:anObject forKey:aKey];
-	[self didChangeValueForKey:aKey];
-}
-
 - (Class)classForKeyedArchiver {
 	return [MPIndex class];
 }

Modified: users/rhwood/MacPorts.Framework/MPPort.h
===================================================================
--- users/rhwood/MacPorts.Framework/MPPort.h	2007-11-06 10:13:12 UTC (rev 30756)
+++ users/rhwood/MacPorts.Framework/MPPort.h	2007-11-06 10:21:28 UTC (rev 30757)
@@ -41,13 +41,12 @@
 #import <Cocoa/Cocoa.h>
 #import "MPConstants.h"
 #import "MPInterpreter.h"
+#import "MPMutableDictionary.h"
 #import "MPReceipt.h"
 #import "MPRegistery.h"
 
- at interface MPPort : NSMutableDictionary {
+ at interface MPPort : MPMutableDictionary {
 
-	NSMutableDictionary *embeddedDictionary;
-
 }
 
 - (id)init;
@@ -63,13 +62,7 @@
 - (void) addDependencyAsPortName:(NSString *)dependency;
 - (void)setState:(int)state;
 
-- (unsigned)count;
-- (NSEnumerator *)keyEnumerator;
-- (id)objectForKey:(id)aKey;
-- (void)removeObjectForKey:(id)aKey;
-- (void)setObject:(id)anObject forKey:(id)aKey;
 - (void)setDictionary:(NSDictionary *)otherDictionary;
-- (NSString *)description;
 
 + (Class)classForKeyedUnarchiver;
 - (Class)classForKeyedArchiver;

Modified: users/rhwood/MacPorts.Framework/MPPort.m
===================================================================
--- users/rhwood/MacPorts.Framework/MPPort.m	2007-11-06 10:13:12 UTC (rev 30756)
+++ users/rhwood/MacPorts.Framework/MPPort.m	2007-11-06 10:21:28 UTC (rev 30757)
@@ -39,27 +39,24 @@
 @implementation MPPort
 
 - (id)init {
-	self = [super init];
+	self = [super initWithCapacity:15];
 	if (self != nil) {
-		embeddedDictionary = [[NSMutableDictionary alloc] initWithCapacity:15];
 		[self setState:MPPortStateUnknown];
 	}
 	return self;
 }
 
 - (id)initWithCapacity:(unsigned)numItems {
-	self = [super init];
+	self = [super initWithCapacity:numItems];
 	if (self != nil) {
-		embeddedDictionary = [[NSMutableDictionary alloc] initWithCapacity:numItems];
 		[self setState:MPPortStateUnknown];
 	}
 	return self;
 }
 
 - (id) initWithTclListAsString:(NSString *)string {
-	self = [super init];
+	self = [super initWithCapacity:15];
 	if (self != nil) {
-		embeddedDictionary = [[NSMutableDictionary alloc] initWithCapacity:15];
 		[self setState:MPPortStateUnknown];
 		[self setPortWithTclListAsString:string];
 	}
@@ -67,7 +64,6 @@
 }
 
 - (void) dealloc {
-	[embeddedDictionary release];
 	[super dealloc];
 }
 
@@ -141,8 +137,8 @@
 		while (item = [installedEnumerator nextObject]) {
 			if ([item valueForKey:@"active"]) {
 				[self setState:MPPortStateActive];
-				activeVersion = [[[item valueForKey:@"version"] stringByAppendingString:@"_"] stringByAppendingString:[item valueForKey:@"revision"]];
-				if (![activeVersion isEqualToString:[self valueForKey:@"compositeVersion"]]) {
+				[self setObject:item forKey:@"activeReceipt"];
+				if (![[item valueForKey:@"compositeVersion"] isEqualToString:[self valueForKey:@"compositeVersion"]]) {
 					[self setState:MPPortStateOutdated];
 				}
 			}
@@ -182,32 +178,10 @@
 //	[interpreter evaluateArrayAsString:];
 }
 
-#pragma NSMutableDictionary Protocal
+#pragma MPMutableDictionary Protocal
 
-- (unsigned)count {
-	return [embeddedDictionary count];
-}
-
-- (NSEnumerator *)keyEnumerator {
-	return [embeddedDictionary keyEnumerator];
-}
-
-- (id)objectForKey:(id)aKey {
-	return [embeddedDictionary objectForKey:aKey];
-}
-
-- (void)removeObjectForKey:(id)aKey {
-	[embeddedDictionary removeObjectForKey:aKey];
-}
-
-- (void)setObject:(id)anObject forKey:(id)aKey {
-	[self willChangeValueForKey:aKey];
-	[embeddedDictionary setObject:anObject forKey:aKey];
-	[self didChangeValueForKey:aKey];
-}
-
 - (void)setDictionary:(NSDictionary *)otherDictionary {
-	[embeddedDictionary setDictionary:otherDictionary];
+	[super setDictionary:otherDictionary];
 	[self setState:MPPortStateUnknown];
 }
 
@@ -215,10 +189,6 @@
 	[self setObject:[NSNumber numberWithInt:state] forKey:@"state"];
 }
 
-- (NSString *)description {
-	return [embeddedDictionary description];
-}
-
 - (Class)classForKeyedArchiver {
 	return [MPPort class];
 }

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20071106/08adf91e/attachment.html


More information about the macports-changes mailing list