home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 October: Mac OS SDK / Dev.CD Oct 00 SDK1.toast / Development Kits / Mac OS / AIAT / Headers / Corpus / HFSTextFolderCorpus.h < prev    next >
Encoding:
Text File  |  1998-04-16  |  2.3 KB  |  90 lines  |  [TEXT/CWIE]

  1. // HFSTextFolderCorpus.h
  2. //    Copyright:    © 1994 - 1998 by Apple Computer, Inc., all rights reserved.
  3.  
  4. // A corpus implementation for all the text files under a root HFS folder.
  5.  
  6. #pragma once
  7. #ifndef HFSTextFolderCorpus_h
  8. #define HFSTextFolderCorpus_h
  9.  
  10. #pragma import on
  11.  
  12. #if PRAGMA_STRUCT_ALIGN
  13.     #pragma options align=power
  14. #endif
  15.  
  16. #include "HFSCorpus.h"
  17. #include "HFSIterator.h"
  18.  
  19. #pragma IA_BEGIN_EXPORTS
  20.  
  21. const uint32    HFSFolderCorpusType = 'HTF1';
  22.  
  23. class HFSTextFolderCorpus : public HFSCorpus {
  24. public:    
  25.                 HFSTextFolderCorpus(uint32 type = HFSFolderCorpusType);
  26.                 HFSTextFolderCorpus(short vRef, long rootDirID, uint32 type = HFSFolderCorpusType);
  27.                 HFSTextFolderCorpus(StringPtr rootDirPath, uint32 type = HFSFolderCorpusType);
  28.  
  29.     virtual ~HFSTextFolderCorpus() {};
  30.     // IACorpus methods
  31.     IADoc*        GetProtoDoc();
  32.     IADocIterator* GetDocIterator();
  33.     
  34.     IADocIterator* GetDocIterator(TProgressFn*    progressFn,
  35.                         clock_t            progressFreq, // never
  36.                         void*            appData);
  37.     
  38.     void SetVolumeRefNum (short vrn) {    vRefNum = vrn;}
  39.     short GetVolumeRefNum () const {return vRefNum;}
  40.     
  41.     void SetRootDirID(long rootdirid) {rootDirId = rootdirid;}
  42.     long GetRootDirID() const {return rootDirId;}
  43.      
  44. protected:
  45.     IABlockSize    InitialSize();
  46.     void        Initializing(IAOutputBlock* output);
  47.     void        Opening(IAInputBlock* input);
  48.     IABlockSize    UpdateSize();
  49.     void        Updating(IAOutputBlock* output);
  50. private:
  51.                 HFSTextFolderCorpus(HFSTextFolderCorpus& fc);
  52.     short        vRefNum;
  53.     long        rootDirId;
  54.  
  55. };
  56.  
  57. class HFSTextFolderDoc : public HFSDoc {
  58. public:
  59.                 HFSTextFolderDoc(HFSTextFolderCorpus* corpus, long dirID, const StringPtr name, long date);
  60.                 HFSTextFolderDoc() : HFSDoc() {}
  61.     virtual ~HFSTextFolderDoc() {};
  62.     IAStorable*    DeepCopy() const;
  63.     IABlockSize    StoreSize() const;
  64.     void        Store(IAOutputBlock* output) const;
  65.     IAStorable*    Restore(IAInputBlock* input) const;
  66.  
  67.     bool        LessThan(const IAOrderedStorable* neighbor) const;
  68.     bool        Equal(const IAOrderedStorable* neighbor) const;
  69.     
  70.     void    SetModDate (long mDate) {modDate = mDate;}
  71.     long    GetModDate () const {return modDate;}
  72.  
  73. protected:
  74.     void        DeepCopying(const IAStorable* source);
  75.     void        Restoring(IAInputBlock* input, const IAStorable* proto);
  76. private:
  77.                 HFSTextFolderDoc(HFSDoc& fd);
  78.     long        modDate;
  79. };
  80.  
  81. #pragma IA_END_EXPORTS
  82.  
  83. #if PRAGMA_STRUCT_ALIGN
  84.     #pragma options align=reset
  85. #endif
  86.  
  87. #pragma import reset
  88.  
  89. #endif
  90.