PageRenderTime 21ms CodeModel.GetById 14ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/filesystems-objc/SpotlightFS/Source/SpotlightFS.h

http://macfuse.googlecode.com/
C++ Header | 89 lines | 14 code | 11 blank | 64 comment | 0 complexity | 1fdf149278c0d7419545cf6290c1d4da MD5 | raw file
 1// ================================================================
 2// Copyright (C) 2007 Google Inc.
 3// 
 4// Licensed under the Apache License, Version 2.0 (the "License");
 5// you may not use this file except in compliance with the License.
 6// You may obtain a copy of the License at
 7// 
 8//      http://www.apache.org/licenses/LICENSE-2.0
 9// 
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15// ================================================================
16//
17//  SpotlightFS.h
18//  SpotlightFS
19//
20//  Created by Greg Miller <jgm@> on 1/19/07.
21//
22#import <Cocoa/Cocoa.h>
23
24// A MacFUSE file system for creating real smart folders.  The SpotlightFS
25// file system may consist of some top-level directories, and each of these
26// directories contain symbolic links to files matching some Spotlight query.
27//
28// In the simplest case, the Spotlight query used to generate the contents of 
29// a directory is simply the name of the diretory itself.  For example, a 
30// directory named /Volumes/SpotlightFS/foo would contain symbolic links to
31// all files that match a Spotlight query for the word "foo".
32//
33// Additionally, SpotlightFS looks in "~/Library/Saved Searches" for all files
34// with a ".savedSearch" extension, and automatically creates top-level
35// directories for these files.  The Spotlight query which generates the
36// contents for these directories is found by reading the "RawQuery" key from
37// the saved search plist.
38//
39// See the documentation for FUSEFileSystem for more details.
40//
41@interface SpotlightFS : NSObject {
42  // Empty
43}
44
45// Returns an array of all *.savedSearch files in "~/Library/Saved Searches".
46// The returned paths have the ".savedSearch" extension removed.  If no 
47// saved searches are found, then an empty array is returned rather than nil.
48//
49- (NSArray *)spotlightSavedSearches;
50
51// Returns a dictionary with the contents of the saved search file named "name",
52// or "name.savedSearch".
53//
54- (NSDictionary *)contentsOfSpotlightSavedSearchNamed:(NSString *)name;
55
56// Returns all the user-created search folders.
57//
58- (NSArray *)userCreatedFolders;
59
60// Returns YES if |path| is a user created folder.
61//
62- (BOOL)isUserCreatedFolder:(NSString *)path;
63
64// Sets the full user-created folders array.
65//
66- (void)setUserCreatedFolders:(NSArray *)folders;
67
68// Adds one search (i.e. directory name) to the list of user-created folders.
69// As an example, "mkdir /Volumes/SpotlightFS/foo" will ultimately call through
70// to this method to create the user-defined search for "foo".
71//
72- (void)addUserCreatedFolder:(NSString *)folder;
73
74// Remove a user-defined search.
75//
76- (void)removeUserCreatedFolder:(NSString *)folder;
77
78// Returns the concatenation of -spotlightSavedSearches and -userCreatedFolderes
79//
80- (NSArray *)topLevelDirectories;
81
82// Runs the Spotlight query specified by "queryString", and returns the paths
83// for all the matching files.  The returned paths are encoded, meaning that
84// all forward slashes have been replaced by colons.
85//
86- (NSArray *)encodedPathResultsForSpotlightQuery:(NSString *)queryString
87                                           scope:(NSArray *)scopeDirectories;
88
89@end