MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / getStringValue

Method getStringValue

Engine/source/console/console.cpp:2596–2630  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2594}
2595
2596const char *ConsoleValue::getStringValue()
2597{
2598 if(type == TypeInternalString || type == TypeInternalStackString)
2599 return sval;
2600 else if (type == TypeInternalStringStackPtr)
2601 return STR.mBuffer + (uintptr_t)sval;
2602 else
2603 {
2604 // We need a string representation, so lets create one
2605 const char *internalValue = NULL;
2606
2607 if(type == TypeInternalFloat)
2608 internalValue = Con::getData(TypeF32, &fval, 0);
2609 else if(type == TypeInternalInt)
2610 internalValue = Con::getData(TypeS32, &ival, 0);
2611 else
2612 return Con::getData(type, dataPtr, 0, enumTable); // We can't save sval here since it is the same as dataPtr
2613
2614 if (!internalValue)
2615 return "";
2616
2617 U32 stringLen = dStrlen(internalValue);
2618 U32 newLen = ((stringLen + 1) + 15) & ~15; // pad upto next cache line
2619
2620 if (bufferLen == 0)
2621 sval = (char *) dMalloc(newLen);
2622 else if(newLen > bufferLen)
2623 sval = (char *) dRealloc(sval, newLen);
2624
2625 dStrcpy(sval, internalValue);
2626 bufferLen = newLen;
2627
2628 return sval;
2629 }
2630}
2631
2632StringStackPtr ConsoleValue::getStringStackPtr()
2633{

Callers 15

getStringVariableMethod · 0.45
setCopyVariableMethod · 0.45
getFieldComponentFunction · 0.45
setFieldComponentFunction · 0.45
execMethod · 0.45
getVariableFunction · 0.45
getBoolVariableFunction · 0.45
exportVariablesMethod · 0.45
getVariableMethod · 0.45
operator()Method · 0.45
operator()Method · 0.45
pushVarMethod · 0.45

Calls 3

getDataFunction · 0.85
dStrcpyFunction · 0.85
dStrlenFunction · 0.50

Tested by 1

TESTFunction · 0.36