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.

160 lines
4.5 KiB

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