Delete LAST enum value. 71/92271/8
authorWoochan Lee <wc0917.lee@samsung.com>
Fri, 14 Oct 2016 07:44:04 +0000 (16:44 +0900)
committerWoochan Lee <wc0917.lee@samsung.com>
Wed, 26 Oct 2016 04:08:22 +0000 (13:08 +0900)
This can make ABI break...

Change-Id: I1c6cfbf3af9b3d4c34633f2e78eabe563637b643

src/examples/efl/c/main.cpp
src/include/efl/mobile/c/_ui_common_view_capi.h
src/include/efl/mobile/c/ui_application.h
src/include/efl/mobile/c/ui_view.h
src/include/interface/UiIfaceTypes.h
src/include/interface/_UiIfacePrivate.h [new file with mode: 0644]
src/lib/efl/mobile/c/ui_application.cpp
src/lib/efl/mobile/c/ui_view.cpp
src/lib/interface/UiIfaceView.cpp

index c2677e9ce43ccb1dd5957f6a82caed6c5d263588..c52895235abe8fba5800a88d1bdd07b677e65df0 100644 (file)
@@ -28,8 +28,7 @@ main(int argc, char *argv[])
 {
        ui_application_event_s events[]= {
                {UI_APPLICATION_EVENT_CREATE, app_create},
-               {UI_APPLICATION_EVENT_CONTROL, app_control},
-               {UI_APPLICATION_EVENT_LAST, NULL}
+               {UI_APPLICATION_EVENT_CONTROL, app_control}
        };
 
        int ret;
@@ -43,7 +42,7 @@ main(int argc, char *argv[])
        }
 
        //Run ui_app. Now it requests to run an application mainloop.
-       ret = ui_application_run(argc, argv, events, NULL);
+       ret = ui_application_run(argc, argv, events, 2, NULL);
        if (ret != TIZEN_ERROR_NONE)
        {
                dlog_print(DLOG_ERROR, LOG_TAG, "ui_app_run() is failed, ret = %d", ret);
index bc5c5650a4c6bc3f7b80819c1bb6e37b3d83578d..7a6a97a3597a00c5eedb699fdb3de786cacdfc13 100644 (file)
@@ -17,6 +17,8 @@
 #ifndef _UI_COMMON_VIEW_CAPI_H_
 #define _UI_COMMON_VIEW_CAPI_H_
 
+#include "../../../../include/interface/_UiIfacePrivate.h"
+
 namespace efl_viewmanager
 {
 
@@ -24,8 +26,8 @@ class ui_common_view_capi
 {
 public:
        //TODO: Optimize memory? We don't need all slots.
-       ui_view_event_cb event_cb[UI_VIEW_EVENT_LAST] = {nullptr, };
-       void* event_data[UI_VIEW_EVENT_LAST] = {nullptr, };
+       ui_view_event_cb event_cb[_NUM_OF_UI_VIEW_EVENT_TYPE] = {nullptr, };
+       void* event_data[_NUM_OF_UI_VIEW_EVENT_TYPE] = {nullptr, };
 
        const char *type = nullptr;
 
index c6cd06fe48deed38a252ae4554b7cd7b1a1335cd..3742c072657fcb39dd2708082abea78dde27194f 100644 (file)
@@ -42,12 +42,9 @@ typedef enum {
        UI_APPLICATION_EVENT_TERMINATE_PRE,   /**< App terminate pre */
        UI_APPLICATION_EVENT_PAUSE_PRE,       /**< App pause pre */
        UI_APPLICATION_EVENT_RESUME_PRE,      /**< App resume pre */
-       UI_APPLICATION_EVENT_CONTROL_PRE,     /**< App control pre */
-
-       UI_APPLICATION_EVENT_LAST
+       UI_APPLICATION_EVENT_CONTROL_PRE      /**< App control pre */
 } ui_application_event_type_e;
 
-
 /**
  *  @brief Struct for ui_application event.
  *  @since_tizen 3.0
@@ -85,6 +82,7 @@ EAPI int ui_application_init(const char *pkg, const char *locale_dir);
  *  @param[in] argc The argument count
  *  @param[in] argv The argument vector
  *  @param[in] events Event callback list
+ *  @param[in] count The number of event count
  *  @param[in] user_data User data for event callbacks
  *
  *  @return @c 0 on success, otherwise a negative error value.
@@ -101,7 +99,7 @@ EAPI int ui_application_init(const char *pkg, const char *locale_dir);
  *  @see ui_application_init()
  *  @see ui_application_term()
  */
-EAPI int ui_application_run(int argc, char **argv, ui_application_event_s *events, void *user_data);
+EAPI int ui_application_run(int argc, char **argv, ui_application_event_s *events, int count, void *user_data);
 
 /**
  *  @brief Deinitializes ui_application.
index 230e1dfc46801a463558b459a32a7e9546156454..dbdd77457c5695a54f8dbff26c80f26c21af9842 100644 (file)
@@ -59,9 +59,7 @@ typedef enum
        UI_VIEW_EVENT_PORTRAIT_POST,     /**< Portrait post */
        UI_VIEW_EVENT_LANDSCAPE_POST,    /**< Landscape post */
        UI_VIEW_EVENT_BACK_POST,         /**< Back post */
-       UI_VIEW_EVENT_MENU_POST,         /**< Menu post */
-
-       UI_VIEW_EVENT_LAST
+       UI_VIEW_EVENT_MENU_POST          /**< Menu post */
 } ui_view_event_type_e;
 
 /**
index ee3ee5d2f24ab8e3b911ee3d7cb2b673fd5c2a43..05c8cd4559f9d5c1a84b5d0647461cad1d01e51f 100644 (file)
@@ -28,8 +28,7 @@ typedef enum UiViewIndicator
        UI_VIEW_INDICATOR_OPTIMAL,     /**< Transparent indicator */
        UI_VIEW_INDICATOR_OVERLAP,     /**< Overlap indicator */
        UI_VIEW_INDICATOR_HIDE,        /**< Indicator hide */
-       UI_VIEW_INDICATOR_SHOW,        /**< Indicator show */
-       UI_VIEW_INDICATOR_LAST
+       UI_VIEW_INDICATOR_SHOW         /**< Indicator show */
 } ui_view_indicator;
 
 /**
@@ -43,8 +42,7 @@ typedef enum UiViewState
        UI_VIEW_STATE_UNLOAD,          /**< Unload state */
        UI_VIEW_STATE_ACTIVATE,        /**< Activate state */
        UI_VIEW_STATE_DEACTIVATE,      /**< Deactivate state */
-       UI_VIEW_STATE_PAUSE,           /**< Pause state */
-       UI_VIEW_STATE_LAST
+       UI_VIEW_STATE_PAUSE            /**< Pause state */
 } ui_view_state;
 
 /**
@@ -55,8 +53,7 @@ typedef enum UiViewOrientationMode
 {
        UI_VIEW_ORIENTATION_MODE_UNKNOWN = 0, /**< Unknown state (Exceptional case) */
        UI_VIEW_ORIENTATION_MODE_PORTRAIT,    /**< Portrait state */
-       UI_VIEW_ORIENTATION_MODE_LANDSCAPE,   /**< Landscape state */
-       UI_VIEW_ORIENTATION_MODE_LAST,
+       UI_VIEW_ORIENTATION_MODE_LANDSCAPE   /**< Landscape state */
 } ui_view_orientation_mode;
 
 #endif /* _UI_IFACE_TYPES_H_ */
diff --git a/src/include/interface/_UiIfacePrivate.h b/src/include/interface/_UiIfacePrivate.h
new file mode 100644 (file)
index 0000000..b468104
--- /dev/null
@@ -0,0 +1,10 @@
+#ifndef _UI_IFACE_PRIVATE_H_
+#define _UI_IFACE_PRIVATE_H_
+
+#define _NUM_OF_UI_APPLICATION_EVENT_TYPE 10
+#define _NUM_OF_UI_VIEW_EVENT_TYPE 24
+#define _NUM_OF_UI_VIEW_INDICATOR 6
+#define _NUM_OF_UI_VIEW_STATE 6
+#define _NUM_OF_UI_VIEW_ORIENTATION_MODE 3
+
+#endif /* _UI_IFACE_PRIVATE_H_ */
index 9f7aca872f43fe2d321fecf7e197ab5b1f86a9cb..f7a03157fde2f13be86c56e5fa99d5eba9de389b 100644 (file)
@@ -1,12 +1,13 @@
 #include "../../../../include/efl/mobile/c/_ui_private.h"
 #include "../../../../include/efl/mobile/c/ui_application.h"
+#include "../../../../include/interface/_UiIfacePrivate.h"
 
 class ui_app_capi : public UiApp
 {
 public:
 
-       ui_application_event_cb event_cb[UI_APPLICATION_EVENT_LAST] = {nullptr, };
-       void *user_data[UI_APPLICATION_EVENT_LAST] = {nullptr, };
+       ui_application_event_cb event_cb[_NUM_OF_UI_APPLICATION_EVENT_TYPE] = {nullptr, };
+       void *user_data[_NUM_OF_UI_APPLICATION_EVENT_TYPE] = {nullptr, };
 
        bool onCreate() override
        {
@@ -127,7 +128,7 @@ EAPI int ui_application_init(const char *pkg, const char *locale_dir)
        return TIZEN_ERROR_NONE;
 }
 
-EAPI int ui_application_run(int argc, char **argv, ui_application_event_s *events, void *user_data)
+EAPI int ui_application_run(int argc, char **argv, ui_application_event_s *events, int count, void *user_data)
 {
        ui_app_capi *app = g_app;
        if (!app)
@@ -136,14 +137,16 @@ EAPI int ui_application_run(int argc, char **argv, ui_application_event_s *event
                return TIZEN_ERROR_NOT_PERMITTED;
        }
 
-       int ret = TIZEN_ERROR_NONE;
+       if (count <= 0)
+       {
+               LOGE("Event Count is %d, Application have to implement app event at least 1(app_create).", count);
+               return TIZEN_ERROR_INVALID_PARAMETER;
+       }
 
-       int i = 0;
+       int ret = TIZEN_ERROR_NONE;
 
-       while (true)
+       for (int i = 0; i < count; i++)
        {
-               if (events[i].event_type == UI_APPLICATION_EVENT_LAST) break;
-
                if (events[i].event_type < UI_APPLICATION_EVENT_CREATE)
                {
                        LOGE("events[%d] is invalid(%d)", i, events[i].event_type);
@@ -153,8 +156,6 @@ EAPI int ui_application_run(int argc, char **argv, ui_application_event_s *event
                {
                        app->set_event_cb(events[i].event_type, events[i].event_cb, user_data);
                }
-
-               ++i;
        }
 
        if (ret != TIZEN_ERROR_NONE) return ret;
index 16786c963dc681fe49f6551bed57d3c0a0b03f26..b165ab7083713feaf3fa4866111636def6f9e383 100644 (file)
@@ -222,7 +222,7 @@ EAPI int ui_view_set_event_cb(ui_view *view, ui_view_event_type_e event_type, ui
        int ret = validate_view(view);
        if (ret != TIZEN_ERROR_NONE) return ret;
 
-       if (event_type < UI_VIEW_EVENT_LOAD || event_type >= UI_VIEW_EVENT_LAST)
+       if (event_type < UI_VIEW_EVENT_LOAD || event_type >= _NUM_OF_UI_VIEW_EVENT_TYPE)
        {
                LOGE("This view(%p) event_type is invalid(%d)", view, event_type);
                return TIZEN_ERROR_INVALID_PARAMETER;
index 9f0272e70f53bc52dfc868ab7868c7f5679044ce..5035fae47582db34e784aa45515ef1bebdb1e5b1 100644 (file)
@@ -16,6 +16,7 @@
  */
 
 #include "../../include/interface/UiIfaceViewManager.h"
+#include "../../include/interface/_UiIfacePrivate.h"
 
 #include <string>
 
@@ -189,7 +190,7 @@ void UiIfaceViewImpl::setRemovableContent(bool removable)
 
 int UiIfaceViewImpl::setIndicator(UiViewIndicator indicator)
 {
-       if (indicator <= UI_VIEW_INDICATOR_UNKNOWN || indicator >= UI_VIEW_INDICATOR_LAST)
+       if (indicator <= UI_VIEW_INDICATOR_UNKNOWN || indicator >= _NUM_OF_UI_VIEW_INDICATOR)
                return TIZEN_ERROR_INVALID_PARAMETER;
 
        this->_indicator = indicator;