Module: sems Branch: sayer/1.4-spce2.4 Commit: a11f3974d7ed33143145519386d25bdffe7aba40 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=a11f3974d7ed33143145519386d25bdffe7aba40
Author: Stefan Sayer <[email protected]> Committer: Stefan Sayer <[email protected]> Date: Thu Mar 8 13:53:48 2012 +0100 dsm: add macros for conditions with 2 arguments --- apps/dsm/DSMModule.h | 33 +++++++++++++++++++++++++++------ 1 files changed, 27 insertions(+), 6 deletions(-) diff --git a/apps/dsm/DSMModule.h b/apps/dsm/DSMModule.h index 7f7f8e8..9398a3f 100644 --- a/apps/dsm/DSMModule.h +++ b/apps/dsm/DSMModule.h @@ -130,8 +130,7 @@ class SCStrArgAction /* bool xsplit(const string& arg, char sep, bool optional, string& par1, string& par2); */ -#define CONST_ACTION_2P(CL_name, sep, optional) \ - CL_name::CL_name(const string& arg) { \ +#define SPLIT_ARGS(sep, optional) \ size_t p = 0; \ char last_c = ' '; \ bool quot=false; \ @@ -194,9 +193,14 @@ class SCStrArgAction ERROR("expected two parameters separated with '%c' in expression '%s' for %s\n", \ sep,arg.c_str(),typeid(this).name()); \ return; \ - } \ - } \ - + } + + +#define CONST_ACTION_2P(CL_name, _sep, _optional) \ + CL_name::CL_name(const string& arg) { \ + SPLIT_ARGS(_sep, _optional); \ + } + #define EXEC_ACTION_START(act_name) \ bool act_name::execute(AmSession* sess, DSMSession* sc_sess, \ @@ -241,7 +245,24 @@ void splitCmd(const string& from_str, bool match(AmSession* sess, DSMSession* sc_sess, DSMCondition::EventType event, \ map<string,string>* event_params); \ }; - + +#define DEF_CONDITION_2P(cond_name) \ + class cond_name \ + : public DSMCondition { \ + string par1; \ + string par2; \ + bool inv; \ + public: \ + cond_name(const string& arg, bool inv); \ + bool match(AmSession* sess, DSMSession* sc_sess, DSMCondition::EventType event, \ + map<string,string>* 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 MATCH_CONDITION_START(cond_clsname) \ bool cond_clsname::match(AmSession* sess, DSMSession* sc_sess, \ _______________________________________________ Semsdev mailing list [email protected] http://lists.iptel.org/mailman/listinfo/semsdev
