home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / AOCE Sample Code / PowerTalk Access Modules / Sample SMSAM / SampleSMSAM Source / VirtualFile / VirtualMacFile.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-28  |  2.5 KB  |  87 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        VirtualMacFile.h
  3.  
  4.     Copyright:    © 1991-1994 by Apple Computer, Inc.
  5.                 All rights reserved.
  6.  
  7.     Part of the AOCE Sample SMSAM Package.  Consult the license
  8.     which came with this software for your specific legal rights.
  9.  
  10. */
  11.  
  12.  
  13.  
  14. #ifndef __VIRTUALMACFILE__
  15. #define __VIRTUALMACFILE__
  16.  
  17. #ifndef __FILES__
  18. #include <Files.h>
  19. #endif
  20.  
  21. #ifndef __HANDLEOBJECT__
  22. #include "HandleObject.h"
  23. #endif
  24.  
  25. /***********************************|****************************************/
  26.  
  27. class TVirtualMacFile : public THandleObject
  28. {
  29. public:
  30.  
  31.     enum WhichDateType { kCreationDate, kModDate };
  32.     enum ForkType { kResource, kData };
  33.  
  34.     virtual ~TVirtualMacFile();
  35.  
  36.     virtual OSErr                     Open () = 0;
  37.     virtual OSErr                     Close () = 0;
  38.     
  39.     virtual OSErr                     ReadData (void *buffer, long& count, ForkType whichFork) = 0;
  40.     virtual OSErr                     WriteData (const void *buffer, long& count, ForkType whichFork) = 0;
  41.  
  42.     virtual OSErr                     SetEnd (long logEof, ForkType whichFork) = 0;
  43.     virtual OSErr                     GetEnd (long& logEof, ForkType whichFork) const = 0;
  44.  
  45.     virtual OSErr                     SetPosition (short posMode, long posOff, ForkType whichFork) = 0;
  46.     virtual OSErr                     GetPosition (long& filePos,ForkType whichFork) const = 0;
  47.  
  48.     virtual OSErr                     SetFinderInfo (const FInfo& finderInfo) = 0;
  49.     virtual OSErr                     GetFinderInfo (FInfo& finderInfo) const = 0;
  50.  
  51.     virtual OSErr                     GetDate (unsigned long& dateTime,WhichDateType whichDate) const = 0;
  52.     virtual OSErr                     SetDate (unsigned long dateTime,WhichDateType whichDate) = 0;
  53.  
  54.     virtual void                     SetUserRef(long ref) = 0;
  55.      virtual long                     GetUserRef() const = 0;
  56.  
  57.     virtual OSErr                     WriteToDisk( const FSSpec& );
  58.     virtual OSErr                     WriteToDisk ();
  59.  
  60.     virtual OSErr                     SetFileName(const Str31 name);
  61.     virtual OSErr                    GetFileName(Str31 name) const;
  62.     
  63.     virtual    OSErr                    GetSpec ( FSSpec& ) const = 0;
  64.     virtual    OSErr                    SetSpec ( const FSSpec& ) = 0;
  65.     
  66.     static    OSErr                    GetFileInfo ( FSSpec&, HParamBlockRec& );
  67.     static    OSErr                    SetFileInfo ( FSSpec&, HParamBlockRec& );
  68.     
  69.     virtual    TVirtualMacFile*         Clone ();
  70.     virtual    OSErr                    Copy ( TVirtualMacFile* dest );
  71.  
  72.     virtual ostream&                 operator >> ( ostream& ) const;
  73.  
  74. protected:    TVirtualMacFile();
  75.             TVirtualMacFile( const TVirtualMacFile& );
  76.             TVirtualMacFile&         operator = ( const TVirtualMacFile& );
  77.  
  78.     virtual    OSErr                    CopyFork ( TVirtualMacFile::ForkType forkToCopy, TVirtualMacFile* dest );
  79. };
  80.  
  81. /***********************************|****************************************/
  82.  
  83. extern OSErr ChangeFileDates(const FSSpec& spec, long modDate, long creationDate);
  84.  
  85. #endif    // __VIRTUALMACFILE__
  86.  
  87.