Permalink
Browse files

base class ARCification

  • Loading branch information...
1 parent 7e464e5 commit e9ed1e77ac251a070d387bb8d93a6af82c97def3 @incanus incanus committed Dec 23, 2011
View
12 SimpleKML.h
@@ -48,17 +48,9 @@ enum SimpleKMLErrorCode {
@class SimpleKMLFeature;
@interface SimpleKML : NSObject
-{
- @private
- NSURL *sourceURL;
-
- @public
- SimpleKMLFeature *feature;
- NSString *source;
-}
-@property (nonatomic, retain, readonly) SimpleKMLFeature *feature;
-@property (nonatomic, retain, readonly) NSString *source;
+@property (nonatomic, strong, readonly) SimpleKMLFeature *feature;
+@property (nonatomic, strong, readonly) NSString *source;
+ (SimpleKML *)KMLWithContentsOfURL:(NSURL *)URL error:(NSError **)error;
+ (SimpleKML *)KMLWithContentsOfFile:(NSString *)path error:(NSError **)error;
View
32 SimpleKML.m
@@ -40,7 +40,9 @@
NSString *const SimpleKMLErrorDomain = @"SimpleKMLErrorDomain";
-@interface SimpleKML (SimpleKMLPrivate)
+@interface SimpleKML ()
+
+@property (nonatomic, strong) NSURL *sourceURL;
- (id)initWithContentsOfFile:(NSString *)path error:(NSError **)error;
+ (NSString *)topLevelKMLFilePathInArchiveAtPath:(NSString *)archivePath;
@@ -53,15 +55,16 @@ @implementation SimpleKML
@synthesize feature;
@synthesize source;
+@synthesize sourceURL;
+ (SimpleKML *)KMLWithContentsOfURL:(NSURL *)URL error:(NSError **)error
{
- return [[[self alloc] initWithContentsOfURL:URL error:error] autorelease];
+ return [[self alloc] initWithContentsOfURL:URL error:error];
}
+ (SimpleKML *)KMLWithContentsOfFile:(NSString *)path error:(NSError **)error
{
- return [[[self alloc] initWithContentsOfFile:path error:error] autorelease];
+ return [[self alloc] initWithContentsOfFile:path error:error];
}
- (id)initWithContentsOfURL:(NSURL *)URL error:(NSError **)error
@@ -70,12 +73,12 @@ - (id)initWithContentsOfURL:(NSURL *)URL error:(NSError **)error
if (self != nil)
{
- sourceURL = [URL retain];
+ sourceURL = URL;
feature = nil;
if ([[[[URL relativePath] pathExtension] lowercaseString] isEqualToString:@"kml"])
{
- source = [[NSString stringWithContentsOfURL:URL encoding:NSUTF8StringEncoding error:NULL] retain];
+ source = [NSString stringWithContentsOfURL:URL encoding:NSUTF8StringEncoding error:NULL];
}
else if ([[[[URL relativePath] pathExtension] lowercaseString] isEqualToString:@"kmz"])
{
@@ -106,9 +109,9 @@ - (id)initWithContentsOfURL:(NSURL *)URL error:(NSError **)error
NSError *parseError = nil;
- CXMLDocument *document = [[[CXMLDocument alloc] initWithXMLString:source
- options:0
- error:&parseError] autorelease];
+ CXMLDocument *document = [[CXMLDocument alloc] initWithXMLString:source
+ options:0
+ error:&parseError];
// return nil if we can't properly parse this file
//
@@ -197,15 +200,6 @@ - (id)initWithContentsOfFile:(NSString *)path error:(NSError **)error
return [self initWithContentsOfURL:[NSURL fileURLWithPath:path] error:error];
}
-- (void)dealloc
-{
- [sourceURL release];
- [feature release];
- [source release];
-
- [super dealloc];
-}
-
#pragma mark -
+ (UIColor *)colorForString:(NSString *)colorString;
@@ -243,7 +237,7 @@ + (UIColor *)colorForString:(NSString *)colorString;
+ (NSString *)topLevelKMLFilePathInArchiveAtPath:(NSString *)archivePath
{
- ZipFile *archive = [[[ZipFile alloc] initWithFileName:archivePath mode:ZipFileModeUnzip] autorelease];
+ ZipFile *archive = [[ZipFile alloc] initWithFileName:archivePath mode:ZipFileModeUnzip];
NSArray *files = [archive listFileInZipInfos];
@@ -264,7 +258,7 @@ + (NSString *)topLevelKMLFilePathInArchiveAtPath:(NSString *)archivePath
+ (NSData *)dataFromArchiveAtPath:(NSString *)archivePath withFilePath:(NSString *)filePath
{
- ZipFile *archive = [[[ZipFile alloc] initWithFileName:archivePath mode:ZipFileModeUnzip] autorelease];
+ ZipFile *archive = [[ZipFile alloc] initWithFileName:archivePath mode:ZipFileModeUnzip];
if ( ! [archive locateFileInZip:filePath])
{
View
8 SimpleKMLBalloonStyle.h
@@ -37,12 +37,8 @@
#import "SimpleKMLSubStyle.h"
@interface SimpleKMLBalloonStyle : SimpleKMLSubStyle
-{
- UIColor *backgroundColor;
- UIColor *textColor;
-}
-@property (nonatomic, retain, readonly) UIColor *backgroundColor;
-@property (nonatomic, retain, readonly) UIColor *textColor;
+@property (nonatomic, strong, readonly) UIColor *backgroundColor;
+@property (nonatomic, strong, readonly) UIColor *textColor;
@end
View
18 SimpleKMLBalloonStyle.m
@@ -45,37 +45,27 @@ - (id)initWithXMLNode:(CXMLNode *)node sourceURL:sourceURL error:(NSError **)err
if (self != nil)
{
- backgroundColor = [[UIColor whiteColor] retain];
- textColor = [[UIColor blackColor] retain];
+ backgroundColor = [UIColor whiteColor];
+ textColor = [UIColor blackColor];
for (CXMLNode *child in [node children])
{
if ([[child name] isEqualToString:@"bgColor"])
{
NSString *colorString = [child stringValue];
- [backgroundColor release];
- backgroundColor = [[SimpleKML colorForString:colorString] retain];
+ backgroundColor = [SimpleKML colorForString:colorString];
}
else if ([[child name] isEqualToString:@"textColor"])
{
NSString *colorString = [child stringValue];
- [textColor release];
- textColor = [[SimpleKML colorForString:colorString] retain];
+ textColor = [SimpleKML colorForString:colorString];
}
}
}
return self;
}
-- (void)dealloc
-{
- [backgroundColor release];
- [textColor release];
-
- [super dealloc];
-}
-
@end
View
5 SimpleKMLColorStyle.h
@@ -37,10 +37,7 @@
#import "SimpleKMLSubStyle.h"
@interface SimpleKMLColorStyle : SimpleKMLSubStyle
-{
- UIColor *color;
-}
-@property (nonatomic, retain, readonly) UIColor *color;
+@property (nonatomic, strong, readonly) UIColor *color;
@end
View
9 SimpleKMLColorStyle.m
@@ -52,19 +52,12 @@ - (id)initWithXMLNode:(CXMLNode *)node sourceURL:sourceURL error:(NSError **)err
{
NSString *colorString = [child stringValue];
- color = [[SimpleKML colorForString:colorString] retain];
+ color = [SimpleKML colorForString:colorString];
}
}
}
return self;
}
-- (void)dealloc
-{
- [color release];
-
- [super dealloc];
-}
-
@end
View
8 SimpleKMLContainer.h
@@ -37,12 +37,8 @@
#import "SimpleKMLFeature.h"
@interface SimpleKMLContainer : SimpleKMLFeature
-{
- NSArray *features; // top-level <Feature> elements
- NSArray *flattenedPlacemarks; // <Placemark> elements at all depths, regardless of hierarchy
-}
-@property (nonatomic, retain, readonly) NSArray *features;
-@property (nonatomic, retain, readonly) NSArray *flattenedPlacemarks;
+@property (nonatomic, strong, readonly) NSArray *features; // top-level <Feature> elements
+@property (nonatomic, strong, readonly) NSArray *flattenedPlacemarks; // <Placemark> elements at all depths, regardless of hierarchy
@end
View
20 SimpleKMLContainer.m
@@ -65,7 +65,7 @@ - (id)initWithXMLNode:(CXMLNode *)node sourceURL:sourceURL error:(NSError **)err
{
parseError = nil;
- id feature = [[[featureClass alloc] initWithXMLNode:child sourceURL:sourceURL error:&parseError] autorelease];
+ id feature = [[featureClass alloc] initWithXMLNode:child sourceURL:sourceURL error:&parseError];
// only add the feature if it's one we know how to handle
//
@@ -82,7 +82,7 @@ - (id)initWithXMLNode:(CXMLNode *)node sourceURL:sourceURL error:(NSError **)err
}
}
- features = [[NSArray arrayWithArray:featuresArray] retain];
+ features = [NSArray arrayWithArray:featuresArray];
// find all Placemark features, regardless of hierarchy
//
@@ -141,28 +141,20 @@ - (id)initWithXMLNode:(CXMLNode *)node sourceURL:sourceURL error:(NSError **)err
{
parseError = nil;
- SimpleKMLPlacemark *placemark = [[[SimpleKMLPlacemark alloc] initWithXMLNode:featureNode
- sourceURL:sourceURL
- error:&parseError] autorelease];
+ SimpleKMLPlacemark *placemark = [[SimpleKMLPlacemark alloc] initWithXMLNode:featureNode
+ sourceURL:sourceURL
+ error:&parseError];
if ( ! parseError)
[flattenedPlacemarksArray addObject:placemark];
}
}
}
- flattenedPlacemarks = [[NSArray arrayWithArray:flattenedPlacemarksArray] retain];
+ flattenedPlacemarks = [NSArray arrayWithArray:flattenedPlacemarksArray];
}
return self;
}
-- (void)dealloc
-{
- [features release];
- [flattenedPlacemarks release];
-
- [super dealloc];
-}
-
@end
View
5 SimpleKMLDocument.h
@@ -39,13 +39,10 @@
@class SimpleKMLStyle;
@interface SimpleKMLDocument : SimpleKMLContainer
-{
- NSArray *sharedStyles;
-}
// abstract class
-@property (nonatomic, retain, readonly) NSArray *sharedStyles;
+@property (nonatomic, strong, readonly) NSArray *sharedStyles;
- (SimpleKMLStyle *)sharedStyleWithID:(NSString *)styleID;
View
11 SimpleKMLDocument.m
@@ -54,14 +54,14 @@ - (id)initWithXMLNode:(CXMLNode *)node sourceURL:sourceURL error:(NSError **)err
if (childClass)
{
- id thisChild = [[[childClass alloc] initWithXMLNode:child sourceURL:sourceURL error:NULL] autorelease];
+ id thisChild = [[childClass alloc] initWithXMLNode:child sourceURL:sourceURL error:NULL];
if (thisChild && [thisChild isKindOfClass:[SimpleKMLStyle class]])
[parsedStyles addObject:thisChild];
}
}
- sharedStyles = [[NSArray arrayWithArray:parsedStyles] retain];
+ sharedStyles = [NSArray arrayWithArray:parsedStyles];
for (SimpleKMLFeature *feature in self.flattenedPlacemarks)
if (feature.sharedStyleID && ! feature.sharedStyle)
@@ -71,13 +71,6 @@ - (id)initWithXMLNode:(CXMLNode *)node sourceURL:sourceURL error:(NSError **)err
return self;
}
-- (void)dealloc
-{
- [sharedStyles release];
-
- [super dealloc];
-}
-
#pragma mark -
- (SimpleKMLStyle *)sharedStyleWithID:(NSString *)styleID
View
23 SimpleKMLFeature.h
@@ -40,22 +40,13 @@
@class SimpleKMLDocument;
@interface SimpleKMLFeature : SimpleKMLObject
-{
- NSString *name;
- NSString *featureDescription;
- NSString *sharedStyleID;
- SimpleKMLStyle *sharedStyle;
- SimpleKMLStyle *inlineStyle;
- SimpleKMLStyle *style;
- SimpleKMLDocument *document;
-}
-@property (nonatomic, retain, readonly) NSString *name;
-@property (nonatomic, retain, readonly) NSString *featureDescription;
-@property (nonatomic, retain, readonly) NSString *sharedStyleID;
-@property (nonatomic, retain, readonly) SimpleKMLStyle *inlineStyle;
-@property (nonatomic, retain, readonly) SimpleKMLStyle *style;
-@property (nonatomic, assign) SimpleKMLStyle *sharedStyle;
-@property (nonatomic, assign) SimpleKMLDocument *document;
+@property (nonatomic, strong, readonly) NSString *name;
+@property (nonatomic, strong, readonly) NSString *featureDescription;
+@property (nonatomic, strong, readonly) NSString *sharedStyleID;
+@property (nonatomic, strong, readonly) SimpleKMLStyle *inlineStyle;
+@property (nonatomic, strong, readonly) SimpleKMLStyle *style;
+@property (nonatomic, weak) SimpleKMLStyle *sharedStyle;
+@property (nonatomic, weak) SimpleKMLDocument *document;
@end
View
16 SimpleKMLFeature.m
@@ -55,33 +55,23 @@ - (id)initWithXMLNode:(CXMLNode *)node sourceURL:sourceURL error:(NSError **)err
for (CXMLNode *child in [node children])
{
if ([[child name] isEqualToString:@"name"])
- name = [[[child stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] retain];
+ name = [[child stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
else if ([[child name] isEqualToString:@"description"])
- featureDescription = [[[child stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] retain];
+ featureDescription = [[child stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
else if ([[child name] isEqualToString:@"Style"])
inlineStyle = [[SimpleKMLStyle alloc] initWithXMLNode:child sourceURL:sourceURL error:NULL];
#pragma mark TODO: we really need case folding here
else if ([[child name] isEqualToString:@"styleUrl"])
- sharedStyleID = [[[child stringValue] stringByReplacingOccurrencesOfString:@"#" withString:@""] retain];
+ sharedStyleID = [[child stringValue] stringByReplacingOccurrencesOfString:@"#" withString:@""];
}
}
return self;
}
-- (void)dealloc
-{
- [name release];
- [featureDescription release];
- [sharedStyleID release];
- [inlineStyle release];
-
- [super dealloc];
-}
-
#pragma mark -
- (SimpleKMLStyle *)style
View
2 SimpleKMLFolder.h
@@ -37,7 +37,5 @@
#import "SimpleKMLContainer.h"
@interface SimpleKMLFolder : SimpleKMLContainer
-{
-}
@end
View
2 SimpleKMLGeometry.h
@@ -37,8 +37,6 @@
#import "SimpleKMLObject.h"
@interface SimpleKMLGeometry : SimpleKMLObject
-{
-}
// abstract class
View
7 SimpleKMLGroundOverlay.h
@@ -39,13 +39,6 @@
#import <CoreLocation/CoreLocation.h>
@interface SimpleKMLGroundOverlay : SimpleKMLOverlay
-{
- CLLocationDegrees north;
- CLLocationDegrees south;
- CLLocationDegrees east;
- CLLocationDegrees west;
- CGFloat rotation;
-}
@property (nonatomic, assign, readonly) CLLocationDegrees north;
@property (nonatomic, assign, readonly) CLLocationDegrees south;
View
5 SimpleKMLIconStyle.h
@@ -37,10 +37,7 @@
#import "SimpleKMLColorStyle.h"
@interface SimpleKMLIconStyle : SimpleKMLColorStyle
-{
- UIImage *icon;
-}
-@property (nonatomic, retain, readonly) UIImage *icon; // automatically gets scale, heading, and parent color applied
+@property (nonatomic, strong, readonly) UIImage *icon; // automatically gets scale, heading, and parent color applied
@end
View
9 SimpleKMLIconStyle.m
@@ -176,17 +176,10 @@ - (id)initWithXMLNode:(CXMLNode *)node sourceURL:sourceURL error:(NSError **)err
CGFloat newWidth = kSimpleKMLIconStyleBaseIconSize * baseScale;
CGFloat newHeight = kSimpleKMLIconStyleBaseIconSize * baseScale;
- icon = [[baseIcon imageWithWidth:newWidth height:newHeight] retain];
+ icon = [baseIcon imageWithWidth:newWidth height:newHeight];
}
return self;
}
-- (void)dealloc
-{
- [icon release];
-
- [super dealloc];
-}
-
@end
View
5 SimpleKMLLineString.h
@@ -35,10 +35,7 @@
#import "SimpleKMLGeometry.h"
@interface SimpleKMLLineString : SimpleKMLGeometry
-{
- NSArray *coordinates;
-}
-@property (nonatomic, retain, readonly) NSArray *coordinates;
+@property (nonatomic, strong, readonly) NSArray *coordinates;
@end
View
13 SimpleKMLLineString.m
@@ -55,7 +55,7 @@ - (id)initWithXMLNode:(CXMLNode *)node sourceURL:sourceURL error:(NSError **)err
NSArray *coordinateStrings = [[child stringValue] componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
- for (NSString *coordinateString in coordinateStrings)
+ for (__strong NSString *coordinateString in coordinateStrings)
{
coordinateString = [coordinateString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
@@ -105,13 +105,13 @@ - (id)initWithXMLNode:(CXMLNode *)node sourceURL:sourceURL error:(NSError **)err
return nil;
}
- CLLocation *coordinate = [[[CLLocation alloc] initWithLatitude:latitude longitude:longitude] autorelease];
+ CLLocation *coordinate = [[CLLocation alloc] initWithLatitude:latitude longitude:longitude];
[parsedCoordinates addObject:coordinate];
}
}
- coordinates = [[NSArray arrayWithArray:parsedCoordinates] retain];
+ coordinates = [NSArray arrayWithArray:parsedCoordinates];
// there should be two or more coordinates
//
@@ -143,11 +143,4 @@ - (id)initWithXMLNode:(CXMLNode *)node sourceURL:sourceURL error:(NSError **)err
return self;
}
-- (void)dealloc
-{
- [coordinates release];
-
- [super dealloc];
-}
-
@end
View
3 SimpleKMLLineStyle.h
@@ -37,9 +37,6 @@
#import "SimpleKMLColorStyle.h"
@interface SimpleKMLLineStyle : SimpleKMLColorStyle
-{
- CGFloat width;
-}
@property (nonatomic, assign, readonly) CGFloat width;
View
5 SimpleKMLLinearRing.h
@@ -37,10 +37,7 @@
#import "SimpleKMLGeometry.h"
@interface SimpleKMLLinearRing : SimpleKMLGeometry
-{
- NSArray *coordinates;
-}
-@property (nonatomic, retain, readonly) NSArray *coordinates;
+@property (nonatomic, strong, readonly) NSArray *coordinates;
@end
View
13 SimpleKMLLinearRing.m
@@ -55,7 +55,7 @@ - (id)initWithXMLNode:(CXMLNode *)node sourceURL:sourceURL error:(NSError **)err
NSArray *coordinateStrings = [[child stringValue] componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
- for (NSString *coordinateString in coordinateStrings)
+ for (__strong NSString *coordinateString in coordinateStrings)
{
coordinateString = [coordinateString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
@@ -105,13 +105,13 @@ - (id)initWithXMLNode:(CXMLNode *)node sourceURL:sourceURL error:(NSError **)err
return nil;
}
- CLLocation *coordinate = [[[CLLocation alloc] initWithLatitude:latitude longitude:longitude] autorelease];
+ CLLocation *coordinate = [[CLLocation alloc] initWithLatitude:latitude longitude:longitude];
[parsedCoordinates addObject:coordinate];
}
}
- coordinates = [[NSArray arrayWithArray:parsedCoordinates] retain];
+ coordinates = [NSArray arrayWithArray:parsedCoordinates];
// there should be four or more coordinates
//
@@ -157,11 +157,4 @@ - (id)initWithXMLNode:(CXMLNode *)node sourceURL:sourceURL error:(NSError **)err
return self;
}
-- (void)dealloc
-{
- [coordinates release];
-
- [super dealloc];
-}
-
@end
View
12 SimpleKMLObject.h
@@ -37,18 +37,8 @@
#import "SimpleKML.h"
@interface SimpleKMLObject : NSObject
-{
- @private
- NSURL *sourceURL;
- @protected
- NSString *source;
-
- @public
- NSString *objectID;
-}
-
-@property (nonatomic, retain, readonly) NSString *objectID;
+@property (nonatomic, strong, readonly) NSString *objectID;
- (id)initWithXMLNode:(CXMLNode *)node sourceURL:(NSURL *)inSourceURL error:(NSError **)error;
- (void)setCacheObject:(id)object forKey:(NSString *)key;
View
22 SimpleKMLObject.m
@@ -34,7 +34,10 @@
#import "SimpleKMLObject.h"
-@interface SimpleKMLObject (SimpleKMLObjectPrivate)
+@interface SimpleKMLObject ()
+
+@property (nonatomic, strong) NSURL *sourceURL;
+@property (nonatomic, strong) NSString *source;
- (NSString *)cachePath;
@@ -45,32 +48,25 @@ - (NSString *)cachePath;
@implementation SimpleKMLObject
@synthesize objectID;
+@synthesize sourceURL;
+@synthesize source;
- (id)initWithXMLNode:(CXMLNode *)node sourceURL:(NSURL *)inSourceURL error:(NSError **)error
{
self = [super init];
if (self != nil)
{
- sourceURL = [inSourceURL retain];
- source = [[NSString stringWithString:[node XMLString]] retain];
- objectID = [[[[((CXMLElement *)node) attributeForName:@"id"] stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] retain];
+ sourceURL = inSourceURL;
+ source = [NSString stringWithString:[node XMLString]];
+ objectID = [[[((CXMLElement *)node) attributeForName:@"id"] stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
}
#pragma mark TODO: assert that abstract classes aren't being instantiated
return self;
}
-- (void)dealloc
-{
- [sourceURL release];
- [source release];
- [objectID release];
-
- [super dealloc];
-}
-
#pragma mark -
- (void)setCacheObject:(id)object forKey:(NSString *)key
View
8 SimpleKMLOverlay.h
@@ -37,13 +37,9 @@
#import "SimpleKMLFeature.h"
@interface SimpleKMLOverlay : SimpleKMLFeature
-{
- UIColor *color;
- UIImage *icon;
-}
-@property (nonatomic, retain, readonly) UIColor *color;
-@property (nonatomic, retain, readonly) UIImage *icon;
+@property (nonatomic, strong, readonly) UIColor *color;
+@property (nonatomic, strong, readonly) UIImage *icon;
// abstract class
View
12 SimpleKMLOverlay.m
@@ -54,7 +54,7 @@ - (id)initWithXMLNode:(CXMLNode *)node sourceURL:sourceURL error:(NSError **)err
{
NSString *colorString = [child stringValue];
- color = [[SimpleKML colorForString:colorString] retain];
+ color = [SimpleKML colorForString:colorString];
}
else if ([[child name] isEqualToString:@"Icon"])
{
@@ -121,7 +121,7 @@ - (id)initWithXMLNode:(CXMLNode *)node sourceURL:sourceURL error:(NSError **)err
}
}
- icon = [[UIImage imageWithData:data] retain];
+ icon = [UIImage imageWithData:data];
if ( ! icon)
{
@@ -140,12 +140,4 @@ - (id)initWithXMLNode:(CXMLNode *)node sourceURL:sourceURL error:(NSError **)err
return self;
}
-- (void)dealloc
-{
- [color release];
- [icon release];
-
- [super dealloc];
-}
-
@end
View
13 SimpleKMLPlacemark.h
@@ -43,14 +43,11 @@
@class SimpleKMLLinearRing;
@interface SimpleKMLPlacemark : SimpleKMLFeature
-{
- SimpleKMLGeometry *geometry;
-}
-@property (nonatomic, retain, readonly) SimpleKMLGeometry *geometry;
-@property (nonatomic, retain, readonly) SimpleKMLPoint *point;
-@property (nonatomic, retain, readonly) SimpleKMLPolygon *polygon;
-@property (nonatomic, retain, readonly) SimpleKMLLineString *lineString;
-@property (nonatomic, retain, readonly) SimpleKMLLinearRing *linearRing;
+@property (nonatomic, strong, readonly) SimpleKMLGeometry *geometry;
+@property (nonatomic, strong, readonly) SimpleKMLPoint *point;
+@property (nonatomic, strong, readonly) SimpleKMLPolygon *polygon;
+@property (nonatomic, strong, readonly) SimpleKMLLineString *lineString;
+@property (nonatomic, strong, readonly) SimpleKMLLinearRing *linearRing;
@end
View
19 SimpleKMLPlacemark.m
@@ -65,10 +65,10 @@ - (id)initWithXMLNode:(CXMLNode *)node sourceURL:sourceURL error:(NSError **)err
if (geometryClass)
{
- id thisGeometry = [[[geometryClass alloc] initWithXMLNode:child sourceURL:sourceURL error:NULL] autorelease];
+ id thisGeometry = [[geometryClass alloc] initWithXMLNode:child sourceURL:sourceURL error:NULL];
if (thisGeometry && [thisGeometry isKindOfClass:[SimpleKMLGeometry class]])
- geometry = [thisGeometry retain];
+ geometry = thisGeometry;
}
}
}
@@ -77,43 +77,36 @@ - (id)initWithXMLNode:(CXMLNode *)node sourceURL:sourceURL error:(NSError **)err
return self;
}
-- (void)dealloc
-{
- [geometry release];
-
- [super dealloc];
-}
-
#pragma mark -
- (SimpleKMLPoint *)point
{
if (self.geometry && [self.geometry isKindOfClass:[SimpleKMLPoint class]])
- return (SimpleKMLPoint *)geometry;
+ return (SimpleKMLPoint *)self.geometry;
return nil;
}
- (SimpleKMLPolygon *)polygon
{
if (self.geometry && [self.geometry isKindOfClass:[SimpleKMLPolygon class]])
- return (SimpleKMLPolygon *)geometry;
+ return (SimpleKMLPolygon *)self.geometry;
return nil;
}
- (SimpleKMLLineString *)lineString
{
if (self.geometry && [self.geometry isKindOfClass:[SimpleKMLLineString class]])
- return (SimpleKMLLineString *)geometry;
+ return (SimpleKMLLineString *)self.geometry;
return nil;
}
- (SimpleKMLLinearRing *)linearRing
{
if (self.geometry && [self.geometry isKindOfClass:[SimpleKMLLinearRing class]])
- return (SimpleKMLLinearRing *)geometry;
+ return (SimpleKMLLinearRing *)self.geometry;
return nil;
}
View
4 SimpleKMLPoint.h
@@ -38,10 +38,6 @@
#import <CoreLocation/CoreLocation.h>
@interface SimpleKMLPoint : SimpleKMLGeometry
-{
- @private
- CLLocation *location;
-}
@property (nonatomic, readonly) CLLocationCoordinate2D coordinate;
View
19 SimpleKMLPoint.m
@@ -34,8 +34,18 @@
#import "SimpleKMLPoint.h"
+@interface SimpleKMLPoint ()
+
+@property (nonatomic, strong) CLLocation *location;
+
+@end
+
+#pragma mark -
+
@implementation SimpleKMLPoint
+@synthesize location;
+
- (id)initWithXMLNode:(CXMLNode *)node sourceURL:sourceURL error:(NSError **)error
{
self = [super initWithXMLNode:node sourceURL:sourceURL error:error];
@@ -113,18 +123,11 @@ - (id)initWithXMLNode:(CXMLNode *)node sourceURL:sourceURL error:(NSError **)err
return self;
}
-- (void)dealloc
-{
- [location release];
-
- [super dealloc];
-}
-
#pragma mark -
- (CLLocationCoordinate2D)coordinate
{
- return location.coordinate;
+ return self.location.coordinate;
}
@end
View
4 SimpleKMLPolyStyle.h
@@ -37,10 +37,6 @@
#import "SimpleKMLColorStyle.h"
@interface SimpleKMLPolyStyle : SimpleKMLColorStyle
-{
- BOOL fill;
- BOOL outline;
-}
@property (nonatomic, assign, readonly) BOOL fill;
@property (nonatomic, assign, readonly) BOOL outline;
View
11 SimpleKMLPolygon.h
@@ -39,14 +39,9 @@
@class SimpleKMLLinearRing;
@interface SimpleKMLPolygon : SimpleKMLGeometry
-{
- SimpleKMLLinearRing *outerBoundary;
- SimpleKMLLinearRing *firstInnerBoundary;
- NSArray *innerBoundaries;
-}
-@property (nonatomic, retain, readonly) SimpleKMLLinearRing *outerBoundary;
-@property (nonatomic, assign, readonly) SimpleKMLLinearRing *firstInnerBoundary;
-@property (nonatomic, retain, readonly) NSArray *innerBoundaries;
+@property (nonatomic, strong, readonly) SimpleKMLLinearRing *outerBoundary;
+@property (nonatomic, weak, readonly) SimpleKMLLinearRing *firstInnerBoundary;
+@property (nonatomic, strong, readonly) NSArray *innerBoundaries;
@end
View
13 SimpleKMLPolygon.m
@@ -85,7 +85,7 @@ - (id)initWithXMLNode:(CXMLNode *)node sourceURL:sourceURL error:(NSError **)err
{
if ([grandchild kind] == CXMLElementKind)
{
- thisBoundary = [[[SimpleKMLLinearRing alloc] initWithXMLNode:grandchild sourceURL:sourceURL error:NULL] autorelease];
+ thisBoundary = [[SimpleKMLLinearRing alloc] initWithXMLNode:grandchild sourceURL:sourceURL error:NULL];
break;
}
}
@@ -108,7 +108,7 @@ - (id)initWithXMLNode:(CXMLNode *)node sourceURL:sourceURL error:(NSError **)err
}
}
- innerBoundaries = [[NSArray arrayWithArray:parsedInnerBoundaries] retain];
+ innerBoundaries = [NSArray arrayWithArray:parsedInnerBoundaries];
// there should be one outer boundary
//
@@ -127,13 +127,4 @@ - (id)initWithXMLNode:(CXMLNode *)node sourceURL:sourceURL error:(NSError **)err
return self;
}
-- (void)dealloc
-{
- [outerBoundary release];
- [firstInnerBoundary release];
- [innerBoundaries release];
-
- [super dealloc];
-}
-
@end
View
14 SimpleKMLStyle.h
@@ -42,16 +42,10 @@
@class SimpleKMLBalloonStyle;
@interface SimpleKMLStyle : SimpleKMLStyleSelector
-{
- SimpleKMLIconStyle *iconStyle;
- SimpleKMLLineStyle *lineStyle;
- SimpleKMLPolyStyle *polyStyle;
- SimpleKMLBalloonStyle *balloonStyle;
-}
-@property (nonatomic, retain, readonly) SimpleKMLIconStyle *iconStyle;
-@property (nonatomic, retain, readonly) SimpleKMLLineStyle *lineStyle;
-@property (nonatomic, retain, readonly) SimpleKMLPolyStyle *polyStyle;
-@property (nonatomic, retain, readonly) SimpleKMLBalloonStyle *balloonStyle;
+@property (nonatomic, strong, readonly) SimpleKMLIconStyle *iconStyle;
+@property (nonatomic, strong, readonly) SimpleKMLLineStyle *lineStyle;
+@property (nonatomic, strong, readonly) SimpleKMLPolyStyle *polyStyle;
+@property (nonatomic, strong, readonly) SimpleKMLBalloonStyle *balloonStyle;
@end
View
20 SimpleKMLStyle.m
@@ -62,21 +62,21 @@ - (id)initWithXMLNode:(CXMLNode *)node sourceURL:sourceURL error:(NSError **)err
if (subStyleClass)
{
- id thisSubStyle = [[[subStyleClass alloc] initWithXMLNode:child sourceURL:sourceURL error:NULL] autorelease];
+ id thisSubStyle = [[subStyleClass alloc] initWithXMLNode:child sourceURL:sourceURL error:NULL];
if (thisSubStyle && [thisSubStyle isKindOfClass:[SimpleKMLSubStyle class]])
{
if ([thisSubStyle isKindOfClass:[SimpleKMLIconStyle class]])
- iconStyle = [thisSubStyle retain];
+ iconStyle = thisSubStyle;
else if ([thisSubStyle isKindOfClass:[SimpleKMLLineStyle class]])
- lineStyle = [thisSubStyle retain];
+ lineStyle = thisSubStyle;
else if ([thisSubStyle isKindOfClass:[SimpleKMLPolyStyle class]])
- polyStyle = [thisSubStyle retain];
+ polyStyle = thisSubStyle;
else if ([thisSubStyle isKindOfClass:[SimpleKMLBalloonStyle class]])
- balloonStyle = [thisSubStyle retain];
+ balloonStyle = thisSubStyle;
}
}
}
@@ -85,14 +85,4 @@ - (id)initWithXMLNode:(CXMLNode *)node sourceURL:sourceURL error:(NSError **)err
return self;
}
-- (void)dealloc
-{
- [iconStyle release];
- [lineStyle release];
- [polyStyle release];
- [balloonStyle release];
-
- [super dealloc];
-}
-
@end
View
2 SimpleKMLStyleSelector.h
@@ -37,8 +37,6 @@
#import "SimpleKMLObject.h"
@interface SimpleKMLStyleSelector : SimpleKMLObject
-{
-}
// abstract class
View
2 SimpleKMLSubStyle.h
@@ -37,8 +37,6 @@
#import "SimpleKMLObject.h"
@interface SimpleKMLSubStyle : SimpleKMLObject
-{
-}
// abstract class
View
2 SimpleKML_UIImage.h
@@ -34,7 +34,7 @@
#import <UIKit/UIKit.h>
-@interface UIImage (SimpleKML_UIImage)
+@interface UIImage (SimpleKML)
- (UIImage *)imageWithWidth:(CGFloat)width height:(CGFloat)height;
- (UIImage *)imageWithAlphaComponent:(CGFloat)alpha;
View
2 SimpleKML_UIImage.m
@@ -34,7 +34,7 @@
#import "SimpleKML_UIImage.h"
-@implementation UIImage (SimpleKML_UIImage)
+@implementation UIImage (SimpleKML)
- (UIImage *)imageWithWidth:(CGFloat)width height:(CGFloat)height
{

0 comments on commit e9ed1e7

Please sign in to comment.