Debugger[New CDB]: Pass formatting parameters.

Pass around formatting parameters as structure.
Prototypically implement formatting of char *-Pointers
as UTF8.
Transfer registers and modules only if dock window is visible.
This commit is contained in:
Friedemann Kleint
2010-12-09 17:04:43 +01:00
parent 691aa41ebc
commit 7baf7b24e0
7 changed files with 307 additions and 39 deletions

View File

@@ -86,6 +86,18 @@ bool integerFromString(const std::string &s, Integer *v)
return !str.fail();
}
// Read an integer from a wstring as '10' or '0xA'
template <class Integer>
bool integerFromWString(const std::wstring &s, Integer *v)
{
const bool isHex = s.compare(0, 2, L"0x") == 0;
std::wistringstream str(isHex ? s.substr(2, s.size() - 2) : s);
if (isHex)
str >> std::hex;
str >> *v;
return !str.fail();
}
void replace(std::wstring &s, wchar_t before, wchar_t after);
// Stream a string onto a char stream doing backslash & octal escaping
@@ -128,6 +140,10 @@ std::string wStringToGdbmiString(const std::wstring &w);
std::string wStringToString(const std::wstring &w);
std::wstring stringToWString(const std::string &w);
// String from hex "414A" -> "AJ".
std::string stringFromHex(const char *begin, const char *end);
std::wstring dataToHexW(const unsigned char *begin, const unsigned char *end);
// Format a map as a GDBMI hash {key="value",..}
void formatGdbmiHash(std::ostream &os, const std::map<std::string, std::string> &);