Unicode, wxString, wxChar *, TCHAR *, QString etc.

Andreas Pakulat apaku at gmx.de
Wed Apr 19 17:48:15 BST 2006


On 19.04.06 17:06:10, Alex Bligh wrote:
> Now, I know it would be unrealistic to hope for an IDE which understood
> every possible string class, especially when the underlying debugger
> (gdb) appears deaf to unicode, but given I'm told kdevelop will
> examine a QString, is it possible to extend this functionality?

Yes, examining  QStrings is done in terms of gdb-macros and is contained
in a file in the kdesdk modules called kde-devel-gdb. The macro for
QString looks like this:

define printqstring
    printqstringdata $arg0.d
end
document printqstring
  Prints the contents of a QString
end
define printqstringdata
    set $i=0
    set $d = (QStringData *)$arg0
    while $i < $d->len
        printf "%c", (char)($d->unicode[$i++].ucs & 0xff)
    end
    printf "\n"
end
document printqstringdata
  Prints the contents of a QStringData
  This is useful when the output of another command (e.g. printqmap)
  shows {d = 0xdeadbeef} for a QString, i.e. the qstringdata address
  instead of the QString object itself.
  printqstring $s and printqstringdata $s.d are equivalent.
end

So you need to know the "internal" layout of the string class, i.e.
QString has a private buffer with ucs chars and the macro just iterates
over it and displays the characters. There seems to also be a separate
macro for utf8-output...

Andreas

-- 
You single-handedly fought your way into this hopeless mess.

-
to unsubscribe from this list send an email to kdevelop-request at kdevelop.org with the following body:
unsubscribe »your-email-address«



More information about the KDevelop mailing list