summaryrefslogtreecommitdiff
path: root/glib/src/optionentry.hg
diff options
context:
space:
mode:
authorKjell Ahlstedt <kjellahlstedt@gmail.com>2018-03-02 11:06:27 +0100
committerKjell Ahlstedt <kjellahlstedt@gmail.com>2018-03-02 11:06:27 +0100
commit8724cfedd70991c8545fe96d5cf6b7f051e69ce1 (patch)
tree953099f53b5a072a42aff3dfeb775fdfe0333650 /glib/src/optionentry.hg
parentd114609bffc5c43667adb0c89ac59c72a3d3eaa6 (diff)
downloadglibmm-8724cfedd70991c8545fe96d5cf6b7f051e69ce1.tar.gz
Glib::OptionEntry: Use _MEMBER_SET_STR where possible
No need to hand-code member functions that set a text string.
Diffstat (limited to 'glib/src/optionentry.hg')
-rw-r--r--glib/src/optionentry.hg20
1 files changed, 10 insertions, 10 deletions
diff --git a/glib/src/optionentry.hg b/glib/src/optionentry.hg
index 4e02700a..bf9847d7 100644
--- a/glib/src/optionentry.hg
+++ b/glib/src/optionentry.hg
@@ -22,7 +22,6 @@ _DEFS(glibmm,glib)
extern "C" { typedef struct _GOptionEntry GOptionEntry; }
#endif
-
namespace Glib
{
@@ -56,11 +55,13 @@ public:
OptionEntry& operator=(const OptionEntry& src);
- //#m4 _CONVERSION(`Glib::ustring',`const gchar*',`($3).empty() ? nullptr : g_strdup(($3).c_str())')
-
+ // We do not use nullptr for an empty string in set_long_name(),
+ // because G_OPTION_REMAINING is actually a "", so it has a distinct meaning.
+ // TODO: Wrap G_OPTION_REMAINING in C++ somehow, maybe as an overloaded
+ // set_long_name(void) or set_is_remaining()? murrayc.
+ #m4 _CONVERSION(`Glib::ustring',`const char*',`($3).c_str()')
_MEMBER_GET(long_name, long_name, Glib::ustring, const char*)
-
- void set_long_name(const Glib::ustring& value);
+ _MEMBER_SET_STR(long_name, long_name, Glib::ustring, const char*)
_MEMBER_GET(short_name, short_name, gchar, gchar)
_MEMBER_SET(short_name, short_name, gchar, gchar)
@@ -75,13 +76,13 @@ public:
*/
_MEMBER_SET(flags, flags, Flags, int)
+ // We use nullptr for an empty string in set_description() and set_arg_description().
+ #m4 _CONVERSION(`Glib::ustring',`const char*',`Glib::c_str_or_nullptr($3)')
_MEMBER_GET(description, description, Glib::ustring, const char*)
-
- void set_description(const Glib::ustring& value);
+ _MEMBER_SET_STR(description, description, Glib::ustring, const char*)
_MEMBER_GET(arg_description, arg_description, Glib::ustring, const char*)
-
- void set_arg_description(const Glib::ustring& value);
+ _MEMBER_SET_STR(arg_description, arg_description, Glib::ustring, const char*)
GOptionEntry* gobj() { return gobject_; }
const GOptionEntry* gobj() const { return gobject_; }
@@ -90,7 +91,6 @@ private:
void release_gobject() noexcept;
protected:
-
GOptionEntry* gobject_;
};