This is the to-string callback for the dictionary type
| 276 | |
| 277 | // This is the to-string callback for the dictionary type |
| 278 | std::string DictionaryToString(void *obj, int expandMembers, CDebugger *dbg) |
| 279 | { |
| 280 | CScriptDictionary *dic = reinterpret_cast<CScriptDictionary*>(obj); |
| 281 | |
| 282 | std::stringstream s; |
| 283 | s << "(len=" << dic->GetSize() << ")"; |
| 284 | |
| 285 | if( expandMembers > 0 ) |
| 286 | { |
| 287 | s << " ["; |
| 288 | asUINT n = 0; |
| 289 | for( CScriptDictionary::CIterator it = dic->begin(); it != dic->end(); it++, n++ ) |
| 290 | { |
| 291 | s << "[" << it.GetKey() << "] = "; |
| 292 | |
| 293 | // Get the type and address of the value |
| 294 | const void *val = it.GetAddressOfValue(); |
| 295 | int typeId = it.GetTypeId(); |
| 296 | |
| 297 | // Use the engine from the currently active context (if none is active, the debugger |
| 298 | // will use the engine held inside it by default, but in an environment where there |
| 299 | // multiple engines this might not be the correct instance). |
| 300 | asIScriptContext *ctx = asGetActiveContext(); |
| 301 | |
| 302 | s << dbg->ToString(const_cast<void*>(val), typeId, expandMembers - 1, ctx ? ctx->GetEngine() : 0); |
| 303 | |
| 304 | if( n < dic->GetSize() - 1 ) |
| 305 | s << ", "; |
| 306 | } |
| 307 | s << "]"; |
| 308 | } |
| 309 | |
| 310 | return s.str(); |
| 311 | } |
| 312 | |
| 313 | // This is the to-string callback for the dictionary type |
| 314 | std::string DateTimeToString(void *obj, int expandMembers, CDebugger *dbg) |