summaryrefslogtreecommitdiff
path: root/ui/qt/qt_ui_utils.h
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2015-02-02 19:58:29 -0500
committerMichael Mann <mmann78@netscape.net>2015-02-03 13:03:32 +0000
commitb63599762468e4cf1783419a5556377604d344bb (patch)
treef77790ecea3d83e6552dcd68420ab5035d8adede /ui/qt/qt_ui_utils.h
parente9429732ff91cbbbaead63b643870da91ef415bd (diff)
downloadwireshark-b63599762468e4cf1783419a5556377604d344bb.tar.gz
Convert val_to_str_ext -> val_to_str_ext_wmem for calls that don't have valid packet scope (GUI).
val_to_str_ext now officially uses wmem_packet_scope(). Removed const from val_to_str[_ext]_wmem return value since it's not really constant. Created utility functions in qt_ui_utils.h to help with the new memory management for its GUI. Change-Id: Idf2ce4a4ce78d628b2269ad23a3a48fbfc9c077c Reviewed-on: https://code.wireshark.org/review/6926 Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'ui/qt/qt_ui_utils.h')
-rw-r--r--ui/qt/qt_ui_utils.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/ui/qt/qt_ui_utils.h b/ui/qt/qt_ui_utils.h
index e114f7c2fd..14fa196635 100644
--- a/ui/qt/qt_ui_utils.h
+++ b/ui/qt/qt_ui_utils.h
@@ -35,6 +35,7 @@
#include <glib.h>
#include <epan/timestamp.h>
+#include <epan/value_string.h>
#include <QFont>
#include <QString>
@@ -109,6 +110,26 @@ const QString address_to_qstring(const struct _address *address);
*/
const QString address_to_display_qstring(const struct _address *address);
+/** Convert a value_string to a QString using val_to_str_wmem().
+ *
+ * @param val The value to convert to string.
+ * @param vs value_string array.
+ * @param fmt Formatting for value not in array.
+ *
+ * @return A QString representation of the value_string.
+ */
+const QString val_to_qstring(const guint32 val, const value_string *vs, const char *fmt);
+
+/** Convert an value_string_ext to a QString using val_to_str_ext_wmem().
+ *
+ * @param val The value to convert to string.
+ * @param vse value_string_ext array.
+ * @param fmt Formatting for value not in array.
+ *
+ * @return A QString representation of the value_string_ext.
+ */
+const QString val_ext_to_qstring(const guint32 val, value_string_ext *vse, const char *fmt);
+
/**
* Round the current size of a font up to its next "smooth" size.
* If a smooth size can't be found the font is left unchanged.