MCPcopy Create free account
hub / github.com/anjo76/angelscript / ArrayToString

Function ArrayToString

sdk/samples/asrun/source/main.cpp:255–275  ·  view source on GitHub ↗

This is the to-string callback for the array type This is generic and will take care of all template instances based on the array template

Source from the content-addressed store, hash-verified

253// This is the to-string callback for the array type
254// This is generic and will take care of all template instances based on the array template
255std::string ArrayToString(void *obj, int expandMembers, CDebugger *dbg)
256{
257 CScriptArray *arr = reinterpret_cast<CScriptArray*>(obj);
258
259 std::stringstream s;
260 s << "(len=" << arr->GetSize() << ")";
261
262 if( expandMembers > 0 )
263 {
264 s << " [";
265 for( asUINT n = 0; n < arr->GetSize(); n++ )
266 {
267 s << dbg->ToString(arr->At(n), arr->GetElementTypeId(), expandMembers - 1, arr->GetArrayObjectType()->GetEngine());
268 if( n < arr->GetSize()-1 )
269 s << ", ";
270 }
271 s << "]";
272 }
273
274 return s.str();
275}
276
277// This is the to-string callback for the dictionary type
278std::string DictionaryToString(void *obj, int expandMembers, CDebugger *dbg)

Callers

nothing calls this directly

Calls 7

GetArrayObjectTypeMethod · 0.80
strMethod · 0.80
GetSizeMethod · 0.45
ToStringMethod · 0.45
AtMethod · 0.45
GetElementTypeIdMethod · 0.45
GetEngineMethod · 0.45

Tested by

no test coverage detected