]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Add operator==.
authorBruno Haible <bruno@clisp.org>
Mon, 27 Nov 2006 12:36:42 +0000 (12:36 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:14:23 +0000 (12:14 +0200)
gnulib-local/ChangeLog
gnulib-local/build-aux/moopp

index bf1bc462b75ccfa5de55326e8cc228187fd26f18..02450cd6adba6e949a87ceef58563d0e24f2d5a5 100644 (file)
@@ -1,3 +1,8 @@
+2006-11-26  Bruno Haible  <bruno@clisp.org>
+
+       * build-aux/moopp: In the C++ class definition, add 'operator ==',
+       'operator !=' members, and add constructors for downcasting.
+
 2006-11-25  Bruno Haible  <bruno@clisp.org>
 
        * lib/glibconfig_.h (g_return_if_fail, g_return_val_if_fail,
index 4093c57f914f4badf57f5ca8f8adf94b0a153047..4fa4455701e604bbe6c60ee9f84eabc9b1868cdb 100755 (executable)
@@ -368,6 +368,9 @@ func_start_creation "$newfile"
   done
   # The 'operator void *' is needed to avoid ambiguous conversion chains.
   echo "  operator void * () { return _pointer; }"
+  # The 'operator ==' and 'operator !=' are needed to avoid ambiguous comparisons with NULL.
+  echo "  bool operator == (const void *p) { return _pointer == p; }"
+  echo "  bool operator != (const void *p) { return _pointer != p; }"
   atroot=yes
   for classname in $all_superclasses; do
     if test -n "$atroot"; then
@@ -375,7 +378,9 @@ func_start_creation "$newfile"
     else
       repclassalias="${classname}_representation"
     fi
-    echo "  operator ${classname}_t () { return (${classname}_t) ($struct ${repclassalias} *) _pointer; }"
+    echo "  operator ${classname}_t () { return (${classname}_t) (struct ${repclassalias} *) _pointer; }"
+    # The 'explicit' constructors allow to downcast.
+    echo "  explicit ${main_classname}_t (${classname}_t x) : _pointer ((struct ${main_repclassalias} *) (void *) x) {}"
     atroot=
   done
   echo "};"