summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrandomguy3 <randomguy3@7c02a99a-9b00-45e3-bf44-6f3dd7fddb64>2012-01-17 17:58:26 +0000
committerrandomguy3 <randomguy3@7c02a99a-9b00-45e3-bf44-6f3dd7fddb64>2012-01-17 17:58:26 +0000
commit6e8e84cdcb300092f93479d50e62479c83f1ac49 (patch)
tree65dabad9217ef0ad4e8ca388287d599b1e0125bf
parent18c354ee32a605f50e094ab9c16099d3fde4cb88 (diff)
Remove BasicMapTable
git-svn-id: https://tikzit.svn.sourceforge.net/svnroot/tikzit/trunk@385 7c02a99a-9b00-45e3-bf44-6f3dd7fddb64
-rw-r--r--tikzit/src/Makefile.am1
-rw-r--r--tikzit/src/common/BasicMapTable.h50
-rw-r--r--tikzit/src/common/BasicMapTable.m75
-rw-r--r--tikzit/src/common/ColorRGB.m5
-rw-r--r--tikzit/src/common/Graph.h13
-rw-r--r--tikzit/src/common/Graph.m15
-rw-r--r--tikzit/src/common/GraphChange.h21
-rw-r--r--tikzit/src/common/GraphChange.m24
-rw-r--r--tikzit/src/linux/TikzDocument.h4
9 files changed, 39 insertions, 169 deletions
diff --git a/tikzit/src/Makefile.am b/tikzit/src/Makefile.am
index 3c5f6b0..5b7baa2 100644
--- a/tikzit/src/Makefile.am
+++ b/tikzit/src/Makefile.am
@@ -59,7 +59,6 @@ tikzit_SOURCES = linux/CairoRenderContext.m \
linux/logo.m \
linux/mkdtemp.m \
linux/main.m \
- common/BasicMapTable.m \
common/CircleShape.m \
common/ColorRGB.m \
common/Edge.m \
diff --git a/tikzit/src/common/BasicMapTable.h b/tikzit/src/common/BasicMapTable.h
deleted file mode 100644
index e3ddeea..0000000
--- a/tikzit/src/common/BasicMapTable.h
+++ /dev/null
@@ -1,50 +0,0 @@
-//
-// BasicMapTable.h
-// TikZiT
-//
-// Copyright 2010 Aleks Kissinger. All rights reserved.
-//
-//
-// This file is part of TikZiT.
-//
-// TikZiT is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// TikZiT is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with TikZiT. If not, see <http://www.gnu.org/licenses/>.
-//
-
-#import <Foundation/Foundation.h>
-
-/*!
- @class BasicMapTable
- @brief A stripped-down wrapper for NSMapTable.
- @details A stripped-down wrapper for NSMapTable. In OS X, this is
- just an interface to NSMapTable.
- */
-@interface BasicMapTable : NSObject {
- NSMapTable *mapTable;
-}
-
-- (id)init;
-+ (BasicMapTable*)mapTable;
-- (id)objectForKey:(id)aKey;
-- (void)setObject:(id)anObject forKey:(id)aKey;
-- (NSEnumerator*)objectEnumerator;
-- (NSEnumerator*)keyEnumerator;
-- (NSUInteger)count;
-
-// for fast enumeration
-- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state
- objects:(id *)stackbuf
- count:(NSUInteger)len;
-@end
-
-// vi:ft=objc:noet:ts=4:sts=4:sw=4
diff --git a/tikzit/src/common/BasicMapTable.m b/tikzit/src/common/BasicMapTable.m
deleted file mode 100644
index 163cf8f..0000000
--- a/tikzit/src/common/BasicMapTable.m
+++ /dev/null
@@ -1,75 +0,0 @@
-//
-// BasicMapTable.m
-// TikZiT
-//
-// Copyright 2010 Aleks Kissinger. All rights reserved.
-//
-//
-// This file is part of TikZiT.
-//
-// TikZiT is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// TikZiT is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with TikZiT. If not, see <http://www.gnu.org/licenses/>.
-//
-
-#import "BasicMapTable.h"
-
-@implementation BasicMapTable
-
-- (id)init {
- [super init];
-
- mapTable = [[NSMapTable alloc] initWithKeyOptions:NSMapTableStrongMemory
- valueOptions:NSMapTableStrongMemory
- capacity:10];
-
- return self;
-}
-
-+ (BasicMapTable*)mapTable {
- return [[[BasicMapTable alloc] init] autorelease];
-}
-
-- (id)objectForKey:(id)aKey {
- return [mapTable objectForKey:aKey];
-}
-
-- (void)setObject:(id)anObject forKey:(id)aKey {
- [mapTable setObject:anObject forKey:aKey];
-}
-
-- (NSEnumerator*)objectEnumerator {
- return [mapTable objectEnumerator];
-}
-
-- (NSEnumerator*)keyEnumerator {
- return [mapTable keyEnumerator];
-}
-
-- (void)dealloc {
- [mapTable release];
- [super dealloc];
-}
-
-- (NSUInteger)count {
- return [mapTable count];
-}
-
-- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state
- objects:(id *)stackbuf
- count:(NSUInteger)len {
- return [mapTable countByEnumeratingWithState:state objects:stackbuf count:len];
-}
-
-@end
-
-// vi:ft=objc:noet:ts=4:sts=4:sw=4
diff --git a/tikzit/src/common/ColorRGB.m b/tikzit/src/common/ColorRGB.m
index 7b3e51f..b6fc2e3 100644
--- a/tikzit/src/common/ColorRGB.m
+++ b/tikzit/src/common/ColorRGB.m
@@ -22,7 +22,6 @@
//
#import "ColorRGB.h"
-#import "BasicMapTable.h"
#import "util.h"
typedef struct {
@@ -180,7 +179,7 @@ static const ColorRGBEntry kColors[147] = {
{ @"YellowGreen", 154, 205, 50 }
};
-static BasicMapTable *colorHash = nil;
+static NSMapTable *colorHash = nil;
@implementation ColorRGB
@@ -285,7 +284,7 @@ static BasicMapTable *colorHash = nil;
}
+ (void)makeColorHash {
- BasicMapTable *h = [[BasicMapTable alloc] init];
+ NSMapTable *h = [[NSMapTable alloc] init];
int i;
for (i = 0; i < 147; ++i) {
ColorRGB *col = [[ColorRGB alloc] initWithRed:kColors[i].r
diff --git a/tikzit/src/common/Graph.h b/tikzit/src/common/Graph.h
index f396912..d9b4a3c 100644
--- a/tikzit/src/common/Graph.h
+++ b/tikzit/src/common/Graph.h
@@ -35,7 +35,6 @@
#import "Node.h"
#import "Edge.h"
#import "GraphChange.h"
-#import "BasicMapTable.h"
#import "Transformer.h"
/*!
@@ -53,8 +52,8 @@
// NSSet *nodesCache;
// NSSet *edgesCache;
- BasicMapTable *inEdges;
- BasicMapTable *outEdges;
+ NSMapTable *inEdges;
+ NSMapTable *outEdges;
GraphElementData *data;
NSRect boundingBox;
@@ -312,18 +311,18 @@
keys are the original nodes. This is used to save the state
of a set of nodes in a GraphChange.
@param nds a set of nodes.
- @result A <tt>BasicMapTable</tt> of node copies.
+ @result A <tt>NSMapTable</tt> of node copies.
*/
-+ (BasicMapTable*)nodeTableForNodes:(NSSet*)nds;
++ (NSMapTable*)nodeTableForNodes:(NSSet*)nds;
/*!
@brief Copy the edge set and return a table of copies, whose
keys are the original edges. This is used to save the state
of a set of edges in a GraphChange.
@param es a set of edges.
- @result A <tt>BasicMapTable</tt> of edge copies.
+ @result A <tt>NSMapTable</tt> of edge copies.
*/
-+ (BasicMapTable*)edgeTableForEdges:(NSSet*)es;
++ (NSMapTable*)edgeTableForEdges:(NSSet*)es;
/*!
@brief Compute the bounds for a set of nodes.
diff --git a/tikzit/src/common/Graph.m b/tikzit/src/common/Graph.m
index 293695a..63476f3 100644
--- a/tikzit/src/common/Graph.m
+++ b/tikzit/src/common/Graph.m
@@ -22,7 +22,6 @@
//
#import "Graph.h"
-#import "BasicMapTable.h"
@implementation Graph
@@ -45,8 +44,8 @@
if (dirty) {
[inEdges release];
[outEdges release];
- inEdges = [[BasicMapTable alloc] init];
- outEdges = [[BasicMapTable alloc] init];
+ inEdges = [[NSMapTable alloc] init];
+ outEdges = [[NSMapTable alloc] init];
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
@@ -483,7 +482,7 @@
- (Graph*)copyOfSubgraphWithNodes:(NSSet*)nds {
[graphLock lock];
- BasicMapTable *newNds = [Graph nodeTableForNodes:nds];
+ NSMapTable *newNds = [Graph nodeTableForNodes:nds];
Graph* newGraph = [[Graph graph] retain];
NSEnumerator *en = [newNds objectEnumerator];
@@ -710,8 +709,8 @@
return [[[self alloc] init] autorelease];
}
-+ (BasicMapTable*)nodeTableForNodes:(NSSet*)nds {
- BasicMapTable *tab = [BasicMapTable mapTable];
++ (NSMapTable*)nodeTableForNodes:(NSSet*)nds {
+ NSMapTable *tab = [NSMapTable mapTableWithStrongToStrongObjects];
for (Node *n in nds) {
Node *ncopy = [n copy];
[tab setObject:ncopy forKey:n];
@@ -720,8 +719,8 @@
return tab;
}
-+ (BasicMapTable*)edgeTableForEdges:(NSSet*)es {
- BasicMapTable *tab = [BasicMapTable mapTable];
++ (NSMapTable*)edgeTableForEdges:(NSSet*)es {
+ NSMapTable *tab = [NSMapTable mapTableWithStrongToStrongObjects];
for (Edge *e in es) {
Edge *ecopy = [e copy];
[tab setObject:ecopy forKey:e];
diff --git a/tikzit/src/common/GraphChange.h b/tikzit/src/common/GraphChange.h
index 63bdfad..73a912a 100644
--- a/tikzit/src/common/GraphChange.h
+++ b/tikzit/src/common/GraphChange.h
@@ -23,7 +23,6 @@
#import "Node.h"
#import "Edge.h"
-#import "BasicMapTable.h"
typedef enum {
GraphAddition,
@@ -63,8 +62,8 @@ typedef enum {
Node *oldNode, *nwNode;
Edge *oldEdge, *nwEdge;
- BasicMapTable *oldNodeTable, *nwNodeTable;
- BasicMapTable *oldEdgeTable, *nwEdgeTable;
+ NSMapTable *oldNodeTable, *nwNodeTable;
+ NSMapTable *oldEdgeTable, *nwEdgeTable;
NSRect oldBoundingBox, nwBoundingBox;
GraphElementData *oldGraphData, *nwGraphData;
}
@@ -139,25 +138,25 @@ typedef enum {
@property oldNodeTable
@brief A a table containing copies of a set of nodes pre-change.
*/
-@property (retain) BasicMapTable *oldNodeTable;
+@property (retain) NSMapTable *oldNodeTable;
/*!
@property nwNodeTable
@brief A a table containing copies of a set of nodes post-change.
*/
-@property (retain) BasicMapTable *nwNodeTable;
+@property (retain) NSMapTable *nwNodeTable;
/*!
@property oldEdgeTable
@brief A a table containing copies of a set of edges pre-change.
*/
-@property (retain) BasicMapTable *oldEdgeTable;
+@property (retain) NSMapTable *oldEdgeTable;
/*!
@property nwEdgeTable
@brief A a table containing copies of a set of edges post-change.
*/
-@property (retain) BasicMapTable *nwEdgeTable;
+@property (retain) NSMapTable *nwEdgeTable;
/*!
@property oldBoundingBox
@@ -238,8 +237,8 @@ typedef enum {
@param newC a table of copies of nodes post-change
@result A property change of a set of nodes.
*/
-+ (GraphChange*)propertyChangeOfNodesFromOldCopies:(BasicMapTable*)oldC
- toNewCopies:(BasicMapTable*)newC;
++ (GraphChange*)propertyChangeOfNodesFromOldCopies:(NSMapTable*)oldC
+ toNewCopies:(NSMapTable*)newC;
/*!
@brief Construct a property change of set of edges.
@@ -251,8 +250,8 @@ typedef enum {
@param newC a table of copies of edges post-change
@result A property change of a set of edges.
*/
-+ (GraphChange*)propertyChangeOfEdgesFromOldCopies:(BasicMapTable*)oldC
- toNewCopies:(BasicMapTable*)newC;
++ (GraphChange*)propertyChangeOfEdgesFromOldCopies:(NSMapTable*)oldC
+ toNewCopies:(NSMapTable*)newC;
/*!
diff --git a/tikzit/src/common/GraphChange.m b/tikzit/src/common/GraphChange.m
index 3635383..f9210df 100644
--- a/tikzit/src/common/GraphChange.m
+++ b/tikzit/src/common/GraphChange.m
@@ -124,36 +124,36 @@
}
}
-- (BasicMapTable*)oldNodeTable { return oldNodeTable; }
+- (NSMapTable*)oldNodeTable { return oldNodeTable; }
-- (void)setOldNodeTable:(BasicMapTable*)tab {
+- (void)setOldNodeTable:(NSMapTable*)tab {
if (oldNodeTable != tab) {
[oldNodeTable release];
oldNodeTable = [tab retain];
}
}
-- (BasicMapTable*)nwNodeTable { return nwNodeTable; }
+- (NSMapTable*)nwNodeTable { return nwNodeTable; }
-- (void)setNwNodeTable:(BasicMapTable*)tab {
+- (void)setNwNodeTable:(NSMapTable*)tab {
if (nwNodeTable != tab) {
[nwNodeTable release];
nwNodeTable = [tab retain];
}
}
-- (BasicMapTable*)oldEdgeTable { return oldEdgeTable; }
+- (NSMapTable*)oldEdgeTable { return oldEdgeTable; }
-- (void)setOldEdgeTable:(BasicMapTable*)tab {
+- (void)setOldEdgeTable:(NSMapTable*)tab {
if (oldEdgeTable != tab) {
[oldEdgeTable release];
oldEdgeTable = [tab retain];
}
}
-- (BasicMapTable*)nwEdgeTable { return nwEdgeTable; }
+- (NSMapTable*)nwEdgeTable { return nwEdgeTable; }
-- (void)setNwEdgeTable:(BasicMapTable*)tab {
+- (void)setNwEdgeTable:(NSMapTable*)tab {
if (nwEdgeTable != tab) {
[nwEdgeTable release];
nwEdgeTable = [tab retain];
@@ -294,8 +294,8 @@
return [gc autorelease];
}
-+ (GraphChange*)propertyChangeOfNodesFromOldCopies:(BasicMapTable*)oldC
- toNewCopies:(BasicMapTable*)newC {
++ (GraphChange*)propertyChangeOfNodesFromOldCopies:(NSMapTable*)oldC
+ toNewCopies:(NSMapTable*)newC {
GraphChange *gc = [[GraphChange alloc] init];
[gc setChangeType:NodesPropertyChange];
[gc setOldNodeTable:oldC];
@@ -312,8 +312,8 @@
return [gc autorelease];
}
-+ (GraphChange*)propertyChangeOfEdgesFromOldCopies:(BasicMapTable*)oldC
- toNewCopies:(BasicMapTable*)newC {
++ (GraphChange*)propertyChangeOfEdgesFromOldCopies:(NSMapTable*)oldC
+ toNewCopies:(NSMapTable*)newC {
GraphChange *gc = [[GraphChange alloc] init];
[gc setChangeType:EdgesPropertyChange];
[gc setOldEdgeTable:oldC];
diff --git a/tikzit/src/linux/TikzDocument.h b/tikzit/src/linux/TikzDocument.h
index 11f754b..2e29677 100644
--- a/tikzit/src/linux/TikzDocument.h
+++ b/tikzit/src/linux/TikzDocument.h
@@ -34,9 +34,9 @@
NSString *tikz;
NSString *path;
NSSet *nodesetBeingModified;
- BasicMapTable *nodesetBeingModifiedOldCopy;
+ NSMapTable *nodesetBeingModifiedOldCopy;
NSSet *edgesetBeingModified;
- BasicMapTable *edgesetBeingModifiedOldCopy;
+ NSMapTable *edgesetBeingModifiedOldCopy;
NSPoint currentNodeShift;
Node *nodeBeingModified;
Node *nodeBeingModifiedOldCopy;