From 9fc0064ec29e82905cbea9971bbfa5dbc9ddee4a Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 10 Jan 2011 21:41:25 -0500 Subject: [PATCH] Update Breakpoint.{h,m} to use the right types and to cleanup the header --- Source/Breakpoint.h | 17 +++++++++-------- Source/Breakpoint.m | 28 +++++++++++++++++----------- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/Source/Breakpoint.h b/Source/Breakpoint.h index ad49df6..33ca62d 100644 --- a/Source/Breakpoint.h +++ b/Source/Breakpoint.h @@ -16,19 +16,20 @@ #import - +// This represents a breakpoint at a certain file and line number. It also +// maintains the identifier that the backend assigns to the breakpoint. @interface Breakpoint : NSObject { - NSString* file; - int line; - int debuggerId; + NSString* file_; + NSUInteger line_; + NSUInteger debuggerId_; } -@property(readonly) NSString* file; -@property(readonly) int line; -@property(readwrite, assign) int debuggerId; +@property (readonly) NSString* file; +@property (readonly) NSUInteger line; +@property (readwrite, assign) NSUInteger debuggerId; -- (id)initWithLine:(int)l inFile:(NSString*)f; +- (id)initWithLine:(NSUInteger)l inFile:(NSString*)f; - (id)initWithDictionary:(NSDictionary*)dict; - (NSString*)transformedPath; diff --git a/Source/Breakpoint.m b/Source/Breakpoint.m index 509d3be..5076a90 100644 --- a/Source/Breakpoint.m +++ b/Source/Breakpoint.m @@ -19,17 +19,19 @@ @implementation Breakpoint -@synthesize file, line, debuggerId; +@synthesize file = file_; +@synthesize line = line_; +@synthesize debuggerId = debuggerId_; /** * Initializes a breakpoint with a file and line */ -- (id)initWithLine:(int)l inFile:(NSString*)f +- (id)initWithLine:(NSUInteger)l inFile:(NSString*)f { if (self = [super init]) { - file = [f retain]; - line = l; + file_ = [f retain]; + line_ = l; } return self; } @@ -39,7 +41,7 @@ */ - (void)dealloc { - [file release]; + [file_ release]; [super dealloc]; } @@ -50,8 +52,8 @@ { if (self = [super init]) { - file = [[dict valueForKey:@"file"] retain]; - line = [[dict valueForKey:@"line"] intValue]; + file_ = [[dict valueForKey:@"file"] retain]; + line_ = [[dict valueForKey:@"line"] intValue]; } return self; } @@ -83,7 +85,7 @@ */ - (BOOL)isEqual:(id)obj { - return ([[obj file] isEqualToString:file] && [obj line] == line); + return ([[obj file] isEqualToString:self.file] && [obj line] == self.line); } /** @@ -91,7 +93,7 @@ */ - (NSUInteger)hash { - return ([file hash] << 8) + line; + return ([self.file hash] << 8) + self.line; } /** @@ -99,7 +101,11 @@ */ - (NSDictionary*)dictionary { - return [NSDictionary dictionaryWithObjectsAndKeys:file, @"file", [NSNumber numberWithInt:line], @"line", nil]; + return [NSDictionary dictionaryWithObjectsAndKeys: + self.file, @"file", + [NSNumber numberWithInt:self.line], @"line", + nil + ]; } /** @@ -107,7 +113,7 @@ */ - (NSString*)description { - return [NSString stringWithFormat:@"%@:%i", file, line]; + return [NSString stringWithFormat:@"%@:%i", self.file, self.line]; } @end -- 2.22.5