MCPcopy Create free account
hub / github.com/GarageGames/Torque2D / StringBuffer

Class StringBuffer

engine/source/string/stringBuffer.h:41–142  ·  view source on GitHub ↗

Utility class to wrap string manipulation in a representation independent way. Length does NOT include the null terminator.

Source from the content-addressed store, hash-verified

39///
40/// Length does NOT include the null terminator.
41class StringBuffer
42{
43 Vector<UTF16> mBuffer;
44 Vector<UTF8> mBuffer8;
45 bool mDirty8;
46
47public:
48 #if defined(TORQUE_DEBUG)
49 struct RequestCounts
50 {
51 U64 requestCount8;
52 U64 requestCount16;
53 };
54 RequestCounts *rc;
55 #endif
56
57 StringBuffer();
58 StringBuffer(const StringBuffer &copy);
59 StringBuffer(const StringBuffer *in);
60 StringBuffer(const UTF8 *in);
61 StringBuffer(const UTF16 *in);
62
63 //Luma: Version of StringBuffer that doesn't convert to UTF16 for performance reasons
64 StringBuffer(const UTF8 *in, bool bNoConvert);
65
66 ~StringBuffer();
67
68 void append(const StringBuffer &in);
69 void append(const UTF8* in);
70 void append(const UTF16* in);
71 void append(const UTF16* in, U32 len);
72
73 StringBuffer& operator=(const StringBuffer& inc);
74
75 void insert(const U32 charOffset, const StringBuffer &in);
76 void insert(const U32 charOffset, const UTF8* in);
77 void insert(const U32 charOffset, const UTF16* in);
78 void insert(const U32 charOffset, const UTF16* in, const U32 len);
79
80 /// Get a StringBuffer substring of length 'len' starting from 'start'.
81 /// Returns a new StringBuffer by value;
82 StringBuffer substring(const U32 start, const U32 len) const;
83
84 /// Get a pointer to a substring of length 'len' starting from 'start'.
85 /// Returns a raw pointer to a unicode string.
86 /// You must delete[] the returned string when you are done with it.
87 /// This follows the "create rule".
88 UTF8* createSubstring8(const U32 start, const U32 len) const;
89 UTF16* createSubstring16(const U32 start, const U32 len) const;
90
91 void cut(const U32 start, const U32 len);
92// UTF8* cut8(const U32 start, const U32 len);
93// UTF16* cut16(const U32 start, const U32 len);
94
95 const UTF16 getChar(const U32 offset) const;
96 void setChar(const U32 offset, UTF16 c);
97
98 void set(const StringBuffer *in);

Callers 1

substringMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected