home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / Clock / Sources / Content.cpp < prev    next >
Encoding:
Text File  |  1996-08-16  |  2.8 KB  |  92 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                Content.cpp
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef CONTENT_H
  11. #include "Content.h"
  12. #endif
  13.  
  14. #ifndef PART_H
  15. #include "Part.h"
  16. #endif
  17.  
  18. #ifndef DEFINES_K
  19. #include "Defines.k"
  20. #endif
  21.  
  22. //========================================================================================
  23. // Runtime information
  24. //========================================================================================
  25.  
  26. #ifdef FW_BUILD_MAC
  27. #pragma segment odfclock
  28. #endif
  29.  
  30. //========================================================================================
  31. //    Class CClockContent
  32. //========================================================================================
  33.  
  34. FW_DEFINE_AUTO(CClockContent)
  35.  
  36. //----------------------------------------------------------------------------------------
  37. // CClockContent constructor
  38. //----------------------------------------------------------------------------------------
  39.  
  40. CClockContent::CClockContent(Environment* ev, CClockPart* part)
  41. :    FW_CContent(ev, part),
  42.     fClockPart(part),
  43.     fClockType(kAnalogClock),
  44.     fHasTickSound(false),
  45.     fHasChimeSound(true)
  46. {
  47. }
  48.  
  49. //----------------------------------------------------------------------------------------
  50. // CClockContent destructor
  51. //----------------------------------------------------------------------------------------
  52.  
  53. CClockContent::~CClockContent()
  54. {
  55. }
  56.  
  57. //----------------------------------------------------------------------------------------
  58. // CClockContent::Externalize
  59. //----------------------------------------------------------------------------------------
  60.  
  61. void CClockContent::Externalize(Environment* ev,
  62.                                 ODStorageUnit* storageUnit,
  63.                                 FW_EStorageKinds storageKind,
  64.                                 FW_CCloneInfo* cloneInfo)
  65. {
  66. FW_UNUSED(cloneInfo);
  67.     FW_PStorageUnitSink suSink(ev, storageUnit, kODPropContents, fClockPart->GetPartKind(ev));
  68.     FW_CWritableStream stream(suSink);
  69.     stream << fClockType;
  70.     stream << fHasTickSound;
  71.     stream << fHasChimeSound;
  72. }
  73.  
  74. //----------------------------------------------------------------------------------------
  75. // CClockContent::Internalize
  76. //----------------------------------------------------------------------------------------
  77.  
  78. FW_Boolean CClockContent::Internalize(Environment* ev,
  79.                                        ODStorageUnit* storageUnit, 
  80.                                        FW_EStorageKinds storageKind,
  81.                                        FW_CCloneInfo* cloneInfo)
  82. {
  83.     FW_PStorageUnitSink suSink(ev, storageUnit, kODPropContents, fClockPart->GetPartKind(ev));
  84.     FW_PBufferedSink sink(ev, suSink);
  85.     FW_CReadableStream stream(sink);
  86.     stream >> fClockType;
  87.     stream >> fHasTickSound;
  88.     stream >> fHasChimeSound;
  89.     return true;
  90. }
  91.  
  92.