[Interest] Converting std::string.c_str() code to use QString methods
Thiago Macieira
thiago.macieira at intel.com
Sat Aug 31 23:48:17 CEST 2013
On sábado, 31 de agosto de 2013 17:27:55, Michael Jackson wrote:
> Well, unfortunately I can not remove HDF5 as or entire file format is based
> on it. So with that limiting factor in place and knowing that I may have a
> file path coming from a standard Open/Save Dialog how would _you_ handle
> this situation? These are my design parameters that I have and so I just
> want to figure out the way that will cause the least amount of headaches.
I wouldn't. I would throw the library away and report it to the vendor telling
them to fix their library.
Showing the user "sorry, I can't open that file, please rename it or move it to
a different directory" is unacceptable.
> On the plus side of things HDF5 does have a C++ API where some of the class
> methods will take a std::string but I am not sure this is going to help in
> this case.
It's not. std::string has undefined encoding. The question is: what encoding
does the file name API expect? Most API expect it to be in the locale encoding
and that is not acceptable on Windows.
File name API on Windows *must* be Unicode. Anything else is a fatal design
flaw.
PS: see if there's an API that allows you to pass an opened file, like a FILE*
or a file descriptor.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130831/28a18dd4/attachment.sig>
More information about the Interest
mailing list