MCPcopy Create free account
hub / github.com/MayaPosch/NymphCast / StringToString

Function StringToString

src/server/angelscript/samples/asrun/source/main.cpp:217–232  ·  view source on GitHub ↗

This is the to-string callback for the string type

Source from the content-addressed store, hash-verified

215
216// This is the to-string callback for the string type
217std::string StringToString(void *obj, int /* expandMembers */, CDebugger * /* dbg */)
218{
219 // We know the received object is a string
220 std::string *val = reinterpret_cast<std::string*>(obj);
221
222 // Format the output string
223 // TODO: Should convert non-readable characters to escape sequences
224 std::stringstream s;
225 s << "(len=" << val->length() << ") \"";
226 if( val->length() < 20 )
227 s << *val << "\"";
228 else
229 s << val->substr(0, 20) << "...";
230
231 return s.str();
232}
233
234// This is the to-string callback for the array type
235// This is generic and will take care of all template instances based on the array template

Callers

nothing calls this directly

Calls 1

lengthMethod · 0.80

Tested by

no test coverage detected