summaryrefslogtreecommitdiff
path: root/src/formatter/formatter.cc
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2021-05-07 02:18:07 +0300
committerEvgeny Zinoviev <me@ch1p.io>2021-05-07 02:18:07 +0300
commit7e743b73433475df086fcec81be7b10c1d695a42 (patch)
tree1737c5f9bdad2a40f740e9a655e510641331b9e2 /src/formatter/formatter.cc
initial
Diffstat (limited to 'src/formatter/formatter.cc')
-rw-r--r--src/formatter/formatter.cc38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/formatter/formatter.cc b/src/formatter/formatter.cc
new file mode 100644
index 0000000..6fedf8c
--- /dev/null
+++ b/src/formatter/formatter.cc
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: BSD-3-Clause
+
+#include "formatter.h"
+
+namespace formatter {
+
+std::ostream& operator<<(std::ostream& os, Unit val) {
+ switch (val) {
+ case Unit::V:
+ return os << "V";
+
+ case Unit::A:
+ return os << "A";
+
+ case Unit::Wh:
+ return os << "Wh";
+
+ case Unit::VA:
+ return os << "VA";
+
+ case Unit::Hz:
+ return os << "Hz";
+
+ case Unit::Percentage:
+ return os << "%";
+
+ case Unit::Celsius:
+ return os << "°C";
+
+ default:
+ break;
+ };
+
+ return os;
+}
+
+
+} \ No newline at end of file