[Qt-interest] Is there any hope for the pos() method when used with a QTextStream?
Thiago Macieira
thiago at kde.org
Fri Sep 9 00:53:24 CEST 2011
On Thursday, 8 de September de 2011 17:00:04 Atlant Schmidt wrote:
> So, is there any hope for me? I already keep a line count so when I need
> to page backwards, I COULD close and re-open the file and then read
> forward to the new position that I want, but that seems like using a punch
> card solution in the smartphone age*. Has QTextStream::pos() been fixed?
> If not, can it be fixed? And if it isn't/can't, has anyone got any better
> ideas for alternatives? (I'd prefer not to keep several tens of thousands
> of lines of text in an array of QStrings in memory, although that would
> work too.)
Forget pos(). Keep the line number and column number instead.
The existence of pos() in QTextStream is a flaw in design. Trying to keep a
byte count in a buffered stream, after converting from an arbitrary 8-bit codec
into UTF-16, is close to impossible.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Software Architect - Intel Open Source Technology Center
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110909/2b1d317c/attachment.bin
More information about the Qt-interest-old
mailing list