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

List:       kde-devel
Subject:    Re: QString data
From:       Johnny Andersson <johnny () johnnys ! info>
Date:       2003-08-20 11:54:35
[Download RAW message or body]

On Wednesday 20 August 2003 13.25, Tim Jansen wrote:

> You can cast your string to const QChar* and use it as argument of
> QConstString ( const QChar * unicode, uint length ), provided that:
> - you are sure that all characters in your utf16 string have only 16 bits
> (you may need to check that)
> - you did not compile Qt with QT_QSTRING_UCS_4. In other words, QChar has 2
> bytes and not 4. You can check that at compile time, a sizeof(QChar) should
> be enough

Thanks for the replies (Tim and Harri). I'd really appreciate it if you could 
clear up a few points for me:

I'm creating a program that converts a list of QStrings to a file that can be 
mmap()ed into memory (for later use on a handheld device). It's a dictionary 
application. What I want to do is to write strings to a file (using my Qt 
program), then mmap() the file and access the strings without copying them to 
RAM. What I'm doing now is:

Write strings to file. I'm iteration through the strings, using 
QDataStream.writeRawBytes(string[i], sizeof(QChar)). 

Then I mmap() the file into the process, and I have a list of offsets to each 
string within the file. I create QConstString objects under the assumption 
that each character is sizeof(QChar). 

Would you say that's a good way to do it, or am I just lucky if it works? ;)

 
>> 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