Deprecated: Assigning the return value of new by reference is deprecated in /home/bluestat/public_html/source/index.php on line 477
From fb016683142fb7ca19bfc266b09701284318647e Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Thu, 22 Nov 2007 23:10:24 -0500 Subject: [PATCH] Added -[BSDirectoryRecord type] to get the record type and we add some test code to AppController --- Source/AppController.m | 2 +- Source/BSDirectoryRecord.h | 1 + Source/BSDirectoryRecord.m | 18 ++++++++++++------ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Source/AppController.m b/Source/AppController.m index 5410d78..5b73c8a 100755 --- a/Source/AppController.m +++ b/Source/AppController.m @@ -32,7 +32,7 @@ { for (BSDirectoryRecord *record in [node records]) { - NSLog(@"record name = %@", [record name]); + NSLog(@"record name = %@:%@", [record type], [record name]); [record attributes]; } } diff --git a/Source/BSDirectoryRecord.h b/Source/BSDirectoryRecord.h index 8d9f622..ca6c97e 100755 --- a/Source/BSDirectoryRecord.h +++ b/Source/BSDirectoryRecord.h @@ -37,6 +37,7 @@ inNode:(BSDirectoryNode *)aNode; - (NSString *)name; +- (NSString *)type; - (NSDictionary *)attributes; // TEMPORARY diff --git a/Source/BSDirectoryRecord.m b/Source/BSDirectoryRecord.m index 8de380a..f621625 100755 --- a/Source/BSDirectoryRecord.m +++ b/Source/BSDirectoryRecord.m @@ -33,12 +33,6 @@ nodeRef = node.nodeRef; dirRef = node.service.dirRef; - - NSLog(@"open record: '%i'", record->fRecordNameAndType.fBufferSize); - if (dsOpenRecord(dirRef, NULL, NULL, &recordRef) != eDSNoErr) - { - //NSLog(@"could not open record %s", record->fRecordNameAndType); - } } return self; } @@ -78,6 +72,18 @@ } /** + * Gets the record's type + */ +- (NSString *)type +{ + char *type = NULL; + CK_STATUS_R(dsGetRecordTypeFromEntry(record, &type), @"error getting type", nil); + NSString *typestr = [NSString stringWithUTF8String:type]; + free(type); + return typestr; +} + +/** * Gets an NSDictionary of all the attributes a record has */ - (NSDictionary *)attributes -- 1.7.11.3