aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils.cpp')
-rw-r--r--src/utils.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/utils.cpp b/src/utils.cpp
index d0c1273..90231ce 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -29,6 +29,7 @@
#include "utils.hpp"
#include <cstring>
+#include <sstream>
#include <cmath>
#include <limits>
#include <stdarg.h>
@@ -237,3 +238,15 @@ int absolute_to_dB(int16_t value)
return value ? round(20*log10((double)value / int16_max)) : -90;
}
+std::string flag_to_shortlabel(const std::string& label, uint16_t flag)
+{
+ stringstream shortlabel;
+ for (size_t i = 0; i < label.size(); ++i) {
+ if (flag & 0x8000 >> i) {
+ shortlabel << label[i];
+ }
+ }
+
+ return shortlabel.str();
+}
+