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

Function getUnit

Engine/source/core/strings/stringUnit.cpp:31–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29 static char _returnBuffer[ 2048 ];
30
31 const char *getUnit(const char *string, U32 index, const char *set, char* buffer, U32 bufferSize)
32 {
33 if( !buffer )
34 {
35 buffer = _returnBuffer;
36 bufferSize = sizeof( _returnBuffer );
37 }
38
39 AssertFatal( bufferSize, "StringUnit::getUnit - bufferSize cannot be zero!" );
40 if( !bufferSize )
41 return "";
42
43 buffer[0] = 0;
44
45 dsize_t sz;
46 while(index--)
47 {
48 if(!*string)
49 return buffer;
50
51 sz = dStrcspn(string, set);
52 if (string[sz] == 0)
53 return buffer;
54
55 string += (sz + 1);
56 }
57 sz = dStrcspn(string, set);
58 if (sz == 0)
59 return buffer;
60
61 AssertWarn( sz + 1 < bufferSize, "Size of returned string too large for return buffer" );
62 sz = getMin( sz, bufferSize - 1 );
63
64 dStrncpy(buffer, string, sz);
65 buffer[sz] = '\0';
66 return buffer;
67 }
68
69 const char *getUnits(const char *string, S32 startIndex, S32 endIndex, const char *set)
70 {

Callers 15

fromStringMethod · 0.85
fromStringMethod · 0.85
getFieldComponentFunction · 0.85
default_vector_scanFunction · 0.85
copyFieldsMethod · 0.85
assimpLogCallbackMethod · 0.85
setDependenciesMethod · 0.85
setToBufferMethod · 0.85
terrImport.cppFile · 0.85
visitMethod · 0.85

Calls 2

dStrcspnFunction · 0.85
dStrncpyFunction · 0.85

Tested by 1

constructEditControlMethod · 0.68