summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjh9216.park <jh9216.park@samsung.com>2021-06-09 20:25:43 -0400
committerjh9216.park <jh9216.park@samsung.com>2021-06-23 02:24:06 -0400
commit88e1c4680a965aef8bb12c74efa3936ca660f0ee (patch)
tree92a27736b4095b58150cec17bce6a7e4ef82d37b
parent1846eac6ddae817a79b1bbb42bd1bb5f75c7a29e (diff)
downloadapplication-88e1c4680a965aef8bb12c74efa3936ca660f0ee.tar.gz
application-88e1c4680a965aef8bb12c74efa3936ca660f0ee.tar.bz2
application-88e1c4680a965aef8bb12c74efa3936ca660f0ee.zip
Add internal api for c++
Change-Id: I17b790f64452e6bff3257c277e97a7154bb2d0e8 Signed-off-by: jh9216.park <jh9216.park@samsung.com>
-rw-r--r--CMakeLists.txt2
-rw-r--r--include/app.hpp76
-rw-r--r--packaging/capi-appfw-application.spec1
3 files changed, 78 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0c29ce8..5216a6d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -12,7 +12,7 @@ INSTALL(
DIRECTORY ${INC_DIR}/ DESTINATION include/appfw
FILES_MATCHING
PATTERN "*_private.h" EXCLUDE
- PATTERN "${INC_DIR}/*.h"
+ PATTERN "${INC_DIR}/*.h*"
)
IF(UNIX)
diff --git a/include/app.hpp b/include/app.hpp
new file mode 100644
index 0000000..283c397
--- /dev/null
+++ b/include/app.hpp
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * 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 TIZEN_APPFW_APP_HPP_
+#define TIZEN_APPFW_APP_HPP_
+
+#include <app.h>
+
+#include <app_control.hpp>
+#include <app_common.hpp>
+
+namespace tizen_appfw {
+
+class UiAppBase : public app_common::AppBase<
+ decltype(ui_app_add_event_handler)*,
+ decltype(ui_app_remove_event_handler)*> {
+ public:
+ using Remover = decltype(ui_app_remove_event_handler)*;
+
+ UiAppBase()
+ : AppBase(ui_app_add_event_handler, ui_app_remove_event_handler) {}
+
+ virtual bool OnCreate() { return true; }
+ virtual void OnTerminate() {}
+ virtual void OnResume() {}
+ virtual void OnPause() {}
+ virtual void OnAppControl(const ReceivedAppControl& ctrl) {}
+
+ int Run(int argc, char **argv) {
+ ui_app_lifecycle_callback_s callback = {
+ create : [](void* user_data) -> bool {
+ UiAppBase* b = static_cast<UiAppBase*>(user_data);
+ return b->OnCreate();
+ },
+ terminate : [](void* user_data) {
+ UiAppBase* b = static_cast<UiAppBase*>(user_data);
+ b->OnTerminate();
+ },
+ pause : [](void* user_data) {
+ UiAppBase* b = static_cast<UiAppBase*>(user_data);
+ b->OnPause();
+ },
+ resume : [](void* user_data) {
+ UiAppBase* b = static_cast<UiAppBase*>(user_data);
+ b->OnResume();
+ },
+ app_control : [](app_control_h app_control, void* user_data) {
+ UiAppBase* b = static_cast<UiAppBase*>(user_data);
+ b->OnAppControl(ReceivedAppControl(app_control));
+ }
+ };
+
+ return ui_app_main(argc, argv, &callback, this);
+ }
+
+ void Exit() noexcept {
+ ui_app_exit();
+ }
+};
+
+} // namespace tizen_appfw
+
+#endif // TIZEN_APPFW_APP_HPP_ \ No newline at end of file
diff --git a/packaging/capi-appfw-application.spec b/packaging/capi-appfw-application.spec
index 31af871..2bf176e 100644
--- a/packaging/capi-appfw-application.spec
+++ b/packaging/capi-appfw-application.spec
@@ -136,6 +136,7 @@ Header & package configuration of appcore-ui-app-ambient
%files devel
%manifest %{name}.manifest
%{_includedir}/appfw/app.h
+%{_includedir}/appfw/app.hpp
%{_includedir}/appfw/app_internal.h
%{_includedir}/appfw/app_extension.h
%{_includedir}/appfw/app_i18n.h