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.

106 lines
1.8 KiB

  1. /*++
  2. Copyright (c) 1985 - 1999, Microsoft Corporation
  3. Module Name:
  4. cime.h
  5. Abstract:
  6. This file defines the IMCLock / IMCCLock Class.
  7. Author:
  8. Revision History:
  9. Notes:
  10. --*/
  11. #ifndef CIME_H
  12. #define CIME_H
  13. #include "idebug.h"
  14. #include "template.h"
  15. class CAImeContext;
  16. #define _ENABLE_CAIME_CONTEXT_
  17. #include "imclock.h"
  18. const int MAXCAND = 256;
  19. const int CANDPERPAGE = 9;
  20. class IMCLock : public _IMCLock
  21. {
  22. public:
  23. IMCLock(HIMC hImc=NULL);
  24. virtual ~IMCLock() {
  25. if (m_inputcontext) {
  26. _UnlockIMC(m_himc);
  27. }
  28. }
  29. // virtual InternalIMCCLock
  30. HRESULT _LockIMC(HIMC hIMC, INPUTCONTEXT_AIMM12** ppIMC);
  31. HRESULT _UnlockIMC(HIMC hIMC);
  32. void InitContext();
  33. BOOL ClearCand();
  34. void GenerateMessage();
  35. BOOL ValidCompositionString();
  36. private:
  37. // Do not allow to make a copy
  38. IMCLock(IMCLock&) { }
  39. };
  40. class InternalIMCCLock : public _IMCCLock
  41. {
  42. public:
  43. InternalIMCCLock(HIMCC hImcc = NULL);
  44. virtual ~InternalIMCCLock() {
  45. if (m_pimcc) {
  46. _UnlockIMCC(m_himcc);
  47. }
  48. }
  49. // virtual InternalIMCCLock
  50. HRESULT _LockIMCC(HIMCC hIMCC, void** ppv);
  51. HRESULT _UnlockIMCC(HIMCC hIMCC);
  52. private:
  53. // Do not allow to make a copy
  54. InternalIMCCLock(InternalIMCCLock&) { }
  55. };
  56. template <class T>
  57. class IMCCLock : public InternalIMCCLock
  58. {
  59. public:
  60. IMCCLock(HIMCC hImcc) : InternalIMCCLock(hImcc) {};
  61. T* GetBuffer() { return (T*)m_pimcc; }
  62. operator T*() { return (T*)m_pimcc; }
  63. T* operator->() {
  64. ASSERT(m_pimcc);
  65. return (T*)m_pimcc;
  66. }
  67. private:
  68. // Do not allow to make a copy
  69. IMCCLock(IMCCLock<T>&) { }
  70. };
  71. #endif // CIME_H