ftp.nice.ch/pub/next/developer/resources/classes/misckit/MiscKit.1.10.0.s.gnutar.gz#/MiscKit/Documentation/Classes/MiscDirectory.rtf

This is MiscDirectory.rtf in view mode; [Download] [Up]

Version 0.1 alpha, Copyright ©1994 by Simson L. Garfinkel.  All Rights Reserved.
 Georg Tuparev  --  11.12.1994.



MiscDirectory






Inherits From:	Object


Declared In:	MiscDirectory.h





Class Description

This class is in very preliminary stage. The idea and the first version of the class are from Simson Garfinkel. I slightly modified the source and added a new sort method (currently sorting only by name).  This class may be used separately from all other classes included in the current version of MiscKit. That's the reason, why all the methods return values from type const char * and no MiscString. Returning MiscString is in general bad idea for low level classes, so in the future, I will keep the return values unchanged.

Note: 
- Do not use the init method! Use only initForDirectory:
- I had no time to test all methods. Especially this is true for the archiving methods. Please report any bugs and suggestions to <tuparev@embl-heidelberg.de>
 - The next version of the class may use the MiscFile class by Todd Thomas.  This can lead to more or less drastically changes.
 
TO DO! 
The next version of the class will include the following new features:
- sorting by different criteria (name, date, size, owner, ...)
- updating
- file attributes (all the ugly stuff in the stat structure)





Instance Variables

List *	fileNameList;
int	currentEntry;
char *	dirName;
char *	filetype;



fileNameList 	List containing all directory entries.

currentEntry 	Pointer (index) of the current directory entry.

dirName 	Full directory path.

filetype 	Current file extension type.





Method Types

Initializing the class	+€initialize

Creating and freeing instances	±€init
±€free

Setting global behavior	±€setFileType:
±€sortDir

Information about current entry	±€entry
±€extension
±€fullPathName

Movement	±€nextEntry
±€rewind

Information about directory	±€matchingEntries

Archiving a MiscDirectory	± read:
	± write:








Class Methods

initialize
+ initialize

Initializes the class instance doing things like setting the version number.

See also:  -€initialize (Object)



Instance Methods

entry
- (const char *)entry

Returns the current entry (with extension) or NULL.

See also:  -€nextEntry,  -€fullPathName, -€extension

extension
- (const char *)extension

Returns the current entry's extension or NULL.

See also:  -€nextEntry,  -€fullPathName, -€entry

free
- free

Frees the MiscDirectory object.

See also:  -€free (Object)

fullPathName
- (const char *)fullPathName

Returns the full path of the current entry (with extension) or NULL.

See also:  -€nextEntry,  -€fullPathName, -€entry

initForDirectory
- initForDirectory:(const char *)dirname

Initializes the directory object.

See also:  -€initialize (Object)

matchingEntries
- (int)matchingEntries

Returns the number of entries in the directory object.


nextEntry
- (const char *)nextEntry

Increments the directory pointer to the next entry with matching file extension (if possible) and returns the new directory entry or NULL.

See also:  -€entry,  -€fullPathName, -€extension, -€rewind, -€setFileType

read
- read:(NXTypedStream *)stream

Reads the object from the typed stream.

See also:  -€read: (Object)

rewind
- rewind

Rewind the directory. The current entry (the first in the list) may have an extension different then the one, set by the setFileType: method.  This behavior will be fixed in the next version

See also:  -€nextEntry

setFileType
- setFileType:(const char *)filetype

Sets the search file extension.

See also:  -€initialize (Object)

sortDir
- sortDir

Sorts the directory by name

See also:  -€initialize (Object)

write
- write:(NXTypedStream *)stream

Writes the object to the typed stream.

See also:  -€write (Object)

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