
2014-03-24 21:16 GMT+01:00 Johan Engelen <jbc.engelen@...2592...>:
Hi all, To easier use repr->setAttribute, I want to add two extra (overloaded) functions
virtual void setAttribute(gchar const *key, gchar const *value,
bool is_interactive=false)=0; virtual void setAttribute(gchar const *key, Glib::ustring const &value, bool is_interactive=false)=0; virtual void setAttribute(Glib::ustring const &key, Glib::ustring const &value, bool is_interactive=false)=0;
Should I use std::string or Glib::ustring for this?
The XML tree currently uses the GC allocator, so to avoid memory leaks you cannot use any class that uses the standard allocators within it. You would have to use std::string with a nonstandard allocator.
If this is only about adding an interface without any internal changes, then I think Glib::ustring is the better choice, since the XML data inside is in UTF-8.
Regards, Krzysztof