Re: Why std::string is used for the file paths?
- From: Toralf Lund <toralf procaptura com>
- To: GTK-- Mailing List <gtkmm-list gnome org>
- Subject: Re: Why std::string is used for the file paths?
- Date: Mon, 14 Jul 2008 09:30:26 +0200
Roman Yazmin wrote:
If library has own "string" class, and it is used, it should be used
everywhere.
Gtkmm doesn't have its own "string" class. It has a special class for
UTF-8 encoded strings. That's what Glib::ustring is.
No matter what happens internally. Library interface should be common.
Why we need this "string hell"?
On Sun, Jul 13, 2008 at 6:03 AM, Milosz Derezynski
<internalerror gmail com <mailto:internalerror gmail com>> wrote:
Filesystems aren't in any particular encoding; there is no such
thing as a "string class for file paths". On UNIX a file path is
just a sequence of 8-bit characters, for which std::string is
suited best, and for which Glib::ustring isn't needed. If any of
the mentioned functions would take an Glib::ustring, the ustring
would need to be passed to the relevant internal function using
::raw() anyway which would make any UTF-8ness it might or might
not have there unneccessary.
2008/7/13 Roman Yazmin <roman yazmin gmail com
<mailto:roman yazmin gmail com>>:
Why std::string is used for the file paths?
Most of Miscellaneous Utility Functions
(http://www.gtkmm.org/docs/glibmm-2.4/docs/reference/html/group__MiscUtils.html),
Gio::File, Gtk::Image::set, Gdk::Pixbuf::create_from_file and
so on.
Why not just use Glib:ustring everywhere?
For example, this simple code will cause a crash:
Gtk::Image image;
Glib::ustring path("image.png");
image.set(path);
Why I should write image.set(path.raw()); to prevent this crash?
Thanks.
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org <mailto:gtkmm-list gnome org>
http://mail.gnome.org/mailman/listinfo/gtkmm-list
--
------------
Please note that according to the German law on data retention,
information on every electronic information exchange with me is
retained for a period of six months.
[Bitte beachten Sie, dass dem Gesetz zur Vorratsdatenspeicherung
zufolge
jeder elektronische Kontakt mit mir sechs Monate lang gespeichert
wird.]
------------------------------------------------------------------------
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list
--
Toralf Lund <toralf procaptura com> +47 66 85 51 22
ProCaptura AS +47 66 85 51 00 (switchboard)
http://www.procaptura.com/ +47 66 85 51 01 (fax)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]