home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / MiscKit1.7.1 / MiscKit / Headers / misckit / _MiscDirectoryStream.h next >
Encoding:
Text File  |  1995-04-12  |  2.0 KB  |  75 lines

  1. // Warning:  This class is PRIVATE to the MiscFile class and may at a
  2. // later date be replaced with something more efficient, such as a
  3. // category on the "MiscDirectory" class... in other words, do NOT use
  4. // this class!  If you do, don't complain to us if/when it disappears!
  5.  
  6. // Copyright (C) 1995 Todd Thomas
  7.  
  8. /************************************************************************
  9.   CLASS:            _MiscDirectoryStream
  10.   INHERITS FROM:    Object
  11.   PROGRAMMER:        Todd Thomas        (todd@avocado.cuc.ab.ca)
  12.   STARTED:            May 1, 1994
  13.   LAST CHANGED:    May 25, 1994
  14.   VERSION:            1.1
  15.  
  16.   CHANGES:        
  17.      1.1
  18.          Changed malloc and free to NX_MALLOC and NX_FREE. I was doing some
  19.          odd malloc thing which seemed to work until you read alot of 
  20.          streams.
  21.  
  22.      This class is basically a wrapper for opendir, readdir, rewinddir, and
  23.   closedir. It also makes use of stat(2) to get information about the
  24.   current filename in the directory stream. Currently you can ask if the
  25.   current file is a directory or a symbolic link. I may add more later.
  26.  
  27.      Please see the documentation for more information on what each method
  28.   returns, etc.
  29.  
  30.   An example that prints all the files in /LocalApps:
  31.  
  32.      id  dirStream = [ [DirectoryStream alloc] init];   
  33.      
  34.   
  35.          [dirStream openDir: "/LocalApps"];
  36.    
  37.          while ([dirStream readDir])
  38.             printf ("%s\n", [dirStream filename]);
  39.       
  40.           [dirStream closeDir];
  41.           [dirStream free];
  42.  
  43.  ************************************************************************/
  44.  
  45. #import <sys/types.h>
  46. #import <sys/dir.h>
  47. #import <objc/Object.h>
  48.  
  49.  
  50. @interface _MiscDirectoryStream : Object
  51. {
  52.     DIR  *dirStream;                // pointer to a directory stream 
  53.     struct direct  *dp;                // holds information about the current file
  54.     char  *currentDirName;            // current directory being examined
  55. }
  56.  
  57. - init;
  58. - initWithDirectory: (const char *)directory;
  59. - free;
  60.  
  61.  
  62. - openDir: (const char *)directory;
  63. - (const char *)directory;
  64. - readDir;
  65. - rewindDir;
  66. - closeDir;
  67.  
  68. - (const char *)filename;
  69. - (int)filenameLength;
  70.  
  71. - (BOOL)isADirectory;
  72. - (BOOL)isASymbolicLink;
  73.  
  74. @end
  75.