Re: Why std::string is used for the file paths?
- From: Murray Cumming <murrayc murrayc com>
- To: Roman Yazmin <roman yazmin gmail com>
- Cc: gtkmm-list gnome org, toralf procaptura com
- Subject: Re: Why std::string is used for the file paths?
- Date: Mon, 14 Jul 2008 11:33:35 +0200
On Mon, 2008-07-14 at 12:52 +0400, Roman Yazmin wrote:
> Gtkmm doesn't have its own "string" class. It has a special
> class for UTF-8 encoded strings. That's what Glib::ustring is.
>
> And all library use this special class for UTF-8 encoded strings. And
> must be used for file paths also.
> If not, please show me the benefits of using std::string for file
> paths instead of ustring.
It makes it clear that you need to think about what encoding is used for
the filename, and does not offer you an API to manipulate non-UTF8
characters as UTF-8.
For instance, it makes it clear that you should probably use
filename_to_utf8() and filename_from_utf8() when showing the filepath to
a user or interpreting a filepath entered by a user.
http://www.gtkmm.org/docs/glibmm-2.4/docs/reference/html/group__CharsetConv.html#g2bd94064ad97b43324a7854b62f0835b
You really still need to be aware of these encodings on modern computer
system, unfortunately.
It also avoids an unwanted conversion when writing a filepath out to a C
++ standard stream, such as std::cout.
--
murrayc murrayc com
www.murrayc.com
www.openismus.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]