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

Method parseFromString

Engine/source/gfx/gfxStructs.cpp:36–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36void GFXVideoMode::parseFromString( const char *str )
37{
38 if(!str)
39 return;
40
41 // Copy the string, as dStrtok is destructive
42 dsize_t tempBufLen = dStrlen(str) + 1;
43 char *tempBuf = new char[tempBufLen];
44 dStrcpy( tempBuf, str, tempBufLen );
45
46#define PARSE_ELEM(type, var, func, tokParam, sep) \
47 if(const char *ptr = dStrtok( tokParam, sep)) \
48 { type tmp = func(ptr); if(tmp > 0) var = tmp; }
49
50 PARSE_ELEM(S32, resolution.x, dAtoi, tempBuf, " x\0")
51 PARSE_ELEM(S32, resolution.y, dAtoi, NULL, " x\0")
52 const char *boolptr = dStrtok(NULL, " \0");
53 if (boolptr)
54 fullScreen = dAtob(boolptr);
55 PARSE_ELEM(S32, bitDepth, dAtoi, NULL, " \0")
56 PARSE_ELEM(S32, refreshRate, dAtoi, NULL, " \0")
57 PARSE_ELEM(S32, antialiasLevel, dAtoi, NULL, " \0")
58
59#undef PARSE_ELEM
60
61 delete [] tempBuf;
62}
63
64const String GFXVideoMode::toString() const
65{

Callers 3

jquery.jsFile · 0.80
_GFXInitGetInitialResFunction · 0.80
renderFrameMethod · 0.80

Calls 4

dStrcpyFunction · 0.85
dStrtokFunction · 0.85
dAtobFunction · 0.85
dStrlenFunction · 0.50

Tested by

no test coverage detected