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.

445 lines
11 KiB

  1. /*--------------------------------------------------------------------------*
  2. *
  3. * Microsoft Windows
  4. * Copyright (C) Microsoft Corporation, 1992 - 1999
  5. *
  6. * File: tstring.inl
  7. *
  8. * Contents: Inline implementation file for tstring
  9. *
  10. * History: 04-Oct-99 jeffro Created
  11. *
  12. *--------------------------------------------------------------------------*/
  13. #ifndef TSTRING_INL
  14. #define TSTRING_INL
  15. #pragma once
  16. /*+-------------------------------------------------------------------------*
  17. * tstring::tstring
  18. *
  19. * Simple wrappers that forward the heavy lifting to the base class.
  20. *--------------------------------------------------------------------------*/
  21. inline tstring::tstring (const allocator_type& al) :
  22. BaseClass (al)
  23. {}
  24. inline tstring::tstring (const tstring& other) :
  25. BaseClass (other)
  26. {}
  27. inline tstring::tstring (const BaseClass& other) :
  28. BaseClass (other)
  29. {}
  30. inline tstring::tstring (const tstring& other, size_type pos, size_type n) :
  31. BaseClass (other, pos, n)
  32. {}
  33. inline tstring::tstring (const BaseClass& other, size_type pos, size_type n) :
  34. BaseClass (other, pos, n)
  35. {}
  36. inline tstring::tstring (const TCHAR* psz) :
  37. BaseClass (psz)
  38. {}
  39. inline tstring::tstring (const TCHAR* psz, size_type n) :
  40. BaseClass (psz, n)
  41. {}
  42. inline tstring::tstring (size_type n, TCHAR ch) :
  43. BaseClass (n, ch)
  44. {}
  45. inline tstring::tstring (const_iterator first, const_iterator last) :
  46. BaseClass (first, last)
  47. {}
  48. /*+-------------------------------------------------------------------------*
  49. * tstring::operator=
  50. *
  51. * Simple wrappers that forward the heavy lifting to the base class.
  52. *--------------------------------------------------------------------------*/
  53. inline tstring& tstring::operator= (const tstring& other)
  54. {
  55. if (this != &other)
  56. erase(); // see KB Q172398
  57. BaseClass::operator= (other);
  58. return (*this);
  59. }
  60. inline tstring& tstring::operator= (const BaseClass& other)
  61. {
  62. if (data() != other.data())
  63. erase(); // see KB Q172398
  64. BaseClass::operator= (other);
  65. return (*this);
  66. }
  67. inline tstring& tstring::operator= (TCHAR ch)
  68. {
  69. erase(); // see KB Q172398
  70. BaseClass::operator= (ch);
  71. return (*this);
  72. }
  73. inline tstring& tstring::operator= (const TCHAR* psz)
  74. {
  75. if (!IsPartOfString (*this, psz))
  76. erase(); // see KB Q172398
  77. BaseClass::operator= (psz);
  78. return (*this);
  79. }
  80. /*+-------------------------------------------------------------------------*
  81. * tstring::operator+=
  82. *
  83. * Simple wrappers that forward the heavy lifting to the base class.
  84. *--------------------------------------------------------------------------*/
  85. inline tstring& tstring::operator+= (const tstring& strToAppend)
  86. {
  87. BaseClass::operator+= (strToAppend);
  88. return (*this);
  89. }
  90. inline tstring& tstring::operator+= (const BaseClass& strToAppend)
  91. {
  92. BaseClass::operator+= (strToAppend);
  93. return (*this);
  94. }
  95. inline tstring& tstring::operator+= (TCHAR chToAppend)
  96. {
  97. BaseClass::operator+= (chToAppend);
  98. return (*this);
  99. }
  100. inline tstring& tstring::operator+= (const TCHAR* pszToAppend)
  101. {
  102. BaseClass::operator+= (pszToAppend);
  103. return (*this);
  104. }
  105. /*+-------------------------------------------------------------------------*
  106. * tstring::append
  107. *
  108. * Simple wrappers that forward the heavy lifting to the base class.
  109. *--------------------------------------------------------------------------*/
  110. inline tstring& tstring::append (const tstring& str)
  111. {
  112. BaseClass::append (str);
  113. return (*this);
  114. }
  115. inline tstring& tstring::append (const BaseClass& str)
  116. {
  117. BaseClass::append (str);
  118. return (*this);
  119. }
  120. inline tstring& tstring::append (const tstring& str, size_type pos, size_type n)
  121. {
  122. BaseClass::append (str, pos, n);
  123. return (*this);
  124. }
  125. inline tstring& tstring::append (const BaseClass& str, size_type pos, size_type n)
  126. {
  127. BaseClass::append (str, pos, n);
  128. return (*this);
  129. }
  130. inline tstring& tstring::append (const TCHAR* psz)
  131. {
  132. BaseClass::append (psz);
  133. return (*this);
  134. }
  135. inline tstring& tstring::append (const TCHAR* psz, size_type n)
  136. {
  137. BaseClass::append (psz, n);
  138. return (*this);
  139. }
  140. inline tstring& tstring::append (size_type n, TCHAR ch)
  141. {
  142. BaseClass::append (n, ch);
  143. return (*this);
  144. }
  145. inline tstring& tstring::append (const_iterator first, const_iterator last)
  146. {
  147. BaseClass::append (first, last);
  148. return (*this);
  149. }
  150. /*+-------------------------------------------------------------------------*
  151. * tstring::assign
  152. *
  153. * Simple wrappers that forward the heavy lifting to the base class.
  154. *--------------------------------------------------------------------------*/
  155. inline tstring& tstring::assign (const tstring& str)
  156. {
  157. if (this != &str)
  158. erase(); // see KB Q172398
  159. BaseClass::assign (str);
  160. return (*this);
  161. }
  162. inline tstring& tstring::assign (const BaseClass& str)
  163. {
  164. if (data() != str.data())
  165. erase(); // see KB Q172398
  166. BaseClass::assign (str);
  167. return (*this);
  168. }
  169. inline tstring& tstring::assign (const tstring& str, size_type pos, size_type n)
  170. {
  171. if (this != &str)
  172. erase(); // see KB Q172398
  173. BaseClass::assign (str, pos, n);
  174. return (*this);
  175. }
  176. inline tstring& tstring::assign (const BaseClass& str, size_type pos, size_type n)
  177. {
  178. if (data() != str.data())
  179. erase(); // see KB Q172398
  180. BaseClass::assign (str, pos, n);
  181. return (*this);
  182. }
  183. inline tstring& tstring::assign (const TCHAR* psz)
  184. {
  185. if (!IsPartOfString (*this, psz))
  186. erase(); // see KB Q172398
  187. BaseClass::assign (psz);
  188. return (*this);
  189. }
  190. inline tstring& tstring::assign (const TCHAR* psz, size_type n)
  191. {
  192. if (!IsPartOfString (*this, psz))
  193. erase(); // see KB Q172398
  194. BaseClass::assign (psz, n);
  195. return (*this);
  196. }
  197. inline tstring& tstring::assign (size_type n, TCHAR ch)
  198. {
  199. erase(); // see KB Q172398
  200. BaseClass::assign (n, ch);
  201. return (*this);
  202. }
  203. inline tstring& tstring::assign (const_iterator first, const_iterator last)
  204. {
  205. if (!IsPartOfString (*this, first))
  206. erase(); // see KB Q172398
  207. BaseClass::assign (first, last);
  208. return (*this);
  209. }
  210. /*+-------------------------------------------------------------------------*
  211. * tstring::insert
  212. *
  213. * Simple wrappers that forward the heavy lifting to the base class.
  214. *--------------------------------------------------------------------------*/
  215. inline tstring& tstring::insert (size_type p0, const tstring& str)
  216. {
  217. BaseClass::insert (p0, str);
  218. return (*this);
  219. }
  220. inline tstring& tstring::insert (size_type p0, const BaseClass& str)
  221. {
  222. BaseClass::insert (p0, str);
  223. return (*this);
  224. }
  225. inline tstring& tstring::insert (size_type p0, const tstring& str, size_type pos, size_type n)
  226. {
  227. BaseClass::insert (p0, str, pos, n);
  228. return (*this);
  229. }
  230. inline tstring& tstring::insert (size_type p0, const BaseClass& str, size_type pos, size_type n)
  231. {
  232. BaseClass::insert (p0, str, pos, n);
  233. return (*this);
  234. }
  235. inline tstring& tstring::insert (size_type p0, const TCHAR* psz, size_type n)
  236. {
  237. BaseClass::insert (p0, psz, n);
  238. return (*this);
  239. }
  240. inline tstring& tstring::insert (size_type p0, const TCHAR* psz)
  241. {
  242. BaseClass::insert (p0, psz);
  243. return (*this);
  244. }
  245. inline tstring& tstring::insert (size_type p0, size_type n, TCHAR ch)
  246. {
  247. BaseClass::insert (p0, n, ch);
  248. return (*this);
  249. }
  250. inline void tstring::insert (iterator it, size_type n, TCHAR ch)
  251. {
  252. BaseClass::insert (it, n, ch);
  253. }
  254. inline void tstring::insert (iterator it, const_iterator first, const_iterator last)
  255. {
  256. BaseClass::insert (it, first, last);
  257. }
  258. /*+-------------------------------------------------------------------------*
  259. * tstring::erase
  260. *
  261. * Simple wrapper that forwards the heavy lifting to the base class.
  262. *--------------------------------------------------------------------------*/
  263. inline tstring& tstring::erase (size_type p0, size_type n)
  264. {
  265. BaseClass::erase (p0, n);
  266. return (*this);
  267. }
  268. inline tstring::iterator tstring::erase (iterator it)
  269. {
  270. return (BaseClass::erase (it));
  271. }
  272. inline tstring::iterator tstring::erase (iterator first, iterator last)
  273. {
  274. return (BaseClass::erase (first, last));
  275. }
  276. /*+-------------------------------------------------------------------------*
  277. * tstring::replace
  278. *
  279. * Simple wrappers that forward the heavy lifting to the base class.
  280. *--------------------------------------------------------------------------*/
  281. inline tstring& tstring::replace (size_type p0, size_type n0, const tstring& str)
  282. {
  283. BaseClass::replace (p0, n0, str);
  284. return (*this);
  285. }
  286. inline tstring& tstring::replace (size_type p0, size_type n0, const BaseClass& str)
  287. {
  288. BaseClass::replace (p0, n0, str);
  289. return (*this);
  290. }
  291. inline tstring& tstring::replace (size_type p0, size_type n0, const tstring& str, size_type pos, size_type n)
  292. {
  293. BaseClass::replace (p0, n0, str, pos, n);
  294. return (*this);
  295. }
  296. inline tstring& tstring::replace (size_type p0, size_type n0, const BaseClass& str, size_type pos, size_type n)
  297. {
  298. BaseClass::replace (p0, n0, str, pos, n);
  299. return (*this);
  300. }
  301. inline tstring& tstring::replace (size_type p0, size_type n0, const TCHAR* psz, size_type n)
  302. {
  303. BaseClass::replace (p0, n0, psz, n);
  304. return (*this);
  305. }
  306. inline tstring& tstring::replace (size_type p0, size_type n0, const TCHAR* psz)
  307. {
  308. BaseClass::replace (p0, n0, psz);
  309. return (*this);
  310. }
  311. inline tstring& tstring::replace (size_type p0, size_type n0, size_type n, TCHAR ch)
  312. {
  313. BaseClass::replace (p0, n0, n, ch);
  314. return (*this);
  315. }
  316. inline tstring& tstring::replace (iterator first0, iterator last0, const tstring& str)
  317. {
  318. BaseClass::replace (first0, last0, str);
  319. return (*this);
  320. }
  321. inline tstring& tstring::replace (iterator first0, iterator last0, const BaseClass& str)
  322. {
  323. BaseClass::replace (first0, last0, str);
  324. return (*this);
  325. }
  326. inline tstring& tstring::replace (iterator first0, iterator last0, const TCHAR* psz, size_type n)
  327. {
  328. BaseClass::replace (first0, last0, psz, n);
  329. return (*this);
  330. }
  331. inline tstring& tstring::replace (iterator first0, iterator last0, const TCHAR* psz)
  332. {
  333. BaseClass::replace (first0, last0, psz);
  334. return (*this);
  335. }
  336. inline tstring& tstring::replace (iterator first0, iterator last0, size_type n, TCHAR ch)
  337. {
  338. BaseClass::replace (first0, last0, n, ch);
  339. return (*this);
  340. }
  341. inline tstring& tstring::replace (iterator first0, iterator last0, const_iterator first, const_iterator last)
  342. {
  343. BaseClass::replace (first0, last0, first, last);
  344. return (*this);
  345. }
  346. /*+-------------------------------------------------------------------------*
  347. * tstring::substr
  348. *
  349. * Simple wrapper that forwards the heavy lifting to the base class.
  350. *--------------------------------------------------------------------------*/
  351. inline tstring tstring::substr (size_type pos, size_type n) const
  352. {
  353. return (tstring (BaseClass::substr (pos, n)));
  354. }
  355. #endif /* TSTRING_INL */