fixups to avoid future ABI breakage

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@36538 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2013-04-15 09:07:19 +00:00
parent 9d46636c15
commit add5c5466a
10 changed files with 545 additions and 703 deletions

View file

@ -1,3 +1,54 @@
2013-04-15 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GNUmakefile:
* Source/unix/GNUmakefile:
* Source/unix/NSMetadata.m:
* Source/win32/GNUmakefile:
* Source/win32/NSMetadata.m:
* Source/NSMetadata.m:
* Headers/Foundation/NSMetadata.h:
Move identical system specific metadata code to generic area so we
can have system specific subclasses inherit common functionality.
Fix instance variables so we won't break binrary compatibility in
future.
2013-04-15 Richard Frith-Macdonald <rfm@gnu.org>
* cifframe.m:
* GSString.m:
* GSTLS.m:
* NSArchiver.m:
* NSCalendar.m:
* NSCoder.m:
* NSData.m:
* NSDecimal.m:
* NSDictionary.m:
* NSDistantObject.m:
* NSException.m:
* NSFileManager.m:
* NSHashTable.m:
* NSIndexPath.m:
* NSLocale.m:
* NSMethodSignature.m:
* NSNotificationCenter.m:
* NSNumberFormatter.m:
* NSObject.m:
* NSPortCoder.m:
* NSProcessInfo.m:
* NSProxy.m:
* NSRunLoop.m:
* NSSocketPort.m:
* NSString.m:
* NSURL.m:
* NSURLProtocol.m:
* NSValue.m:
* NSXMLDocument.m:
* NSXMLNode.m:
* NSXMLParser.m:
More changes to avoid static analyzer false-positives/non-issues so we
can see when real issues arise. Changes remove around 60 warnings and
include about half a dozen minor bugfixes.
2013-04-14 Richard Frith-Macdonald <rfm@gnu.org>
* Headers/GNUstepBase/GSIMap.h:

View file

@ -102,6 +102,7 @@
#import <Foundation/NSProtocolChecker.h>
#import <Foundation/NSProxy.h>
#import <Foundation/NSRange.h>
#import <Foundation/NSRegularExpression.h>
#import <Foundation/NSRunLoop.h>
#import <Foundation/NSScanner.h>
#import <Foundation/NSScriptWhoseTests.h>

View file

@ -357,8 +357,8 @@ GS_EXPORT void _NSRemoveHandler( NSHandler *handler );
if( !setjmp(NSLocalHandler.jumpState) ) {
#define NS_HANDLER _NSRemoveHandler(&NSLocalHandler); } else { \
NSException *localException; \
localException = NSLocalHandler.exception; \
NSException __attribute__((unused)) *localException \
= NSLocalHandler.exception; \
{
#define NS_ENDHANDLER }}}

View file

@ -44,12 +44,15 @@ GS_EXPORT NSString * const NSMetadataItemFSContentChangeDateKey;
@interface NSMetadataItem : NSObject
{
NSMutableDictionary *attributes;
#if GS_EXPOSE(NSMetadataItem)
@private
void *_NSMetadataItemInternal; /** Private internal data */
#endif
}
- (NSArray *)attributes;
- (id)valueForAttribute: (NSString *)key;
- (NSDictionary *)valuesForAttributes: (NSArray *)keys;
- (NSArray *) attributes;
- (id) valueForAttribute: (NSString *)key;
- (NSDictionary *) valuesForAttributes: (NSArray *)keys;
@end
// Metdata Query Constants...
@ -67,72 +70,61 @@ GS_EXPORT NSString * const NSMetadataQueryGatheringProgressNotification;
/* Abstract interface for metadata query... */
@interface NSMetadataQuery : NSObject
{
BOOL _isStopped;
BOOL _isGathering;
BOOL _isStarted;
NSArray *_searchURLs;
NSArray *_scopes;
NSArray *_sortDescriptors;
NSPredicate *_predicate;
NSArray *_groupingAttributes;
NSArray *_valueListAttributes;
NSTimeInterval _notificationBatchingInterval;
NSMutableDictionary *_results;
id<NSMetadataQueryDelegate> _delegate;
#if GS_EXPOSE(NSMetadataQuery)
@private
void *_NSMetadataQueryInternal; /** Private internal data */
#endif
}
/* Instance methods */
- (id)valueOfAttribute:(id)attr forResultAtIndex:(NSUInteger)index;
- (NSArray *)groupedResults;
- (NSDictionary *)valueLists;
- (NSUInteger)indexOfResult:(id)result;
- (NSArray *)results;
- (id)resultAtIndex:(NSUInteger)index;
- (NSUInteger)resultCount;
- (id) valueOfAttribute: (id)attr forResultAtIndex: (NSUInteger)index;
- (NSArray *) groupedResults;
- (NSDictionary *) valueLists;
- (NSUInteger) indexOfResult: (id)result;
- (NSArray *) results;
- (id) resultAtIndex: (NSUInteger)index;
- (NSUInteger) resultCount;
// Enable/Disable updates
- (void)enableUpdates;
- (void)disableUpdates;
- (void) enableUpdates;
- (void) disableUpdates;
// Status of the query...
- (BOOL)isStopped;
- (BOOL)isGathering;
- (BOOL)isStarted;
- (void)stopQuery;
- (BOOL)startQuery;
- (BOOL) isStopped;
- (BOOL) isGathering;
- (BOOL) isStarted;
- (void) stopQuery;
- (BOOL) startQuery;
// Search URLS
- (void)setSearchItemURLs:(NSArray *)urls;
- (NSArray *)searchItemURLs;
- (void) setSearchItemURLs: (NSArray *)urls;
- (NSArray *) searchItemURLs;
// Search scopes
- (void)setSearchScopes:(NSArray *)scopes;
- (NSArray *)searchScopes;
- (void) setSearchScopes: (NSArray *)scopes;
- (NSArray *) searchScopes;
// Notification interval
- (void)setNotificationBatchingInterval:(NSTimeInterval)interval;
- (NSTimeInterval)notificationBatchingInterval;
- (void) setNotificationBatchingInterval: (NSTimeInterval)interval;
- (NSTimeInterval) notificationBatchingInterval;
// Grouping Attributes.
- (void)setGroupingAttributes:(NSArray *)attrs;
- (NSArray *)groupingAttributes;
- (void)setValueListAttributes:(NSArray *)attrs;
- (NSArray *)valueListAttributes;
- (void) setGroupingAttributes: (NSArray *)attrs;
- (NSArray *) groupingAttributes;
- (void) setValueListAttributes: (NSArray *)attrs;
- (NSArray *) valueListAttributes;
// Sort descriptors
- (void)setSortDescriptors:(NSArray *)attrs;
- (NSArray *)sortDescriptors;
- (void) setSortDescriptors: (NSArray *)attrs;
- (NSArray *) sortDescriptors;
// Predicate
- (void)setPredicate:(NSPredicate *)predicate;
- (NSPredicate *)predicate;
- (void) setPredicate: (NSPredicate *)predicate;
- (NSPredicate *) predicate;
// Delegate
- (void)setDelegate:(id<NSMetadataQueryDelegate>)delegate;
- (id<NSMetadataQueryDelegate>)delegate;
- (void) setDelegate: (id<NSMetadataQueryDelegate>)delegate;
- (id<NSMetadataQueryDelegate>) delegate;
@end
@ -140,15 +132,20 @@ GS_EXPORT NSString * const NSMetadataQueryGatheringProgressNotification;
#ifdef __OBJC2__
@optional
#endif
- (id)metadataQuery:(NSMetadataQuery *)query replacementObjectForResultObject:(NSMetadataItem *)result;
- (id)metadataQuery:(NSMetadataQuery *)query replacementValueForAttribute:(NSString *)attribute value:(id)attributeValue;
- (id) metadataQuery: (NSMetadataQuery *)query
replacementObjectForResultObject: (NSMetadataItem *)result;
- (id) metadataQuery: (NSMetadataQuery *)query
replacementValueForAttribute: (NSString *)attribute
value: (id)attributeValue;
@end
@interface NSMetadataQueryAttributeValueTuple : NSObject
{
id _attribute;
id _value;
NSUInteger _count;
#if GS_EXPOSE(NSMetadataQueryAttributeValueTuple)
@private
/** Private internal data */
void *_NSMetadataQueryAttributeValueTupleInternal;
#endif
}
- (NSString *) attribute;
@ -159,9 +156,10 @@ GS_EXPORT NSString * const NSMetadataQueryGatheringProgressNotification;
@interface NSMetadataQueryResultGroup : NSObject
{
NSString *_attribute;
id _value;
NSMutableArray *_subgroups;
#if GS_EXPOSE(NSMetadataQueryResultGroup)
@private
void *_NSMetadataQueryResultGroupInternal; /** Private internal data */
#endif
}
- (NSString *) attribute;

View file

@ -228,6 +228,7 @@ NSLocale.m \
NSLock.m \
NSLog.m \
NSMapTable.m \
NSMetadata.m \
NSMethodSignature.m \
NSNotification.m \
NSNotificationCenter.m \

435
Source/NSMetadata.m Normal file
View file

@ -0,0 +1,435 @@
/**Interface for NSMetadataQuery for GNUStep
Copyright (C) 2012 Free Software Foundation, Inc.
Written by: Gregory Casamento
Date: 2012
This file is part of the GNUstep Base Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
AutogsdocSource: NSMetadata.m
*/
#import "Foundation/NSMetadata.h"
#import "Foundation/NSArray.h"
#import "Foundation/NSDictionary.h"
#import "Foundation/NSPredicate.h"
#import "Foundation/NSString.h"
#import "Foundation/NSTimer.h"
#import "GNUstepBase/NSObject+GNUstepBase.h"
// Metadata item constants...
NSString * const NSMetadataItemFSNameKey = @"NSMetadataItemFSNameKey";
NSString * const NSMetadataItemDisplayNameKey = @"NSMetadataItemDisplayNameKey";
NSString * const NSMetadataItemURLKey = @"NSMetadataItemURLKey";
NSString * const NSMetadataItemPathKey = @"NSMetadataItemPathKey";
NSString * const NSMetadataItemFSSizeKey = @"NSMetadataItemFSSizeKey";
NSString * const NSMetadataItemFSCreationDateKey = @"NSMetadataItemFSCreationDateKey";
NSString * const NSMetadataItemFSContentChangeDateKey = @"NSMetadataItemFSContentChangeDateKey";
@implementation NSMetadataItem
#define myAttributes ((NSMutableDictionary*)_NSMetadataItemInternal)
- (NSArray *) attributes
{
return [myAttributes allKeys];
}
- (void) dealloc
{
[myAttributes release];
[super dealloc];
}
- (id) init
{
if (nil != (self = [super init]))
{
_NSMetadataItemInternal = (void*)[NSMutableDictionary new];
}
return self;
}
- (id) valueForAttribute: (NSString *)key
{
return [myAttributes objectForKey: key];
}
- (NSDictionary *) valuesForAttributes: (NSArray *)keys
{
NSMutableDictionary *results = [NSMutableDictionary dictionary];
NSEnumerator *en = [keys objectEnumerator];
id key = nil;
while ((key = [en nextObject]) != nil)
{
id value = [self valueForAttribute: key];
[results setObject: value forKey: key];
}
return results;
}
@end
// Metdata Query Constants...
NSString * const NSMetadataQueryUserHomeScope
= @"NSMetadataQueryUserHomeScope";
NSString * const NSMetadataQueryLocalComputerScope
= @"NSMetadataQueryLocalComputerScope";
NSString * const NSMetadataQueryNetworkScope
= @"NSMetadataQueryNetworkScope";
NSString * const NSMetadataQueryUbiquitousDocumentsScope
= @"NSMetadataQueryUbiquitousDocumentsScope";
NSString * const NSMetadataQueryUbiquitousDataScope
= @"NSMetadataQueryUbiquitousDataScope";
NSString * const NSMetadataQueryDidFinishGatheringNotification
= @"NSMetadataQueryDidFinishGatheringNotification";
NSString * const NSMetadataQueryDidStartGatheringNotification
= @"NSMetadataQueryDidStartGatheringNotification";
NSString * const NSMetadataQueryDidUpdateNotification
= @"NSMetadataQueryDidUpdateNotification";
NSString * const NSMetadataQueryGatheringProgressNotification
= @"NSMetadataQueryGatheringProgressNotification";
@interface NSMetadataQueryInternal : NSObject
{
@public
BOOL _isStopped;
BOOL _isGathering;
BOOL _isStarted;
NSArray *_searchURLs;
NSArray *_scopes;
NSArray *_sortDescriptors;
NSPredicate *_predicate;
NSArray *_groupingAttributes;
NSArray *_valueListAttributes;
NSTimeInterval _notificationBatchingInterval;
NSMutableDictionary *_results;
id<NSMetadataQueryDelegate> _delegate;
}
@end
@implementation NSMetadataQueryInternal
@end
#ifdef this
#undef this
#endif
#define this ((NSMetadataQueryInternal*)_NSMetadataQueryInternal)
@implementation NSMetadataQuery
- (void) dealloc
{
[this release];
[super dealloc];
}
- (id<NSMetadataQueryDelegate>) delegate;
{
return this->_delegate;
}
- (void) disableUpdates
{
[self subclassResponsibility: _cmd];
}
- (void) enableUpdates
{
[self subclassResponsibility: _cmd];
}
- (NSArray *) groupedResults;
{
return [self subclassResponsibility: _cmd];
}
- (NSArray *) groupingAttributes
{
return [self subclassResponsibility: _cmd];
}
- (NSUInteger) indexOfResult: (id)result
{
[self subclassResponsibility: _cmd];
return NSNotFound;
}
- (id) init
{
if ((self = [super init]) != nil)
{
_NSMetadataQueryInternal = (void*)[NSMetadataQueryInternal new];
this->_isStopped = YES;
this->_isGathering = NO;
this->_isStarted = NO;
this->_notificationBatchingInterval = (NSTimeInterval)0.0;
}
return self;
}
- (BOOL) isGathering
{
return this->_isGathering;
}
- (BOOL) isStarted
{
return this->_isStarted;
}
- (BOOL) isStopped
{
return this->_isStopped;
}
- (NSTimeInterval) notificationBatchingInterval
{
[self subclassResponsibility: _cmd];
return (NSTimeInterval)0;
}
- (NSPredicate *) predicate
{
return this->_predicate;
}
- (id) resultAtIndex: (NSUInteger)index
{
return [self subclassResponsibility: _cmd];
}
- (NSUInteger) resultCount
{
[self subclassResponsibility: _cmd];
return 0;
}
- (NSArray *) results
{
return [self subclassResponsibility: _cmd];
}
- (NSArray *) searchItemURLs
{
return this->_searchURLs;
}
- (NSArray *) searchScopes
{
return this->_scopes;
}
- (void) setDelegate: (id<NSMetadataQueryDelegate>)delegate;
{
this->_delegate = delegate;
}
- (void) setGroupingAttributes: (NSArray *)attrs
{
[self subclassResponsibility: _cmd];
}
- (void) setNotificationBatchingInterval: (NSTimeInterval)interval
{
[self subclassResponsibility: _cmd];
}
- (void) setPredicate: (NSPredicate *)predicate
{
ASSIGNCOPY(this->_predicate, predicate);
}
- (void) setSearchItemURLs: (NSArray *)urls
{
ASSIGNCOPY(this->_searchURLs, urls);
}
- (void) setSearchScopes: (NSArray *)scopes
{
ASSIGNCOPY(this->_scopes, scopes);
}
- (void) setSortDescriptors: (NSArray *)descriptors
{
ASSIGNCOPY(this->_sortDescriptors, descriptors);
}
- (void) setValueListAttributes: (NSArray *)attrs
{
[self subclassResponsibility: _cmd];
}
- (NSArray *) sortDescriptors
{
return this->_sortDescriptors;
}
- (BOOL) startQuery
{
[self subclassResponsibility: _cmd];
return NO;
}
- (void) stopQuery
{
[self subclassResponsibility: _cmd];
}
- (id) valueOfAttribute: (id)attr forResultAtIndex: (NSUInteger)index
{
return [self subclassResponsibility: _cmd];
}
- (NSDictionary *) valueLists
{
return [self subclassResponsibility: _cmd];
}
- (NSArray *) valueListAttributes
{
return [self subclassResponsibility: _cmd];
}
@end
@interface NSMetadataQueryAttributeValueTupleInternal : NSObject
{
@public
id _attribute;
id _value;
NSUInteger _count;
}
@end
@implementation NSMetadataQueryAttributeValueTupleInternal
@end
#ifdef this
#undef this
#endif
#define this ((NSMetadataQueryAttributeValueTupleInternal*)\
_NSMetadataQueryAttributeValueTupleInternal)
@implementation NSMetadataQueryAttributeValueTuple
- (NSString *) attribute
{
return this->_attribute;
}
- (NSUInteger) count
{
return this->_count;
}
- (void) dealloc
{
[this release];
[super dealloc];
}
- (id) init
{
if (nil != (self = [super init]))
{
_NSMetadataQueryAttributeValueTupleInternal =
(void*)[NSMetadataQueryAttributeValueTupleInternal new];
}
return self;
}
- (id) value
{
return this->_value;
}
@end
@interface NSMetadataQueryResultGroupInternal : NSObject
{
@public
id _attribute;
id _value;
NSMutableArray *_subgroups;
}
@end
@implementation NSMetadataQueryResultGroupInternal
@end
#ifdef this
#undef this
#endif
#define this ((NSMetadataQueryResultGroupInternal*)\
_NSMetadataQueryResultGroupInternal)
@implementation NSMetadataQueryResultGroup : NSObject
- (NSString *) attribute
{
return this->_attribute;
}
- (void) dealloc
{
[this release];
[super dealloc];
}
- (id) init
{
if (nil != (self = [super init]))
{
_NSMetadataQueryResultGroupInternal =
(void*)[NSMetadataQueryResultGroupInternal new];
}
return self;
}
- (id) resultAtIndex: (NSUInteger)index
{
return [this->_subgroups objectAtIndex:index];
}
- (NSUInteger) resultCount
{
return [this->_subgroups count];
}
- (NSArray *) results
{
return [self subgroups];
}
- (NSArray *) subgroups
{
return this->_subgroups;
}
- (id) value
{
return this->_value;
}
@end

View file

@ -33,7 +33,6 @@ SUBPROJECT_NAME = unix
unix_OBJC_FILES = \
GSRunLoopCtxt.m \
NSStream.m \
NSMetadata.m
-include Makefile.preamble

View file

@ -1,321 +0,0 @@
/**Interface for NSMetadataQuery for GNUStep
Copyright (C) 2012 Free Software Foundation, Inc.
Written by: Gregory Casamento
Date: 2012
This file is part of the GNUstep Base Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
AutogsdocSource: NSMetadata.m
*/
#import "Foundation/NSMetadata.h"
#import "Foundation/NSArray.h"
#import "Foundation/NSDictionary.h"
#import "Foundation/NSString.h"
#import "Foundation/NSTimer.h"
#import "GNUstepBase/NSObject+GNUstepBase.h"
// Metadata item constants...
NSString * const NSMetadataItemFSNameKey = @"NSMetadataItemFSNameKey";
NSString * const NSMetadataItemDisplayNameKey = @"NSMetadataItemDisplayNameKey";
NSString * const NSMetadataItemURLKey = @"NSMetadataItemURLKey";
NSString * const NSMetadataItemPathKey = @"NSMetadataItemPathKey";
NSString * const NSMetadataItemFSSizeKey = @"NSMetadataItemFSSizeKey";
NSString * const NSMetadataItemFSCreationDateKey = @"NSMetadataItemFSCreationDateKey";
NSString * const NSMetadataItemFSContentChangeDateKey = @"NSMetadataItemFSContentChangeDateKey";
@implementation NSMetadataItem
- (NSArray *)attributes
{
return [attributes allKeys];
}
- (id)valueForAttribute: (NSString *)key
{
return [attributes objectForKey: key];
}
- (NSDictionary *)valuesForAttributes: (NSArray *)keys
{
NSMutableDictionary *results = [NSMutableDictionary dictionary];
NSEnumerator *en = [keys objectEnumerator];
id key = nil;
while((key = [en nextObject]) != nil)
{
id value = [self valueForAttribute: key];
[results setObject: value forKey: key];
}
return results;
}
@end
// Metdata Query Constants...
NSString * const NSMetadataQueryUserHomeScope = @"NSMetadataQueryUserHomeScope";
NSString * const NSMetadataQueryLocalComputerScope = @"NSMetadataQueryLocalComputerScope";
NSString * const NSMetadataQueryNetworkScope = @"NSMetadataQueryNetworkScope";
NSString * const NSMetadataQueryUbiquitousDocumentsScope = @"NSMetadataQueryUbiquitousDocumentsScope";
NSString * const NSMetadataQueryUbiquitousDataScope = @"NSMetadataQueryUbiquitousDataScope";
NSString * const NSMetadataQueryDidFinishGatheringNotification = @"NSMetadataQueryDidFinishGatheringNotification";
NSString * const NSMetadataQueryDidStartGatheringNotification = @"NSMetadataQueryDidStartGatheringNotification";
NSString * const NSMetadataQueryDidUpdateNotification = @"NSMetadataQueryDidUpdateNotification";
NSString * const NSMetadataQueryGatheringProgressNotification = @"NSMetadataQueryGatheringProgressNotification";
@implementation NSMetadataQuery
- (id) init
{
if((self = [super init]) != nil)
{
_isStopped = YES;
_isGathering = NO;
_isStarted = NO;
_notificationBatchingInterval = (NSTimeInterval)0.0;
}
return self;
}
/* Instance methods */
- (id)valueOfAttribute:(id)attr forResultAtIndex:(NSUInteger)index
{
[self subclassResponsibility: _cmd];
return nil;
}
- (NSArray *)groupedResults;
{
[self subclassResponsibility: _cmd];
return [NSArray array];
}
- (NSDictionary *)valueLists
{
[self subclassResponsibility: _cmd];
return [NSArray array];
}
- (NSUInteger)indexOfResult:(id)result
{
[self subclassResponsibility: _cmd];
return NSNotFound;
}
- (NSArray *)results
{
[self subclassResponsibility: _cmd];
return [NSArray array];
}
- (id)resultAtIndex:(NSUInteger)index
{
[self subclassResponsibility: _cmd];
return nil;
}
- (NSUInteger)resultCount
{
[self subclassResponsibility: _cmd];
return 0;
}
// Enable/Disable updates
- (void)enableUpdates
{
[self subclassResponsibility: _cmd];
}
- (void)disableUpdates
{
[self subclassResponsibility: _cmd];
}
// Status of the query...
- (BOOL)isStopped
{
return _isStopped;
}
- (BOOL)isGathering
{
return _isGathering;
}
- (BOOL)isStarted
{
return _isStarted;
}
- (void)stopQuery
{
[self subclassResponsibility: _cmd];
}
- (BOOL)startQuery
{
[self subclassResponsibility: _cmd];
return NO;
}
// Search URLS
- (void)setSearchItemURLs:(NSArray *)urls
{
ASSIGNCOPY(_searchURLs,urls);
}
- (NSArray *)searchItemURLs
{
return _searchURLs;
}
// Search scopes
- (void)setSearchScopes:(NSArray *)scopes
{
ASSIGNCOPY(_scopes,scopes);
}
- (NSArray *)searchScopes
{
return _scopes;
}
// Notification interval
- (void)setNotificationBatchingInterval:(NSTimeInterval)interval
{
[self subclassResponsibility: _cmd];
}
- (NSTimeInterval)notificationBatchingInterval
{
[self subclassResponsibility: _cmd];
return (NSTimeInterval)0;
}
// Grouping Attributes.
- (void)setGroupingAttributes:(NSArray *)attrs
{
[self subclassResponsibility: _cmd];
}
- (NSArray *)groupingAttributes
{
[self subclassResponsibility: _cmd];
return [NSArray array];
}
- (void)setValueListAttributes:(NSArray *)attrs
{
[self subclassResponsibility: _cmd];
}
- (NSArray *)valueListAttributes
{
[self subclassResponsibility: _cmd];
return [NSArray array];
}
// Sort descriptors
- (void)setSortDescriptors:(NSArray *)descriptors
{
ASSIGNCOPY(_sortDescriptors,descriptors);
}
- (NSArray *)sortDescriptors
{
return _sortDescriptors;
}
// Predicate
- (void)setPredicate:(NSPredicate *)predicate
{
ASSIGNCOPY(_predicate,predicate);
}
- (NSPredicate *)predicate
{
return _predicate;
}
// Delegate
- (void)setDelegate:(id<NSMetadataQueryDelegate>)delegate;
{
_delegate = delegate;
}
- (id<NSMetadataQueryDelegate>)delegate;
{
return _delegate;
}
@end
@implementation NSMetadataQueryAttributeValueTuple
- (NSString *) attribute
{
return _attribute;
}
- (id) value
{
return _value;
}
- (NSUInteger) count
{
return _count;
}
@end
@implementation NSMetadataQueryResultGroup : NSObject
- (NSString *) attribute
{
return _attribute;
}
- (id) value
{
return _value;
}
- (NSArray *) subgroups
{
return _subgroups;
}
- (NSUInteger) resultCount
{
return [_subgroups count];
}
- (id) resultAtIndex: (NSUInteger)index
{
return [_subgroups objectAtIndex:index];
}
- (NSArray *) results
{
return [self subgroups];
}
@end

View file

@ -37,7 +37,6 @@ win32_OBJC_FILES =\
NSMessagePortNameServer.m \
NSStream.m \
NSUserDefaults.m \
NSMetadata.m
-include Makefile.preamble

View file

@ -1,321 +0,0 @@
/**Interface for NSMetadataQuery for GNUStep
Copyright (C) 2012 Free Software Foundation, Inc.
Written by: Gregory Casamento
Date: 2012
This file is part of the GNUstep Base Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
AutogsdocSource: NSMetadata.m
*/
#import "Foundation/NSMetadata.h"
#import "Foundation/NSArray.h"
#import "Foundation/NSDictionary.h"
#import "Foundation/NSString.h"
#import "Foundation/NSTimer.h"
#import "GNUstepBase/NSObject+GNUstepBase.h"
// Metadata item constants...
NSString * const NSMetadataItemFSNameKey = @"NSMetadataItemFSNameKey";
NSString * const NSMetadataItemDisplayNameKey = @"NSMetadataItemDisplayNameKey";
NSString * const NSMetadataItemURLKey = @"NSMetadataItemURLKey";
NSString * const NSMetadataItemPathKey = @"NSMetadataItemPathKey";
NSString * const NSMetadataItemFSSizeKey = @"NSMetadataItemFSSizeKey";
NSString * const NSMetadataItemFSCreationDateKey = @"NSMetadataItemFSCreationDateKey";
NSString * const NSMetadataItemFSContentChangeDateKey = @"NSMetadataItemFSContentChangeDateKey";
@implementation NSMetadataItem
- (NSArray *)attributes
{
return [attributes allKeys];
}
- (id)valueForAttribute: (NSString *)key
{
return [attributes objectForKey: key];
}
- (NSDictionary *)valuesForAttributes: (NSArray *)keys
{
NSMutableDictionary *results = [NSMutableDictionary dictionary];
NSEnumerator *en = [keys objectEnumerator];
id key = nil;
while((key = [en nextObject]) != nil)
{
id value = [self valueForAttribute: key];
[results setObject: value forKey: key];
}
return results;
}
@end
// Metdata Query Constants...
NSString * const NSMetadataQueryUserHomeScope = @"NSMetadataQueryUserHomeScope";
NSString * const NSMetadataQueryLocalComputerScope = @"NSMetadataQueryLocalComputerScope";
NSString * const NSMetadataQueryNetworkScope = @"NSMetadataQueryNetworkScope";
NSString * const NSMetadataQueryUbiquitousDocumentsScope = @"NSMetadataQueryUbiquitousDocumentsScope";
NSString * const NSMetadataQueryUbiquitousDataScope = @"NSMetadataQueryUbiquitousDataScope";
NSString * const NSMetadataQueryDidFinishGatheringNotification = @"NSMetadataQueryDidFinishGatheringNotification";
NSString * const NSMetadataQueryDidStartGatheringNotification = @"NSMetadataQueryDidStartGatheringNotification";
NSString * const NSMetadataQueryDidUpdateNotification = @"NSMetadataQueryDidUpdateNotification";
NSString * const NSMetadataQueryGatheringProgressNotification = @"NSMetadataQueryGatheringProgressNotification";
@implementation NSMetadataQuery
- (id) init
{
if((self = [super init]) != nil)
{
_isStopped = YES;
_isGathering = NO;
_isStarted = NO;
_notificationBatchingInterval = (NSTimeInterval)0.0;
}
return self;
}
/* Instance methods */
- (id)valueOfAttribute:(id)attr forResultAtIndex:(NSUInteger)index
{
[self subclassResponsibility: _cmd];
return nil;
}
- (NSArray *)groupedResults;
{
[self subclassResponsibility: _cmd];
return [NSArray array];
}
- (NSDictionary *)valueLists
{
[self subclassResponsibility: _cmd];
return [NSArray array];
}
- (NSUInteger)indexOfResult:(id)result
{
[self subclassResponsibility: _cmd];
return NSNotFound;
}
- (NSArray *)results
{
[self subclassResponsibility: _cmd];
return [NSArray array];
}
- (id)resultAtIndex:(NSUInteger)index
{
[self subclassResponsibility: _cmd];
return nil;
}
- (NSUInteger)resultCount
{
[self subclassResponsibility: _cmd];
return 0;
}
// Enable/Disable updates
- (void)enableUpdates
{
[self subclassResponsibility: _cmd];
}
- (void)disableUpdates
{
[self subclassResponsibility: _cmd];
}
// Status of the query...
- (BOOL)isStopped
{
return _isStopped;
}
- (BOOL)isGathering
{
return _isGathering;
}
- (BOOL)isStarted
{
return _isStarted;
}
- (void)stopQuery
{
[self subclassResponsibility: _cmd];
}
- (BOOL)startQuery
{
[self subclassResponsibility: _cmd];
return NO;
}
// Search URLS
- (void)setSearchItemURLs:(NSArray *)urls
{
ASSIGNCOPY(_searchURLs,urls);
}
- (NSArray *)searchItemURLs
{
return _searchURLs;
}
// Search scopes
- (void)setSearchScopes:(NSArray *)scopes
{
ASSIGNCOPY(_scopes,scopes);
}
- (NSArray *)searchScopes
{
return _scopes;
}
// Notification interval
- (void)setNotificationBatchingInterval:(NSTimeInterval)interval
{
[self subclassResponsibility: _cmd];
}
- (NSTimeInterval)notificationBatchingInterval
{
[self subclassResponsibility: _cmd];
return (NSTimeInterval)0;
}
// Grouping Attributes.
- (void)setGroupingAttributes:(NSArray *)attrs
{
[self subclassResponsibility: _cmd];
}
- (NSArray *)groupingAttributes
{
[self subclassResponsibility: _cmd];
return [NSArray array];
}
- (void)setValueListAttributes:(NSArray *)attrs
{
[self subclassResponsibility: _cmd];
}
- (NSArray *)valueListAttributes
{
[self subclassResponsibility: _cmd];
return [NSArray array];
}
// Sort descriptors
- (void)setSortDescriptors:(NSArray *)descriptors
{
ASSIGNCOPY(_sortDescriptors,descriptors);
}
- (NSArray *)sortDescriptors
{
return _sortDescriptors;
}
// Predicate
- (void)setPredicate:(NSPredicate *)predicate
{
ASSIGNCOPY(_predicate,predicate);
}
- (NSPredicate *)predicate
{
return _predicate;
}
// Delegate
- (void)setDelegate:(id<NSMetadataQueryDelegate>)delegate;
{
_delegate = delegate;
}
- (id<NSMetadataQueryDelegate>)delegate;
{
return _delegate;
}
@end
@implementation NSMetadataQueryAttributeValueTuple
- (NSString *) attribute
{
return _attribute;
}
- (id) value
{
return _value;
}
- (NSUInteger) count
{
return _count;
}
@end
@implementation NSMetadataQueryResultGroup : NSObject
- (NSString *) attribute
{
return _attribute;
}
- (id) value
{
return _value;
}
- (NSArray *) subgroups
{
return _subgroups;
}
- (NSUInteger) resultCount
{
return [_subgroups count];
}
- (id) resultAtIndex: (NSUInteger)index
{
return [_subgroups objectAtIndex:index];
}
- (NSArray *) results
{
return [self subgroups];
}
@end