]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/gtk/private.h
reuse operator bool() check in compatibility_iterator::IndexOf() instead of rewriting it
[wxWidgets.git] / include / wx / gtk / private.h
index 4c6be9b94e33ed962e012ea49fe18e7f7455ebbd..bad72b53f2507c048804c912eade0425c5024c11 100644 (file)
@@ -60,6 +60,24 @@ G_END_DECLS
 extern void wxapp_install_idle_handler();
 extern bool g_isIdle;
 
+//-----------------------------------------------------------------------------
+// Convenience class for g_freeing a gchar* on scope exit automatically
+//-----------------------------------------------------------------------------
+
+class wxGtkString
+{
+public:
+    explicit wxGtkString(gchar *s) : m_str(s) { }
+    ~wxGtkString() { g_free(m_str); }
+
+    operator gchar *() const { return m_str; }
+
+private:
+    gchar *m_str;
+
+    DECLARE_NO_COPY_CLASS(wxGtkString)
+};
+
 //-----------------------------------------------------------------------------
 // GTK+ scroll types -> wxEventType
 //-----------------------------------------------------------------------------