1 /**Interface for NSMetadataQuery for GNUStep 2 Copyright (C) 2012 Free Software Foundation, Inc. 3 4 Written by: Gregory Casamento 5 Date: 2012 6 7 This file is part of the GNUstep Base Library. 8 9 This library is free software; you can redistribute it and/or 10 modify it under the terms of the GNU Lesser General Public 11 License as published by the Free Software Foundation; either 12 version 2 of the License, or (at your option) any later version. 13 14 This library is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 Lesser General Public License for more details. 18 19 You should have received a copy of the GNU Lesser General Public 20 License along with this library; if not, write to the Free 21 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 22 Boston, MA 02110 USA. 23 24 AutogsdocSource: NSMetadataQuery.h 25 */ 26 27 #ifndef __NSMetadata_h_GNUSTEP_BASE_INCLUDE 28 #define __NSMetadata_h_GNUSTEP_BASE_INCLUDE 29 #import <GNUstepBase/GSVersionMacros.h> 30 31 #import <Foundation/NSObject.h> 32 #import <Foundation/NSTimer.h> 33 #import <Foundation/NSMetadataAttributes.h> 34 35 @class NSPredicate, NSMutableDictionary, NSDictionary, NSMutableArray; 36 @protocol NSMetadataQueryDelegate; 37 38 @interface NSMetadataItem : NSObject 39 { 40 #if GS_EXPOSE(NSMetadataItem) 41 @private 42 void *_NSMetadataItemInternal; /** Private internal data */ 43 #endif 44 } 45 46 - (NSArray *) attributes; 47 - (id) valueForAttribute: (NSString *)key; 48 - (NSDictionary *) valuesForAttributes: (NSArray *)keys; 49 @end 50 51 // Metdata Query Constants... 52 GS_EXPORT NSString * const NSMetadataQueryUserHomeScope; 53 GS_EXPORT NSString * const NSMetadataQueryLocalComputerScope; 54 GS_EXPORT NSString * const NSMetadataQueryNetworkScope; 55 GS_EXPORT NSString * const NSMetadataQueryUbiquitousDocumentsScope; 56 GS_EXPORT NSString * const NSMetadataQueryUbiquitousDataScope; 57 58 GS_EXPORT NSString * const NSMetadataQueryDidFinishGatheringNotification; 59 GS_EXPORT NSString * const NSMetadataQueryDidStartGatheringNotification; 60 GS_EXPORT NSString * const NSMetadataQueryDidUpdateNotification; 61 GS_EXPORT NSString * const NSMetadataQueryGatheringProgressNotification; 62 63 /* Abstract interface for metadata query... */ 64 @interface NSMetadataQuery : NSObject 65 { 66 #if GS_EXPOSE(NSMetadataQuery) 67 @private 68 void *_NSMetadataQueryInternal; /** Private internal data */ 69 #endif 70 } 71 72 /* Instance methods */ 73 - (id) valueOfAttribute: (id)attr forResultAtIndex: (NSUInteger)index; 74 - (NSArray *) groupedResults; 75 - (NSDictionary *) valueLists; 76 - (NSUInteger) indexOfResult: (id)result; 77 - (NSArray *) results; 78 - (id) resultAtIndex: (NSUInteger)index; 79 - (NSUInteger) resultCount; 80 81 // Enable/Disable updates 82 - (void) enableUpdates; 83 - (void) disableUpdates; 84 85 // Status of the query... 86 - (BOOL) isStopped; 87 - (BOOL) isGathering; 88 - (BOOL) isStarted; 89 - (void) stopQuery; 90 - (BOOL) startQuery; 91 92 // Search URLS 93 - (void) setSearchItemURLs: (NSArray *)urls; 94 - (NSArray *) searchItemURLs; 95 96 // Search scopes 97 - (void) setSearchScopes: (NSArray *)scopes; 98 - (NSArray *) searchScopes; 99 100 // Notification interval 101 - (void) setNotificationBatchingInterval: (NSTimeInterval)interval; 102 - (NSTimeInterval) notificationBatchingInterval; 103 104 // Grouping Attributes. 105 - (void) setGroupingAttributes: (NSArray *)attrs; 106 - (NSArray *) groupingAttributes; 107 - (void) setValueListAttributes: (NSArray *)attrs; 108 - (NSArray *) valueListAttributes; 109 110 // Sort descriptors 111 - (void) setSortDescriptors: (NSArray *)attrs; 112 - (NSArray *) sortDescriptors; 113 114 // Predicate 115 - (void) setPredicate: (NSPredicate *)predicate; 116 - (NSPredicate *) predicate; 117 118 // Delegate 119 - (void) setDelegate: (id<NSMetadataQueryDelegate>)delegate; 120 - (id<NSMetadataQueryDelegate>) delegate; 121 122 @end 123 124 @protocol NSMetadataQueryDelegate 125 #if OS_API_VERSION(MAC_OS_X_VERSION_10_6,GS_API_LATEST) && GS_PROTOCOLS_HAVE_OPTIONAL 126 @optional 127 #else 128 @end 129 @interface NSObject (NSMetadataQueryDelegate) 130 #endif // GS_PROTOCOLS_HAVE_OPTIONAL 131 - (id) metadataQuery: (NSMetadataQuery *)query 132 replacementObjectForResultObject: (NSMetadataItem *)result; 133 - (id) metadataQuery: (NSMetadataQuery *)query 134 replacementValueForAttribute: (NSString *)attribute 135 value: (id)attributeValue; 136 @end 137 138 @interface NSMetadataQueryAttributeValueTuple : NSObject 139 { 140 #if GS_EXPOSE(NSMetadataQueryAttributeValueTuple) 141 @private 142 /** Private internal data */ 143 void *_NSMetadataQueryAttributeValueTupleInternal; 144 #endif 145 } 146 147 - (NSString *) attribute; 148 - (id) value; 149 - (NSUInteger) count; 150 151 @end 152 153 @interface NSMetadataQueryResultGroup : NSObject 154 { 155 #if GS_EXPOSE(NSMetadataQueryResultGroup) 156 @private 157 void *_NSMetadataQueryResultGroupInternal; /** Private internal data */ 158 #endif 159 } 160 161 - (NSString *) attribute; 162 - (id) value; 163 - (NSArray *) subgroups; 164 - (NSUInteger) resultCount; 165 - (id) resultAtIndex: (NSUInteger)index; 166 - (NSArray *) results; 167 168 @end 169 170 #endif 171