#define APP_APP_CONTROL_REQUEST_H
#include "App/AppControl.h"
+#include "App/AppControlUtils.h"
#include "Utils/Range.h"
-#include <string>
-#include <vector>
-
#define APP_CONTROL_OPERATION_SETTING_CALL "http://tizen.org/appcontrol/operation/setting/call"
#define APP_CONTROL_MIME_CONTACT "application/vnd.tizen.contact"
* @return AppControl wrapper
*/
AppControl EXPORT_API requestPickRingtone(const char *selectedPath);
-
- /**
- * @brief Get single first string from App Control array extra data.
- * @param[in] appControl App Control handle
- * @param[in] key Extra data array key
- * @return First string from array on success, otherwise empty string.
- */
- std::string EXPORT_API getSingleExtraData(app_control_h appControl, const char *key);
-
- /**
- * @brief Get integer value from App Control array extra data.
- * @param[in] appControl App Control handle
- * @param[in] key Extra data array key
- * @return Integer value.
- */
- int EXPORT_API getIntExtraData(app_control_h appControl, const char *key);
-
- /**
- * @brief Get vector of integer values from App Control array extra data.
- * @param[in] appControl App Control handle
- * @param[in] key Extra data array key
- * @return Vector of integer values on success, otherwise empty vector.
- */
- std::vector<int> EXPORT_API getIntExtraDataArray(app_control_h appControl, const char *key);
}
#endif /* APP_APP_CONTROL_REQUEST_H */
--- /dev/null
+/*
+ * Copyright (c) 2015-2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef APP_APP_CONTROL_UTILS_H
+#define APP_APP_CONTROL_UTILS_H
+
+#include <app_control.h>
+#include <string>
+#include <vector>
+
+namespace App
+{
+ /**
+ * @brief Get single first string from App Control array extra data.
+ * @param[in] appControl App Control handle
+ * @param[in] key Extra data array key
+ * @return First string from array on success, otherwise empty string.
+ */
+ std::string EXPORT_API getSingleExtraData(app_control_h appControl, const char *key);
+
+ /**
+ * @brief Get integer value from App Control array extra data.
+ * @param[in] appControl App Control handle
+ * @param[in] key Extra data array key
+ * @return Integer value.
+ */
+ int EXPORT_API getIntExtraData(app_control_h appControl, const char *key);
+
+ /**
+ * @brief Get vector of integer values from App Control array extra data.
+ * @param[in] appControl App Control handle
+ * @param[in] key Extra data array key
+ * @return Vector of integer values on success, otherwise empty vector.
+ */
+ std::vector<int> EXPORT_API getIntExtraDataArray(app_control_h appControl, const char *key);
+}
+
+#endif /* APP_APP_CONTROL_UTILS_H */
*/
#include "App/AppControlRequest.h"
-#include "Utils/Logger.h"
using namespace App;
request.addExtra("default", "default show");
return request;
}
-
-std::string App::getSingleExtraData(app_control_h appControl, const char *key)
-{
- std::string result;
- char **array = nullptr;
- int count = 0;
-
- int err = app_control_get_extra_data_array(appControl, key, &array, &count);
- RETVM_IF_ERR(err, result, "app_control_get_extra_data_array() failed.");
-
- if (array && array[0]) {
- result = array[0];
- }
-
- for (int i = 0; i < count; ++i) {
- free(array[i]);
- }
- free(array);
-
- return result;
-}
-
-int App::getIntExtraData(app_control_h appControl, const char *key)
-{
- int result = 0;
- char *resultStr = nullptr;
-
- int err = app_control_get_extra_data(appControl, key, &resultStr);
- RETVM_IF_ERR(err, result, "app_control_get_extra_data_array() failed.");
-
- if (resultStr) {
- result = atoi(resultStr);
- free(resultStr);
- }
-
- return result;
-}
-
-std::vector<int> App::getIntExtraDataArray(app_control_h appControl, const char *key)
-{
- std::vector<int> result;
- char **array = nullptr;
- int count = 0;
-
- int err = app_control_get_extra_data_array(appControl, key, &array, &count);
- RETVM_IF_ERR(err, result, "app_control_get_extra_data_array() failed.");
- result.reserve(count);
-
- for (int i = 0; i < count; ++i) {
- int value = atoi(array[i]);
- result.push_back(value);
- free(array[i]);
- }
- free(array);
-
- return result;
-}
--- /dev/null
+/*
+ * Copyright (c) 2015-2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "App/AppControlUtils.h"
+#include "Utils/Logger.h"
+
+using namespace App;
+
+std::string App::getSingleExtraData(app_control_h appControl, const char *key)
+{
+ std::string result;
+ char **array = nullptr;
+ int count = 0;
+
+ int err = app_control_get_extra_data_array(appControl, key, &array, &count);
+ RETVM_IF_ERR(err, result, "app_control_get_extra_data_array() failed.");
+
+ if (array && array[0]) {
+ result = array[0];
+ }
+
+ for (int i = 0; i < count; ++i) {
+ free(array[i]);
+ }
+ free(array);
+
+ return result;
+}
+
+int App::getIntExtraData(app_control_h appControl, const char *key)
+{
+ int result = 0;
+ char *resultStr = nullptr;
+
+ int err = app_control_get_extra_data(appControl, key, &resultStr);
+ RETVM_IF_ERR(err, result, "app_control_get_extra_data_array() failed.");
+
+ if (resultStr) {
+ result = atoi(resultStr);
+ free(resultStr);
+ }
+
+ return result;
+}
+
+std::vector<int> App::getIntExtraDataArray(app_control_h appControl, const char *key)
+{
+ std::vector<int> result;
+ char **array = nullptr;
+ int count = 0;
+
+ int err = app_control_get_extra_data_array(appControl, key, &array, &count);
+ RETVM_IF_ERR(err, result, "app_control_get_extra_data_array() failed.");
+ result.reserve(count);
+
+ for (int i = 0; i < count; ++i) {
+ int value = atoi(array[i]);
+ result.push_back(value);
+ free(array[i]);
+ }
+ free(array);
+
+ return result;
+}