[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: QString data
From:       Nicolas Goutte <nicolasg () snafu ! de>
Date:       2003-08-20 15:07:49
[Download RAW message or body]

It depends how you see the problem.

I do not think that, in this case, Japanese signs differ more than the 
(accented) Latin letters that I had thought of. (Except that UTF-8 would 
perhaps need more bytes to describe each sign.)

So if I have understood your problem, you first write a file, one time, 
without any time constraint. Then when the user uses your program, the 
program checks a QString against a lists of words in the mapped file. Here 
you want that it works smoothly.

As the lists of words is potentialy large, copying those words can take long, 
especially if for each QString that you check, you would need to check, let's 
say, 100 words. Additionaly copying your strings put pressure on the memory 
system. I suppose that it was what you wanted to avoid by mapping the file.

So perhaps converting the word that you search to a QCString first is perhaps 
not so slow in comparison or might have less drawbacks.

The problem of using QString's internal representation is that you depend on 
how it works inside Qt. So you need versions for 16 bits QString and one for 
32 bits QString and you need versions for big endian and little endian 
computers. Of course, you could say: "I always use 16 bits big endian" (what 
normally UCS2 is supposed to be in files) but then you would need also to 
convert the data inside your program.

I am sorry that portability issues are no fun. However it is better to think 
about them before starting to code, or even before investing months of coding 
before finding out that it will not work. (Sorry if I sound like a teacher.)

Have a nice day!

On Wednesday 20 August 2003 14:47, Johnny Andersson wrote:
> On Wednesday 20 August 2003 14.14, Nicolas Goutte wrote:
> > Just a question: are you sure that you cannot use QCString?
> >
> > QCString would be indendant of UCS-2 or UCS-4, so you would not get this
> > problem. (Of course the QCString would be probably in UTF-8 in this
> > case.)
>
> My program uses Japanese, so I can't use QCString.  Actually, I can (using
> utf8 conversion functions), but to avoid conversion overhead I want to use
> QString all the way. Thanks for the reply though.
>
> >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to
> >> unsubscribe <<

 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic