smjg
Joined: 29 Sep 2004 Posts: 41
|
Posted: Thu Oct 06, 2005 6:24 am Post subject: Working on TextStream |
|
|
I've started work on TextStream. At the moment I'm using the codec directly to do the translations, but it can be changed to use TE/D when that's ready. I've already noticed a few things that need thinking about:
1. I don't really like generateByteOrderMark. Firstly the name is misleading - it sounds like a method that outputs the BOM there and then, but it's actually a property. Secondly, the documentation for the setter states "This function must be called before any data is written. Otherwise, it does nothing." But what cases does "before any data is written" cover exactly?
The behaviour of generateByteOrderMark and autoDetectUnicode needs thinking about in any case. Will they be automatically set to false after use, so that it doesn't keep doing it for every read or write operation, or shall a separate internal variable be used for this? Will they be reset to default values when the device is changed? (What about when you seek back to the beginning of the device, FTM?)
2. The Qt documentation for integerBase and NumberFlags seems a bit contradictory - the integerBase documentation indicates that only 2, 8, 10 and 16 are supported, but NumberFlags talks of bases up to 36. How far should we go with supporting bases?
3. Should we have separate UTF-8 and UTF-16 versions of readAll and readLine? What should we call them?
4. Which definition of space should be used for skipWhitespace and for reading a word at a time? u_isspace, u_isWhiteSpace or u_isUWhiteSpace?
5. Should opShr(out char) and opShr(out wchar) be allowed? If the character extracted equals more than one UTF-8 or UTF-16 fragment, should it buffer them and return each with successive opShr calls? Or throw an exception? Or what? Moreover, what if the application tries to mix reading/writing chars, wchars and dchars?
6. If an I/O operation throws a CodecException, how should the stream be left?
Stewart. |
|