Improved some scripts

This commit is contained in:
WolverinDEV
2020-01-24 20:17:29 +01:00
parent deeba1b73e
commit ba89fe72ab
2 changed files with 50 additions and 17 deletions
+23 -1
View File
@@ -21,6 +21,27 @@ using field = ts::descriptor::field<key_t, value_type_t>;
template <class key_t>
using trigger = ts::descriptor::trigger<key_t>;
template<unsigned N>
class FixedString {
public:
constexpr FixedString(char const* s) {
for (unsigned i = 0; i < N; ++i)
buf[i] = s[i];
}
constexpr operator const char*() const { return buf; }
[[nodiscard]] constexpr const char* c_str() const { return buf; }
private:
char buf[N + 1]{};
};
template<unsigned N> FixedString(char const (&)[N]) -> FixedString<N - 1>;
template<FixedString T>
void test() {
std::cout << "Parameter: " << T.c_str() << "\n";
}
void handleCommand(
ts::command& _cmd,
const cconstants::return_code::optional& return_code,
@@ -56,7 +77,7 @@ command_result test3() {
void eval_test(command_result x) {
if(x.is_detailed()) {
cout << "Detailed!" << endl;
delete x.release_details();
x.release_details();
} else {
auto a = x.permission_id();
auto b = x.error_code();
@@ -65,6 +86,7 @@ void eval_test(command_result x) {
}
int main() {
test<"abs">();
//for(const auto& error : avariableErrors)
// cout << error.name << " = " << hex << "0x" << error.errorId << "," << endl;