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.

90 lines
2.3 KiB

  1. #ifndef __TOKEN_H__
  2. #define __TOKEN_H__
  3. #include <afx.h>
  4. class CToken: public CObject
  5. {
  6. friend class CTokenFile;
  7. public:
  8. // Constructor
  9. CToken();
  10. int Parse(CString strSrc, CString strTgt);
  11. CString GetTgtText()
  12. { return m_strTgtText; }
  13. CString GetSrcText()
  14. { return m_strSrcText; }
  15. unsigned int GetFlags()
  16. { return m_uiFlags; }
  17. BOOL GetTgtSize(WORD *, WORD *, WORD *, WORD *);
  18. BOOL GetSrcSize(WORD *, WORD *, WORD *, WORD *);
  19. int GetLastError()
  20. { return m_uiLastError; }
  21. CString GetTokenID()
  22. { return m_strTokenID; }
  23. protected:
  24. unsigned int m_uiTypeID;
  25. unsigned int m_uiResID;
  26. unsigned int m_uiItemID;
  27. unsigned int m_uiFlags;
  28. unsigned int m_uiStatusFlags;
  29. unsigned int m_uiLastError;
  30. CString m_strItemName;
  31. CString m_strSrcText;
  32. CString m_strTgtText;
  33. CString m_strTokenID;
  34. };
  35. class CTokenFile
  36. {
  37. public:
  38. CTokenFile();
  39. ~CTokenFile();
  40. // Operators
  41. int Open(CString strSrcFile, CString strTgtFile);
  42. const CToken * GetToken(unsigned int TypeID,
  43. unsigned int ResID,
  44. unsigned int ItemID,
  45. CString strText,
  46. CString strItemName = "");
  47. const CToken * GetNoCaptionToken(unsigned int TypeID,
  48. unsigned int ResID,
  49. unsigned int ItemID,
  50. CString strItemName = "");
  51. // Overload GetTokenSize since some item have no text but change in size
  52. const CToken * GetTokenSize(CToken * pToken, WORD * px, WORD * py,
  53. WORD * pcx, WORD * pcy);
  54. const CToken * CTokenFile::GetTokenSize(unsigned int TypeID,
  55. unsigned int ResID,
  56. unsigned int ItemID,
  57. CString strItemName,
  58. WORD * px, WORD * py,
  59. WORD * pcx, WORD * pcy);
  60. int GetTokenNumber()
  61. { return (int)m_Tokens.GetSize(); }
  62. private:
  63. CObArray m_Tokens;
  64. INT_PTR m_iLastPos;
  65. INT_PTR m_iUpperBound;
  66. CString m_strSrcFile;
  67. CString m_strTgtFile;
  68. };
  69. #endif // __TOKEN_H__