MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / StringBuffer

Class StringBuffer

Engine/source/core/stringBuffer.h:41–132  ·  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 mutable Vector<UTF8> mBuffer8;
45 mutable 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 ~StringBuffer();
64
65 void append(const StringBuffer &in);
66 void append(const UTF8* in);
67 void append(const UTF16* in);
68 void append(const UTF16* in, U32 len);
69
70 void insert(const U32 charOffset, const StringBuffer &in);
71 void insert(const U32 charOffset, const UTF8* in);
72 void insert(const U32 charOffset, const UTF16* in);
73 void insert(const U32 charOffset, const UTF16* in, const U32 len);
74
75 /// Get a StringBuffer substring of length 'len' starting from 'start'.
76 /// Returns a new StringBuffer by value;
77 StringBuffer substring(const U32 start, const U32 len) const;
78
79 /// Get a pointer to a substring of length 'len' starting from 'start'.
80 /// Returns a raw pointer to a unicode string.
81 /// You must delete[] the returned string when you are done with it.
82 /// This follows the "create rule".
83 UTF8* createSubstring8(const U32 start, const U32 len) const;
84 UTF16* createSubstring16(const U32 start, const U32 len) const;
85
86 void cut(const U32 start, const U32 len);
87// UTF8* cut8(const U32 start, const U32 len);
88// UTF16* cut16(const U32 start, const U32 len);
89
90 const UTF16 getChar(const U32 offset) const;
91 void setChar(const U32 offset, UTF16 c);
92
93 void set(const StringBuffer *in);
94 void set(const UTF8 *in);
95 void set(const UTF16 *in);
96
97 inline const U32 length() const
98 {

Callers 1

substringMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected