Source code of Windows XP (NT5)
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.

118 lines
3.0 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1998.
  5. //
  6. // File: bmkmap.cxx
  7. //
  8. // Contents: Book Mark Map Implementation
  9. //
  10. // Classes: CBookMarkMap
  11. //
  12. // Functions:
  13. //
  14. // History: 11-22-94 srikants Created
  15. //
  16. //----------------------------------------------------------------------------
  17. #include "pch.cxx"
  18. #pragma hdrstop
  19. #include <pidmap.hxx>
  20. #include "bmkmap.hxx"
  21. #include "rowindex.hxx"
  22. //+---------------------------------------------------------------------------
  23. //
  24. // Function: AddBookMark
  25. //
  26. // Synopsis: Adds a NEW book mark to the mapping.
  27. //
  28. // Arguments: [wid] -- WorkId to be added.
  29. // [oTableRow] -- Offset of the in the table window for this
  30. // bookmark.
  31. //
  32. // History: 11-23-94 srikants Created
  33. //
  34. // Notes:
  35. //
  36. //----------------------------------------------------------------------------
  37. void CBookMarkMap::AddBookMark( WORKID wid, TBL_OFF oTableRow )
  38. {
  39. Win4Assert( widInvalid != wid );
  40. CWidBmkHashEntry entry( wid, oTableRow );
  41. _widHash.AddEntry( entry );
  42. }
  43. //+---------------------------------------------------------------------------
  44. //
  45. // Function: AddReplaceBookMark
  46. //
  47. // Synopsis: Adds a NEW book mark to the mapping or replaces one if
  48. // already present.
  49. //
  50. // Arguments: [wid] -- WorkId to be added.
  51. // [oTableRow] -- Offset of the in the table window for this
  52. // bookmark.
  53. //
  54. // History: 11-30-94 srikants Created
  55. //
  56. // Notes:
  57. //
  58. //----------------------------------------------------------------------------
  59. void CBookMarkMap::AddReplaceBookMark( WORKID wid, TBL_OFF oTableRow )
  60. {
  61. Win4Assert( widInvalid != wid );
  62. CWidBmkHashEntry entry( wid, oTableRow );
  63. _widHash.ReplaceOrAddEntry( entry );
  64. }
  65. //+---------------------------------------------------------------------------
  66. //
  67. // Function: FindBookMark
  68. //
  69. // Synopsis: Locates the requested bookmark mapping.
  70. //
  71. // Arguments: [wid] -- WorkId to locate.
  72. // [obTableRow] -- (Output) Offset of the table row in the
  73. // window.
  74. // [iRowIndex] -- (Output) Index in the sorted permutation
  75. // (RowIndex) of the entry.
  76. //
  77. // Returns: TRUE if found; FALSE o/w
  78. //
  79. // History: 11-23-94 srikants Created
  80. //
  81. // Notes:
  82. //
  83. //----------------------------------------------------------------------------
  84. BOOL CBookMarkMap::FindBookMark(
  85. WORKID wid,
  86. TBL_OFF & obTableRow,
  87. ULONG & iRowIndex )
  88. {
  89. CWidBmkHashEntry entry( wid );
  90. BOOL fHash = _widHash.LookUpWorkId( entry );
  91. if ( !fHash )
  92. {
  93. return FALSE;
  94. }
  95. obTableRow = entry.Value();
  96. //
  97. // It has been located in the hash table. Now find out the corresponding
  98. // entry in the row index.
  99. //
  100. return _rowIndex.FindRow( obTableRow, iRowIndex );
  101. }