WSTRING.H 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. ** Command & Conquer Red Alert(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /****************************************************************************\
  19. * C O N F I D E N T I A L --- W E S T W O O D S T U D I O S *
  20. ******************************************************************************
  21. Project Name: Carpenter (The RedAlert ladder creator)
  22. File Name : main.cpp
  23. Author : Neal Kettler
  24. Start Date : June 1, 1997
  25. Last Update : June 17, 1997
  26. \****************************************************************************/
  27. #ifndef WSTRING_HEADER
  28. #define WSTRING_HEADER
  29. #include <stdio.h>
  30. #include <stdlib.h>
  31. #include "wstypes.h"
  32. class Wstring
  33. {
  34. public:
  35. Wstring();
  36. Wstring(IN const Wstring &other);
  37. Wstring(IN char *string);
  38. ~Wstring();
  39. void clear(void);
  40. bit8 cat(IN char *string);
  41. bit8 cat(uint32 size,IN char *string);
  42. bit8 cat(IN Wstring &string);
  43. void cellCopy(OUT char *dest, uint32 len);
  44. char remove(sint32 pos, sint32 count);
  45. bit8 removeChar(char c);
  46. void removeSpaces(void);
  47. char *get(void);
  48. char get(uint32 index);
  49. uint32 length(void);
  50. bit8 insert(char c, uint32 pos);
  51. bit8 insert(char *instring, uint32 pos);
  52. bit8 replace(IN char *replaceThis,IN char *withThis);
  53. char set(IN char *str);
  54. char set(uint32 size,IN char *str);
  55. bit8 set(char c, uint32 index);
  56. void setSize(sint32 bytes); // create an empty string
  57. void toLower(void);
  58. void toUpper(void);
  59. bit8 truncate(uint32 len);
  60. bit8 truncate(char c); // trunc after char c
  61. sint32 getToken(int offset,char *delim,Wstring &out);
  62. sint32 getLine(int offset, Wstring &out);
  63. bit8 operator==(IN char *other);
  64. bit8 operator==(IN Wstring &other);
  65. bit8 operator!=(IN char *other);
  66. bit8 operator!=(IN Wstring &other);
  67. Wstring &operator=(IN char *other);
  68. Wstring &operator=(IN Wstring &other);
  69. Wstring &operator+=(IN char *other);
  70. Wstring &operator+=(IN Wstring &other);
  71. Wstring operator+(IN char *other);
  72. Wstring operator+(IN Wstring &other);
  73. private:
  74. char *str; // Pointer to allocated string.
  75. };
  76. #endif