summaryrefslogtreecommitdiff
path: root/gui/util.h
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2025-04-26 15:11:19 -0400
committerbd <bdunahu@operationnull.com>2025-04-26 15:11:19 -0400
commit6382d595cf947eb54249ff5fea20d8eb073ef3c1 (patch)
treeece23d61bf25869fe2058a1b2323dac417f25617 /gui/util.h
parent118427baa510419041c3f8e9c7a4616b93f01672 (diff)
Move digit formatter to util.h
Diffstat (limited to 'gui/util.h')
-rw-r--r--gui/util.h23
1 files changed, 21 insertions, 2 deletions
diff --git a/gui/util.h b/gui/util.h
index 87c33f6..8e9d308 100644
--- a/gui/util.h
+++ b/gui/util.h
@@ -1,8 +1,27 @@
+#ifndef UTIL_H
+#define UTIL_H
+
+#include <QString>
+
/**
- * Given `total_levels', returns an integer between 4 and 12 which is a linear map of `level' onto `total_levels'.
- * This is used for generating cache sizes given a number of levels.
+ * Given `total_levels', returns an integer between 4 and 12 which is a linear
+ * map of `level' onto `total_levels'. This is used for generating cache sizes
+ * given a number of levels.
* @param the total number of cache levels, zero-indexed.
* @param a numberedcache level, zero-indexed.
* @return an integer between 4-12, linearly scaled with level.
*/
int cache_size_mapper(int total_levels, int level);
+
+/**
+ * Contains the main formatting logic used to format integers. Uses 2's
+ * complement for hexadecimal numbers.
+ * @param the value to be formated
+ * @param if the value should be displayed in hex. If false, displays in
+ * decimal.
+ * @param if the value should display.
+ * @return a string respecting the above parameters.
+ */
+QString format_toggled_value(int value, bool is_hex, bool is_cleared = false);
+
+#endif // UTIL_H