Skip to content

Commit

Permalink
Remove debugging, minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
gcasa committed Aug 17, 2024
1 parent 9152753 commit 030148b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 67 deletions.
4 changes: 2 additions & 2 deletions XCode/NSObject+KeyExtraction.m
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ - (NSDictionary *) recursiveKeysAndValuesForObject: (id)object
}
else
{
[keysAndValues setObject: [NSNull null]
forKey: key];
// [keysAndValues setObject: [NSNull null]
// forKey: key];
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions XCode/PBXCoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,4 @@

- (id) archive;

- (id) archiveWithRootObject: (id)rootObject;

@end
66 changes: 3 additions & 63 deletions XCode/PBXCoder.m
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,10 @@ - (NSDictionary *) objects
}

// Archiving methods...
+ (instancetype) archiveWithRootObject: (id)root
+ (id) archiveWithRootObject: (id)root
{
return AUTORELEASE([[self alloc] initWithRootObject: root]);
PBXCoder *coder = [[self alloc] initWithRootObject: root];
return [coder archive];
}

- (instancetype) initWithRootObject: (id)root
Expand All @@ -266,69 +267,8 @@ - (instancetype) initWithRootObject: (id)root
}

- (id) archive
{
return [self archiveWithRootObject: _rootObject];
}

- (id) archiveWithRootObject: (id)rootObject
{
return [_rootObject allKeysAndValues];
}

- (NSArray *) _propertiesFromMethods: (NSArray *)methods
forObject: (id)obj
{
NSEnumerator *en = [methods objectEnumerator];
NSString *name = nil;
NSMutableArray *result = [NSMutableArray array];

while ((name = [en nextObject]) != nil)
{
if ([name isEqualToString: @"set"] == NO) // this is the [NSFont set] method... skip...
{
NSString *substring = [name substringToIndex: 3];
if ([substring isEqualToString: @"set"])
{
NSString *os = [[name substringFromIndex: 3]
stringByReplacingOccurrencesOfString: @":"
withString: @""];
NSString *s = [os lowercaseFirstCharacter];
NSString *iss = [NSString stringWithFormat: @"is%@", os];

if ([methods containsObject: s])
{
SEL sel = NSSelectorFromString(s);
if (sel != NULL)
{
NSDebugLog(@"selector = %@",s);
// NSMethodSignature *sig = [obj methodSignatureForSelector: sel];

// NSLog(@"methodSignatureForSelector %@ -> %s", s, [sig methodReturnType]);
if ([obj respondsToSelector: sel]) // if it has a normal getting, fine...
{
[result addObject: s];
}
}
}
else if ([methods containsObject: iss])
{
NSDebugLog(@"***** retrying with getter name: %@", iss);
SEL sel = NSSelectorFromString(iss);
if (sel != nil)
{
if ([obj respondsToSelector: sel])
{
NSDebugLog(@"Added... %@", iss);
[result addObject: iss];
}
}
}
}
}
}

return result;
}


@end

0 comments on commit 030148b

Please sign in to comment.