Re: Why std::string is used for the file paths?



If library has own "string" class, and it is used,  it should be used everywhere.
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> 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>:
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
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.]



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]