PVRTString.h 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765
  1. /******************************************************************************
  2. @File PVRTString.h
  3. @Title PVRTString
  4. @Version
  5. @Copyright Copyright (C) Imagination Technologies Limited.
  6. @Platform ANSI compatible
  7. @Description A string class that can be used as drop-in replacement for
  8. std::string on platforms/compilers that don't provide a full C++
  9. standard library.
  10. ******************************************************************************/
  11. #ifndef _PVRTSTRING_H_
  12. #define _PVRTSTRING_H_
  13. #include <stdio.h>
  14. #define _USING_PVRTSTRING_
  15. /*!***************************************************************************
  16. @Class CPVRTString
  17. @Brief A string class
  18. *****************************************************************************/
  19. class CPVRTString
  20. {
  21. public:
  22. typedef size_t size_type;
  23. typedef char value_type;
  24. typedef char& reference;
  25. typedef const char& const_reference;
  26. static const size_type npos;
  27. /*!***********************************************************************
  28. @Function CPVRTString
  29. @Input _Ptr A string
  30. @Input _Count Length of _Ptr
  31. @Description Constructor
  32. ************************************************************************/
  33. CPVRTString(const char* _Ptr, size_t _Count = npos);
  34. /*!***********************************************************************
  35. @Function CPVRTString
  36. @Input _Right A string
  37. @Input _Roff Offset into _Right
  38. @Input _Count Number of chars from _Right to assign to the new string
  39. @Description Constructor
  40. ************************************************************************/
  41. CPVRTString(const CPVRTString& _Right, size_t _Roff = 0, size_t _Count = npos);
  42. /*!***********************************************************************
  43. @Function CPVRTString
  44. @Input _Count Length of new string
  45. @Input _Ch A char to fill it with
  46. @Description Constructor
  47. *************************************************************************/
  48. CPVRTString(size_t _Count, const char _Ch);
  49. /*!***********************************************************************
  50. @Function CPVRTString
  51. @Input _Ch A char
  52. @Description Constructor
  53. *************************************************************************/
  54. CPVRTString(const char _Ch);
  55. /*!***********************************************************************
  56. @Function CPVRTString
  57. @Description Constructor
  58. ************************************************************************/
  59. CPVRTString();
  60. /*!***********************************************************************
  61. @Function ~CPVRTString
  62. @Description Destructor
  63. ************************************************************************/
  64. virtual ~CPVRTString();
  65. /*!***********************************************************************
  66. @Function append
  67. @Input _Ptr A string
  68. @Returns Updated string
  69. @Description Appends a string
  70. *************************************************************************/
  71. CPVRTString& append(const char* _Ptr);
  72. /*!***********************************************************************
  73. @Function append
  74. @Input _Ptr A string
  75. @Input _Count String length
  76. @Returns Updated string
  77. @Description Appends a string of length _Count
  78. *************************************************************************/
  79. CPVRTString& append(const char* _Ptr, size_t _Count);
  80. /*!***********************************************************************
  81. @Function append
  82. @Input _Str A string
  83. @Returns Updated string
  84. @Description Appends a string
  85. *************************************************************************/
  86. CPVRTString& append(const CPVRTString& _Str);
  87. /*!***********************************************************************
  88. @Function append
  89. @Input _Str A string
  90. @Input _Off A position in string
  91. @Input _Count Number of letters to append
  92. @Returns Updated string
  93. @Description Appends _Count letters of _Str from _Off in _Str
  94. *************************************************************************/
  95. CPVRTString& append(const CPVRTString& _Str, size_t _Off, size_t _Count);
  96. /*!***********************************************************************
  97. @Function append
  98. @Input _Ch A char
  99. @Input _Count Number of times to append _Ch
  100. @Returns Updated string
  101. @Description Appends _Ch _Count times
  102. *************************************************************************/
  103. CPVRTString& append(size_t _Count, const char _Ch);
  104. //template<class InputIterator> CPVRTString& append(InputIterator _First, InputIterator _Last);
  105. /*!***********************************************************************
  106. @Function assign
  107. @Input _Ptr A string
  108. @Returns Updated string
  109. @Description Assigns the string to the string _Ptr
  110. *************************************************************************/
  111. CPVRTString& assign(const char* _Ptr);
  112. /*!***********************************************************************
  113. @Function assign
  114. @Input _Ptr A string
  115. @Input _Count Length of _Ptr
  116. @Returns Updated string
  117. @Description Assigns the string to the string _Ptr
  118. *************************************************************************/
  119. CPVRTString& assign(const char* _Ptr, size_t _Count);
  120. /*!***********************************************************************
  121. @Function assign
  122. @Input _Str A string
  123. @Returns Updated string
  124. @Description Assigns the string to the string _Str
  125. *************************************************************************/
  126. CPVRTString& assign(const CPVRTString& _Str);
  127. /*!***********************************************************************
  128. @Function assign
  129. @Input _Str A string
  130. @Input _Off First char to start assignment from
  131. @Input _Count Length of _Str
  132. @Returns Updated string
  133. @Description Assigns the string to _Count characters in string _Str starting at _Off
  134. *************************************************************************/
  135. CPVRTString& assign(const CPVRTString& _Str, size_t _Off, size_t _Count=npos);
  136. /*!***********************************************************************
  137. @Function assign
  138. @Input _Ch A string
  139. @Input _Count Number of times to repeat _Ch
  140. @Returns Updated string
  141. @Description Assigns the string to _Count copies of _Ch
  142. *************************************************************************/
  143. CPVRTString& assign(size_t _Count, char _Ch);
  144. //template<class InputIterator> CPVRTString& assign(InputIterator _First, InputIterator _Last);
  145. //const_reference at(size_t _Off) const;
  146. //reference at(size_t _Off);
  147. // const_iterator begin() const;
  148. // iterator begin();
  149. /*!***********************************************************************
  150. @Function c_str
  151. @Returns const char* pointer of the string
  152. @Description Returns a const char* pointer of the string
  153. *************************************************************************/
  154. const char* c_str() const;
  155. /*!***********************************************************************
  156. @Function capacity
  157. @Returns The size of the character array reserved
  158. @Description Returns the size of the character array reserved
  159. *************************************************************************/
  160. size_t capacity() const;
  161. /*!***********************************************************************
  162. @Function clear
  163. @Description Clears the string
  164. *************************************************************************/
  165. void clear();
  166. /*!***********************************************************************
  167. @Function compare
  168. @Input _Str A string to compare with
  169. @Returns 0 if the strings match
  170. @Description Compares the string with _Str
  171. *************************************************************************/
  172. int compare(const CPVRTString& _Str) const;
  173. /*!***********************************************************************
  174. @Function compare
  175. @Input _Pos1 Position to start comparing from
  176. @Input _Num1 Number of chars to compare
  177. @Input _Str A string to compare with
  178. @Returns 0 if the strings match
  179. @Description Compares the string with _Str
  180. *************************************************************************/
  181. int compare(size_t _Pos1, size_t _Num1, const CPVRTString& _Str) const;
  182. /*!***********************************************************************
  183. @Function compare
  184. @Input _Pos1 Position to start comparing from
  185. @Input _Num1 Number of chars to compare
  186. @Input _Str A string to compare with
  187. @Input _Off Position in _Str to compare from
  188. @Input _Count Number of chars in _Str to compare with
  189. @Returns 0 if the strings match
  190. @Description Compares the string with _Str
  191. *************************************************************************/
  192. int compare(size_t _Pos1, size_t _Num1, const CPVRTString& _Str, size_t _Off, size_t _Count) const;
  193. /*!***********************************************************************
  194. @Function compare
  195. @Input _Ptr A string to compare with
  196. @Returns 0 if the strings match
  197. @Description Compares the string with _Ptr
  198. *************************************************************************/
  199. int compare(const char* _Ptr) const;
  200. /*!***********************************************************************
  201. @Function compare
  202. @Input _Pos1 Position to start comparing from
  203. @Input _Num1 Number of chars to compare
  204. @Input _Ptr A string to compare with
  205. @Returns 0 if the strings match
  206. @Description Compares the string with _Ptr
  207. *************************************************************************/
  208. int compare(size_t _Pos1, size_t _Num1, const char* _Ptr) const;
  209. /*!***********************************************************************
  210. @Function compare
  211. @Input _Pos1 Position to start comparing from
  212. @Input _Num1 Number of chars to compare
  213. @Input _Ptr A string to compare with
  214. @Input _Count Number of chars to compare
  215. @Returns 0 if the strings match
  216. @Description Compares the string with _Str
  217. *************************************************************************/
  218. int compare(size_t _Pos1, size_t _Num1, const char* _Ptr, size_t _Count = npos) const;
  219. /*!***********************************************************************
  220. @Function <
  221. @Input _Str A string to compare with
  222. @Returns True on success
  223. @Description Less than operator
  224. *************************************************************************/
  225. bool operator<(const CPVRTString & _Str) const;
  226. /*!***********************************************************************
  227. @Function ==
  228. @Input _Str A string to compare with
  229. @Returns True if they match
  230. @Description == Operator
  231. *************************************************************************/
  232. bool operator==(const CPVRTString& _Str) const;
  233. /*!***********************************************************************
  234. @Function ==
  235. @Input _Ptr A string to compare with
  236. @Returns True if they match
  237. @Description == Operator
  238. *************************************************************************/
  239. bool operator==(const char* const _Ptr) const;
  240. /*!***********************************************************************
  241. @Function !=
  242. @Input _Str A string to compare with
  243. @Returns True if they don't match
  244. @Description != Operator
  245. *************************************************************************/
  246. bool operator!=(const CPVRTString& _Str) const;
  247. /*!***********************************************************************
  248. @Function !=
  249. @Input _Ptr A string to compare with
  250. @Returns True if they don't match
  251. @Description != Operator
  252. *************************************************************************/
  253. bool operator!=(const char* const _Ptr) const;
  254. /*!***********************************************************************
  255. @Function copy
  256. @Modified _Ptr A string to copy to
  257. @Input _Count Size of _Ptr
  258. @Input _Off Position to start copying from
  259. @Returns Number of bytes copied
  260. @Description Copies the string to _Ptr
  261. *************************************************************************/
  262. size_t copy(char* _Ptr, size_t _Count, size_t _Off = 0) const;
  263. /*!***********************************************************************
  264. @Function data
  265. @Returns A const char* version of the string
  266. @Description Returns a const char* version of the string
  267. *************************************************************************/
  268. const char* data( ) const;
  269. /*!***********************************************************************
  270. @Function empty
  271. @Returns True if the string is empty
  272. @Description Returns true if the string is empty
  273. *************************************************************************/
  274. bool empty() const;
  275. // const_iterator end() const;
  276. // iterator end();
  277. //iterator erase(iterator _First, iterator _Last);
  278. //iterator erase(iterator _It);
  279. /*!***********************************************************************
  280. @Function erase
  281. @Input _Pos The position to start erasing from
  282. @Input _Count Number of chars to erase
  283. @Returns An updated string
  284. @Description Erases a portion of the string
  285. *************************************************************************/
  286. CPVRTString& erase(size_t _Pos = 0, size_t _Count = npos);
  287. //size_t find(char _Ch, size_t _Off = 0) const;
  288. //size_t find(const char* _Ptr, size_t _Off = 0) const;
  289. //size_t find(const char* _Ptr, size_t _Off = 0, size_t _Count) const;
  290. //size_t find(const CPVRTString& _Str, size_t _Off = 0) const;
  291. /*!***********************************************************************
  292. @Function find_first_not_of
  293. @Input _Ch A char
  294. @Input _Off Start position of the find
  295. @Returns Position of the first char that is not _Ch
  296. @Description Returns the position of the first char that is not _Ch
  297. *************************************************************************/
  298. size_t find_first_not_of(char _Ch, size_t _Off = 0) const;
  299. /*!***********************************************************************
  300. @Function find_first_not_of
  301. @Input _Ptr A string
  302. @Input _Off Start position of the find
  303. @Returns Position of the first char that is not in _Ptr
  304. @Description Returns the position of the first char that is not in _Ptr
  305. *************************************************************************/
  306. size_t find_first_not_of(const char* _Ptr, size_t _Off = 0) const;
  307. /*!***********************************************************************
  308. @Function find_first_not_of
  309. @Input _Ptr A string
  310. @Input _Off Start position of the find
  311. @Input _Count Number of chars in _Ptr
  312. @Returns Position of the first char that is not in _Ptr
  313. @Description Returns the position of the first char that is not in _Ptr
  314. *************************************************************************/
  315. size_t find_first_not_of(const char* _Ptr, size_t _Off, size_t _Count) const;
  316. /*!***********************************************************************
  317. @Function find_first_not_of
  318. @Input _Str A string
  319. @Input _Off Start position of the find
  320. @Returns Position of the first char that is not in _Str
  321. @Description Returns the position of the first char that is not in _Str
  322. *************************************************************************/
  323. size_t find_first_not_of(const CPVRTString& _Str, size_t _Off = 0) const;
  324. /*!***********************************************************************
  325. @Function find_first_of
  326. @Input _Ch A char
  327. @Input _Off Start position of the find
  328. @Returns Position of the first char that is _Ch
  329. @Description Returns the position of the first char that is _Ch
  330. *************************************************************************/
  331. size_t find_first_of(char _Ch, size_t _Off = 0) const;
  332. /*!***********************************************************************
  333. @Function find_first_of
  334. @Input _Ptr A string
  335. @Input _Off Start position of the find
  336. @Returns Position of the first char that matches a char in _Ptr
  337. @Description Returns the position of the first char that matches a char in _Ptr
  338. *************************************************************************/
  339. size_t find_first_of(const char* _Ptr, size_t _Off = 0) const;
  340. /*!***********************************************************************
  341. @Function find_first_of
  342. @Input _Ptr A string
  343. @Input _Off Start position of the find
  344. @Input _Count Size of _Ptr
  345. @Returns Position of the first char that matches a char in _Ptr
  346. @Description Returns the position of the first char that matches a char in _Ptr
  347. *************************************************************************/
  348. size_t find_first_of(const char* _Ptr, size_t _Off, size_t _Count) const;
  349. /*!***********************************************************************
  350. @Function find_first_of
  351. @Input _Str A string
  352. @Input _Off Start position of the find
  353. @Returns Position of the first char that matches a char in _Str
  354. @Description Returns the position of the first char that matches a char in _Str
  355. *************************************************************************/
  356. size_t find_first_of(const CPVRTString& _Str, size_t _Off = 0) const;
  357. /*!***********************************************************************
  358. @Function find_last_not_of
  359. @Input _Ch A char
  360. @Input _Off Start position of the find
  361. @Returns Position of the last char that is not _Ch
  362. @Description Returns the position of the last char that is not _Ch
  363. *************************************************************************/
  364. size_t find_last_not_of(char _Ch, size_t _Off = 0) const;
  365. /*!***********************************************************************
  366. @Function find_last_not_of
  367. @Input _Ptr A string
  368. @Input _Off Start position of the find
  369. @Returns Position of the last char that is not in _Ptr
  370. @Description Returns the position of the last char that is not in _Ptr
  371. *************************************************************************/
  372. size_t find_last_not_of(const char* _Ptr, size_t _Off = 0) const;
  373. /*!***********************************************************************
  374. @Function find_last_not_of
  375. @Input _Ptr A string
  376. @Input _Off Start position of the find
  377. @Input _Count Length of _Ptr
  378. @Returns Position of the last char that is not in _Ptr
  379. @Description Returns the position of the last char that is not in _Ptr
  380. *************************************************************************/
  381. size_t find_last_not_of(const char* _Ptr, size_t _Off, size_t _Count) const;
  382. /*!***********************************************************************
  383. @Function find_last_not_of
  384. @Input _Str A string
  385. @Input _Off Start position of the find
  386. @Returns Position of the last char that is not in _Str
  387. @Description Returns the position of the last char that is not in _Str
  388. *************************************************************************/
  389. size_t find_last_not_of(const CPVRTString& _Str, size_t _Off = 0) const;
  390. /*!***********************************************************************
  391. @Function find_last_of
  392. @Input _Ch A char
  393. @Input _Off Start position of the find
  394. @Returns Position of the last char that is _Ch
  395. @Description Returns the position of the last char that is _Ch
  396. *************************************************************************/
  397. size_t find_last_of(char _Ch, size_t _Off = 0) const;
  398. /*!***********************************************************************
  399. @Function find_last_of
  400. @Input _Ptr A string
  401. @Input _Off Start position of the find
  402. @Returns Position of the last char that is in _Ptr
  403. @Description Returns the position of the last char that is in _Ptr
  404. *************************************************************************/
  405. size_t find_last_of(const char* _Ptr, size_t _Off = 0) const;
  406. /*!***********************************************************************
  407. @Function find_last_of
  408. @Input _Ptr A string
  409. @Input _Off Start position of the find
  410. @Input _Count Length of _Ptr
  411. @Returns Position of the last char that is in _Ptr
  412. @Description Returns the position of the last char that is in _Ptr
  413. *************************************************************************/
  414. size_t find_last_of(const char* _Ptr, size_t _Off, size_t _Count) const;
  415. /*!***********************************************************************
  416. @Function find_last_of
  417. @Input _Str A string
  418. @Input _Off Start position of the find
  419. @Returns Position of the last char that is in _Str
  420. @Description Returns the position of the last char that is in _Str
  421. *************************************************************************/
  422. size_t find_last_of(const CPVRTString& _Str, size_t _Off = 0) const;
  423. //allocator_type get_allocator( ) const;
  424. //CPVRTString& insert(size_t _P0, const char* _Ptr);
  425. //CPVRTString& insert(size_t _P0, const char* _Ptr, size_t _Count);
  426. //CPVRTString& insert(size_t _P0, const CPVRTString& _Str);
  427. //CPVRTString& insert(size_t _P0, const CPVRTString& _Str, size_t _Off, size_t _Count);
  428. //CPVRTString& insert(size_t _P0, size_t _Count, char _Ch);
  429. //iterator insert(iterator _It, char _Ch = char());
  430. //template<class InputIterator> void insert(iterator _It, InputIterator _First, InputIterator _Last);
  431. //void insert(iterator _It, size_t _Count, char _Ch);
  432. /*!***********************************************************************
  433. @Function length
  434. @Returns Length of the string
  435. @Description Returns the length of the string
  436. *************************************************************************/
  437. size_t length() const;
  438. /*!***********************************************************************
  439. @Function max_size
  440. @Returns The maximum number of chars that the string can contain
  441. @Description Returns the maximum number of chars that the string can contain
  442. *************************************************************************/
  443. size_t max_size() const;
  444. /*!***********************************************************************
  445. @Function push_back
  446. @Input _Ch A char to append
  447. @Description Appends _Ch to the string
  448. *************************************************************************/
  449. void push_back(char _Ch);
  450. // const_reverse_iterator rbegin() const;
  451. // reverse_iterator rbegin();
  452. // const_reverse_iterator rend() const;
  453. // reverse_iterator rend();
  454. //CPVRTString& replace(size_t _Pos1, size_t _Num1, const char* _Ptr);
  455. //CPVRTString& replace(size_t _Pos1, size_t _Num1, const CPVRTString& _Str);
  456. //CPVRTString& replace(size_t _Pos1, size_t _Num1, const char* _Ptr, size_t _Num2);
  457. //CPVRTString& replace(size_t _Pos1, size_t _Num1, const CPVRTString& _Str, size_t _Pos2, size_t _Num2);
  458. //CPVRTString& replace(size_t _Pos1, size_t _Num1, size_t _Count, char _Ch);
  459. //CPVRTString& replace(iterator _First0, iterator _Last0, const char* _Ptr);
  460. //CPVRTString& replace(iterator _First0, iterator _Last0, const CPVRTString& _Str);
  461. //CPVRTString& replace(iterator _First0, iterator _Last0, const char* _Ptr, size_t _Num2);
  462. //CPVRTString& replace(iterator _First0, iterator _Last0, size_t _Num2, char _Ch);
  463. //template<class InputIterator> CPVRTString& replace(iterator _First0, iterator _Last0, InputIterator _First, InputIterator _Last);
  464. /*!***********************************************************************
  465. @Function reserve
  466. @Input _Count Size of string to reserve
  467. @Description Reserves space for _Count number of chars
  468. *************************************************************************/
  469. void reserve(size_t _Count = 0);
  470. /*!***********************************************************************
  471. @Function resize
  472. @Input _Count Size of string to resize to
  473. @Input _Ch Character to use to fill any additional space
  474. @Description Resizes the string to _Count in length
  475. *************************************************************************/
  476. void resize(size_t _Count, char _Ch = char());
  477. //size_t rfind(char _Ch, size_t _Off = npos) const;
  478. //size_t rfind(const char* _Ptr, size_t _Off = npos) const;
  479. //size_t rfind(const char* _Ptr, size_t _Off = npos, size_t _Count) const;
  480. //size_t rfind(const CPVRTString& _Str, size_t _Off = npos) const;
  481. /*!***********************************************************************
  482. @Function size
  483. @Returns Size of the string
  484. @Description Returns the size of the string
  485. *************************************************************************/
  486. size_t size() const;
  487. /*!***********************************************************************
  488. @Function substr
  489. @Input _Off Start of the substring
  490. @Input _Count Length of the substring
  491. @Returns A substring of the string
  492. @Description Returns the size of the string
  493. *************************************************************************/
  494. CPVRTString substr(size_t _Off = 0, size_t _Count = npos) const;
  495. /*!***********************************************************************
  496. @Function swap
  497. @Input _Str A string to swap with
  498. @Description Swaps the contents of the string with _Str
  499. *************************************************************************/
  500. void swap(CPVRTString& _Str);
  501. /*!***********************************************************************
  502. @Function toLower
  503. @Returns An updated string
  504. @Description Converts the string to lower case
  505. *************************************************************************/
  506. CPVRTString& toLower();
  507. /*!***********************************************************************
  508. @Function +=
  509. @Input _Ch A char
  510. @Returns An updated string
  511. @Description += Operator
  512. *************************************************************************/
  513. CPVRTString& operator+=(char _Ch);
  514. /*!***********************************************************************
  515. @Function +=
  516. @Input _Ptr A string
  517. @Returns An updated string
  518. @Description += Operator
  519. *************************************************************************/
  520. CPVRTString& operator+=(const char* _Ptr);
  521. /*!***********************************************************************
  522. @Function +=
  523. @Input _Right A string
  524. @Returns An updated string
  525. @Description += Operator
  526. *************************************************************************/
  527. CPVRTString& operator+=(const CPVRTString& _Right);
  528. /*!***********************************************************************
  529. @Function =
  530. @Input _Ch A char
  531. @Returns An updated string
  532. @Description = Operator
  533. *************************************************************************/
  534. CPVRTString& operator=(char _Ch);
  535. /*!***********************************************************************
  536. @Function =
  537. @Input _Ptr A string
  538. @Returns An updated string
  539. @Description = Operator
  540. *************************************************************************/
  541. CPVRTString& operator=(const char* _Ptr);
  542. /*!***********************************************************************
  543. @Function =
  544. @Input _Right A string
  545. @Returns An updated string
  546. @Description = Operator
  547. *************************************************************************/
  548. CPVRTString& operator=(const CPVRTString& _Right);
  549. /*!***********************************************************************
  550. @Function []
  551. @Input _Off An index into the string
  552. @Returns A character
  553. @Description [] Operator
  554. *************************************************************************/
  555. const_reference operator[](size_t _Off) const;
  556. /*!***********************************************************************
  557. @Function []
  558. @Input _Off An index into the string
  559. @Returns A character
  560. @Description [] Operator
  561. *************************************************************************/
  562. reference operator[](size_t _Off);
  563. /*!***********************************************************************
  564. @Function +
  565. @Input _Left A string
  566. @Input _Right A string
  567. @Returns An updated string
  568. @Description + Operator
  569. *************************************************************************/
  570. friend CPVRTString operator+ (const CPVRTString& _Left, const CPVRTString& _Right);
  571. /*!***********************************************************************
  572. @Function +
  573. @Input _Left A string
  574. @Input _Right A string
  575. @Returns An updated string
  576. @Description + Operator
  577. *************************************************************************/
  578. friend CPVRTString operator+ (const CPVRTString& _Left, const char* _Right);
  579. /*!***********************************************************************
  580. @Function +
  581. @Input _Left A string
  582. @Input _Right A string
  583. @Returns An updated string
  584. @Description + Operator
  585. *************************************************************************/
  586. friend CPVRTString operator+ (const CPVRTString& _Left, const char _Right);
  587. /*!***********************************************************************
  588. @Function +
  589. @Input _Left A string
  590. @Input _Right A string
  591. @Returns An updated string
  592. @Description + Operator
  593. *************************************************************************/
  594. friend CPVRTString operator+ (const char* _Left, const CPVRTString& _Right);
  595. /*!***********************************************************************
  596. @Function +
  597. @Input _Left A string
  598. @Input _Right A string
  599. @Returns An updated string
  600. @Description + Operator
  601. *************************************************************************/
  602. friend CPVRTString operator+ (const char _Left, const CPVRTString& _Right);
  603. protected:
  604. char* m_pString;
  605. size_t m_Size;
  606. size_t m_Capacity;
  607. };
  608. /*************************************************************************
  609. * MISCELLANEOUS UTILITY FUNCTIONS
  610. *************************************************************************/
  611. /*!***********************************************************************
  612. @Function PVRTStringGetFileExtension
  613. @Input strFilePath A string
  614. @Returns Extension
  615. @Description Extracts the file extension from a file path.
  616. Returns an empty CPVRTString if no extension is found.
  617. ************************************************************************/
  618. CPVRTString PVRTStringGetFileExtension(const CPVRTString& strFilePath);
  619. /*!***********************************************************************
  620. @Function PVRTStringGetContainingDirectoryPath
  621. @Input strFilePath A string
  622. @Returns Directory
  623. @Description Extracts the directory portion from a file path.
  624. ************************************************************************/
  625. CPVRTString PVRTStringGetContainingDirectoryPath(const CPVRTString& strFilePath);
  626. /*!***********************************************************************
  627. @Function PVRTStringGetFileName
  628. @Input strFilePath A string
  629. @Returns FileName
  630. @Description Extracts the name and extension portion from a file path.
  631. ************************************************************************/
  632. CPVRTString PVRTStringGetFileName(const CPVRTString& strFilePath);
  633. /*!***********************************************************************
  634. @Function PVRTStringStripWhiteSpaceFromStartOf
  635. @Input strLine A string
  636. @Returns Result of the white space stripping
  637. @Description strips white space characters from the beginning of a CPVRTString.
  638. ************************************************************************/
  639. CPVRTString PVRTStringStripWhiteSpaceFromStartOf(const CPVRTString& strLine);
  640. /*!***********************************************************************
  641. @Function PVRTStringStripWhiteSpaceFromEndOf
  642. @Input strLine A string
  643. @Returns Result of the white space stripping
  644. @Description strips white space characters from the end of a CPVRTString.
  645. ************************************************************************/
  646. CPVRTString PVRTStringStripWhiteSpaceFromEndOf(const CPVRTString& strLine);
  647. /*!***********************************************************************
  648. @Function PVRTStringFromFormattedStr
  649. @Input pFormat A string containing the formating
  650. @Returns A formatted string
  651. @Description Creates a formatted string
  652. ************************************************************************/
  653. CPVRTString PVRTStringFromFormattedStr(const char *pFormat, ...);
  654. #endif // _PVRTSTRING_H_
  655. /*****************************************************************************
  656. End of file (PVRTString.h)
  657. *****************************************************************************/