summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Rice <glennricster@gmail.com>2012-12-25 22:36:05 -0600
committerGlenn Rice <glennricster@gmail.com>2012-12-25 22:36:05 -0600
commitfa503a0754fc40c03634d7f580096eef53fa994e (patch)
treecd0000ae2851897f7650d9da20e10c1a26aeb09c
parent6f7dbe45e8d35b986af05d8fcb84b4a787fc8fe2 (diff)
Convert 'operator bool' methods to 'operator const void*' operators to
avoid the possibility of implicit conversions to int. Update the poppler-glib_signal.defs file.
-rw-r--r--poppler-glib/src/action.hg22
-rw-r--r--poppler-glib/src/annot_callout_line.hg15
-rw-r--r--poppler-glib/src/color.hg15
-rw-r--r--poppler-glib/src/fonts_iter.hg15
-rw-r--r--poppler-glib/src/index_iter.hg15
-rw-r--r--poppler-glib/src/layers_iter.hg15
-rw-r--r--poppler-glib/src/page_transition.hg17
-rw-r--r--poppler-glib/src/poppler-glib_signal.defs2
8 files changed, 86 insertions, 30 deletions
diff --git a/poppler-glib/src/action.hg b/poppler-glib/src/action.hg
index 4c1ca51..b38f2a3 100644
--- a/poppler-glib/src/action.hg
+++ b/poppler-glib/src/action.hg
@@ -68,11 +68,16 @@ class Dest
_MEMBER_GET(change_zoom, change_zoom, guint, guint)
_MEMBER_SET(change_zoom, change_zoom, guint, guint)
+ /** This typedef is just to make it more obvious that
+ * our operator const void* should be used like operator bool().
+ */
+ typedef const void* BoolExpr;
+
/** Returns <tt>true</tt> if this Dest is valid, that is if the
* underlying instance is non-null.
* @return <tt>true</tt>, if the Dest is valid
*/
- inline operator bool() const { return gobj() != NULL; };
+ inline operator BoolExpr() const { return gobj() ? GINT_TO_POINTER(1) : 0; }
};
/** Poppler::ActionLayer - Layer actions
@@ -157,11 +162,18 @@ class Action
// PopplerActionJavascript members
_MEMBER_GET(javascript, javascript.script, std::string, gchar*)
- /** Returns <tt>true</tt> if this Action is valid, that is if the
- * underlying instance is non-null.
- * @return <tt>true</tt>, if the Action is valid
+ /** This typedef is just to make it more obvious that
+ * our operator const void* should be used like operator bool().
+ */
+ typedef const void* BoolExpr;
+
+ /** Tests whether the Action is valid.
+ * For instance,
+ * @code
+ * if (action) do_something()
+ * @endcode
*/
- inline operator bool() const { return gobj() != NULL; };
+ inline operator BoolExpr() const { return gobj() ? GINT_TO_POINTER(1) : 0; }
};
} // namespace Poppler
diff --git a/poppler-glib/src/annot_callout_line.hg b/poppler-glib/src/annot_callout_line.hg
index 8e56c99..d4655b8 100644
--- a/poppler-glib/src/annot_callout_line.hg
+++ b/poppler-glib/src/annot_callout_line.hg
@@ -45,11 +45,18 @@ class AnnotCalloutLine
_MEMBER_GET(y3, y3, double, gdouble)
_MEMBER_SET(y3, y3, double, gdouble)
- /** Returns <tt>true</tt> if this AnnotCalloutLine is valid, that is if the
- * underlying instance is non-null.
- * @return <tt>true</tt>, if the AnnotCalloutLine is valid
+ /** This typedef is just to make it more obvious that
+ * our operator const void* should be used like operator bool().
*/
- inline operator bool() const { return gobj() != NULL; };
+ typedef const void* BoolExpr;
+
+ /** Tests whether the AnnotCalloutLine is valid.
+ * For instance,
+ * @code
+ * if (annot) do_something()
+ * @endcode
+ */
+ inline operator BoolExpr() const { return gobj() ? GINT_TO_POINTER(1) : 0; }
};
} // namespace Poppler
diff --git a/poppler-glib/src/color.hg b/poppler-glib/src/color.hg
index 49f96e1..e27de17 100644
--- a/poppler-glib/src/color.hg
+++ b/poppler-glib/src/color.hg
@@ -40,11 +40,18 @@ class Color
_MEMBER_GET(blue, blue, guint16, guint16)
_MEMBER_SET(blue, blue, guint16, guint16)
- /** Returns <tt>true</tt> if this Color is valid, that is if the
- * underlying instance is non-null.
- * @return <tt>true</tt>, if the Color is valid
+ /** This typedef is just to make it more obvious that
+ * our operator const void* should be used like operator bool().
*/
- inline operator bool() const { return gobj() != NULL; };
+ typedef const void* BoolExpr;
+
+ /** Tests whether the Color is valid.
+ * For instance,
+ * @code
+ * if (color) do_something()
+ * @endcode
+ */
+ inline operator BoolExpr() const { return gobj() ? GINT_TO_POINTER(1) : 0; }
};
} // namespace Poppler
diff --git a/poppler-glib/src/fonts_iter.hg b/poppler-glib/src/fonts_iter.hg
index 1691cc0..7ca44e4 100644
--- a/poppler-glib/src/fonts_iter.hg
+++ b/poppler-glib/src/fonts_iter.hg
@@ -42,11 +42,18 @@ class FontsIter
_WRAP_METHOD(Glib::ustring get_substitute_name() const, poppler_fonts_iter_get_substitute_name)
_WRAP_METHOD(Glib::ustring get_encoding() const, poppler_fonts_iter_get_encoding)
- /** Returns <tt>true</tt> if this FontsIter points to fonts found in the
- * associated document.
- * @return <tt>true</tt>, if the FontsIter is valid
+ /** This typedef is just to make it more obvious that
+ * our operator const void* should be used like operator bool().
*/
- inline operator bool() const { return gobj() != NULL; };
+ typedef const void* BoolExpr;
+
+ /** Tests whether the FonstIter is valid.
+ * For instance,
+ * @code
+ * if (fonts_iter) do_something()
+ * @endcode
+ */
+ inline operator BoolExpr() const { return gobj() ? GINT_TO_POINTER(1) : 0; }
};
} // namespace Poppler
diff --git a/poppler-glib/src/index_iter.hg b/poppler-glib/src/index_iter.hg
index e54b021..c513d5b 100644
--- a/poppler-glib/src/index_iter.hg
+++ b/poppler-glib/src/index_iter.hg
@@ -62,11 +62,18 @@ class IndexIter
_WRAP_METHOD(Action get_action() const, poppler_index_iter_get_action)
_WRAP_METHOD(bool next() const, poppler_index_iter_next)
- /** Returns <tt>true</tt> if this IndexIter points contains valid
- * information about indices of the associated document.
- * @return <tt>true</tt>, if the IndexIter is valid
+ /** This typedef is just to make it more obvious that
+ * our operator const void* should be used like operator bool().
*/
- inline operator bool() const { return gobj() != NULL; };
+ typedef const void* BoolExpr;
+
+ /** Tests whether the IndexIter is valid.
+ * For instance,
+ * @code
+ * if (index_iter) do_something()
+ * @endcode
+ */
+ inline operator BoolExpr() const { return gobj() ? GINT_TO_POINTER(1) : 0; }
};
} // namespace Poppler
diff --git a/poppler-glib/src/layers_iter.hg b/poppler-glib/src/layers_iter.hg
index 4080be4..64df78f 100644
--- a/poppler-glib/src/layers_iter.hg
+++ b/poppler-glib/src/layers_iter.hg
@@ -36,11 +36,18 @@ class LayersIter
_WRAP_METHOD(Glib::ustring get_title() const, poppler_layers_iter_get_title)
_WRAP_METHOD(bool next() const, poppler_layers_iter_next)
- /** Returns <tt>true</tt> if this LayersIter contains valid information
- * about layers in the associated document.
- * @return <tt>true</tt>, if the LayersIter is valid
+ /** This typedef is just to make it more obvious that
+ * our operator const void* should be used like operator bool().
*/
- inline operator bool() const { return gobj() != NULL; };
+ typedef const void* BoolExpr;
+
+ /** Tests whether the LayersIter is valid.
+ * For instance,
+ * @code
+ * if (layers_iter) do_something()
+ * @endcode
+ */
+ inline operator BoolExpr() const { return gobj() ? GINT_TO_POINTER(1) : 0; }
};
} // namespace Poppler
diff --git a/poppler-glib/src/page_transition.hg b/poppler-glib/src/page_transition.hg
index 5191ddf..a0ea852 100644
--- a/poppler-glib/src/page_transition.hg
+++ b/poppler-glib/src/page_transition.hg
@@ -50,11 +50,18 @@ class PageTransition
_MEMBER_GET(rectangular, rectangular, bool, gboolean)
_MEMBER_SET(rectangular, rectangular, bool, gboolean)
- /** Returns <tt>true</tt> if this PageTransition is valid, that is if the
- * underlying instance is non-null.
- * @return <tt>true</tt>, if the PageTransition is valid
- */
- inline operator bool() const { return gobj() != NULL; };
+ /** This typedef is just to make it more obvious that
+ * our operator const void* should be used like operator bool().
+ */
+ typedef const void* BoolExpr;
+
+ /** Tests whether the PageTransition is valid.
+ * For instance,
+ * @code
+ * if (page_transition) do_something()
+ * @endcode
+ */
+ inline operator BoolExpr() const { return gobj() ? GINT_TO_POINTER(1) : 0; }
};
} // namespace Poppler
diff --git a/poppler-glib/src/poppler-glib_signal.defs b/poppler-glib/src/poppler-glib_signal.defs
index 1372cf9..de85dc9 100644
--- a/poppler-glib/src/poppler-glib_signal.defs
+++ b/poppler-glib/src/poppler-glib_signal.defs
@@ -203,6 +203,8 @@
;; From PopplerError
+;; From PopplerFindFlags
+
;; From PopplerFontsIter
;; From PopplerFontInfo