home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / OS / FWResour / FWResFil.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  3.3 KB  |  111 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWResFil.h
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #if !defined(FWRESFIL_H) && !defined(__ODFRC__)
  11. #define FWRESFIL_H
  12.  
  13. #ifndef FWSOMPTR_H
  14. #include "FWSOMPtr.h"
  15. #endif
  16.  
  17. #ifndef FWEXCDEF_H
  18. #include "FWExcDef.h"
  19. #endif
  20.  
  21. #ifndef FWCOUPTR_H
  22. #include "FWCouPtr.h"
  23. #endif
  24.  
  25. #include "SLResFil.xh"
  26.  
  27. //========================================================================================
  28. // CLASS FW_PResourceFile
  29. //
  30. //        Inherited API for operator->()
  31. //
  32. //            FW_OFileSpecification GetFileSpecification();
  33. //                // Get the file specification for the resourcesFile.
  34. //        
  35. //            FW_Boolean HasResource(in FW_ResourceID resourceID,
  36. //                                   in FW_ResourceType resourceType);
  37. //                // Returns TRUE if the resource exists in the file, FALSE if it doesn't.
  38. //    
  39. //            FW_ResourceHandle GetResourceHandle(in FW_ResourceID resourceID,
  40. //                                                in FW_ResourceType resourceType);
  41. //                // Gets the resource handle.  Resource data may still be purgeable or unloaded.
  42. //                // Client assumes responsibility to call ReleaseResourceHandle when done.
  43. //    
  44. //            void ReleaseResourceHandle(in FW_ResourceHandle handle);
  45. //                // Releases the resource handle.  All memory is released.
  46. //    
  47. //========================================================================================
  48.  
  49. class FW_PResourceFile : public FW_TCountedSOMPtr<FW_OResourceFile>
  50. {
  51. public:
  52.  
  53.     FW_DECLARE_AUTO(FW_PResourceFile)
  54.  
  55.     FW_PResourceFile(Environment* ev, FW_OResourceFile *rep);
  56.         // Attach to the given resources file rep.
  57.  
  58.     FW_PResourceFile(Environment* ev, FW_OFileSpecification* newFileSpec);
  59.         //     Open a resources file by name.
  60.         //     This instance assumes responsibility for closing the file.
  61.         
  62.     FW_PResourceFile(Environment* ev, FW_ResourceFileID resFileID);
  63.         // Attach to an already opened resource file.
  64.         // This instance does not assume responsibility for closing the file.
  65.  
  66.     virtual ~FW_PResourceFile();
  67.  
  68.     FW_PResourceFile(const FW_PResourceFile& other);
  69.         // Copy constructor, attach to same file as other.
  70.     
  71.     FW_PResourceFile& operator=(const FW_PResourceFile& other);
  72.         // Assignment operator.
  73.  
  74. protected:
  75.     FW_PResourceFile();
  76. };
  77.  
  78.  
  79. //----------------------------------------------------------------------------------------
  80. // FW_PResourceFile::operator=
  81. //----------------------------------------------------------------------------------------
  82. inline FW_PResourceFile& FW_PResourceFile::operator=(const FW_PResourceFile& other)
  83. {
  84.     FW_TCountedSOMPtr<FW_OResourceFile>::operator=(other);
  85.     return *this;
  86. }
  87.  
  88.  
  89.  
  90. #if defined FW_BUILD_MAC
  91. //========================================================================================
  92. // CLASS FW_CMacResLoadFalse
  93. //========================================================================================
  94. // This utility class provides a mechanism to ::SetResLoad(false) and then be
  95. // assured that ::SetResLoad(true) is executed even in the presend of an FW_THROW
  96.  
  97. class FW_CMacResLoadFalse
  98. {
  99. public:
  100.     FW_DECLARE_AUTO(FW_CMacResLoadFalse)
  101.  
  102.     FW_CMacResLoadFalse();
  103.         // Sets ResLoad false
  104.  
  105.     ~FW_CMacResLoadFalse();
  106.         // Sets ResLoad true
  107. };
  108. #endif
  109.  
  110. #endif
  111.