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.

86 lines
2.0 KiB

  1. #include <windows.h>
  2. #include "svWrdSnk.h"
  3. #include <mvopsys.h>
  4. #include <common.h>
  5. /*
  6. By not implementing this method we cause DBCS source lengths to be
  7. inaccurate. To solve this problem we need to beffur the result of the
  8. PutAltWord call and actually add the term to the index once we have all
  9. the occurrence data. Specifically, the byte count for cwc.
  10. */
  11. STDMETHODIMP CDefWordSink::PutWord
  12. (WCHAR const *pwcInBuf, ULONG cwc, ULONG cwcSrcLen, ULONG cwcSrcPos)
  13. {
  14. return S_OK;
  15. } // PutWord
  16. STDMETHODIMP CDefWordSink::PutAltWord
  17. (WCHAR const *pwcInBuf, ULONG cwc, ULONG cwcSrcLen, ULONG cwcSrcPos)
  18. {
  19. OCC occ;
  20. occ.dwFieldId = m_dwVFLD;
  21. occ.dwTopicID = m_dwUID;
  22. occ.dwCount = m_dwWordCount++;
  23. // This is a character count and will be wrong for DBCS languages!
  24. occ.wWordLen = (WORD)cwcSrcLen;
  25. occ.dwOffset = cwcSrcPos;
  26. char strTerm[100 + sizeof(WORD)];
  27. if(0 == (*(LPWORD)strTerm = (WORD) WideCharToMultiByte(m_dwCodePage, 0, pwcInBuf, cwc,
  28. strTerm + sizeof(WORD), 99, NULL, NULL)))
  29. {
  30. // The conversion failed! -- very bad
  31. return SetErrReturn(E_UNEXPECTED);
  32. }
  33. return MVIndexAddWord(m_lpipb, (LPB)strTerm, &occ);
  34. } // PutAltWord
  35. STDMETHODIMP CDefWordSink::StartAltPhrase(void)
  36. {
  37. return S_OK;
  38. } // StartAltPhrase
  39. STDMETHODIMP CDefWordSink::EndAltPhrase(void)
  40. {
  41. return S_OK;
  42. } // EndAltPhrase
  43. STDMETHODIMP CDefWordSink::PutBreak(WORDREP_BREAK_TYPE breakType)
  44. {
  45. return S_OK;
  46. } // PutBreak
  47. STDMETHODIMP CDefWordSink::SetIPB(void *lpipb)
  48. {
  49. if(NULL == (m_lpipb = lpipb))
  50. return E_POINTER;
  51. return S_OK;
  52. } // SetIPB
  53. STDMETHODIMP CDefWordSink::SetDocID(DWORD dwUID)
  54. {
  55. if (m_dwUID != dwUID)
  56. {
  57. m_dwUID = dwUID;
  58. m_dwWordCount = 0;
  59. }
  60. return S_OK;
  61. } // SetDocID
  62. STDMETHODIMP CDefWordSink::SetVFLD(DWORD dwVFLD)
  63. {
  64. m_dwVFLD = dwVFLD;
  65. return S_OK;
  66. } // SetVFLD
  67. STDMETHODIMP CDefWordSink::SetLocaleInfo(DWORD dwCodePage, LCID lcid)
  68. {
  69. m_dwCodePage = dwCodePage;
  70. m_lcid = lcid;
  71. return S_OK;
  72. } /* SetLocaleInfo */