Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

113 lines
2.5 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1996.
  5. //
  6. // File: dffuncs.hxx
  7. //
  8. // Contents: CDocFile inline functions
  9. // In a separate file to avoid circular dependencies
  10. //
  11. //----------------------------------------------------------------------------
  12. #ifndef __DFFUNCS_HXX__
  13. #define __DFFUNCS_HXX__
  14. #include "ref.hxx"
  15. #include "cdocfile.hxx"
  16. #include "sstream.hxx"
  17. //+--------------------------------------------------------------
  18. //
  19. // Member: CDocFile::CDocFile, public
  20. //
  21. // Synopsis: Empty object ctor
  22. //
  23. // Aguments: [dl] - LUID
  24. // [pdfb] - Basis
  25. //
  26. //---------------------------------------------------------------
  27. inline CDocFile::CDocFile(DFLUID dl, ILockBytes *pilbBase)
  28. : PEntry(dl)
  29. {
  30. _cReferences = 0;
  31. _pilbBase = pilbBase;
  32. }
  33. //+--------------------------------------------------------------
  34. //
  35. // Member: CDocFile::CDocFile, public
  36. //
  37. // Synopsis: Handle-setting construction
  38. //
  39. // Arguments: [pms] - MultiStream to use
  40. // [sid] - SID to use
  41. // [dl] - LUID
  42. // [pdfb] - Basis
  43. //
  44. //---------------------------------------------------------------
  45. inline CDocFile::CDocFile(CMStream *pms,
  46. SID sid,
  47. DFLUID dl,
  48. ILockBytes *pilbBase)
  49. : PEntry(dl)
  50. {
  51. _stgh.Init(pms, sid);
  52. _cReferences = 0;
  53. _pilbBase = pilbBase;
  54. }
  55. //+--------------------------------------------------------------
  56. //
  57. // Member: CDocFile::~CDocFile, public
  58. //
  59. // Synopsis: Destructor
  60. //
  61. //---------------------------------------------------------------
  62. inline CDocFile::~CDocFile(void)
  63. {
  64. olAssert(_cReferences == 0);
  65. if (_stgh.IsValid())
  66. {
  67. if (_stgh.IsRoot())
  68. DllReleaseMultiStream(_stgh.GetMS());
  69. }
  70. }
  71. //+--------------------------------------------------------------
  72. //
  73. // Member: CDocFile::GetHandle, public
  74. //
  75. // Synopsis: Returns the handle
  76. //
  77. //---------------------------------------------------------------
  78. inline CStgHandle *CDocFile::GetHandle(void)
  79. {
  80. return &_stgh;
  81. }
  82. //+---------------------------------------------------------------------------
  83. //
  84. // Member: CDocFile::DecRef, public
  85. //
  86. // Synopsis: Decrements the ref count
  87. //
  88. //----------------------------------------------------------------------------
  89. inline void CDocFile::DecRef(void)
  90. {
  91. AtomicDec(&_cReferences);
  92. }
  93. #endif // #ifndef __DFFUNCS_HXX__