From 98664ebf9e383362e7ecd1c0dc99a0698a2718e4 Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Thu, 26 Sep 2024 19:47:59 +0200 Subject: [PATCH] MT#61102 DSM: add handling of 3 parameters function Add support for 3 parameters functions. Change-Id: Icdd6dcc43bb02b7e318921394e3d9f28692255b1 --- apps/dsm/DSMModule.h | 140 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+) diff --git a/apps/dsm/DSMModule.h b/apps/dsm/DSMModule.h index 0153971e..5f541a02 100644 --- a/apps/dsm/DSMModule.h +++ b/apps/dsm/DSMModule.h @@ -130,6 +130,19 @@ class SCStrArgAction map* event_params); \ }; \ +#define DEF_ACTION_3P(CL_Name) \ + class CL_Name \ + : public DSMAction { \ + string par1; \ + string par2; \ + string par3; \ + public: \ + CL_Name(const string& arg); \ + bool execute(AmSession* sess, DSMSession* sc_sess, \ + DSMCondition::EventType event, \ + map* event_params); \ + }; + /* bool xsplit(const string& arg, char sep, bool optional, string& par1, string& par2); */ #define SPLIT_ARGS(sep, optional) \ @@ -197,12 +210,120 @@ class SCStrArgAction return; \ } +#define SPLIT_ARGS3(sep, optional) \ + size_t p = 0; \ + size_t p2 = 0; \ + char last_c = ' '; \ + bool quot=false; \ + char quot_c = ' '; \ + bool sep_found = false; \ + bool sep_found2 = false; \ + \ + while (p* event_params); \ }; +#define DEF_CONDITION_3P(cond_name) \ + class cond_name \ + : public DSMCondition { \ + string par1; \ + string par2; \ + string par3; \ + bool inv; \ + public: \ + cond_name(const string& arg, bool inv); \ + bool match(AmSession* sess, DSMSession* sc_sess, DSMCondition::EventType event, \ + map* event_params); \ + }; + #define CONST_CONDITION_2P(cond_name, _sep, _optional) \ cond_name::cond_name(const string& arg, bool inv) \ : inv(inv) { \ SPLIT_ARGS(_sep, _optional); \ } +#define CONST_CONDITION_3P(cond_name, _sep, _optional) \ + cond_name::cond_name(const string& arg, bool inv) \ + : inv(inv) { \ + SPLIT_ARGS3(_sep, _optional); \ + } + #define MATCH_CONDITION_START(cond_clsname) \ bool cond_clsname::match(AmSession* sess, DSMSession* sc_sess, \ DSMCondition::EventType event, \