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.

144 lines
3.5 KiB

  1. //+--------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1991 - 1992.
  5. //
  6. // File: iter.cxx
  7. //
  8. // Contents: CDocFileIterator implementation
  9. //
  10. //---------------------------------------------------------------
  11. #include "dfhead.cxx"
  12. #include "h/msfiter.hxx"
  13. #include "iter.hxx"
  14. //+--------------------------------------------------------------
  15. //
  16. // Member: CDocFileIterator::CDocFileIterator, public
  17. //
  18. // Synopsis: Empty object ctor
  19. //
  20. //---------------------------------------------------------------
  21. CDocFileIterator::CDocFileIterator(void)
  22. {
  23. olDebugOut((DEB_ITRACE, "In CDocFileIterator::CDocFileIterator()\n"));
  24. _pi = NULL;
  25. olDebugOut((DEB_ITRACE, "Out CDocFileIterator::CDocFileIterator\n"));
  26. }
  27. //+--------------------------------------------------------------
  28. //
  29. // Member: CDocFileIterator::Init
  30. //
  31. // Synopsis: Constructor
  32. //
  33. // Arguments: [ph] - Multistream handle
  34. //
  35. // Returns: Appropriate status code
  36. //
  37. //---------------------------------------------------------------
  38. SCODE CDocFileIterator::Init(CStgHandle *ph)
  39. {
  40. SCODE sc;
  41. olDebugOut((DEB_ITRACE, "In CDocFileIterator::Init(%p)\n", ph));
  42. if (FAILED(sc = ph->GetIterator(&_pi)))
  43. _pi = NULL;
  44. olDebugOut((DEB_ITRACE, "Out CDocFileIterator::Init\n"));
  45. return sc;
  46. }
  47. //+--------------------------------------------------------------
  48. //
  49. // Member: CDocFileIterator::~CDocFileIterator
  50. //
  51. // Synopsis: Destructor
  52. //
  53. //---------------------------------------------------------------
  54. CDocFileIterator::~CDocFileIterator(void)
  55. {
  56. olDebugOut((DEB_ITRACE, "In CDocFileIterator::~CDocFileIterator\n"));
  57. if (_pi)
  58. _pi->Release();
  59. olDebugOut((DEB_ITRACE, "Out CDocFileIterator::~CDocFileIterator\n"));
  60. }
  61. //+--------------------------------------------------------------
  62. //
  63. // Member: CDocFileIterator::GetNext
  64. //
  65. // Synopsis: Get the next entry
  66. //
  67. // Arguments: [pstatstg] - Buffer to return information in
  68. //
  69. // Returns: Appropriate status code
  70. //
  71. // Modifies: [pstatstg]
  72. //
  73. //---------------------------------------------------------------
  74. SCODE CDocFileIterator::GetNext(STATSTGW *pstatstg)
  75. {
  76. SCODE sc;
  77. olDebugOut((DEB_ITRACE, "In CDocFileIterator::GetNext(%p)\n", pstatstg));
  78. if (FAILED(sc = _pi->GetNext(pstatstg)))
  79. {
  80. #if DEVL == 1
  81. // Null the name to clean up some debug prints
  82. pstatstg->pwcsName = NULL;
  83. #endif
  84. }
  85. olDebugOut((DEB_ITRACE, "Out CDocFileIterator::GetNext => %ws, %ld\n",
  86. pstatstg->pwcsName, pstatstg->type));
  87. return sc;
  88. }
  89. //+--------------------------------------------------------------
  90. //
  91. // Member: CDocFileIterator::BufferGetNext, public
  92. //
  93. // Synopsis: Fast, fixed-space version of GetNext
  94. //
  95. // Arguments: [pib] - Buffer to fill in
  96. //
  97. // Returns: Appropriate status code
  98. //
  99. // Modifies: [pib]
  100. //
  101. //---------------------------------------------------------------
  102. SCODE CDocFileIterator::BufferGetNext(SIterBuffer *pib)
  103. {
  104. return _pi->BufferGetNext(pib);
  105. }
  106. //+--------------------------------------------------------------
  107. //
  108. // Member: CDocFileIterator::Release, public
  109. //
  110. // Synopsis: Releases resources for an iterator
  111. //
  112. // Returns: Appropriate status code
  113. //
  114. //---------------------------------------------------------------
  115. void CDocFileIterator::Release(void)
  116. {
  117. olDebugOut((DEB_ITRACE, "In CDocFileIterator::Release()\n"));
  118. delete this;
  119. olDebugOut((DEB_ITRACE, "Out CDocFileIterator::Release\n"));
  120. }