Some minor changes

This commit is contained in:
WolverinDEV
2019-10-13 17:12:50 +02:00
parent cb73d9df32
commit e30c03029f
6 changed files with 121 additions and 224 deletions
+8 -18
View File
@@ -23,11 +23,11 @@ using trigger = ts::descriptor::trigger<key_t>;
void handleCommand(
ts::command& _cmd,
cconstants::return_code::optional return_code,
field<tl("key_a"), int> key_a,
field<tl("key_b"), string>::optional key_b,
field<tl("key_c"), uint64_t>::optional::bulked key_c,
trigger<tl("test")> switch_test
const cconstants::return_code::optional& return_code,
const field<tl("key_a"), int>& key_a,
const field<tl("key_b"), string>::optional& key_b,
const field<tl("key_c"), uint64_t>::optional::bulked& key_c,
const trigger<tl("test")>& switch_test
) {
if(key_a.value() < 10)
cout << "ERROR" << endl;
@@ -67,18 +67,6 @@ void eval_test(command_result x) {
int main() {
//for(const auto& error : avariableErrors)
// cout << error.name << " = " << hex << "0x" << error.errorId << "," << endl;
#if false
{
string error;
istringstream is(base64::decode("AQCvbHFTQDY/terPeilrp/ECU9xCH5U3xC92lYTNaY/0KQAJFueAazbsgAAAACVUZWFtU3BlYWsgU3lzdGVtcyBHbWJIAADCxw83PomiAdX11jLso/hdMVov4e8N79iq2NRhwkIjqgAKSyfbMFu6mwAAACRUZWFtU3BlYWsgc3lzdGVtcyBHbWJIAAA+kiuhufX/V96lZzq4MICxnYxFPkV/mG03Pu+VYgUISwIKU0+AC1RkAAQAAAIASmFuLU5pa2xhcyBLZXR0ZW5idXJnAADlcwyCViOfHJKYvWHHqyL9R1Ba5ZP+cL7MQ5nI7s1R2yAKnICdCp0pXQ=="));
auto chain = LicenseChain::parse(is, error);
chain->print();
cout << base64::encode(chain->generatePublicKey(public_root)) << endl;
cout << base64::encode(chain->generatePublicKey(public_root, 1)) << endl;
cout << base64::encode(chain->generatePublicKey(public_root, 2)) << endl;
cout << base64::encode(chain->generatePublicKey(public_root, 3)) << endl;
}
#endif
eval_test(test());
eval_test(test2());
@@ -127,7 +115,7 @@ int main() {
cout << ts::command::parse("a=c", false).build(ts::command::format::BRACE_ESCAPED_QUERY) << endl;
cout << ts::command::parse("a=c | a=c -x", false).build(ts::command::format::BRACE_ESCAPED_QUERY) << endl;
cout << ts::command::parse("a a=c|a=c").build(ts::command::format::BRACE_ESCAPED_QUERY) << endl;
cout << ts::command::parse("a a=c a=c2 -z | a=c").build(ts::command::format::BRACE_ESCAPED_QUERY) << endl;
cout << ts::command::parse("a a=c a=c2 -z | -? a=c").build(ts::command::format::BRACE_ESCAPED_QUERY) << endl;
/*
*
@@ -147,6 +135,8 @@ int main() {
cmd[1]["key_c"] = "key_c_value_1";
cmd.set_trigger("test");
auto result = ts::descriptor::describe_function(handleCommand);
auto cmd_handler = ts::descriptor::parse_function(handleCommand);
cmd_handler->invoke(cmd);
cout << cmd.build() << endl;