mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 13:10:59 +00:00
Remove NSString category per discussion with @fredkiefer
This commit is contained in:
parent
9a91d04bc0
commit
aa4f9b5dbf
3 changed files with 31 additions and 39 deletions
|
@ -86,8 +86,4 @@
|
|||
}
|
||||
@end
|
||||
|
||||
@interface NSString (PrivatePathExtension)
|
||||
- (NSString *) stringByRemovingFirstKeyPath;
|
||||
@end
|
||||
|
||||
#endif //_GS_BINDING_HELPER_H
|
||||
|
|
|
@ -122,40 +122,6 @@
|
|||
|
||||
@end
|
||||
|
||||
@implementation NSString (PrivatePathExtension)
|
||||
|
||||
- (NSString *) stringByRemovingFirstKeyPath
|
||||
{
|
||||
NSArray *components = [self componentsSeparatedByString: @"."];
|
||||
NSString *result = @"";
|
||||
NSEnumerator *en = [components objectEnumerator];
|
||||
NSString *component = nil;
|
||||
NSUInteger i = 0;
|
||||
|
||||
if ([components count] == 1)
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
while ((component = [en nextObject]) != nil)
|
||||
{
|
||||
if (i > 0)
|
||||
{
|
||||
result = [result stringByAppendingString: component];
|
||||
if ([[components lastObject] isEqual: component] == NO)
|
||||
{
|
||||
result = [result stringByAppendingString: @"."];
|
||||
}
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
static NSRecursiveLock *bindingLock = nil;
|
||||
static NSMapTable *classTable = NULL; //available bindings
|
||||
static NSMapTable *objectTable = NULL; //bound bindings
|
||||
|
|
|
@ -1873,6 +1873,36 @@ Also returns the child index relative to this parent. */
|
|||
@selector(outlineView:writeItems:toPasteboard:)];
|
||||
}
|
||||
|
||||
- (NSString *) _stringByRemovingFirstKeyPath: (NSString *)path
|
||||
{
|
||||
NSArray *components = [path componentsSeparatedByString: @"."];
|
||||
NSString *result = @"";
|
||||
NSEnumerator *en = [components objectEnumerator];
|
||||
NSString *component = nil;
|
||||
NSUInteger i = 0;
|
||||
|
||||
if ([components count] == 1)
|
||||
{
|
||||
return path;
|
||||
}
|
||||
|
||||
while ((component = [en nextObject]) != nil)
|
||||
{
|
||||
if (i > 0)
|
||||
{
|
||||
result = [result stringByAppendingString: component];
|
||||
if ([[components lastObject] isEqual: component] == NO)
|
||||
{
|
||||
result = [result stringByAppendingString: @"."];
|
||||
}
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
- (id) _objectValueForTableColumn: (NSTableColumn *)tb
|
||||
row: (NSInteger) index
|
||||
{
|
||||
|
@ -1885,7 +1915,7 @@ Also returns the child index relative to this parent. */
|
|||
{
|
||||
id theItem = [_items objectAtIndex: index];
|
||||
NSString *ikp = [info objectForKey: @"NSObservedKeyPath"];
|
||||
NSString *keyPath = [ikp stringByRemovingFirstKeyPath];
|
||||
NSString *keyPath = [self _stringByRemovingFirstKeyPath: ikp];
|
||||
|
||||
// Here we are getting the last part of the keyPath since elsewhere in this class
|
||||
// we are recursively storing the contents of arrangedObjects (for example) to
|
||||
|
|
Loading…
Reference in a new issue