From: Mu-Woong Lee Date: Thu, 8 Jun 2017 12:29:37 +0000 (+0900) Subject: Rename the class Json to avoid symbol conflicts with Jsoncpp X-Git-Tag: submit/tizen/20170609.130020^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F78%2F132978%2F1;p=platform%2Fcore%2Fapi%2Fcontext.git Rename the class Json to avoid symbol conflicts with Jsoncpp Change-Id: Id37ba824dec9b48002735ae2484589fbe491cc91 Signed-off-by: Mu-Woong Lee --- diff --git a/src/ComparisonConverter.cpp b/src/ComparisonConverter.cpp index ea247e9..3d73626 100644 --- a/src/ComparisonConverter.cpp +++ b/src/ComparisonConverter.cpp @@ -22,7 +22,7 @@ using namespace ctx; -ComparisonConverter::ComparisonConverter(const char* type, Json& info) : +ComparisonConverter::ComparisonConverter(const char* type, CtxJson1& info) : __completed(false), __size(0), __logicalOp(TRIG_RULE_LOGICAL_DISJUNCTION), @@ -35,7 +35,7 @@ ComparisonConverter::ComparisonConverter(const char* type, Json& info) : __size = __info.getSize(NULL, OLD_TRIG_RULE_KEY_DATA_VALUE_ARR); } -int ComparisonConverter::getResult(Json* result) +int ComparisonConverter::getResult(CtxJson1* result) { if (__result == EMPTY_JSON_OBJECT) return ERR_INVALID_RULE; @@ -58,7 +58,7 @@ bool ComparisonConverter::__convertEmptyComparison() { IF_FAIL_RETURN(__size == 0, false); - Json temp = EMPTY_JSON_OBJECT; + CtxJson1 temp = EMPTY_JSON_OBJECT; __result.set(NULL, __key.c_str(), temp); return true; diff --git a/src/ComparisonConverter.h b/src/ComparisonConverter.h index 54a796f..9cde85c 100644 --- a/src/ComparisonConverter.h +++ b/src/ComparisonConverter.h @@ -17,7 +17,7 @@ #ifndef _CONTEXT_COMPARISON_CONVERTER_H_ #define _CONTEXT_COMPARISON_CONVERTER_H_ -#include +#include #include "TriggerOldRuleTypes.h" namespace ctx { @@ -26,18 +26,18 @@ namespace ctx { public: virtual ~ComparisonConverter() {}; - int getResult(Json* result); + int getResult(CtxJson1* result); protected: bool __completed; int __size; std::string __logicalOp; std::string __type; - Json __info; - Json __result; + CtxJson1 __info; + CtxJson1 __result; std::string __key; - ComparisonConverter(const char* type, Json& info); + ComparisonConverter(const char* type, CtxJson1& info); void __convertComparison(); virtual int __getOperatorCount(std::string op) = 0; virtual bool __checkEtc(); diff --git a/src/IntComparisonConverter.cpp b/src/IntComparisonConverter.cpp index 98aa36d..9f1a4e5 100644 --- a/src/IntComparisonConverter.cpp +++ b/src/IntComparisonConverter.cpp @@ -24,7 +24,7 @@ using namespace ctx; -IntComparisonConverter::IntComparisonConverter(Json info) : +IntComparisonConverter::IntComparisonConverter(CtxJson1 info) : ComparisonConverter(TRIG_TMPL_TYPE_INTEGER, info) { if (__size >= 2) { diff --git a/src/IntComparisonConverter.h b/src/IntComparisonConverter.h index ec72e6b..f18cd2b 100644 --- a/src/IntComparisonConverter.h +++ b/src/IntComparisonConverter.h @@ -18,7 +18,7 @@ #define _CONTEXT_INT_COMPARISON_CONVERTER_H_ #include -#include +#include #include "ComparisonConverter.h" namespace ctx { @@ -28,7 +28,7 @@ namespace ctx { typedef std::map IntComparisonMap; // { operator, IntList } public: - IntComparisonConverter(Json info); + IntComparisonConverter(CtxJson1 info); ~IntComparisonConverter() {}; private: diff --git a/src/StringComparisonConverter.cpp b/src/StringComparisonConverter.cpp index 88fd359..f4c1757 100644 --- a/src/StringComparisonConverter.cpp +++ b/src/StringComparisonConverter.cpp @@ -22,7 +22,7 @@ using namespace ctx; -StringComparisonConverter::StringComparisonConverter(Json info) : +StringComparisonConverter::StringComparisonConverter(CtxJson1 info) : ComparisonConverter(TRIG_TMPL_TYPE_STRING, info) { if (__size >= 2) { diff --git a/src/StringComparisonConverter.h b/src/StringComparisonConverter.h index 2f45162..69fb110 100644 --- a/src/StringComparisonConverter.h +++ b/src/StringComparisonConverter.h @@ -18,7 +18,7 @@ #define _CONTEXT_STRING_COMPARISON_CONVERTER_H_ #include -#include +#include #include "ComparisonConverter.h" namespace ctx { @@ -27,7 +27,7 @@ namespace ctx { typedef std::map StringComparisonMap; public: - StringComparisonConverter(Json info); + StringComparisonConverter(CtxJson1 info); ~StringComparisonConverter() {}; private: diff --git a/src/context_history.cpp b/src/context_history.cpp index 223319c..8895ad4 100644 --- a/src/context_history.cpp +++ b/src/context_history.cpp @@ -16,7 +16,7 @@ #include #include -#include +#include #include #include #include @@ -41,7 +41,7 @@ typedef struct _context_history_handle_s { } _cx_history_handle; typedef struct _context_history_filter_handle_s { - ctx::Json jfilter; + ctx::CtxJson jfilter; } _cx_history_filter_handle; typedef struct _context_history_list_handle_s { diff --git a/src/context_trigger.cpp b/src/context_trigger.cpp index e737384..941cc02 100644 --- a/src/context_trigger.cpp +++ b/src/context_trigger.cpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include #include @@ -63,9 +63,9 @@ static bool condition_is_deprecated(context_trigger_condition_e item); //static std::string double_to_string(int value); typedef struct _context_trigger_rule_s { - ctx::Json jold_rule; - ctx::Json jrule; // description, event{}, condition[], action{}, _extra{} - ctx::Json jref; + ctx::CtxJson1 jold_rule; + ctx::CtxJson1 jrule; // description, event{}, condition[], action{}, _extra{} + ctx::CtxJson1 jref; _context_trigger_rule_s() { jold_rule = EMPTY_JSON_OBJECT; @@ -76,8 +76,8 @@ typedef struct _context_trigger_rule_s { typedef struct _context_trigger_rule_entry_s { int type; - ctx::Json jentry; - ctx::Json jref; + ctx::CtxJson1 jentry; + ctx::CtxJson1 jref; _context_trigger_rule_entry_s(int t): type(t) { jentry = OLD_INITIAL_ENTRY; @@ -109,7 +109,7 @@ SO_EXPORT int context_trigger_add_rule(context_trigger_rule_h rule, int* rule_id (rule->jrule).set(_TRIG_RULE_KEY_EXTRA, _TRIG_RULE_KEY_RULE_LOGICAL_OP, TRIG_RULE_LOGICAL_CONJUNCTION); } - ctx::Json jrule_id; + ctx::CtxJson1 jrule_id; int error = __dbusClient.write(SUBJ_TRIGGER_ADD, rule->jrule, &jrule_id); if (error == ERR_NONE) { @@ -126,7 +126,7 @@ SO_EXPORT int context_trigger_remove_rule(int rule_id) if (rule_id <= 0) return CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER; - ctx::Json jrule_id; + ctx::CtxJson1 jrule_id; jrule_id.set(NULL, TRIG_KEY_RULE_ID, rule_id); int error = __dbusClient.write(SUBJ_TRIGGER_REMOVE, jrule_id, NULL); @@ -146,7 +146,7 @@ SO_EXPORT int context_trigger_enable_rule(int rule_id) if (rule_id <= 0) return CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER; - ctx::Json jrule_id; + ctx::CtxJson1 jrule_id; jrule_id.set(NULL, TRIG_KEY_RULE_ID, rule_id); int req_id; // Useless in context_trigger @@ -166,7 +166,7 @@ SO_EXPORT int context_trigger_disable_rule(int rule_id) if (rule_id <= 0) return CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER; - ctx::Json jrule_id; + ctx::CtxJson1 jrule_id; jrule_id.set(NULL, TRIG_KEY_RULE_ID, rule_id); int error = __dbusClient.write(SUBJ_TRIGGER_DISABLE, jrule_id, NULL); @@ -183,7 +183,7 @@ SO_EXPORT int context_trigger_get_own_rule_ids(int** enabled_rule_ids, int* enab ASSERT_NOT_NULL(enabled_rule_ids && enabled_rule_count && disabled_rule_ids && disabled_rule_count); int req_id; - ctx::Json data_read; + ctx::CtxJson1 data_read; int error = __dbusClient.readSync(SUBJ_TRIGGER_GET_RULE_IDS, NULL, &req_id, &data_read); if (error != ERR_NONE) { @@ -231,11 +231,11 @@ SO_EXPORT int context_trigger_get_rule_by_id(int rule_id, context_trigger_rule_h if (rule_id <= 0) return CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER; - ctx::Json option; + ctx::CtxJson1 option; option.set(NULL, TRIG_KEY_RULE_ID, rule_id); int req_id; - ctx::Json data_read; + ctx::CtxJson1 data_read; int error = __dbusClient.readSync(SUBJ_TRIGGER_GET, option, &req_id, &data_read); if (error == ERR_NO_DATA) { @@ -286,13 +286,13 @@ SO_EXPORT int context_trigger_rule_add_entry(context_trigger_rule_h rule, contex ASSERT_NOT_NULL(rule && entry); // Check if rule handle is created - ctx::Json extra; + ctx::CtxJson1 extra; bool ret = (rule->jrule).get(NULL, _TRIG_RULE_KEY_EXTRA, &extra); IF_FAIL_RETURN(ret, CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER); if (entry->type == TYPE_EVENT) { // Err: More than one event - ctx::Json elem; + ctx::CtxJson1 elem; if ((rule->jold_rule).get(NULL, OLD_TRIG_RULE_KEY_EVENT, &elem)) { return CONTEXT_TRIGGER_ERROR_INVALID_RULE; } @@ -307,7 +307,7 @@ SO_EXPORT int context_trigger_rule_add_entry(context_trigger_rule_h rule, contex ret = ctx::rule_validator::check_referential_data(ename, rule->jref); IF_FAIL_RETURN(ret, CONTEXT_TRIGGER_ERROR_INVALID_RULE); - ctx::Json temp = (entry->jentry).str(); + ctx::CtxJson1 temp = (entry->jentry).str(); ret = (rule->jold_rule).set(NULL, OLD_TRIG_RULE_KEY_EVENT, temp); int error = ctx::rule_util::setEvent(entry->jentry, &(rule->jrule)); @@ -318,7 +318,7 @@ SO_EXPORT int context_trigger_rule_add_entry(context_trigger_rule_h rule, contex return CONTEXT_TRIGGER_ERROR_INVALID_RULE; } - ctx::Json elem; + ctx::CtxJson1 elem; for (int i = 0; (entry->jentry).getAt(NULL, OLD_TRIG_RULE_KEY_DATA_ARR, i, &elem); i++) { int val_arr_size = elem.getSize(NULL, OLD_TRIG_RULE_KEY_DATA_VALUE_ARR); int op_arr_size = elem.getSize(NULL, OLD_TRIG_RULE_KEY_DATA_VALUE_OPERATOR_ARR); @@ -341,7 +341,7 @@ SO_EXPORT int context_trigger_rule_add_entry(context_trigger_rule_h rule, contex IF_FAIL_RETURN(ret, CONTEXT_TRIGGER_ERROR_INVALID_RULE); } else { // If not, copy referential information to rule entry - ctx::Json info; + ctx::CtxJson1 info; for (int j = 0; (entry->jref).getAt(NULL, TYPE_OPTION, j, &info); j++) { (rule->jref).append(NULL, TYPE_OPTION, info); } @@ -352,7 +352,7 @@ SO_EXPORT int context_trigger_rule_add_entry(context_trigger_rule_h rule, contex } } - ctx::Json temp = (entry->jentry).str(); + ctx::CtxJson1 temp = (entry->jentry).str(); ret = (rule->jold_rule).append(NULL, OLD_TRIG_RULE_KEY_CONDITION, temp); ctx::rule_util::addCondition(entry->jentry, &(rule->jrule)); @@ -799,7 +799,7 @@ SO_EXPORT int context_trigger_rule_entry_add_key(context_trigger_rule_entry_h en IF_FAIL_RETURN(ret, CONTEXT_TRIGGER_ERROR_INVALID_RULE); // Err: Comparison key is already added - ctx::Json elem; + ctx::CtxJson1 elem; for (int i = 0; (entry->jentry).getAt(NULL, OLD_TRIG_RULE_KEY_DATA_ARR, i, &elem); i++) { std::string elem_item; elem.get(NULL, OLD_TRIG_RULE_KEY_DATA_KEY, &elem_item); @@ -809,7 +809,7 @@ SO_EXPORT int context_trigger_rule_entry_add_key(context_trigger_rule_entry_h en } } - ctx::Json data; + ctx::CtxJson1 data; data.set(NULL, OLD_TRIG_RULE_KEY_DATA_KEY, key); data.set(NULL, OLD_TRIG_RULE_KEY_DATA_KEY_OPERATOR, logical_str); (entry->jentry).append(NULL, OLD_TRIG_RULE_KEY_DATA_ARR, data); @@ -819,7 +819,7 @@ SO_EXPORT int context_trigger_rule_entry_add_key(context_trigger_rule_entry_h en static int context_trigger_rule_entry_add_comparison_string_internal(context_trigger_rule_entry_h entry, const char* key, std::string op, std::string value) { - ctx::Json elem; + ctx::CtxJson1 elem; for (int i = 0; (entry->jentry).getAt(NULL, OLD_TRIG_RULE_KEY_DATA_ARR, i, &elem); i++) { std::string elem_item; elem.get(NULL, OLD_TRIG_RULE_KEY_DATA_KEY, &elem_item); @@ -849,7 +849,7 @@ static int context_trigger_rule_entry_add_comparison_string_internal(context_tri static int context_trigger_rule_entry_add_comparison_int_internal(context_trigger_rule_entry_h entry, const char* key, std::string op, int value) { - ctx::Json elem; + ctx::CtxJson1 elem; for (int i = 0; (entry->jentry).getAt(NULL, OLD_TRIG_RULE_KEY_DATA_ARR, i, &elem); i++) { std::string elem_item; elem.get(NULL, OLD_TRIG_RULE_KEY_DATA_KEY, &elem_item); @@ -961,15 +961,15 @@ SO_EXPORT int context_trigger_custom_register(const char* name, const char* attr _D("BEGIN"); ASSERT_NOT_NULL(name && attr_template); - // Err: Invalid Json - ctx::Json jattr_template = attr_template; + // Err: Invalid CtxJson1 + ctx::CtxJson1 jattr_template = attr_template; IF_FAIL_RETURN_TAG(jattr_template.valid(), CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER, _E, "Failed to parse template"); // Err: Invalid template bool ret = ctx::rule_validator::is_valid_template(jattr_template); IF_FAIL_RETURN_TAG(ret, CONTEXT_TRIGGER_ERROR_INVALID_DATA, _E, "Invalid template"); - ctx::Json data; + ctx::CtxJson1 data; data.set(NULL, TRIG_CUSTOM_KEY_REQ, TRIG_CUSTOM_REQ_ADD); data.set(NULL, TRIG_CUSTOM_KEY_NAME, name); data.set(NULL, TRIG_TMPL_KEY_ATTRIBUTE, jattr_template); @@ -985,11 +985,11 @@ SO_EXPORT int context_trigger_custom_unregister(const char* name) _D("BEGIN"); ASSERT_NOT_NULL(name); - ctx::Json data; + ctx::CtxJson1 data; data.set(NULL, TRIG_CUSTOM_KEY_REQ, TRIG_CUSTOM_REQ_REMOVE); data.set(NULL, TRIG_CUSTOM_KEY_NAME, name); - ctx::Json subj; + ctx::CtxJson1 subj; int error = __dbusClient.write(SUBJ_TRIGGER_CUSTOM, data, &subj); IF_FAIL_RETURN_TAG(error == ERR_NONE, error, _E, "Failed to remove custom item: %#x", error); @@ -1005,11 +1005,11 @@ SO_EXPORT int context_trigger_custom_publish(const char* name, const char* fact) _D("BEGIN"); ASSERT_NOT_NULL(name && fact); - // Err: Invalid Json - ctx::Json jfact = fact; - IF_FAIL_RETURN_TAG(jfact.valid(), CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER, _E, "Cannot parse fact Json"); + // Err: Invalid CtxJson1 + ctx::CtxJson1 jfact = fact; + IF_FAIL_RETURN_TAG(jfact.valid(), CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER, _E, "Cannot parse fact CtxJson1"); - ctx::Json data; + ctx::CtxJson1 data; data.set(NULL, TRIG_CUSTOM_KEY_REQ, TRIG_CUSTOM_REQ_PUBLISH); data.set(NULL, TRIG_CUSTOM_KEY_NAME, name); data.set(NULL, TRIG_CUSTOM_KEY_FACT, jfact); diff --git a/src/rule_util.cpp b/src/rule_util.cpp index 2934968..f57de01 100644 --- a/src/rule_util.cpp +++ b/src/rule_util.cpp @@ -30,22 +30,22 @@ using namespace ctx; -static bool __handleTimerEvent(Json& event); -static int __arrangeDayOfWeek(Json& dayInfo); +static bool __handleTimerEvent(CtxJson1& event); +static int __arrangeDayOfWeek(CtxJson1& dayInfo); -int ctx::rule_util::setEvent(Json& entry, Json* rule) +int ctx::rule_util::setEvent(CtxJson1& entry, CtxJson1* rule) { - Json tempEvent; + CtxJson1 tempEvent; std::string subject; entry.get(NULL, OLD_TRIG_RULE_KEY_EVENT_ITEM, &subject); - Json option; + CtxJson1 option; entry.get(NULL, OLD_TRIG_RULE_KEY_EVENT_OPTION, &option); tempEvent.set(subject.c_str(), TRIG_RULE_KEY_OPTION, option); - Json elem; + CtxJson1 elem; for (int i = 0; entry.getAt(NULL, OLD_TRIG_RULE_KEY_DATA_ARR, i, &elem); i++) { - Json newElem; + CtxJson1 newElem; std::string key; elem.get(NULL, OLD_TRIG_RULE_KEY_DATA_KEY, &key); @@ -61,7 +61,7 @@ int ctx::rule_util::setEvent(Json& entry, Json* rule) IF_FAIL_RETURN_TAG(converter, ERR_OUT_OF_MEMORY, _E, "Failed to create comparison converter"); converter->getResult(&newElem); - Json detail; + CtxJson1 detail; newElem.get(NULL, key.c_str(), &detail); std::string path = subject + "." + TRIG_RULE_KEY_COMPARISON; @@ -86,19 +86,19 @@ int ctx::rule_util::setEvent(Json& entry, Json* rule) return ERR_NONE; } -int ctx::rule_util::addCondition(Json& entry, Json* rule) +int ctx::rule_util::addCondition(CtxJson1& entry, CtxJson1* rule) { - Json tempCond; + CtxJson1 tempCond; std::string subject; entry.get(NULL, OLD_TRIG_RULE_KEY_CONDITION_ITEM, &subject); - Json option; + CtxJson1 option; entry.get(NULL, OLD_TRIG_RULE_KEY_CONDITION_OPTION, &option); tempCond.set(subject.c_str(), TRIG_RULE_KEY_OPTION, option); - Json elem; + CtxJson1 elem; for (int i = 0; entry.getAt(NULL, OLD_TRIG_RULE_KEY_DATA_ARR, i, &elem); i++) { - Json newElem; + CtxJson1 newElem; std::string key; elem.get(NULL, OLD_TRIG_RULE_KEY_DATA_KEY, &key); @@ -130,18 +130,18 @@ int ctx::rule_util::addCondition(Json& entry, Json* rule) return ERR_NONE; } -bool __handleTimerEvent(Json& event) +bool __handleTimerEvent(CtxJson1& event) { - Json alarmComp; + CtxJson1 alarmComp; bool ret = event.get(SUBJ_STATE_ALARM, TRIG_RULE_KEY_COMPARISON, &alarmComp); IF_FAIL_RETURN_TAG(ret, false, _E, "Invalid EVENT_TIME event"); // Day processing - Json dayInfo; + CtxJson1 dayInfo; bool daySpecified = alarmComp.get(NULL, KEY_DAY_OF_WEEK, &dayInfo); if (daySpecified) { - Json newDayInfo; + CtxJson1 newDayInfo; newDayInfo.set(NULL, TRIG_RULE_KEY_OPERATOR, TRIG_RULE_OP_ONE_OF); int dow = __arrangeDayOfWeek(dayInfo); @@ -170,7 +170,7 @@ bool __handleTimerEvent(Json& event) } // Time processing - Json timeInfo; + CtxJson1 timeInfo; alarmComp.get(NULL, KEY_TIME_OF_DAY, &timeInfo); int time; @@ -189,7 +189,7 @@ bool __handleTimerEvent(Json& event) return true; } -int __arrangeDayOfWeek(Json& dayInfo) +int __arrangeDayOfWeek(CtxJson1& dayInfo) { std::string dayOp; if (!dayInfo.get(NULL, TRIG_RULE_KEY_OPERATOR, &dayOp)) { @@ -229,9 +229,9 @@ int __arrangeDayOfWeek(Json& dayInfo) return result; } -bool ctx::rule_util::isEventSet(Json& rule) +bool ctx::rule_util::isEventSet(CtxJson1& rule) { - ctx::Json event; + ctx::CtxJson1 event; if (rule.get(NULL, TRIG_RULE_KEY_EVENT, &event)) { if (event != EMPTY_JSON_OBJECT) { return true; @@ -241,9 +241,9 @@ bool ctx::rule_util::isEventSet(Json& rule) return false; } -bool ctx::rule_util::isActionSet(Json& rule) +bool ctx::rule_util::isActionSet(CtxJson1& rule) { - ctx::Json action; + ctx::CtxJson1 action; if (rule.get(NULL, TRIG_RULE_KEY_ACTION, &action)) { if (action != EMPTY_JSON_OBJECT) { return true; diff --git a/src/rule_util.h b/src/rule_util.h index e072433..d4443bb 100644 --- a/src/rule_util.h +++ b/src/rule_util.h @@ -17,16 +17,16 @@ #ifndef __CONTEXT_RULE_UTIL_H__ #define __CONTEXT_RULE_UTIL_H__ -#include +#include namespace ctx { namespace rule_util { - int setEvent(Json& entry, Json* rule); - int addCondition(Json& entry, Json* rule); - bool isEventSet(Json& rule); - bool isActionSet(Json& rule); + int setEvent(CtxJson1& entry, CtxJson1* rule); + int addCondition(CtxJson1& entry, CtxJson1* rule); + bool isEventSet(CtxJson1& rule); + bool isActionSet(CtxJson1& rule); } } /* namespace ctx */ diff --git a/src/rule_validator.cpp b/src/rule_validator.cpp index c68641b..6f37448 100644 --- a/src/rule_validator.cpp +++ b/src/rule_validator.cpp @@ -32,18 +32,18 @@ using namespace ctx; #define RULE_VALIDATOR_TYPE "type" #define RULE_VALIDATOR_REF "ref" -typedef std::map template_map_t; +typedef std::map template_map_t; template_map_t template_map; // static int string_to_int(std::string str); -static bool check_value_int(Json& tmpl, std::string key, int value); -static bool check_value_string(Json& tmpl, std::string key, std::string value); -static bool check_value_enum(Json& tmpl, std::string key, std::string value); -static Json get_template(std::string name); -static bool check_template_int(Json& elem); -static bool check_template_string(Json& elem); -static bool check_template_enum(Json& elem); -static std::string get_data_type(Json& elem, std::string& key); +static bool check_value_int(CtxJson1& tmpl, std::string key, int value); +static bool check_value_string(CtxJson1& tmpl, std::string key, std::string value); +static bool check_value_enum(CtxJson1& tmpl, std::string key, std::string value); +static CtxJson1 get_template(std::string name); +static bool check_template_int(CtxJson1& elem); +static bool check_template_string(CtxJson1& elem); +static bool check_template_enum(CtxJson1& elem); +static std::string get_data_type(CtxJson1& elem, std::string& key); static bool is_equal_type(std::string& type1, std::string& type2); int string_to_int(std::string str) @@ -57,7 +57,7 @@ int string_to_int(std::string str) return i; } -Json get_template(std::string name) +CtxJson1 get_template(std::string name) { rule_validator::request_template(name); return template_map[name]; @@ -71,11 +71,11 @@ int rule_validator::request_template(std::string name, bool mandatory) } // Request template - Json request; + CtxJson1 request; request.set(NULL, TRIG_TMPL_KEY_SUBJECT, name); int req_id; - Json tmpl; + CtxJson1 tmpl; DBusClient dbusClient; int error = dbusClient.readSync(SUBJ_TRIGGER_GET_TEMPLATE, request, &req_id, &tmpl); if (error == ERR_NOT_SUPPORTED) { @@ -96,16 +96,16 @@ void rule_validator::remove_template(std::string name) } // called by context_trigger_rule_add_entry() -bool rule_validator::check_option(Json& item) +bool rule_validator::check_option(CtxJson1& item) { std::string name; item.get(NULL, OLD_TRIG_RULE_KEY_EVENT_ITEM, &name); - Json tmpl = get_template(name); + CtxJson1 tmpl = get_template(name); IF_FAIL_RETURN(tmpl != EMPTY_JSON_OBJECT, false); // No option needed - Json opt_tmpl; + CtxJson1 opt_tmpl; tmpl.get(NULL, TRIG_TMPL_KEY_OPTION, &opt_tmpl); std::list opt_keys; @@ -134,10 +134,10 @@ bool rule_validator::check_option(Json& item) // called by context_trigger_rule_entry_add_option_int() bool rule_validator::check_option_int(std::string name, std::string key, int value) { - Json tmpl = get_template(name); + CtxJson1 tmpl = get_template(name); IF_FAIL_RETURN(tmpl != EMPTY_JSON_OBJECT, false); - Json opt_tmpl; + CtxJson1 opt_tmpl; tmpl.get(NULL, TRIG_TMPL_KEY_OPTION, &opt_tmpl); // Err: Item with no option @@ -160,10 +160,10 @@ bool rule_validator::check_option_int(std::string name, std::string key, int val // called by context_trigger_rule_entry_add_option_string() bool rule_validator::check_option_string(std::string name, std::string key, std::string value) { - Json tmpl = get_template(name); + CtxJson1 tmpl = get_template(name); IF_FAIL_RETURN(tmpl != EMPTY_JSON_OBJECT, false); - Json opt_tmpl; + CtxJson1 opt_tmpl; tmpl.get(NULL, TRIG_TMPL_KEY_OPTION, &opt_tmpl); // Err: ';' for SQL injection @@ -216,10 +216,10 @@ bool rule_validator::check_option_string(std::string name, std::string key, std: // called by context_trigger_rule_entry_add_comparison_int() bool rule_validator::check_comparison_int(std::string name, std::string key, std::string op, int value) { - Json tmpl = get_template(name); + CtxJson1 tmpl = get_template(name); IF_FAIL_RETURN(tmpl != EMPTY_JSON_OBJECT, false); - Json attr_tmpl; + CtxJson1 attr_tmpl; tmpl.get(NULL, TRIG_TMPL_KEY_ATTRIBUTE, &attr_tmpl); // Err: Invalid attribute key or Invalid value type @@ -246,10 +246,10 @@ bool rule_validator::check_comparison_int(std::string name, std::string key, std // called by context_trigger_rule_entry_add_comparison_string() bool rule_validator::check_comparison_string(std::string name, std::string key, std::string op, std::string value) { - Json tmpl = get_template(name); - IF_FAIL_RETURN(tmpl != Json(EMPTY_JSON_OBJECT), false); + CtxJson1 tmpl = get_template(name); + IF_FAIL_RETURN(tmpl != CtxJson1(EMPTY_JSON_OBJECT), false); - Json attr_tmpl; + CtxJson1 attr_tmpl; tmpl.get(NULL, TRIG_TMPL_KEY_ATTRIBUTE, &attr_tmpl); // Err: ';' for SQL injection @@ -278,18 +278,18 @@ bool rule_validator::check_comparison_string(std::string name, std::string key, bool rule_validator::check_valid_key(std::string type, std::string name, std::string key) { - Json tmpl = get_template(name); + CtxJson1 tmpl = get_template(name); IF_FAIL_RETURN(tmpl != EMPTY_JSON_OBJECT, false); // Err: Invalid key - Json tmp; + CtxJson1 tmp; bool ret = tmpl.get(type.c_str(), key.c_str(), &tmp); IF_FAIL_RETURN(ret, false); return true; } -bool check_value_int(Json& tmpl, std::string key, int value) +bool check_value_int(CtxJson1& tmpl, std::string key, int value) { int min, max; @@ -304,12 +304,12 @@ bool check_value_int(Json& tmpl, std::string key, int value) return true; } -bool check_value_string(Json& tmpl, std::string key, std::string value) +bool check_value_string(CtxJson1& tmpl, std::string key, std::string value) { return true; } -bool check_value_enum(Json& tmpl, std::string key, std::string value) +bool check_value_enum(CtxJson1& tmpl, std::string key, std::string value) { std::string t_val; for (int i = 0; tmpl.getAt(key.c_str(), TRIG_TMPL_TYPE_ENUM, i, &t_val); i++) { @@ -322,18 +322,18 @@ bool check_value_enum(Json& tmpl, std::string key, std::string value) // called by context_trigger_rule_entry_add_comparison() // called by context_trigger_rule_entry_add_option() -bool rule_validator::set_ref_info(std::string type, Json* jref, std::string name, std::string key, std::string ref_data) +bool rule_validator::set_ref_info(std::string type, CtxJson1* jref, std::string name, std::string key, std::string ref_data) { - Json tmpl = get_template(name); + CtxJson1 tmpl = get_template(name); IF_FAIL_RETURN(tmpl != EMPTY_JSON_OBJECT, false); - Json detailed_tmpl; + CtxJson1 detailed_tmpl; tmpl.get(NULL, type.c_str(), &detailed_tmpl); std::string dt = get_data_type(detailed_tmpl, key); IF_FAIL_RETURN(dt == TRIG_TMPL_TYPE_INTEGER || dt == TRIG_TMPL_TYPE_STRING || dt == TRIG_TMPL_TYPE_ENUM, false); - Json temp; + CtxJson1 temp; temp.set(NULL, RULE_VALIDATOR_COND_NAME, name); temp.set(NULL, RULE_VALIDATOR_KEY, key); temp.set(NULL, RULE_VALIDATOR_TYPE, dt); @@ -350,7 +350,7 @@ bool rule_validator::set_ref_info(std::string type, Json* jref, std::string name return true;; } -std::string get_data_type(Json& elem, std::string& key) +std::string get_data_type(CtxJson1& elem, std::string& key) { std::string data_type; bool ret = elem.get(key.c_str(), TRIG_TMPL_KEY_TYPE, &data_type); @@ -367,21 +367,21 @@ std::string get_data_type(Json& elem, std::string& key) // called by context_trigger_rule_entry_add_comparison() std::string rule_validator::get_data_type_from_template(std::string type, std::string name, std::string key) { - Json tmpl = get_template(name); + CtxJson1 tmpl = get_template(name); IF_FAIL_RETURN(tmpl != EMPTY_JSON_OBJECT, ""); - Json detailed_tmpl; + CtxJson1 detailed_tmpl; tmpl.get(NULL, type.c_str(), &detailed_tmpl); return get_data_type(detailed_tmpl, key); } // called by context_trigger_rule_add_entry() -bool rule_validator::check_referential_data(std::string name, Json& ref_info) +bool rule_validator::check_referential_data(std::string name, CtxJson1& ref_info) { std::map type_map; - Json ref_data; + CtxJson1 ref_data; for (int i = 0; ref_info.getAt(NULL, TRIG_TMPL_KEY_OPTION, i, &ref_data); i++) { std::string ref_key; ref_data.get(NULL, RULE_VALIDATOR_REF, &ref_key); @@ -444,9 +444,9 @@ bool rule_validator::is_valid_operator(std::string type, std::string op) } // For custom item template -bool rule_validator::is_valid_template(Json& attr_template) +bool rule_validator::is_valid_template(CtxJson1& attr_template) { - IF_FAIL_RETURN_TAG(attr_template != EMPTY_JSON_OBJECT, false, _E, "Custom template: empty Json"); + IF_FAIL_RETURN_TAG(attr_template != EMPTY_JSON_OBJECT, false, _E, "Custom template: empty CtxJson1"); bool ret; std::list keys; @@ -459,7 +459,7 @@ bool rule_validator::is_valid_template(Json& attr_template) IF_FAIL_RETURN_TAG(type == TRIG_TMPL_TYPE_INTEGER || type == TRIG_TMPL_TYPE_STRING || type == TRIG_TMPL_TYPE_ENUM, false, _E, "Custom template: invalid data type"); - Json elem; + CtxJson1 elem; attr_template.get(NULL, key.c_str(), &elem); if (type == TRIG_TMPL_TYPE_INTEGER) { ret = check_template_int(elem); @@ -476,7 +476,7 @@ bool rule_validator::is_valid_template(Json& attr_template) return true; } -bool check_template_int(Json& elem) +bool check_template_int(CtxJson1& elem) { std::list elem_keys; elem.getKeys(&elem_keys); @@ -506,7 +506,7 @@ bool check_template_int(Json& elem) return true; } -bool check_template_string(Json& elem) +bool check_template_string(CtxJson1& elem) { std::list elem_keys; elem.getKeys(&elem_keys); @@ -519,7 +519,7 @@ bool check_template_string(Json& elem) return true; } -bool check_template_enum(Json& elem) +bool check_template_enum(CtxJson1& elem) { std::list elem_keys; elem.getKeys(&elem_keys); diff --git a/src/rule_validator.h b/src/rule_validator.h index 15cf340..688a295 100644 --- a/src/rule_validator.h +++ b/src/rule_validator.h @@ -17,27 +17,27 @@ #ifndef __CONTEXT_RULE_VALIDATOR_H__ #define __CONTEXT_RULE_VALIDATOR_H__ -#include +#include namespace ctx { namespace rule_validator { int request_template(std::string name, bool mandatory = false); void remove_template(std::string name); - bool check_option(ctx::Json &item); + bool check_option(ctx::CtxJson1 &item); bool check_option_int(std::string name, std::string key, int value); bool check_option_string(std::string name, std::string key, std::string value); - bool check_option_reference(std::string event, ctx::Json &item); + bool check_option_reference(std::string event, ctx::CtxJson1 &item); bool check_comparison_int(std::string name, std::string key, std::string op, int value); bool check_comparison_string(std::string name, std::string key, std::string op, std::string value); bool check_valid_key(std::string type, std::string name, std::string key); - bool set_ref_info(std::string type, ctx::Json *jref, std::string name, std::string key, std::string ref_key); + bool set_ref_info(std::string type, ctx::CtxJson1 *jref, std::string name, std::string key, std::string ref_key); std::string get_data_type_from_template(std::string type, std::string name, std::string key); - bool check_referential_data(std::string name, ctx::Json &ref_info); + bool check_referential_data(std::string name, ctx::CtxJson1 &ref_info); bool is_valid_operator(std::string type, std::string op); - bool is_valid_template(ctx::Json& attr_template); + bool is_valid_template(ctx::CtxJson1& attr_template); } } /* namespace ctx */ diff --git a/testsuite/src/shared.cpp b/testsuite/src/shared.cpp index 6c0d8a5..7e36952 100644 --- a/testsuite/src/shared.cpp +++ b/testsuite/src/shared.cpp @@ -29,7 +29,7 @@ namespace ctx { bool bool_val = false; bool skip_tc = false; bool newline_after_tcname = false; - ctx::Json json_val = EMPTY_JSON_OBJECT; + ctx::CtxJson1 json_val = EMPTY_JSON_OBJECT; std::string str_val = ""; } } diff --git a/testsuite/src/shared.h b/testsuite/src/shared.h index 71bc726..55356dc 100644 --- a/testsuite/src/shared.h +++ b/testsuite/src/shared.h @@ -22,7 +22,7 @@ #include #include #include -#include +#include #define CALLBACK_COUNT 5 @@ -81,7 +81,7 @@ namespace ctx { extern bool bool_val; extern bool skip_tc; extern bool newline_after_tcname; - extern ctx::Json json_val; + extern ctx::CtxJson1 json_val; extern std::string str_val; void start_mainloop(); diff --git a/testsuite/src/trigger/condition.cpp b/testsuite/src/trigger/condition.cpp index 3efb31a..063ece3 100644 --- a/testsuite/src/trigger/condition.cpp +++ b/testsuite/src/trigger/condition.cpp @@ -232,7 +232,7 @@ static std::string& __get_objective_app_id() return app_id; } -static bool __trigger_cond_app_use_freq_base(ctx::Json option) +static bool __trigger_cond_app_use_freq_base(ctx::CtxJson1 option) { if (!__support(CONTEXT_TRIGGER_CONDITION_APP_USE_FREQUENCY)) return false; @@ -253,7 +253,7 @@ static bool __trigger_cond_app_use_freq_base(ctx::Json option) bool _trigger_cond_app_use_freq1() { /* Case 1: App ID only */ - ctx::Json option; + ctx::CtxJson1 option; option.set(NULL, CONTEXT_TRIGGER_APP_ID, __get_objective_app_id()); return __trigger_cond_app_use_freq_base(option); @@ -262,7 +262,7 @@ bool _trigger_cond_app_use_freq1() bool _trigger_cond_app_use_freq2() { /* Case 2: App ID, Day of Week */ - ctx::Json option; + ctx::CtxJson1 option; option.set(NULL, CONTEXT_TRIGGER_APP_ID, __get_objective_app_id()); option.set(NULL, CONTEXT_TRIGGER_DAY_OF_WEEK, CONTEXT_TRIGGER_WEEKDAY); @@ -272,7 +272,7 @@ bool _trigger_cond_app_use_freq2() bool _trigger_cond_app_use_freq3() { /* Case 3: App ID, Time of Day */ - ctx::Json option; + ctx::CtxJson1 option; option.set(NULL, CONTEXT_TRIGGER_APP_ID, __get_objective_app_id()); option.set(NULL, CONTEXT_TRIGGER_TIME_OF_DAY, "10-16"); @@ -282,7 +282,7 @@ bool _trigger_cond_app_use_freq3() bool _trigger_cond_app_use_freq4() { /* Case 3: App ID, Time of Day, Day of Week */ - ctx::Json option; + ctx::CtxJson1 option; option.set(NULL, CONTEXT_TRIGGER_APP_ID, __get_objective_app_id()); option.set(NULL, CONTEXT_TRIGGER_DAY_OF_WEEK, CONTEXT_TRIGGER_WEEKDAY); option.set(NULL, CONTEXT_TRIGGER_TIME_OF_DAY, "10-16"); @@ -330,7 +330,7 @@ static std::string& __get_objective_address() return address; } -static bool __trigger_cond_comm_freq_base(ctx::Json option) +static bool __trigger_cond_comm_freq_base(ctx::CtxJson1 option) { if (!__support(CONTEXT_TRIGGER_CONDITION_COMMUNICATION_FREQUENCY)) return false; @@ -351,7 +351,7 @@ static bool __trigger_cond_comm_freq_base(ctx::Json option) bool _trigger_cond_comm_freq1() { /* Case 1: Address only */ - ctx::Json option; + ctx::CtxJson1 option; option.set(NULL, CONTEXT_TRIGGER_ADDRESS, __get_objective_address()); return __trigger_cond_comm_freq_base(option); @@ -360,7 +360,7 @@ bool _trigger_cond_comm_freq1() bool _trigger_cond_comm_freq2() { /* Case 2: Address, Day of Week */ - ctx::Json option; + ctx::CtxJson1 option; option.set(NULL, CONTEXT_TRIGGER_ADDRESS, __get_objective_address()); option.set(NULL, CONTEXT_TRIGGER_DAY_OF_WEEK, CONTEXT_TRIGGER_WEEKDAY); @@ -370,7 +370,7 @@ bool _trigger_cond_comm_freq2() bool _trigger_cond_comm_freq3() { /* Case 3: Address, Time of Day */ - ctx::Json option; + ctx::CtxJson1 option; option.set(NULL, CONTEXT_TRIGGER_ADDRESS, __get_objective_address()); option.set(NULL, CONTEXT_TRIGGER_TIME_OF_DAY, "10-16"); @@ -380,7 +380,7 @@ bool _trigger_cond_comm_freq3() bool _trigger_cond_comm_freq4() { /* Case 4: Address, Day of Week, Time of Day */ - ctx::Json option; + ctx::CtxJson1 option; option.set(NULL, CONTEXT_TRIGGER_ADDRESS, __get_objective_address()); option.set(NULL, CONTEXT_TRIGGER_DAY_OF_WEEK, CONTEXT_TRIGGER_WEEKDAY); option.set(NULL, CONTEXT_TRIGGER_TIME_OF_DAY, "10-16"); @@ -388,7 +388,7 @@ bool _trigger_cond_comm_freq4() return __trigger_cond_comm_freq_base(option); } -static bool __trigger_cond_media_freq_base(context_trigger_condition_e item, const char *item_str, ctx::Json option) +static bool __trigger_cond_media_freq_base(context_trigger_condition_e item, const char *item_str, ctx::CtxJson1 option) { if (!__support(item)) return false; @@ -405,7 +405,7 @@ static bool __trigger_cond_media_freq_base(context_trigger_condition_e item, con bool _trigger_cond_music_freq1() { - ctx::Json option; + ctx::CtxJson1 option; return __trigger_cond_media_freq_base( CONTEXT_TRIGGER_CONDITION_MUSIC_PLAYBACK_FREQUENCY, @@ -414,7 +414,7 @@ bool _trigger_cond_music_freq1() bool _trigger_cond_music_freq2() { - ctx::Json option; + ctx::CtxJson1 option; option.set(NULL, CONTEXT_TRIGGER_DAY_OF_WEEK, CONTEXT_TRIGGER_WEEKDAY); return __trigger_cond_media_freq_base( @@ -424,7 +424,7 @@ bool _trigger_cond_music_freq2() bool _trigger_cond_music_freq3() { - ctx::Json option; + ctx::CtxJson1 option; option.set(NULL, CONTEXT_TRIGGER_TIME_OF_DAY, "10-16"); return __trigger_cond_media_freq_base( @@ -434,7 +434,7 @@ bool _trigger_cond_music_freq3() bool _trigger_cond_music_freq4() { - ctx::Json option; + ctx::CtxJson1 option; option.set(NULL, CONTEXT_TRIGGER_DAY_OF_WEEK, CONTEXT_TRIGGER_WEEKDAY); option.set(NULL, CONTEXT_TRIGGER_TIME_OF_DAY, "10-16"); @@ -445,7 +445,7 @@ bool _trigger_cond_music_freq4() bool _trigger_cond_video_freq1() { - ctx::Json option; + ctx::CtxJson1 option; return __trigger_cond_media_freq_base( CONTEXT_TRIGGER_CONDITION_VIDEO_PLAYBACK_FREQUENCY, @@ -454,7 +454,7 @@ bool _trigger_cond_video_freq1() bool _trigger_cond_video_freq2() { - ctx::Json option; + ctx::CtxJson1 option; option.set(NULL, CONTEXT_TRIGGER_DAY_OF_WEEK, CONTEXT_TRIGGER_WEEKDAY); return __trigger_cond_media_freq_base( @@ -464,7 +464,7 @@ bool _trigger_cond_video_freq2() bool _trigger_cond_video_freq3() { - ctx::Json option; + ctx::CtxJson1 option; option.set(NULL, CONTEXT_TRIGGER_TIME_OF_DAY, "10-16"); return __trigger_cond_media_freq_base( @@ -474,7 +474,7 @@ bool _trigger_cond_video_freq3() bool _trigger_cond_video_freq4() { - ctx::Json option; + ctx::CtxJson1 option; option.set(NULL, CONTEXT_TRIGGER_DAY_OF_WEEK, CONTEXT_TRIGGER_WEEKDAY); option.set(NULL, CONTEXT_TRIGGER_TIME_OF_DAY, "10-16"); diff --git a/testsuite/src/trigger/event.cpp b/testsuite/src/trigger/event.cpp index a59f564..f36fe70 100644 --- a/testsuite/src/trigger/event.cpp +++ b/testsuite/src/trigger/event.cpp @@ -24,7 +24,7 @@ using namespace ctx::test; -static void __domain_cb(const char *item, int rid, int error, ctx::Json data) +static void __domain_cb(const char *item, int rid, int error, ctx::CtxJson1 data) { g_print("[%d] %s: Error=%#x, Data=%s\n", callback_count--, item, error, data.str().c_str()); @@ -272,7 +272,7 @@ bool _trigger_event_time() dow_str = CONTEXT_TRIGGER_WEEKDAY; break; } - ctx::Json option; + ctx::CtxJson1 option; option.append(NULL, CONTEXT_TRIGGER_DAY_OF_WEEK, dow_str); option.append(NULL, CONTEXT_TRIGGER_TIME_OF_DAY, tod); @@ -365,7 +365,7 @@ bool _trigger_event_place() { if (!__support(CONTEXT_TRIGGER_EVENT_PLACE)) return false; - ctx::Json option; + ctx::CtxJson1 option; option.set(NULL, CONTEXT_TRIGGER_PLACE_ID, 2); /* 2 => office */ err = ctx::request_handler::subscribe(SUBJ_PLACE_GEOFENCE, &option, &req_id, NULL); diff --git a/testsuite/src/trigger/request_handler.cpp b/testsuite/src/trigger/request_handler.cpp index 6969aff..d92ae27 100644 --- a/testsuite/src/trigger/request_handler.cpp +++ b/testsuite/src/trigger/request_handler.cpp @@ -31,7 +31,7 @@ public: DBusClientListenerImpl() {} ~DBusClientListenerImpl() {} void setCb(std::string subject, request_handler::subject_response_cb cb); - void onPublish(std::string subject, int reqId, int error, Json event); + void onPublish(std::string subject, int reqId, int error, CtxJson1 event); private: std::map __callbackMap; }; @@ -41,7 +41,7 @@ void DBusClientListenerImpl::setCb(std::string subject, request_handler::subject __callbackMap[subject] = cb; } -void DBusClientListenerImpl::onPublish(std::string subject, int reqId, int error, Json event) +void DBusClientListenerImpl::onPublish(std::string subject, int reqId, int error, CtxJson1 event) { auto it = __callbackMap.find(subject); IF_FAIL_VOID_TAG(it != __callbackMap.end(), _W, "Unregistered subject"); @@ -51,7 +51,7 @@ void DBusClientListenerImpl::onPublish(std::string subject, int reqId, int error static DBusClientListenerImpl __dbusListener; static DBusClient __dbusClient; -int ctx::request_handler::subscribe(const char* subject, ctx::Json* option, int* req_id, ctx::Json* request_result) +int ctx::request_handler::subscribe(const char* subject, ctx::CtxJson1* option, int* req_id, ctx::CtxJson1* request_result) { return __dbusClient.subscribe(subject, option ? *option : NULL, req_id, request_result); } @@ -61,22 +61,22 @@ int ctx::request_handler::unsubscribe(const char* subject, int req_id) return __dbusClient.unsubscribe(subject, req_id); } -int ctx::request_handler::read(const char* subject, ctx::Json* option, int* req_id, ctx::Json* request_result) +int ctx::request_handler::read(const char* subject, ctx::CtxJson1* option, int* req_id, ctx::CtxJson1* request_result) { return __dbusClient.read(subject, option ? *option : NULL, req_id, request_result); } -int ctx::request_handler::read_sync(const char* subject, ctx::Json* option, int* req_id, ctx::Json* data_read) +int ctx::request_handler::read_sync(const char* subject, ctx::CtxJson1* option, int* req_id, ctx::CtxJson1* data_read) { return __dbusClient.readSync(subject, option ? *option : NULL, req_id, data_read); } -int ctx::request_handler::write(const char* subject, ctx::Json* data) +int ctx::request_handler::write(const char* subject, ctx::CtxJson1* data) { return __dbusClient.write(subject, *data); } -int ctx::request_handler::write_with_reply(const char* subject, ctx::Json* data, ctx::Json* request_result) +int ctx::request_handler::write_with_reply(const char* subject, ctx::CtxJson1* data, ctx::CtxJson1* request_result) { return __dbusClient.write(subject, *data, request_result); } diff --git a/testsuite/src/trigger/request_handler.h b/testsuite/src/trigger/request_handler.h index 3d7fa41..9a91338 100644 --- a/testsuite/src/trigger/request_handler.h +++ b/testsuite/src/trigger/request_handler.h @@ -17,13 +17,13 @@ #ifndef __CONTEXT_LIB_REQUEST_HANDLER_H__ #define __CONTEXT_LIB_REQUEST_HANDLER_H__ -#include +#include namespace ctx { namespace request_handler { /* */ - typedef void(* subject_response_cb)(const char* subject, int req_id, int error, ctx::Json response); + typedef void(* subject_response_cb)(const char* subject, int req_id, int error, ctx::CtxJson1 response); /* */ @@ -31,7 +31,7 @@ namespace ctx { namespace request_handler { /* */ - int subscribe(const char* subject, ctx::Json* option, int* req_id, ctx::Json* request_result = NULL); + int subscribe(const char* subject, ctx::CtxJson1* option, int* req_id, ctx::CtxJson1* request_result = NULL); /* */ @@ -39,19 +39,19 @@ namespace ctx { namespace request_handler { /* */ - int read(const char* subject, ctx::Json* option, int* req_id, ctx::Json* request_result = NULL); + int read(const char* subject, ctx::CtxJson1* option, int* req_id, ctx::CtxJson1* request_result = NULL); /* */ - int read_sync(const char* subject, ctx::Json* option, int* req_id, ctx::Json* data_read); + int read_sync(const char* subject, ctx::CtxJson1* option, int* req_id, ctx::CtxJson1* data_read); /* */ - int write(const char* subject, ctx::Json* data); + int write(const char* subject, ctx::CtxJson1* data); /* */ - int write_with_reply(const char* subject, ctx::Json* data, ctx::Json* request_result = NULL); + int write_with_reply(const char* subject, ctx::CtxJson1* data, ctx::CtxJson1* request_result = NULL); /* */