summaryrefslogtreecommitdiff
path: root/gui/util.h
diff options
context:
space:
mode:
authorSiddarth Suresh <155843085+SiddarthSuresh98@users.noreply.github.com>2025-04-27 09:12:50 -0400
committerGitHub <noreply@github.com>2025-04-27 09:12:50 -0400
commit5653b2a033e7a4173d2f178b5ce52384666d3d7b (patch)
tree5c8fc7282ad1ce0c215786a70b35296645df2a1b /gui/util.h
parent3d0133c2f793e82d7519d8e2c5023114cd0f0eab (diff)
parenta4dd1f00a5d0108058fb3bfbd5f399a507792859 (diff)
Merge pull request #68 from bdunahu/bdunahu
[WIP] Pipeline cleanup and revisited GUI storage display
Diffstat (limited to 'gui/util.h')
-rw-r--r--gui/util.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/gui/util.h b/gui/util.h
new file mode 100644
index 0000000..8e9d308
--- /dev/null
+++ b/gui/util.h
@@ -0,0 +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.
+ * @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