2012-11-18 16:37:57 +00:00
|
|
|
/**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: NSMetadataQuery.h
|
|
|
|
*/
|
|
|
|
|
2012-11-20 17:58:34 +00:00
|
|
|
#ifndef __NSMetadata_h_GNUSTEP_BASE_INCLUDE
|
|
|
|
#define __NSMetadata_h_GNUSTEP_BASE_INCLUDE
|
2013-12-31 13:14:11 +00:00
|
|
|
#import <GNUstepBase/GSVersionMacros.h>
|
2012-11-18 16:37:57 +00:00
|
|
|
|
|
|
|
#import <Foundation/NSObject.h>
|
|
|
|
#import <Foundation/NSTimer.h>
|
|
|
|
|
2012-11-25 19:40:10 +00:00
|
|
|
@class NSPredicate, NSMutableDictionary, NSDictionary, NSMutableArray;
|
2012-11-20 17:58:34 +00:00
|
|
|
@protocol NSMetadataQueryDelegate;
|
|
|
|
|
|
|
|
// Metadata item constants...
|
|
|
|
GS_EXPORT NSString * const NSMetadataItemFSNameKey;
|
|
|
|
GS_EXPORT NSString * const NSMetadataItemDisplayNameKey;
|
|
|
|
GS_EXPORT NSString * const NSMetadataItemURLKey;
|
|
|
|
GS_EXPORT NSString * const NSMetadataItemPathKey;
|
|
|
|
GS_EXPORT NSString * const NSMetadataItemFSSizeKey;
|
|
|
|
GS_EXPORT NSString * const NSMetadataItemFSCreationDateKey;
|
|
|
|
GS_EXPORT NSString * const NSMetadataItemFSContentChangeDateKey;
|
|
|
|
|
|
|
|
@interface NSMetadataItem : NSObject
|
|
|
|
{
|
2013-04-15 09:07:19 +00:00
|
|
|
#if GS_EXPOSE(NSMetadataItem)
|
|
|
|
@private
|
|
|
|
void *_NSMetadataItemInternal; /** Private internal data */
|
|
|
|
#endif
|
2012-11-20 17:58:34 +00:00
|
|
|
}
|
|
|
|
|
2013-04-15 09:07:19 +00:00
|
|
|
- (NSArray *) attributes;
|
|
|
|
- (id) valueForAttribute: (NSString *)key;
|
|
|
|
- (NSDictionary *) valuesForAttributes: (NSArray *)keys;
|
2012-11-20 17:58:34 +00:00
|
|
|
@end
|
|
|
|
|
|
|
|
// Metdata Query Constants...
|
|
|
|
GS_EXPORT NSString * const NSMetadataQueryUserHomeScope;
|
|
|
|
GS_EXPORT NSString * const NSMetadataQueryLocalComputerScope;
|
|
|
|
GS_EXPORT NSString * const NSMetadataQueryNetworkScope;
|
|
|
|
GS_EXPORT NSString * const NSMetadataQueryUbiquitousDocumentsScope;
|
|
|
|
GS_EXPORT NSString * const NSMetadataQueryUbiquitousDataScope;
|
|
|
|
|
|
|
|
GS_EXPORT NSString * const NSMetadataQueryDidFinishGatheringNotification;
|
|
|
|
GS_EXPORT NSString * const NSMetadataQueryDidStartGatheringNotification;
|
|
|
|
GS_EXPORT NSString * const NSMetadataQueryDidUpdateNotification;
|
|
|
|
GS_EXPORT NSString * const NSMetadataQueryGatheringProgressNotification;
|
2012-11-18 16:37:57 +00:00
|
|
|
|
2012-11-20 17:58:34 +00:00
|
|
|
/* Abstract interface for metadata query... */
|
2012-11-18 16:37:57 +00:00
|
|
|
@interface NSMetadataQuery : NSObject
|
2012-11-20 17:58:34 +00:00
|
|
|
{
|
2013-04-15 09:07:19 +00:00
|
|
|
#if GS_EXPOSE(NSMetadataQuery)
|
|
|
|
@private
|
|
|
|
void *_NSMetadataQueryInternal; /** Private internal data */
|
|
|
|
#endif
|
2012-11-20 17:58:34 +00:00
|
|
|
}
|
2012-11-18 16:37:57 +00:00
|
|
|
|
|
|
|
/* Instance methods */
|
2013-04-15 09:07:19 +00:00
|
|
|
- (id) valueOfAttribute: (id)attr forResultAtIndex: (NSUInteger)index;
|
|
|
|
- (NSArray *) groupedResults;
|
|
|
|
- (NSDictionary *) valueLists;
|
|
|
|
- (NSUInteger) indexOfResult: (id)result;
|
|
|
|
- (NSArray *) results;
|
|
|
|
- (id) resultAtIndex: (NSUInteger)index;
|
|
|
|
- (NSUInteger) resultCount;
|
2012-11-18 16:37:57 +00:00
|
|
|
|
|
|
|
// Enable/Disable updates
|
2013-04-15 09:07:19 +00:00
|
|
|
- (void) enableUpdates;
|
|
|
|
- (void) disableUpdates;
|
2012-11-18 16:37:57 +00:00
|
|
|
|
|
|
|
// Status of the query...
|
2013-04-15 09:07:19 +00:00
|
|
|
- (BOOL) isStopped;
|
|
|
|
- (BOOL) isGathering;
|
|
|
|
- (BOOL) isStarted;
|
|
|
|
- (void) stopQuery;
|
|
|
|
- (BOOL) startQuery;
|
2012-11-18 16:37:57 +00:00
|
|
|
|
|
|
|
// Search URLS
|
2013-04-15 09:07:19 +00:00
|
|
|
- (void) setSearchItemURLs: (NSArray *)urls;
|
|
|
|
- (NSArray *) searchItemURLs;
|
2012-11-18 16:37:57 +00:00
|
|
|
|
|
|
|
// Search scopes
|
2013-04-15 09:07:19 +00:00
|
|
|
- (void) setSearchScopes: (NSArray *)scopes;
|
|
|
|
- (NSArray *) searchScopes;
|
2012-11-18 16:37:57 +00:00
|
|
|
|
|
|
|
// Notification interval
|
2013-04-15 09:07:19 +00:00
|
|
|
- (void) setNotificationBatchingInterval: (NSTimeInterval)interval;
|
|
|
|
- (NSTimeInterval) notificationBatchingInterval;
|
2012-11-18 16:37:57 +00:00
|
|
|
|
|
|
|
// Grouping Attributes.
|
2013-04-15 09:07:19 +00:00
|
|
|
- (void) setGroupingAttributes: (NSArray *)attrs;
|
|
|
|
- (NSArray *) groupingAttributes;
|
|
|
|
- (void) setValueListAttributes: (NSArray *)attrs;
|
|
|
|
- (NSArray *) valueListAttributes;
|
2012-11-18 16:37:57 +00:00
|
|
|
|
|
|
|
// Sort descriptors
|
2013-04-15 09:07:19 +00:00
|
|
|
- (void) setSortDescriptors: (NSArray *)attrs;
|
|
|
|
- (NSArray *) sortDescriptors;
|
2012-11-18 16:37:57 +00:00
|
|
|
|
|
|
|
// Predicate
|
2013-04-15 09:07:19 +00:00
|
|
|
- (void) setPredicate: (NSPredicate *)predicate;
|
|
|
|
- (NSPredicate *) predicate;
|
2012-11-18 16:37:57 +00:00
|
|
|
|
|
|
|
// Delegate
|
2013-04-15 09:07:19 +00:00
|
|
|
- (void) setDelegate: (id<NSMetadataQueryDelegate>)delegate;
|
|
|
|
- (id<NSMetadataQueryDelegate>) delegate;
|
2012-11-18 16:37:57 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
2012-11-20 17:58:34 +00:00
|
|
|
@protocol NSMetadataQueryDelegate
|
2013-12-31 13:14:11 +00:00
|
|
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6,GS_API_LATEST) && GS_PROTOCOLS_HAVE_OPTIONAL
|
2012-11-20 17:58:34 +00:00
|
|
|
@optional
|
2013-12-31 13:14:11 +00:00
|
|
|
#else
|
|
|
|
@end
|
|
|
|
@interface NSObject (NSMetadataQueryDelegate)
|
|
|
|
#endif // GS_PROTOCOLS_HAVE_OPTIONAL
|
2013-04-15 09:07:19 +00:00
|
|
|
- (id) metadataQuery: (NSMetadataQuery *)query
|
|
|
|
replacementObjectForResultObject: (NSMetadataItem *)result;
|
|
|
|
- (id) metadataQuery: (NSMetadataQuery *)query
|
|
|
|
replacementValueForAttribute: (NSString *)attribute
|
|
|
|
value: (id)attributeValue;
|
2012-11-20 17:58:34 +00:00
|
|
|
@end
|
|
|
|
|
2012-11-25 19:40:10 +00:00
|
|
|
@interface NSMetadataQueryAttributeValueTuple : NSObject
|
|
|
|
{
|
2013-04-15 09:07:19 +00:00
|
|
|
#if GS_EXPOSE(NSMetadataQueryAttributeValueTuple)
|
|
|
|
@private
|
|
|
|
/** Private internal data */
|
|
|
|
void *_NSMetadataQueryAttributeValueTupleInternal;
|
|
|
|
#endif
|
2012-11-25 19:40:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (NSString *) attribute;
|
|
|
|
- (id) value;
|
|
|
|
- (NSUInteger) count;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface NSMetadataQueryResultGroup : NSObject
|
|
|
|
{
|
2013-04-15 09:07:19 +00:00
|
|
|
#if GS_EXPOSE(NSMetadataQueryResultGroup)
|
|
|
|
@private
|
|
|
|
void *_NSMetadataQueryResultGroupInternal; /** Private internal data */
|
|
|
|
#endif
|
2012-11-25 19:40:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (NSString *) attribute;
|
|
|
|
- (id) value;
|
|
|
|
- (NSArray *) subgroups;
|
|
|
|
- (NSUInteger) resultCount;
|
|
|
|
- (id) resultAtIndex: (NSUInteger)index;
|
|
|
|
- (NSArray *) results;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
2012-11-18 16:37:57 +00:00
|
|
|
#endif
|