ftp.nice.ch/pub/next/developer/languages/c/gcc.2.7.2.2.I.b.tar.gz#/lib/gcc-lib/m68k-next-nextstep3/2.7.2.2.f.2/include/indexing/IXFileFinder.h

This is IXFileFinder.h in view mode; [Download] [Up]

/*
IXFileFinder.h
Copyright 1991, NeXT Computer, Inc.
*/

#import <objc/hashtable.h>
#import	<machkit/reference.h>

#import	"IXPostingList.h"

@class IXBTree, IXFileFinder, IXFileRecord;

typedef struct 			{
    unsigned			recordNumber;
    unsigned			dateModified;
} IXFileRegistration;

@protocol IXFileFinderQueryAndUpdate

- (const char *)rootPath; /* returns the root path*/

/* Returns the file finder's record manager.  The file finder forwards all */
/* unrecognized messages to its record manager.*/
- recordManager;

- (char *)attributeNames; /* returns the names of indexed attributes*/

- clean; /* removes stale information from the index*/
- reset; /* removes everything from the index*/

/* updates the index in the caller's thread, starting at the supplied path.*/
- updateIndexAtPath:(const char *)path forSender:aSender;

- (BOOL)isUpdating; /* true when asynchronous updating is in progress*/
- resumeUpdating; /* resumes asynchronous updating*/
- suspendUpdating; /* suspends asynchronous updating*/

- stopQueryForSender:aSender; /* stops a recursive descent in progress*/
- (IXPostingList *)performQuery:(const char *)query 
    atPath:(const char *)path forSender:aSender;

/* This method returns the registry used by the file finder.  The keys are */
/* relative file names, and the values are instances of the IXFileRegistration */
/* structure defined above.  The registry should be considered read only.*/
- (IXBTree *)registry;

@end

@interface Object(IXFileFinderSender)

/* Called with the list of index results before recursive descent is started.*/
- fileFinder:(IXFileFinder *)aFinder 
    didFindFiles:(IXPostingList *)aList;

/* Called during recursive descent for each file visited before the file date */
/* is compared with the registry for currency.  If the return value is NO, the */
/* file will be skipped.*/
- (BOOL)fileFinder:(IXFileFinder *)aFinder 
    willTryPath:(const char *)filename;

/* Called during recursive descent for each modified file before parsing the */
/* file contents or testing for conformance to the query.  This method returns */
/* its second argument, or a new file record that replaces its second argument.*/
- fileFinder:(IXFileFinder *)aFinder 
    willAddFile:(IXFileRecord *)anObject;

/* Called during recursive descent for each modified file after parsing and */
/* testing, but before adding the file to the index.  The file record contains */
/* a full complement of attribute bindings at this point.  This method returns */
/* its second argument, or a new file record that replaces its second argument.*/
- fileFinder:(IXFileFinder *)aFinder 
    didAddFile:(IXFileRecord *)anObject;

/* Called during recursive descent for each file that satisfies the query.*/
- fileFinder:(IXFileFinder *)aFinder 
    didFindFile:(IXFileRecord *)anObject;

@end

@protocol IXFinderControl

/* Returns self, or nil to deny enumeration of the named directory.  */
- fileFinder:(IXFileFinder *)aFinder willEnumerate:(char *)filename;

/* Called to allow subsidiary file finders to be recursively queried.*/
- (IXPostingList *)fileFinder:(IXFileFinder *)aFinder 
    didPerform:(char *)query atPath:(char *)path forSender:aSender;

@end

@protocol IXFileFinderConfiguration

/* These methods manage the list of parsers used by a file finder.  The list */
/* is searched for a parser that understands the type of the file being parsed.*/

- getAttributeParsers:(List *)aList;
- setAttributeParsers:(List *)aList;

/* The following methods read and write ignored types using strings.*/

- (char *)ignoredTypes; /* returns the list of ignored types*/
- setIgnoredTypes:(const char *)types; /* sets the list of ignored types*/

/* The following methods read and write ignored types using streams.*/

- readIgnoredTypes:(NXStream *)aStream;
- writeIgnoredTypes:(NXStream *)aStream;

/* The following methods read and write ignored types using files.*/

- readIgnoredTypesFromFile:(const char *)filename;
- writeIgnoredTypesToFile:(const char *)filename;

/* The following methods read and write ignored names using strings.*/

- (char *)ignoredNames; /* returns the list of ignored names*/
- setIgnoredNames:(const char *)names; /* sets the list of ignored names*/

/* The following methods read and write ignored names using streams.*/

- readIgnoredNames:(NXStream *)aStream;
- writeIgnoredNames:(NXStream *)aStream;

/* The following methods read and write ignored names using files.*/

- readIgnoredNamesFromFile:(const char *)filename;
- writeIgnoredNamesToFile:(const char *)filename;

/* N.B.: the hidden file policy is not preserved across archiving */
/* or across closing the store.  it defaults to NO at initialization.*/

- (BOOL)considersHiddenFiles; /* returns hidden file policy*/
- setConsidersHiddenFiles:(BOOL)flag; /* sets hidden file policy*/

- (BOOL)crossesDeviceChanges; /* returns device crossing policy*/
- setCrossesDeviceChanges:(BOOL)flag; /* sets device crossing policy*/

- (BOOL)followsSymbolicLinks; /* returns symbolic link policy*/
- setFollowsSymbolicLinks:(BOOL)flag; /* sets symbolic link policy*/

- (BOOL)generatesDescriptions; /* returns description generation policy*/
- setGeneratesDescriptions:(BOOL)flag; /* sets description generation policy*/

- (BOOL)updatesAutomatically; /* returns automatic update policy*/
- setUpdatesAutomatically:(BOOL)flag; /* sets automatic update policy*/

- (BOOL)scansForModifiedFiles; /* returns file scanning policy*/
- setScansForModifiedFiles:(BOOL)flag; /* sets file scanning policy*/

- (BOOL)removesAutomatically; /* sets the automatic removal policy*/
- setRemovesAutomatically:(BOOL)aBoolean; /* returns automatic removal policy*/

- (unsigned)commitDelay; /* returns the commit delay in seconds*/
- setCommitDelay:(unsigned)seconds; /* sets the commit delay for updating*/

- (id <IXFinderControl>)finderControl; /* sets the controller for recursion*/
- setFinderControl:(id <IXFinderControl>)anObject; /* returns the controller*/

@end

/* an instance of this class manages the inversion of a single rootPath tree in the file system.  multiple queries may be run concurrently with updating.*/

@interface IXFileFinder: Object <NXReference, IXNameAndFileAccess, IXFileFinderQueryAndUpdate, IXFileFinderConfiguration, IXAttributeBinding>
{
    struct FinderRecord	*_finderRecord;
    unsigned		references; /* the reference count*/
    List		*attributeParsers; /* the list of attribute parsers*/
    id			recordManager; /* the supporting record manager*/
    NXHashTable		*ignoredNames; /* table of ignored names*/
    NXHashTable		*ignoredTypes; /* table of ignored types*/
    char		*rootPath; /* the root path*/
    unsigned		commitDelay; /* transaction commit delay in seconds*/
    struct		{
	unsigned	crossesDeviceChanges:1; /* crosses device changes*/
	unsigned	followsSymbolicLinks:1; /* follows symbolic links*/
	unsigned	generatesDescriptions:1; /* generates descriptions*/
	unsigned	updatesAutomatically:1; /* queries request updates*/
	unsigned	scansForModifiedFiles:1; /* scans for modified files*/
	unsigned	removesAutomatically:1; /* scans for removed files*/
	unsigned	considersHiddenFiles:1; /* considers hidden files*/
    } 			booleanOptions;
}

/* Returns the store, e.g., [[client store] startTransaction].*/
- (IXStore *)store;


/* The following methods are analagous to the initialization methods defined  */
/* by the IXBlockAndStoreAccess and IXNameAndFileAccess protocols.  The path */
/* supplied to the methods is the root of the file system subtree managed by */
/* the file finder.  A file finder may be rerooted simply by opening it with a */
/* new root path.  If the protocol methods are used, then the current working */
/* directory is used as the default root path parameter.*/

- initInStore:(IXStore *)aStore 
    atPath:(const char *)path;
- initFromBlock:(unsigned)block inStore:(IXStore *)aStore 
    atPath:(const char *)path;

- initWithName:(const char *)name inFile:(const char *)filename 
    atPath:(const char *)path;
- initFromName:(const char *)aName inFile:(const char *)filename 
    forWriting:(BOOL)flag atPath:(const char *)path;

@end

#ifdef KANJI

#define IX_NOTDEF_ENCODING	0
#define IX_NEXTSTEP_ENCODING	1
#define IX_NJE_ENCODING	2

@interface IXFileFinder(QueryEncoding)

- (unsigned)queryEncoding;
- setQueryEncoding:(unsigned)encoding;

@end

#endif

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.