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 / ODF / OS / FWFiles / Sources / SLFileAc.cpp < prev    next >
Encoding:
Text File  |  1996-08-16  |  5.6 KB  |  218 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                SLFileAc.cpp
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #include "FWOS.hpp"
  11.  
  12. #include <Limits.h>
  13.  
  14. #ifndef FWEXCDEF_H
  15. #include "FWExcDef.h"
  16. #endif
  17.  
  18. #ifndef SLFILESY_H
  19. #include "SLFileSy.h"
  20. #endif
  21.  
  22. #include "SLFileSp.xh"
  23.  
  24. #ifndef FWACCBUF_H
  25. //#include "FWAccBuf.h"
  26. #endif
  27.  
  28. #include "SLFilRep.xh"
  29.  
  30. #ifndef FWPRIDEB_H
  31. #include "FWPriDeb.h"
  32. #endif
  33.  
  34. #ifdef FW_BUILD_MAC
  35. #pragma segment File
  36. #endif
  37.  
  38.  
  39. /*
  40.  *  This file was generated by the SOM Compiler.
  41.  *  Generated using: 
  42.  *      SOM Emitter emitxtm.dll: 2.33
  43.  */
  44.  
  45. #define FW_OFileSink_Class_Source
  46. #include "SLFileAc.xih"
  47.  
  48.  
  49.  
  50. //----------------------------------------------------------------------------------------
  51. // FW_OFileSink__Init
  52. //----------------------------------------------------------------------------------------
  53.  
  54. SOM_Scope void  SOMLINK FW_OFileSink__InitFromOFile(FW_OFileSink *somSelf, Environment *ev,
  55.         FW_OFile* theFile)
  56. {
  57. FW_UNUSED(ev);
  58.     FW_OFileSinkData *somThis = FW_OFileSinkGetData(somSelf);
  59.  
  60.     somThis->fRep = theFile;
  61. }
  62.  
  63.  
  64. //----------------------------------------------------------------------------------------
  65. // FW_OFileSink__GetOFile
  66. //----------------------------------------------------------------------------------------
  67.  
  68. SOM_Scope FW_OFile*  SOMLINK FW_OFileSink__GetOFileRep(FW_OFileSink *somSelf, Environment *ev)
  69. {
  70. FW_UNUSED(ev);
  71.     FW_OFileSinkData *somThis = FW_OFileSinkGetData(somSelf);
  72.  
  73.     return somThis->fRep;
  74. }
  75.  
  76.  
  77. //----------------------------------------------------------------------------------------
  78. // FW_OFileSink__somInit
  79. //----------------------------------------------------------------------------------------
  80.  
  81. SOM_Scope void  SOMLINK FW_OFileSink__somInit(FW_OFileSink *somSelf)
  82. {
  83.     FW_OFileSinkData *somThis = FW_OFileSinkGetData(somSelf);
  84.  
  85.     FW_OFileSink_parent_FW_ORandomAccessSink_somInit(somSelf);
  86. }
  87.  
  88.  
  89. //----------------------------------------------------------------------------------------
  90. // FW_OFileSink__somUninit
  91. //----------------------------------------------------------------------------------------
  92.  
  93. SOM_Scope void  SOMLINK FW_OFileSink__somUninit(FW_OFileSink *somSelf)
  94. {
  95.     FW_OFileSinkData *somThis = FW_OFileSinkGetData(somSelf);
  96.  
  97.     FW_OFileSink_parent_FW_ORandomAccessSink_somUninit(somSelf);
  98. }
  99.  
  100.  
  101. //----------------------------------------------------------------------------------------
  102. // FW_OFileSink__Read
  103. //----------------------------------------------------------------------------------------
  104.  
  105. SOM_Scope void  SOMLINK FW_OFileSink__Read(FW_OFileSink *somSelf, Environment *ev,
  106.         void* destination,
  107.         long count)
  108. {
  109.     FW_OFileSinkData *somThis = FW_OFileSinkGetData(somSelf);
  110.  
  111.     FW_SOM_TRY
  112.     {
  113.         somThis->fRep->Read(ev, destination, count);
  114.     }
  115.     FW_SOM_CATCH
  116. }
  117.  
  118.  
  119. //----------------------------------------------------------------------------------------
  120. // FW_OFileSink__GetWritableBytes
  121. //----------------------------------------------------------------------------------------
  122.  
  123. SOM_Scope long  SOMLINK FW_OFileSink__GetWritableBytes(FW_OFileSink *somSelf, Environment *ev)
  124. {
  125. FW_UNUSED(ev);
  126.     FW_OFileSinkData *somThis = FW_OFileSinkGetData(somSelf);
  127.  
  128.     return LONG_MAX;
  129. }
  130.  
  131.  
  132. //----------------------------------------------------------------------------------------
  133. // FW_OFileSink__Write
  134. //----------------------------------------------------------------------------------------
  135.  
  136. SOM_Scope void  SOMLINK FW_OFileSink__Write(FW_OFileSink *somSelf, Environment *ev,
  137.         void* source,
  138.         long count)
  139. {
  140.     FW_OFileSinkData *somThis = FW_OFileSinkGetData(somSelf);
  141.  
  142.     FW_SOM_TRY
  143.     {
  144.         somThis->fRep->Write(ev, (void *) source, count);
  145.     }
  146.     FW_SOM_CATCH
  147. }
  148.  
  149.  
  150. //----------------------------------------------------------------------------------------
  151. // FW_OFileSink__GetLength
  152. //----------------------------------------------------------------------------------------
  153.  
  154. SOM_Scope long  SOMLINK FW_OFileSink__GetLength(FW_OFileSink *somSelf, Environment *ev)
  155. {
  156.     FW_OFileSinkData *somThis = FW_OFileSinkGetData(somSelf);
  157.  
  158.     FW_SOM_TRY
  159.     {
  160.         return somThis->fRep->GetLength(ev);
  161.     }
  162.     FW_SOM_CATCH
  163.     return 0;
  164. }
  165.  
  166.  
  167. //----------------------------------------------------------------------------------------
  168. // FW_OFileSink__SetLength
  169. //----------------------------------------------------------------------------------------
  170.  
  171. SOM_Scope void  SOMLINK FW_OFileSink__SetLength(FW_OFileSink *somSelf, Environment *ev,
  172.         long length)
  173. {
  174.     FW_OFileSinkData *somThis = FW_OFileSinkGetData(somSelf);
  175.  
  176.     FW_SOM_TRY
  177.     {
  178.         somThis->fRep->SetLength(ev, length);
  179.     }
  180.     FW_SOM_CATCH
  181. }
  182.  
  183.  
  184. //----------------------------------------------------------------------------------------
  185. // FW_OFileSink__GetPosition
  186. //----------------------------------------------------------------------------------------
  187.  
  188. SOM_Scope long  SOMLINK FW_OFileSink__GetPosition(FW_OFileSink *somSelf, Environment *ev)
  189. {
  190.     FW_OFileSinkData *somThis = FW_OFileSinkGetData(somSelf);
  191.  
  192.     FW_SOM_TRY
  193.     {
  194.         return somThis->fRep->GetPosition(ev);
  195.     }
  196.     FW_SOM_CATCH
  197.     return 0;
  198. }
  199.  
  200.  
  201. //----------------------------------------------------------------------------------------
  202. // FW_OFileSink__SetPosition
  203. //----------------------------------------------------------------------------------------
  204.  
  205. SOM_Scope void  SOMLINK FW_OFileSink__SetPosition(FW_OFileSink *somSelf, Environment *ev,
  206.         long position)
  207. {
  208.     FW_OFileSinkData *somThis = FW_OFileSinkGetData(somSelf);
  209.  
  210.     FW_SOM_TRY
  211.     {
  212.         somThis->fRep->SetPosition(ev, FW_kFromStart, position);
  213.     }
  214.     FW_SOM_CATCH
  215. }
  216.  
  217.  
  218.