Copyright ©1995 by NeXT Computer, Inc.  All Rights Reserved.

IXFileRecord



Inherits From: Object
Conforms To: NXTransport
Declared In: indexing/IXFileRecord.h



Class Description

An IXFileRecord represents a single file in a file system, and is used primarily by instances of IXFileFinder.  Queries against an IXFileFinder return sets of IXFileRecords representing the selected files; the IXFileFinder may also store IXFileRecords in an IXRecordManager to improve query performance.  An IXFileRecord records the file's name, type, and other information which may be useful to display to a user after performing a query; the file's name may also be used to access the file itself.



Instance Variables

unsigned int filedate;

IXFileFinder *fileFinder;

char *filename;

char *filetype;

char *description;

struct stat *statBuffer;


filedate The date that the file was last modified.
fileFinder The IXFileFinder using this IXFileRecord.
filename The name of the file.
filetype The type of the file (for example, "ps" or "man").  This is often the same as its extension, though it need not be.
description A description of the file.
statBuffer The UNIX stat buffer for the file.



Adopted Protocols

NXTransport encodeRemotelyFor:freeAfterEncoding:isBycopy:
encodeUsing:
decodeUsing:



Method Types

Initializing a new instance initWithFileFinder:
Getting the file finder fileFinder
Accessing  file attributes setFilename:
filename
setFiletype:
filetype
setDescription:
description
setFiledate:
filedate
Accessing UNIX file information
statBuffer



Instance Methods

description
(const char *)description

Returns the description of the file, or NULL if one hasn't been set.

See also:  setDescription:



filedate
(unsigned int)filedate

Returns the time that the file was last modified as the number of seconds since January 1, 1970, or 0 if one hasn't been set.

See also:  setFiledate:



fileFinder
(IXFileFinder *)fileFinder

Returns the IXFileFinder that created and stores the receiving IXFileRecord.

See also:  initWithFileFinder:



filename
(const char *)filename

Returns the file's name relative to the root path of the IXFileRecord's IXFileFinder, or NULL if one hasn't been set.

See also:  setFilename:



filetype
(const char *)filetype

Returns the file's type, or NULL if one hasn't been set.  A file's type is used by the IXFileFinder to convert it to a parsable format, and is also a queryable attribute of the file.  File types are such things as "rtf" for Rich Text Format, "eps" for PostScript and Encapsulated PostScript, or "man" for UNIX manual pages.  A file's type string is often the same as its extension, though it need not be (as is the case for "man").

See also:  setFiletype:



initWithFileFinder:
initWithFileFinder:(IXFileFinder *)aFileFinder

Initializes the IXFileRecord to work with aFileFinder and returns self.  This establishes a root path for the IXFileRecord.

See also:  fileFinder



setDescription:
setDescription:(const char *)aDescription

Sets the description of the file to aDescription.  This method is usually invoked from the fileFinder:willAddFile: delegate method, which is sent by IXFileFinder when the IXFileRecord is created.   Returns self.

See also:  description, generatesDescriptions (IXFileFinderConfiguration protocol), fileFinder:willAddFile: (IXFileFinderQueryAndUpdate protocol)



setFiledate:
setFiledate:(unsigned int)aDate

Records the time the file was last modified as aDate, expressed in seconds since January 1, 1970.  Returns self.

See also:  filedate



setFilename:
setFilename:(const char *)aName

Records the file's name as aNameaName should be the path of the file relative to the IXFileFinder's root path.  Returns self.

See also:  filename



setFiletype:
setFiletype:(const char *)aType

Records the file's type as aType.  A file's type is used by the IXFileFinder to convert it to a parsable format, and is a queryable attribute.  Returns self.

See also:  filetype



statBuffer
(const struct stat *)statBuffer

Returns the file's UNIX status information:  its creation date, permissions, whether it's a directory or special file, and so on. Returns NULL if the status information isn't available.

Your code can use this information to determine whether to display specific information about this file (for example, if the user doesn't have read permission, that file's name could be listed in dimmed text, or perhaps not listed at all).

The stat buffer is generally available only in the fileFinder:willAddFile: method for the sender of an update request. fileFinder:willAddFile: is invoked by IXFileFinder when the IXFileRecord is created.

See also:  stat(2) UNIX manual page, fileFinder:willAddFile: (IXFileFinderQueryAndUpdate protocol)