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.

156 lines
4.5 KiB

  1. //-----------------------------------------------------------------------------
  2. //
  3. // File: locstr.h
  4. // Copyright (C) 1994-1997 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // Definition of a localizable string. The following classes are defined:
  8. // CLocString - all the operations we can do on a localizable string.
  9. //
  10. //-----------------------------------------------------------------------------
  11. #ifndef LOCSTR_H
  12. #define LOCSTR_H
  13. interface ILocStringValidation;
  14. #pragma warning(disable: 4275) // non dll-interface class 'foo' used
  15. // as base for dll-interface class 'bar'
  16. class LTAPIENTRY CLocString : public CObject
  17. {
  18. public:
  19. NOTHROW CLocString();
  20. void AssertValid(void) const;
  21. //
  22. // Information about the localizable string...
  23. //
  24. NOTHROW BOOL HasHotKey(void) const;
  25. NOTHROW WCHAR GetHotKeyChar(void) const;
  26. NOTHROW UINT GetHotKeyPos(void) const;
  27. NOTHROW const CPascalString & GetNote(void) const;
  28. NOTHROW const CPascalString & GetString(void) const;
  29. NOTHROW int operator==(const CLocString &) const;
  30. NOTHROW int operator!=(const CLocString &) const;
  31. //
  32. // Some useful assigment operators.
  33. //
  34. NOTHROW void SetString(const CPascalString&);
  35. NOTHROW void SetHotKeyChar(WCHAR);
  36. NOTHROW void SetHotKeyPos(UINT);
  37. NOTHROW void ClearHotKey(void);
  38. NOTHROW void SetNote(const CPascalString &);
  39. // Conversion from/to Windows hot key strings
  40. // This is also the format used to display strings in edit mode
  41. NOTHROW int ParseString(const CPascalString & pasStr, WORD langId);
  42. NOTHROW void ComposeString(CPascalString & pasStr, WORD langId) const;
  43. NOTHROW CST::StringType GetStringType(void) const;
  44. NOTHROW CodePageType GetCodePageType(void) const;
  45. NOTHROW void SetStringType(CST::StringType);
  46. NOTHROW void SetCodePageType(CodePageType);
  47. // Conversion from/to displayable string in the resource table.
  48. void GetDisplayLString(CLString &strDest, LangId langId);
  49. void GetDisplayPString(CPascalString &strDest, LangId langId, BOOL bReplaceMetaCharacters);
  50. void GetEditableString(CLString &strDest, LangId langId);
  51. int ParseEditableString(const CLString &strSrc, LangId langId, CString &strErr);
  52. int ParseEscapeChar(BOOL bSetHotkeyPos, CPascalString &strErr);
  53. int ParseAmpersand(LangId langId,BOOL bSetHotkeyPos,CPascalString &strErr);
  54. NOTHROW const CLocString& operator=(const CLocString&);
  55. NOTHROW ~CLocString();
  56. protected:
  57. private:
  58. //
  59. // Private implementation functions.
  60. //
  61. NOTHROW void CopyLocString(const CLocString &);
  62. virtual void Serialize(CArchive &) {}
  63. //
  64. // Prevents the default copy constructor from being called.
  65. //
  66. CLocString(const CLocString&);
  67. CPascalString m_pasBaseString;
  68. CST::StringType m_stStringType;
  69. WCHAR m_wchHotKeyChar;
  70. UINT m_uiHotKeyPos;
  71. CodePageType m_cptCodePageType; // cpAnsi
  72. CPascalString m_pstrNote;
  73. };
  74. class LTAPIENTRY CLocTranslation : public CObject
  75. {
  76. public:
  77. CLocTranslation();
  78. CLocTranslation(const CLocTranslation &);
  79. CLocTranslation(const CLocString &Source, LangId lidSource,
  80. const CLocString &Target, LangId lidTarget);
  81. NOTHROW int operator==(const CLocTranslation &) const;
  82. NOTHROW int operator!=(const CLocTranslation &) const;
  83. void AssertValid(void) const;
  84. NOTHROW void SetTranslation(const CLocString &Source, LangId lidSource,
  85. const CLocString &Target, LangId lidTarget);
  86. NOTHROW void SetNote(const CPascalString &);
  87. NOTHROW void CalculateRanking(const CLocString &);
  88. NOTHROW const CLocString & GetSourceString(void) const;
  89. NOTHROW const CLocString & GetTargetString(void) const;
  90. NOTHROW const CPascalString & GetNote(void) const;
  91. NOTHROW UINT GetRanking(void) const;
  92. NOTHROW LangId GetSourceLanguage(void) const;
  93. NOTHROW LangId GetTargetLanguage(void) const;
  94. NOTHROW CVC::ValidationCode ValidateTranslation(
  95. const CValidationOptions &) const;
  96. NOTHROW CVC::ValidationCode ValidateTranslation(
  97. const CValidationOptions &, BOOL,
  98. const CLString &, CReport *, CGoto *) const;
  99. NOTHROW const CLocTranslation & operator=(const CLocTranslation &);
  100. ~CLocTranslation();
  101. private:
  102. NOTHROW void CopyTranslation(const CLocTranslation &);
  103. NOTHROW void ReordBuildSig(const CLocString &, CPascalString *) const;
  104. NOTHROW void PrintfBuildSig(const CLocString &, CPascalString &) const;
  105. NOTHROW int ReplaceableLength(const CPascalString &, UINT) const;
  106. CLocString m_lsSource;
  107. LangId m_lidSource;
  108. CLocString m_lsTarget;
  109. LangId m_lidTarget;
  110. CPascalString m_pstrGlossaryNote;
  111. UINT m_uiRanking;
  112. };
  113. #pragma warning(default: 4275)
  114. #if !defined(_DEBUG) || defined(IMPLEMENT)
  115. #include "locstr.inl"
  116. #endif
  117. #endif //LOCSTR_H