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 / FWGraphx / FWGrRef.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  1.2 KB  |  61 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWGrRef.h
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWGRREF_H
  11. #define FWGRREF_H
  12.  
  13. //========================================================================================
  14. //    class FW_TGrRefPtr
  15. //========================================================================================
  16.  
  17. #ifdef _MSC_VER
  18.  
  19. // Visual C++ has trouble with friends of templates (see below)
  20.  
  21. template<class T>
  22. void FW_PrivAcquireGrRep(T rep);
  23.  
  24. template<class T>
  25. void FW_PrivReleaseGrRep(T rep);
  26.  
  27. #endif
  28.  
  29. template <class T>
  30. class FW_TGrRefPtr
  31. {
  32. public:
  33.     FW_DECLARE_AUTO(FW_TGrRefPtr)
  34.  
  35. #ifndef _MSC_VER
  36.     friend void FW_PrivAcquireGrRep(T rep);
  37.     friend void FW_PrivReleaseGrRep(T rep);
  38. #endif
  39.  
  40.     FW_TGrRefPtr(T rep = 0);
  41.     ~FW_TGrRefPtr();
  42.  
  43.     void operator=(const FW_TGrRefPtr<T>& other)
  44.         { SetRep(other.fRep); }
  45.  
  46.     void operator=(T rep)
  47.         { SetRep(rep); }
  48.  
  49.     operator T() const
  50.         { return fRep; }
  51.  
  52.     void SetRep(T rep);
  53.  
  54. protected:
  55.     T    fRep;
  56.  
  57.     FW_TGrRefPtr(const FW_TGrRefPtr<T>& other);
  58. };
  59.  
  60. #endif // FWGRREF_H
  61.