Rename the class Json to avoid symbol conflicts with Jsoncpp 78/132978/1
authorMu-Woong Lee <muwoong.lee@samsung.com>
Thu, 8 Jun 2017 12:29:37 +0000 (21:29 +0900)
committerMu-Woong Lee <muwoong.lee@samsung.com>
Thu, 8 Jun 2017 12:29:37 +0000 (21:29 +0900)
Change-Id: Id37ba824dec9b48002735ae2484589fbe491cc91
Signed-off-by: Mu-Woong Lee <muwoong.lee@samsung.com>
18 files changed:
src/ComparisonConverter.cpp
src/ComparisonConverter.h
src/IntComparisonConverter.cpp
src/IntComparisonConverter.h
src/StringComparisonConverter.cpp
src/StringComparisonConverter.h
src/context_history.cpp
src/context_trigger.cpp
src/rule_util.cpp
src/rule_util.h
src/rule_validator.cpp
src/rule_validator.h
testsuite/src/shared.cpp
testsuite/src/shared.h
testsuite/src/trigger/condition.cpp
testsuite/src/trigger/event.cpp
testsuite/src/trigger/request_handler.cpp
testsuite/src/trigger/request_handler.h

index ea247e9c6bdf8677167f6757301bc53a3ccffc13..3d73626418049164f7665a6997202d444ac05d5f 100644 (file)
@@ -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;
index 54a796f10e2a1158d0649d4e34dde9fa000c9bb5..9cde85c90136f8e79cc6485bd60605db8f6e039e 100644 (file)
@@ -17,7 +17,7 @@
 #ifndef _CONTEXT_COMPARISON_CONVERTER_H_
 #define _CONTEXT_COMPARISON_CONVERTER_H_
 
-#include <Json.h>
+#include <CtxJson1.h>
 #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();
index 98aa36d823581479471a7b98fdb35193bd5fd394..9f1a4e5256ece54a6ec24ae7a49f11f14dcbc0a5 100644 (file)
@@ -24,7 +24,7 @@
 
 using namespace ctx;
 
-IntComparisonConverter::IntComparisonConverter(Json info) :
+IntComparisonConverter::IntComparisonConverter(CtxJson1 info) :
        ComparisonConverter(TRIG_TMPL_TYPE_INTEGER, info)
 {
        if (__size >= 2) {
index ec72e6b1e108570d170adc57e9b8414a908b076c..f18cd2bd9513568b9cd631bbf336cc0f3e0f6b78 100644 (file)
@@ -18,7 +18,7 @@
 #define _CONTEXT_INT_COMPARISON_CONVERTER_H_
 
 #include <list>
-#include <Json.h>
+#include <CtxJson1.h>
 #include "ComparisonConverter.h"
 
 namespace ctx {
@@ -28,7 +28,7 @@ namespace ctx {
                typedef std::map<std::string, IntList> IntComparisonMap;                // { operator, IntList }
 
        public:
-               IntComparisonConverter(Json info);
+               IntComparisonConverter(CtxJson1 info);
                ~IntComparisonConverter() {};
 
        private:
index 88fd359f4aae7582885f9bd3664fb1334d4e75a1..f4c1757821b8a0bae1108acee5fec4c90fe8d332 100644 (file)
@@ -22,7 +22,7 @@
 
 using namespace ctx;
 
-StringComparisonConverter::StringComparisonConverter(Json info) :
+StringComparisonConverter::StringComparisonConverter(CtxJson1 info) :
        ComparisonConverter(TRIG_TMPL_TYPE_STRING, info)
 {
        if (__size >= 2) {
index 2f451622024e31cf3f6b0b64a87a2d7c5919aae6..69fb110583a2b1e0fb5c2ccb18f23ae5f161a3ed 100644 (file)
@@ -18,7 +18,7 @@
 #define _CONTEXT_STRING_COMPARISON_CONVERTER_H_
 
 #include <map>
-#include <Json.h>
+#include <CtxJson1.h>
 #include "ComparisonConverter.h"
 
 namespace ctx {
@@ -27,7 +27,7 @@ namespace ctx {
                typedef std::map<std::string, int> StringComparisonMap;
 
        public:
-               StringComparisonConverter(Json info);
+               StringComparisonConverter(CtxJson1 info);
                ~StringComparisonConverter() {};
 
        private:
index 223319cce7e6489d5c28ed66111e70b5bd6bf9ed..8895ad4b7d7a1669ab6f24b3cbcc2d75e78bd1ac 100644 (file)
@@ -16,7 +16,7 @@
 
 #include <map>
 #include <ContextTypes.h>
-#include <Json.h>
+#include <CtxJson.h>
 #include <Tuple.h>
 #include <app_history_internal.h>
 #include <app_history_types_internal.h>
@@ -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 {
index e737384c9928d194bf77537657175b56bd04f3c6..941cc02d7a8ee91fffa48fe9b5e12ecc69fc6943 100644 (file)
@@ -24,7 +24,7 @@
 #include <context_trigger_internal.h>
 #include <Types.h>
 #include <DBusTypes.h>
-#include <Json.h>
+#include <CtxJson1.h>
 #include <DBusClient.h>
 #include <TriggerTypes.h>
 #include <TriggerRuleTypes.h>
@@ -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);
index 29349689833e16045abe9eaa695d26f495ba32ac..f57de01bf57e896977d8797b91be4748ed61d878 100644 (file)
 
 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;
index e072433830a77bf34fcea0dccfc42cbdfcbd4209..d4443bbc4b54a38ef53006aab29acb3bbdd5b80a 100644 (file)
 #ifndef __CONTEXT_RULE_UTIL_H__
 #define __CONTEXT_RULE_UTIL_H__
 
-#include <Json.h>
+#include <CtxJson1.h>
 
 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 */
index c68641b48c2b3fdf3c2e8d02e75217db8eadae55..6f3744828c8c2f75f7246ffb270c19079660573a 100644 (file)
@@ -32,18 +32,18 @@ using namespace ctx;
 #define RULE_VALIDATOR_TYPE "type"
 #define RULE_VALIDATOR_REF "ref"
 
-typedef std::map<std::string, Json> template_map_t;
+typedef std::map<std::string, CtxJson1> template_map_t;
 template_map_t template_map;   // <name, template>
 
 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<std::string> 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<std::string, std::string> 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<std::string> 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<std::string> 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<std::string> 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<std::string> elem_keys;
        elem.getKeys(&elem_keys);
index 15cf340de22463e5390b06d58a65db14273c1d44..688a2952ae41458637b0cc2851d916a42b95e744 100644 (file)
 #ifndef __CONTEXT_RULE_VALIDATOR_H__
 #define __CONTEXT_RULE_VALIDATOR_H__
 
-#include <Json.h>
+#include <CtxJson1.h>
 
 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 */
 
index 6c0d8a5f5f7c96e7dcb0c6eb539851c45836da21..7e3695221535ea9d3720f9fc92227060347431e3 100644 (file)
@@ -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 = "";
        }
 }
index 71bc726916ef69dda3f53d59d558358a953059bb..55356dc565b2549f9c19015a49a6b7f14d93b305 100644 (file)
@@ -22,7 +22,7 @@
 #include <string>
 #include <glib.h>
 #include <Types.h>
-#include <Json.h>
+#include <CtxJson1.h>
 
 #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();
index 3efb31a863b06c27a5ad392ab0a9ab31818328b4..063ece34cfff8acf41b654d7dfeba616b4e85f66 100644 (file)
@@ -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");
 
index a59f56494e65aa7d2e00f0fdd16a35964b719442..f36fe70035cb1c008207db5010a0534794142941 100644 (file)
@@ -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);
index 6969affd411235502f51cbe401202da2e97c84b6..d92ae2713bb18a6a9e14b7cb17d5af0f8f3a9d85 100644 (file)
@@ -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<std::string, request_handler::subject_response_cb> __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);
 }
index 3d7fa414278c675ee1a5359aa92eb19158b2bf26..9a91338cb1973419d6f70355ccfba1b50a6d85b6 100644 (file)
 #ifndef __CONTEXT_LIB_REQUEST_HANDLER_H__
 #define __CONTEXT_LIB_REQUEST_HANDLER_H__
 
-#include <Json.h>
+#include <CtxJson1.h>
 
 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);
 
        /*
         */