[Interest] QFile::size() and QTextStream::pos()
Igor Mironchik
igor.mironchik at gmail.com
Wed Oct 28 20:57:19 CET 2015
Hi,
On 28.10.2015 22:50, Thiago Macieira wrote:
> On Wednesday 28 October 2015 22:37:06 Igor Mironchik wrote:
>> Hi,
>>
>> Can I expect that values returned by QFile::size() and
>> QTextStream::pos() are equal when stream at end?
> It should be, but...
>
>> Or pos() of text stream can be smaller then size of file because, for
>> example, text stream uses 2 bytes for each character?
> The documentation says "Returns the device position corresponding to the
> current position of the stream", so it should account for the codec
> transformations.
>
> But since it's doing conversions along the way, there may be trouble.
>
> Why do you want to know this? Your question screams of the X-Y problem to me.
I want to calculate progress of file reading/parsing...
>
>> Do I understand right that QTextStream::skipWhiteSpace() skips '_' and
>> '*' too?
> You can easily test this...
>
>> "bool QChar::isSpace() const
>> Returns true if the character is a separator character (Separator_*
>> categories or certain code points from Other_Control category);
>> otherwise returns false."
> 002A;ASTERISK;Po;0;ON;;;;;N;;;;;
> 002D;HYPHEN-MINUS;Pd;0;ES;;;;;N;;;;;
>
> Both have categories starting with P (Punctuation), so they're not Separator
> and they're not Other_Control.
>
> Why do you think '*' and '_' should be considered whitespace? They're not even
> blank...
Because of this sentence:
Separator_* categories or certain code points from Other_Control category
And I don't know how to understand this, especially _* in the sentence...
--
Best Regards,
Igor Mironchik.
More information about the Interest
mailing list