This is the to-string callback for the string type
| 215 | |
| 216 | // This is the to-string callback for the string type |
| 217 | std::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 |