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.

63 lines
1.6 KiB

  1. // MLSWalk.h : Declaration of the CMLStrWalkW and CMLStrWalkA
  2. #ifndef __MLSWALK_H_
  3. #define __MLSWALK_H_
  4. /////////////////////////////////////////////////////////////////////////////
  5. // CMLStrWalkW
  6. class CMLStrWalkW
  7. {
  8. public:
  9. inline CMLStrWalkW(IMLangStringWStr* pMLStrW, long lPos, long lLen, long lFlags = MLSTR_READ, BOOL fCanStopAtMiddle = FALSE);
  10. BOOL Lock(HRESULT& rhr);
  11. void Unlock(HRESULT& rhr, long lActualLen = 0);
  12. inline WCHAR* GetStr(void);
  13. inline long GetCCh(void) const;
  14. long GetPos(void) const {return m_lPos + m_lDoneLen;}
  15. long GetLen(void) const {return m_lLen - m_lDoneLen;}
  16. long GetDoneLen(void) const {return m_lDoneLen;}
  17. protected:
  18. IMLangStringWStr* m_pMLStr;
  19. BOOL m_fCanStopAtMiddle;
  20. long m_lPos;
  21. long m_lLen;
  22. long m_lFlags;
  23. long m_lDoneLen;
  24. WCHAR* m_pszBuf;
  25. long m_cchBuf;
  26. long m_lLockLen;
  27. };
  28. /////////////////////////////////////////////////////////////////////////////
  29. // CMLStrWalkW inline functions
  30. CMLStrWalkW::CMLStrWalkW(IMLangStringWStr* pMLStr, long lPos, long lLen, long lFlags, BOOL fCanStopAtMiddle) :
  31. m_pMLStr(pMLStr),
  32. m_fCanStopAtMiddle(fCanStopAtMiddle)
  33. {
  34. m_lPos = lPos;
  35. m_lLen = lLen;
  36. m_lFlags = lFlags;
  37. m_lDoneLen = 0;
  38. m_pszBuf = NULL; // Mark as it's not locked
  39. }
  40. WCHAR* CMLStrWalkW::GetStr(void)
  41. {
  42. ASSERT(m_pszBuf); // Not locked
  43. return m_pszBuf;
  44. }
  45. long CMLStrWalkW::GetCCh(void) const
  46. {
  47. ASSERT(m_pszBuf); // Not locked
  48. if (m_pszBuf)
  49. return m_cchBuf;
  50. else
  51. return 0;
  52. }
  53. #endif //__MLSWALK_H_