Rename the class Json to avoid symbol conflicts with Jsoncpp
[platform/core/context/context-provider.git] / src / sensor / ClientInfo.cpp
index 6c5955d..8988a9d 100644 (file)
@@ -62,13 +62,13 @@ ClientInfo::~ClientInfo()
        __uninstallMonitor = NULL;
 }
 
-int ClientInfo::get(std::string subject, std::string pkgId, Json& option)
+int ClientInfo::get(std::string subject, std::string pkgId, CtxJson1& option)
 {
        IF_FAIL_RETURN_TAG(__dbMgr, ERR_OPERATION_FAILED, _W, "DB not initialized");
 
        bool ret;
        std::string optStr;
-       std::vector<Json> records;
+       std::vector<CtxJson1> records;
        char *query = sqlite3_mprintf(
                        "SELECT " KEY_OPTION " FROM " CLIENT_INFO " WHERE " \
                        KEY_SUBJECT "='%q' AND " KEY_PKG_ID "='%q'",
@@ -86,13 +86,13 @@ int ClientInfo::get(std::string subject, std::string pkgId, Json& option)
        return ERR_NONE;
 }
 
-int ClientInfo::get(std::string subject, std::vector<Json>& options)
+int ClientInfo::get(std::string subject, std::vector<CtxJson1>& options)
 {
        IF_FAIL_RETURN_TAG(__dbMgr, ERR_OPERATION_FAILED, _W, "DB not initialized");
 
        bool ret;
        std::string optStr;
-       std::vector<Json> records;
+       std::vector<CtxJson1> records;
        char *query = sqlite3_mprintf(
                        "SELECT " KEY_OPTION " FROM " CLIENT_INFO " WHERE " \
                        KEY_SUBJECT "='%q'",
@@ -104,10 +104,10 @@ int ClientInfo::get(std::string subject, std::vector<Json>& options)
        IF_FAIL_RETURN(ret, ERR_OPERATION_FAILED);
        IF_FAIL_RETURN(!records.empty(), ERR_NO_DATA);
 
-       for (Json& jObj : records) {
+       for (CtxJson1& jObj : records) {
                if (!jObj.get(NULL, KEY_OPTION, &optStr))
                        continue;
-               options.push_back(Json(optStr));
+               options.push_back(CtxJson1(optStr));
        }
 
        return ERR_NONE;
@@ -118,7 +118,7 @@ bool ClientInfo::exist(std::string subject)
        IF_FAIL_RETURN_TAG(__dbMgr, ERR_OPERATION_FAILED, _W, "DB not initialized");
 
        bool ret;
-       std::vector<Json> records;
+       std::vector<CtxJson1> records;
        char *query = sqlite3_mprintf(
                        "SELECT " KEY_PKG_ID " FROM " CLIENT_INFO " WHERE " \
                        KEY_SUBJECT "='%q' LIMIT 1",
@@ -133,7 +133,7 @@ bool ClientInfo::exist(std::string subject)
        return true;
 }
 
-bool ClientInfo::set(std::string subject, std::string pkgId, Json option, int retentionPeriod)
+bool ClientInfo::set(std::string subject, std::string pkgId, CtxJson1 option, int retentionPeriod)
 {
        IF_FAIL_RETURN_TAG(__dbMgr, false, _W, "DB not initialized");
 
@@ -164,11 +164,11 @@ bool ClientInfo::remove(std::string subject, std::string pkgId)
        return ret;
 }
 
-void ClientInfo::getParam(std::vector<Json> &options, const char *key, float *min, float *max)
+void ClientInfo::getParam(std::vector<CtxJson1> &options, const char *key, float *min, float *max)
 {
        double val;
 
-       for (Json& opt : options) {
+       for (CtxJson1& opt : options) {
                if (!opt.get(NULL, key, &val))
                        continue;
                if (min)
@@ -184,7 +184,7 @@ void ClientInfo::purgeClient(std::string pkgId)
 
        bool ret;
        std::string subject;
-       std::vector<Json> records;
+       std::vector<CtxJson1> records;
 
        char *query = sqlite3_mprintf(
                        "SELECT " KEY_SUBJECT " FROM " CLIENT_INFO " WHERE " KEY_PKG_ID "='%q'",
@@ -194,7 +194,7 @@ void ClientInfo::purgeClient(std::string pkgId)
        sqlite3_free(query);
        IF_FAIL_VOID(ret);
 
-       for (Json& jObj : records) {
+       for (CtxJson1& jObj : records) {
                if (!jObj.get(NULL, KEY_SUBJECT, &subject))
                        continue;
                _I("Stop recording '%s' for '%s'", subject.c_str(), pkgId.c_str());