reformat more files; add Ep3 map endpoint in HTTP server

This commit is contained in:
Martin Michelsen
2025-12-21 10:35:41 -08:00
parent a462a774f5
commit 894ac6b8ff
19 changed files with 376 additions and 168 deletions
+15
View File
@@ -7,6 +7,7 @@
#include <initializer_list>
#include <phosg/Encoding.hh>
#include <phosg/JSON.hh>
#include <phosg/Strings.hh>
#include <stdexcept>
#include <string>
@@ -303,6 +304,20 @@ struct parray {
}
return true;
}
phosg::JSON json() const {
auto ret = phosg::JSON::list();
for (size_t z = 0; z < Count; z++) {
if constexpr (requires(ItemT x) { x.json(); }) {
ret.emplace_back(this->items[z].json());
} else if constexpr (requires(ItemT x) { x.load(); }) {
ret.emplace_back(this->items[z].load());
} else {
ret.emplace_back(this->items[z]);
}
}
return ret;
}
} __attribute__((packed));
template <typename ItemT, size_t Count>