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.

96 lines
1.8 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 1996 - 1999
  3. Module Name:
  4. unicodes
  5. Abstract:
  6. This header file describes the CUnicodeString class, useful for converting
  7. string types.
  8. Author:
  9. Doug Barlow (dbarlow) 11/6/1997
  10. Environment:
  11. Win32, C++
  12. Notes:
  13. ?Notes?
  14. --*/
  15. #ifndef _UNICODES_H_
  16. #define _UNICODES_H_
  17. //
  18. //==============================================================================
  19. //
  20. // CUnicodeString
  21. //
  22. class CUnicodeString
  23. {
  24. public:
  25. // Constructors & Destructor
  26. CUnicodeString(void);
  27. CUnicodeString(LPCSTR sz);
  28. CUnicodeString(LPCWSTR wsz);
  29. CUnicodeString(PUNICODE_STRING pus);
  30. ~CUnicodeString();
  31. // Properties
  32. // Methods
  33. LPCSTR Set(LPCSTR sz);
  34. LPCWSTR Set(LPCWSTR wsz);
  35. PUNICODE_STRING Set(PUNICODE_STRING pus);
  36. BOOL Valid(void)
  37. {
  38. if (m_fFlags == fNoneGood)
  39. {
  40. return(FALSE);
  41. }
  42. else
  43. {
  44. return(TRUE);
  45. }
  46. }
  47. // Operators
  48. LPCSTR operator=(LPCSTR sz)
  49. { return Set(sz); };
  50. LPCWSTR operator=(LPCWSTR wsz)
  51. { return Set(wsz); };
  52. PUNICODE_STRING operator=(PUNICODE_STRING pus)
  53. { return Set(pus);};
  54. operator LPCSTR(void)
  55. { return Ansi(); };
  56. operator LPCWSTR(void)
  57. { return Unicode(); };
  58. operator PUNICODE_STRING(void);
  59. protected:
  60. // Properties
  61. UNICODE_STRING m_us;
  62. LPSTR m_szAnsi;
  63. LPWSTR m_wszUnicode;
  64. enum {
  65. fNoneGood = 0,
  66. fAnsiGood = 1,
  67. fUnicodeGood = 2,
  68. fBothGood = 3
  69. } m_fFlags;
  70. // Methods
  71. LPCWSTR Unicode(void); // Return the text as a Unicode string.
  72. LPCSTR Ansi(void); // Return the text as an Ansi string.
  73. };
  74. #endif // _UNICODES_H_