wstring.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. ** Command & Conquer Generals(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 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) RO;
  48. char get(uint32 index) RO;
  49. uint32 length(void) RO;
  50. bit8 insert(char c, uint32 pos);
  51. bit8 insert(char *instring, uint32 pos);
  52. bit8 beautifyNumber();
  53. bit8 replace(IN char *replaceThis,IN char *withThis);
  54. char set(IN char *str);
  55. char set(uint32 size,IN char *str);
  56. bit8 set(char c, uint32 index);
  57. char setFormatted(IN char *str, ...); // Added by Joe Howes
  58. void setSize(sint32 bytes); // create an empty string
  59. void toLower(void);
  60. void toUpper(void);
  61. bit8 truncate(uint32 len);
  62. bit8 truncate(char c); // trunc after char c
  63. sint32 getToken(int offset,char *delim,Wstring &out) RO;
  64. sint32 getLine(int offset, Wstring &out);
  65. void strgrow(int length);
  66. bit8 operator==(IN char *other) RO;
  67. bit8 operator==(IN Wstring &other) RO;
  68. bit8 operator!=(IN char *other) RO;
  69. bit8 operator!=(IN Wstring &other) RO;
  70. Wstring &operator=(IN char *other);
  71. Wstring &operator=(IN Wstring &other);
  72. Wstring &operator+=(IN char *other);
  73. Wstring &operator+=(IN Wstring &other);
  74. Wstring operator+(IN char *other);
  75. Wstring operator+(IN Wstring &other);
  76. bool operator<(IN Wstring &other) RO;
  77. private:
  78. char *str; // Pointer to allocated string.
  79. int strsize; // allocated data length
  80. };
  81. #endif