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.

249 lines
3.3 KiB

  1. //-----------------------------------------------------------------------------
  2. //
  3. // File: clstring.inl
  4. // Copyright (C) 1994-1997 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. //
  8. //
  9. //-----------------------------------------------------------------------------
  10. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  11. //
  12. // All these methods re-direct to the CString methods.
  13. //
  14. //-----------------------------------------------------------------------------
  15. inline
  16. CLString::CLString()
  17. :
  18. CString()
  19. {
  20. DEBUGONLY(++m_UsageCounter);
  21. }
  22. inline
  23. CLString::CLString(
  24. const CLString &stringSrc)
  25. :
  26. CString(stringSrc)
  27. {
  28. DEBUGONLY(++m_UsageCounter);
  29. }
  30. inline
  31. CLString::CLString(
  32. TCHAR ch,
  33. int nRepeat)
  34. :
  35. CString(ch, nRepeat)
  36. {
  37. DEBUGONLY(++m_UsageCounter);
  38. }
  39. inline
  40. CLString::CLString(
  41. LPCSTR lpsz)
  42. :
  43. CString(lpsz)
  44. {
  45. DEBUGONLY(++m_UsageCounter);
  46. }
  47. inline
  48. CLString::CLString(
  49. LPCTSTR lpch,
  50. int nLength)
  51. :
  52. CString(lpch, nLength)
  53. {
  54. DEBUGONLY(++m_UsageCounter);
  55. }
  56. inline
  57. CLString::CLString(
  58. const unsigned char * psz)
  59. :
  60. CString(psz)
  61. {
  62. DEBUGONLY(++m_UsageCounter);
  63. }
  64. inline
  65. CLString::CLString(
  66. HINSTANCE hDll,
  67. UINT uiStringID)
  68. {
  69. LTVERIFY(LoadString(hDll, uiStringID));
  70. DEBUGONLY(++m_UsageCounter);
  71. }
  72. inline
  73. const CLString &
  74. CLString::operator=(
  75. const CString& stringSrc)
  76. {
  77. CString::operator=(stringSrc);
  78. return *this;
  79. }
  80. inline
  81. const CLString &
  82. CLString::operator=(
  83. TCHAR ch)
  84. {
  85. CString::operator=(ch);
  86. return *this;
  87. }
  88. #ifdef _UNICODE
  89. inline
  90. const CLString &
  91. CLString::operator=(
  92. char ch)
  93. {
  94. CString::operator=(ch);
  95. return *this;
  96. }
  97. #endif // _UNICODE
  98. inline
  99. const CLString &
  100. CLString::operator=(
  101. LPCSTR lpsz)
  102. {
  103. CString::operator=(lpsz);
  104. return *this;
  105. }
  106. inline
  107. const CLString &
  108. CLString::operator=(
  109. const unsigned char * psz)
  110. {
  111. CString::operator=(psz);
  112. return *this;
  113. }
  114. inline
  115. const CLString &
  116. CLString::operator+=(
  117. const CString & string)
  118. {
  119. CString::operator+=(string);
  120. return *this;
  121. }
  122. inline
  123. const CLString &
  124. CLString::operator+=(
  125. TCHAR ch)
  126. {
  127. CString::operator+=(ch);
  128. return *this;
  129. }
  130. #ifdef _UNICODE
  131. inline
  132. const CLString &
  133. CLString::operator+=(
  134. char ch)
  135. {
  136. CString::operator+=(ch);
  137. return *this;
  138. }
  139. #endif // _UNICODE
  140. inline
  141. const CLString &
  142. CLString::operator+=(
  143. LPCTSTR lpsz)
  144. {
  145. CString::operator+=(lpsz);
  146. return *this;
  147. }
  148. inline
  149. CLString
  150. CLString::operator+(
  151. const CString &str)
  152. const
  153. {
  154. return CLString(*this)+=str;
  155. }
  156. inline
  157. CLString
  158. CLString::operator+(
  159. const TCHAR *sz)
  160. const
  161. {
  162. return CLString(*this)+=sz;
  163. }
  164. inline
  165. void
  166. CLString::Format(
  167. LPCTSTR lpszFormat, ...)
  168. {
  169. //
  170. // This stolen from CString::Format()
  171. //
  172. va_list argList;
  173. va_start(argList, lpszFormat);
  174. FormatV(lpszFormat, argList);
  175. va_end(argList);
  176. }
  177. inline
  178. void
  179. CLString::Format(
  180. HMODULE hResourceModule,
  181. UINT nFormatID, ...)
  182. {
  183. CLString strFormat;
  184. LTVERIFY(strFormat.LoadString(hResourceModule, nFormatID) != 0);
  185. va_list argList;
  186. va_start(argList, nFormatID);
  187. FormatV(strFormat, argList);
  188. va_end(argList);
  189. }
  190. #ifdef _DEBUG
  191. inline
  192. CLString::~CLString()
  193. {
  194. DEBUGONLY(--m_UsageCounter);
  195. }
  196. #endif