[SystemSetting] Adjust code to google style.
authorLukasz Bardeli <l.bardeli@samsung.com>
Fri, 13 Feb 2015 13:45:56 +0000 (14:45 +0100)
committerPawel Andruszkiewicz <p.andruszkie@samsung.com>
Fri, 13 Feb 2015 15:41:39 +0000 (00:41 +0900)
[Verification] Code compiles without error.

Change-Id: Ic9a43f103f6bc66a6b74af8849436f7b0083db58
Signed-off-by: Lukasz Bardeli <l.bardeli@samsung.com>
src/systemsetting/systemsetting_instance.cc
src/systemsetting/systemsetting_instance.h

index b1d412caabc4721704386c2a8785286f0c0d21b2..2efb13bb0ffbf15763362bb52e65cd218f7d11e1 100644 (file)
@@ -28,13 +28,13 @@ using namespace extension::systemsetting;
 
 SystemSettingInstance::SystemSettingInstance()
 {
-    using namespace std::placeholders;
+  using namespace std::placeholders;
 
 #define REGISTER(c,x) \
-RegisterHandler(c, std::bind(&SystemSettingInstance::x, this, _1, _2));
+    RegisterHandler(c, std::bind(&SystemSettingInstance::x, this, _1, _2));
 
-    REGISTER("SystemSettingManager_getProperty", getProperty);
-    REGISTER("SystemSettingManager_setProperty", setProperty);
+  REGISTER("SystemSettingManager_getProperty", getProperty);
+  REGISTER("SystemSettingManager_setProperty", setProperty);
 
 #undef REGISTER
 }
@@ -45,139 +45,139 @@ SystemSettingInstance::~SystemSettingInstance()
 
 void SystemSettingInstance::getProperty(const picojson::value& args, picojson::object& out)
 {
-    LoggerD("");
-    const double callback_id = args.get("callbackId").get<double>();
-
-    const std::string& type = args.get("type").get<std::string>();
-    LoggerD("Getting property type: %s ", type.c_str());
-
-    auto get = [this, type](const std::shared_ptr<picojson::value>& response) -> void {
-        LoggerD("Getting platform value");
-        picojson::value result = picojson::value(picojson::object());
-        PlatformResult status = getPlatformPropertyValue(type, &result);
-        if(status.IsSuccess())
-            ReportSuccess(result, response->get<picojson::object>());
-        else
-            ReportError(status, &response->get<picojson::object>());
-    };
-
-    auto get_response = [this, callback_id](const std::shared_ptr<picojson::value>& response) -> void {
-        LoggerD("Getting response");
-        picojson::object& obj = response->get<picojson::object>();
-        obj.insert(std::make_pair("callbackId", callback_id));
-        PostMessage(response->serialize().c_str());
-    };
-
-    TaskQueue::GetInstance().Queue<picojson::value>
-        (get, get_response, std::shared_ptr<picojson::value>(new picojson::value(picojson::object())));
+  LoggerD("");
+  const double callback_id = args.get("callbackId").get<double>();
+
+  const std::string& type = args.get("type").get<std::string>();
+  LoggerD("Getting property type: %s ", type.c_str());
+
+  auto get = [this, type](const std::shared_ptr<picojson::value>& response) -> void {
+    LoggerD("Getting platform value");
+    picojson::value result = picojson::value(picojson::object());
+    PlatformResult status = getPlatformPropertyValue(type, &result);
+    if(status.IsSuccess())
+      ReportSuccess(result, response->get<picojson::object>());
+    else
+      ReportError(status, &response->get<picojson::object>());
+  };
+
+  auto get_response = [this, callback_id](const std::shared_ptr<picojson::value>& response) -> void {
+    LoggerD("Getting response");
+    picojson::object& obj = response->get<picojson::object>();
+    obj.insert(std::make_pair("callbackId", callback_id));
+    PostMessage(response->serialize().c_str());
+  };
+
+  TaskQueue::GetInstance().Queue<picojson::value>
+  (get, get_response, std::shared_ptr<picojson::value>(new picojson::value(picojson::object())));
 }
 
 PlatformResult SystemSettingInstance::getPlatformPropertyValue(
-        const std::string& settingType,
-        picojson::value* out) {
-    picojson::object& result_obj = out->get<picojson::object>();
-
-    int ret;
-    char *value = NULL;
-    if (settingType == SETTING_HOME_SCREEN) {
-        ret = system_settings_get_value_string(
-            SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN, &value);
-    }
-    else if (settingType == SETTING_LOCK_SCREEN) {
-        ret = system_settings_get_value_string(
-            SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN, &value);
-    }
-    else if (settingType == SETTING_INCOMING_CALL) {
-        ret = system_settings_get_value_string(
-            SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, &value);
-    }
-    else if (settingType == SETTING_NOTIFICATION_EMAIL) {
-        ret = system_settings_get_value_string(
-            SYSTEM_SETTINGS_KEY_EMAIL_ALERT_RINGTONE, &value);
-    }
-    // other values (not specified in the documentation) are handled in JS
-
-    switch (ret) {
-        case SYSTEM_SETTINGS_ERROR_NONE:
-            LoggerD("ret == SYSTEM_SETTINGS_ERROR_NONE");
-            result_obj.insert(std::make_pair("value", value));
-            free(value);
-            return PlatformResult(ErrorCode::NO_ERROR);
-        case SYSTEM_SETTINGS_ERROR_CALL_UNSUPPORTED_API:
-            LoggerD("ret == SYSTEM_SETTINGS_ERROR_CALL_UNSUPPORTED_API");
-            return PlatformResult(ErrorCode::NOT_SUPPORTED_ERR,
-                    "This property is not supported.");
-        default:
-            LoggerD("Other error");
-            return PlatformResult(ErrorCode::UNKNOWN_ERR);
+    const std::string& settingType,
+    picojson::value* out) {
+  picojson::object& result_obj = out->get<picojson::object>();
+
+  int ret;
+  char *value = NULL;
+  if (settingType == SETTING_HOME_SCREEN) {
+    ret = system_settings_get_value_string(
+        SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN, &value);
+  }
+  else if (settingType == SETTING_LOCK_SCREEN) {
+    ret = system_settings_get_value_string(
+        SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN, &value);
+  }
+  else if (settingType == SETTING_INCOMING_CALL) {
+    ret = system_settings_get_value_string(
+        SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, &value);
+  }
+  else if (settingType == SETTING_NOTIFICATION_EMAIL) {
+    ret = system_settings_get_value_string(
+        SYSTEM_SETTINGS_KEY_EMAIL_ALERT_RINGTONE, &value);
+  }
+  // other values (not specified in the documentation) are handled in JS
+
+  switch (ret) {
+    case SYSTEM_SETTINGS_ERROR_NONE:
+      LoggerD("ret == SYSTEM_SETTINGS_ERROR_NONE");
+      result_obj.insert(std::make_pair("value", value));
+      free(value);
+      return PlatformResult(ErrorCode::NO_ERROR);
+    case SYSTEM_SETTINGS_ERROR_CALL_UNSUPPORTED_API:
+      LoggerD("ret == SYSTEM_SETTINGS_ERROR_CALL_UNSUPPORTED_API");
+      return PlatformResult(ErrorCode::NOT_SUPPORTED_ERR,
+                            "This property is not supported.");
+    default:
+      LoggerD("Other error");
+      return PlatformResult(ErrorCode::UNKNOWN_ERR);
   }
 }
 
 void SystemSettingInstance::setProperty(const picojson::value& args, picojson::object& out)
 {
-    LoggerD("");
-    const double callback_id = args.get("callbackId").get<double>();
-
-    const std::string& type = args.get("type").get<std::string>();
-    LoggerD("Type to set: %s ", type.c_str());
-
-    const std::string& value = args.get("value").get<std::string>();
-    LoggerD("Value to set: %s ", value.c_str());
-
-    auto get = [this, type, value](const std::shared_ptr<picojson::value>& response) -> void {
-        LoggerD("Setting platform value");
-        PlatformResult status = setPlatformPropertyValue(type, value);
-        if (status.IsSuccess())
-            ReportSuccess(response->get<picojson::object>());
-        else
-            ReportError(status, &response->get<picojson::object>());
-    };
-
-    auto get_response = [this, callback_id](const std::shared_ptr<picojson::value>& response) -> void {
-        LoggerD("Getting response");
-        picojson::object& obj = response->get<picojson::object>();
-        obj.insert(std::make_pair("callbackId", callback_id));
-        PostMessage(response->serialize().c_str());
-    };
-
-    TaskQueue::GetInstance().Queue<picojson::value>
-        (get, get_response, std::shared_ptr<picojson::value>(new picojson::value(picojson::object())));
+  LoggerD("");
+  const double callback_id = args.get("callbackId").get<double>();
+
+  const std::string& type = args.get("type").get<std::string>();
+  LoggerD("Type to set: %s ", type.c_str());
+
+  const std::string& value = args.get("value").get<std::string>();
+  LoggerD("Value to set: %s ", value.c_str());
+
+  auto get = [this, type, value](const std::shared_ptr<picojson::value>& response) -> void {
+    LoggerD("Setting platform value");
+    PlatformResult status = setPlatformPropertyValue(type, value);
+    if (status.IsSuccess())
+      ReportSuccess(response->get<picojson::object>());
+    else
+      ReportError(status, &response->get<picojson::object>());
+  };
+
+  auto get_response = [this, callback_id](const std::shared_ptr<picojson::value>& response) -> void {
+    LoggerD("Getting response");
+    picojson::object& obj = response->get<picojson::object>();
+    obj.insert(std::make_pair("callbackId", callback_id));
+    PostMessage(response->serialize().c_str());
+  };
+
+  TaskQueue::GetInstance().Queue<picojson::value>
+  (get, get_response, std::shared_ptr<picojson::value>(new picojson::value(picojson::object())));
 }
 
 PlatformResult SystemSettingInstance::setPlatformPropertyValue(
-        const std::string& settingType,
-        const std::string& settingValue) {
-    int ret;
-    if (settingType == SETTING_HOME_SCREEN) {
-        ret = system_settings_set_value_string(
-            SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN, settingValue.c_str());
-    }
-    else if (settingType == SETTING_LOCK_SCREEN) {
-        ret = system_settings_set_value_string(
-            SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN, settingValue.c_str());
-    }
-    else if (settingType == SETTING_INCOMING_CALL) {
-        ret = system_settings_set_value_string(
-            SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, settingValue.c_str());
-    }
-    else if (settingType == SETTING_NOTIFICATION_EMAIL) {
-        ret = system_settings_set_value_string(
-            SYSTEM_SETTINGS_KEY_EMAIL_ALERT_RINGTONE, settingValue.c_str());
-    }
-    // other values (not specified in the documentation) are handled in JS
-
-    switch (ret) {
-        case SYSTEM_SETTINGS_ERROR_NONE:
-            LoggerD("ret == SYSTEM_SETTINGS_ERROR_NONE");
-            return PlatformResult(ErrorCode::NO_ERROR);
-        case SYSTEM_SETTINGS_ERROR_CALL_UNSUPPORTED_API:
-            LoggerD("ret == SYSTEM_SETTINGS_ERROR_CALL_UNSUPPORTED_API");
-            return PlatformResult(ErrorCode::NOT_SUPPORTED_ERR,
-                    "This property is not supported.");
-        default:
-            LoggerD("Other error");
-            return PlatformResult(ErrorCode::UNKNOWN_ERR);
-    }
+    const std::string& settingType,
+    const std::string& settingValue) {
+  int ret;
+  if (settingType == SETTING_HOME_SCREEN) {
+    ret = system_settings_set_value_string(
+        SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN, settingValue.c_str());
+  }
+  else if (settingType == SETTING_LOCK_SCREEN) {
+    ret = system_settings_set_value_string(
+        SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN, settingValue.c_str());
+  }
+  else if (settingType == SETTING_INCOMING_CALL) {
+    ret = system_settings_set_value_string(
+        SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, settingValue.c_str());
+  }
+  else if (settingType == SETTING_NOTIFICATION_EMAIL) {
+    ret = system_settings_set_value_string(
+        SYSTEM_SETTINGS_KEY_EMAIL_ALERT_RINGTONE, settingValue.c_str());
+  }
+  // other values (not specified in the documentation) are handled in JS
+
+  switch (ret) {
+    case SYSTEM_SETTINGS_ERROR_NONE:
+      LoggerD("ret == SYSTEM_SETTINGS_ERROR_NONE");
+      return PlatformResult(ErrorCode::NO_ERROR);
+    case SYSTEM_SETTINGS_ERROR_CALL_UNSUPPORTED_API:
+      LoggerD("ret == SYSTEM_SETTINGS_ERROR_CALL_UNSUPPORTED_API");
+      return PlatformResult(ErrorCode::NOT_SUPPORTED_ERR,
+                            "This property is not supported.");
+    default:
+      LoggerD("Other error");
+      return PlatformResult(ErrorCode::UNKNOWN_ERR);
+  }
 }
 
 } // namespace systemsetting
index 8ad8e2bfc1f56a2b6b44f163f018edacab6c3d25..edbe7324c95be6c90e9691769cc957457992ca12 100644 (file)
@@ -13,20 +13,20 @@ namespace systemsetting {
 
 class SystemSettingInstance : public common::ParsedInstance
 {
-public:
-    SystemSettingInstance();
-    virtual ~SystemSettingInstance();
-
-private:
-    void getProperty(const picojson::value& args, picojson::object& out);
-    common::PlatformResult getPlatformPropertyValue(
-            const std::string& valueType,
-            picojson::value* out);
-
-    void setProperty(const picojson::value& args, picojson::object& out);
-    common::PlatformResult setPlatformPropertyValue(
-            const std::string& settingType,
-            const std::string& settingValue);
+ public:
+  SystemSettingInstance();
+  virtual ~SystemSettingInstance();
+
+ private:
+  void getProperty(const picojson::value& args, picojson::object& out);
+  common::PlatformResult getPlatformPropertyValue(
+      const std::string& valueType,
+      picojson::value* out);
+
+  void setProperty(const picojson::value& args, picojson::object& out);
+  common::PlatformResult setPlatformPropertyValue(
+      const std::string& settingType,
+      const std::string& settingValue);
 };
 
 } // namespace systemsetting