TizenRefApp-9096 [Call UI] Update UCL library 46/145646/1
authorIgor Olshevskyi <i.olshevskyi@samsung.com>
Fri, 11 Aug 2017 06:58:00 +0000 (09:58 +0300)
committerIgor Olshevskyi <i.olshevskyi@samsung.com>
Wed, 23 Aug 2017 07:26:03 +0000 (10:26 +0300)
Change-Id: Ib0ad8d859015e058413830ab4ed72b1abb41db6f

309 files changed:
.cproject
call-ui/common.h
call-ui/model/impl/IncomingCall.h
call-ui/presenters/Instance.cpp
call-ui/presenters/base/Page.cpp
call-ui/presenters/base/Page.h
call-ui/presenters/dialogs/AcceptDialog.cpp
call-ui/presenters/misc/AccessoryPresenter.cpp
call-ui/presenters/misc/CallInfoPresenter.cpp
call-ui/presenters/misc/IndicatorPresenter.cpp
call-ui/presenters/misc/MoreOptionsPresenter.cpp
call-ui/presenters/misc/RejectMsgPresenter.cpp
call-ui/presenters/misc/common.h
call-ui/presenters/pages/KeypadPage.cpp
call-ui/presenters/pages/MainPage.cpp
call-ui/presenters/pages/common.h
call-ui/view/AcceptRejectWidget.cpp
call-ui/view/Slider.cpp
call-ui/view/VolumeControl.cpp
call-ui/view/helpers.cpp
project_def.prop
ucl/inc/ucl/appfw/IInstance.h [deleted file]
ucl/inc/ucl/appfw/IInstanceAppControlExt.h [deleted file]
ucl/inc/ucl/appfw/IInstanceContext.h [deleted file]
ucl/inc/ucl/appfw/InstanceManagerBase.h [deleted file]
ucl/inc/ucl/appfw/SysEventProvider.h [deleted file]
ucl/inc/ucl/appfw/SysEventProvider.hpp [deleted file]
ucl/inc/ucl/appfw/UIApp.h [deleted file]
ucl/inc/ucl/appfw/helpers.h [deleted file]
ucl/inc/ucl/appfw/types.h [deleted file]
ucl/inc/ucl/config.h [deleted file]
ucl/inc/ucl/gui/EdjeWidget.h [deleted file]
ucl/inc/ucl/gui/EdjeWidget.hpp [deleted file]
ucl/inc/ucl/gui/ElmWidget.h [deleted file]
ucl/inc/ucl/gui/ElmWidget.hpp [deleted file]
ucl/inc/ucl/gui/Genlist.h [deleted file]
ucl/inc/ucl/gui/Genlist.hpp [deleted file]
ucl/inc/ucl/gui/GenlistItem.h [deleted file]
ucl/inc/ucl/gui/GenlistItem.hpp [deleted file]
ucl/inc/ucl/gui/Layout.h [deleted file]
ucl/inc/ucl/gui/Layout.hpp [deleted file]
ucl/inc/ucl/gui/NaviItem.h [deleted file]
ucl/inc/ucl/gui/NaviItem.hpp [deleted file]
ucl/inc/ucl/gui/Naviframe.h [deleted file]
ucl/inc/ucl/gui/Naviframe.hpp [deleted file]
ucl/inc/ucl/gui/StyledWidget.h [deleted file]
ucl/inc/ucl/gui/StyledWidget.hpp [deleted file]
ucl/inc/ucl/gui/Theme.h [deleted file]
ucl/inc/ucl/gui/Theme.hpp [deleted file]
ucl/inc/ucl/gui/Widget.h [deleted file]
ucl/inc/ucl/gui/Widget.hpp [deleted file]
ucl/inc/ucl/gui/WidgetItem.h [deleted file]
ucl/inc/ucl/gui/WidgetItem.hpp [deleted file]
ucl/inc/ucl/gui/Window.h [deleted file]
ucl/inc/ucl/gui/Window.hpp [deleted file]
ucl/inc/ucl/gui/helpers.h [deleted file]
ucl/inc/ucl/gui/helpers.hpp [deleted file]
ucl/inc/ucl/gui/stdTheme.h [deleted file]
ucl/inc/ucl/gui/stdTheme/common.h [deleted file]
ucl/inc/ucl/gui/stdTheme/layout.h [deleted file]
ucl/inc/ucl/gui/stdTheme/naviframe.h [deleted file]
ucl/inc/ucl/gui/types.h [deleted file]
ucl/inc/ucl/gui/types.hpp [deleted file]
ucl/inc/ucl/misc/Aspect.h [deleted file]
ucl/inc/ucl/misc/Aspect.hpp [deleted file]
ucl/inc/ucl/misc/AutoHandle.h [deleted file]
ucl/inc/ucl/misc/CString.h [deleted file]
ucl/inc/ucl/misc/CString.hpp [deleted file]
ucl/inc/ucl/misc/ConstCString.h [deleted file]
ucl/inc/ucl/misc/ConstCString.hpp [deleted file]
ucl/inc/ucl/misc/Event.h [deleted file]
ucl/inc/ucl/misc/Event.hpp [deleted file]
ucl/inc/ucl/misc/HashMap.h [deleted file]
ucl/inc/ucl/misc/HashMap.hpp [deleted file]
ucl/inc/ucl/misc/RefCountAware.h [deleted file]
ucl/inc/ucl/misc/RefCountAware.hpp [deleted file]
ucl/inc/ucl/misc/TString.h [deleted file]
ucl/inc/ucl/misc/TString.hpp [deleted file]
ucl/inc/ucl/misc/Timeout.h [deleted file]
ucl/inc/ucl/misc/Variant.h [deleted file]
ucl/inc/ucl/misc/Variant.hpp [deleted file]
ucl/inc/ucl/mvp/GuiPresenter.h [deleted file]
ucl/inc/ucl/mvp/ListItemPresenter.h [deleted file]
ucl/inc/ucl/mvp/ListPresenter.h [deleted file]
ucl/inc/ucl/mvp/types.h [deleted file]
ucl/inc/ucl/util/delegation.h [deleted file]
ucl/inc/ucl/util/delegation/BaseDelegate.h [deleted file]
ucl/inc/ucl/util/delegation/BaseDelegate.hpp [deleted file]
ucl/inc/ucl/util/delegation/BaseDelegate2.h [deleted file]
ucl/inc/ucl/util/delegation/BaseDelegate2.hpp [deleted file]
ucl/inc/ucl/util/delegation/Callback.h [deleted file]
ucl/inc/ucl/util/delegation/Callback.hpp [deleted file]
ucl/inc/ucl/util/delegation/Delegate.h [deleted file]
ucl/inc/ucl/util/delegation/Delegate.hpp [deleted file]
ucl/inc/ucl/util/delegation/Delegate2.h [deleted file]
ucl/inc/ucl/util/delegation/Delegate2.hpp [deleted file]
ucl/inc/ucl/util/delegation/helpers.h [deleted file]
ucl/inc/ucl/util/delegation/macro.h [deleted file]
ucl/inc/ucl/util/delegation/shortMacro.h [deleted file]
ucl/inc/ucl/util/helpers.h [deleted file]
ucl/inc/ucl/util/helpers.hpp [deleted file]
ucl/inc/ucl/util/logging.h [deleted file]
ucl/inc/ucl/util/memory.h [deleted file]
ucl/inc/ucl/util/memory/BaseRef.h [deleted file]
ucl/inc/ucl/util/memory/BaseRef.hpp [deleted file]
ucl/inc/ucl/util/memory/IRefCountObj.h [deleted file]
ucl/inc/ucl/util/memory/RefCountObj.h [deleted file]
ucl/inc/ucl/util/memory/RefCountObj.hpp [deleted file]
ucl/inc/ucl/util/memory/RefCounterMT.h [deleted file]
ucl/inc/ucl/util/memory/RefCounterMT.hpp [deleted file]
ucl/inc/ucl/util/memory/RefCounterST.h [deleted file]
ucl/inc/ucl/util/memory/RefCounterST.hpp [deleted file]
ucl/inc/ucl/util/memory/ReffedObj.h [deleted file]
ucl/inc/ucl/util/memory/ReffedObj.hpp [deleted file]
ucl/inc/ucl/util/memory/SharedRef.h [deleted file]
ucl/inc/ucl/util/memory/SharedRef.hpp [deleted file]
ucl/inc/ucl/util/memory/WeakRef.h [deleted file]
ucl/inc/ucl/util/memory/WeakRef.hpp [deleted file]
ucl/inc/ucl/util/memory/helpers.h [deleted file]
ucl/inc/ucl/util/memory/macro.h [deleted file]
ucl/inc/ucl/util/shortLogs.h [deleted file]
ucl/inc/ucl/util/smartDelegation.h [deleted file]
ucl/inc/ucl/util/smartDelegation/WeakDelegate.h [deleted file]
ucl/inc/ucl/util/smartDelegation/WeakDelegate.hpp [deleted file]
ucl/inc/ucl/util/smartDelegation/macro.h [deleted file]
ucl/inc/ucl/util/smartDelegation/shortMacro.h [deleted file]
ucl/inc/ucl/util/threading.h [deleted file]
ucl/inc/ucl/util/threading/CondVar.h [deleted file]
ucl/inc/ucl/util/threading/CondVar.hpp [deleted file]
ucl/inc/ucl/util/threading/Mutex.h [deleted file]
ucl/inc/ucl/util/threading/Mutex.hpp [deleted file]
ucl/inc/ucl/util/threading/MutexLock.h [deleted file]
ucl/inc/ucl/util/threading/MutexLock.hpp [deleted file]
ucl/inc/ucl/util/threading/Thread.h [deleted file]
ucl/inc/ucl/util/threading/Thread.hpp [deleted file]
ucl/inc/ucl/util/types.h [deleted file]
ucl/inc/ucl/util/types/Result.h [deleted file]
ucl/inc/ucl/util/types/Result.hpp [deleted file]
ucl/inc/ucl/util/types/baseTypes.h [deleted file]
ucl/inc/ucl/util/types/classTypes.h [deleted file]
ucl/include/ucl/appfw/IInstance.h [new file with mode: 0644]
ucl/include/ucl/appfw/IInstanceAppControlExt.h [new file with mode: 0644]
ucl/include/ucl/appfw/IInstanceContext.h [new file with mode: 0644]
ucl/include/ucl/appfw/InstanceManagerBase.h [new file with mode: 0644]
ucl/include/ucl/appfw/SysEventProvider.h [new file with mode: 0644]
ucl/include/ucl/appfw/SysEventProvider.hpp [new file with mode: 0644]
ucl/include/ucl/appfw/UIApp.h [new file with mode: 0644]
ucl/include/ucl/appfw/helpers.h [new file with mode: 0644]
ucl/include/ucl/appfw/types.h [new file with mode: 0644]
ucl/include/ucl/config.h [new file with mode: 0644]
ucl/include/ucl/gui/EdjeWidget.h [new file with mode: 0644]
ucl/include/ucl/gui/EdjeWidget.hpp [new file with mode: 0644]
ucl/include/ucl/gui/ElmWidget.h [new file with mode: 0644]
ucl/include/ucl/gui/ElmWidget.hpp [new file with mode: 0644]
ucl/include/ucl/gui/Genlist.h [new file with mode: 0644]
ucl/include/ucl/gui/Genlist.hpp [new file with mode: 0644]
ucl/include/ucl/gui/GenlistItem.h [new file with mode: 0644]
ucl/include/ucl/gui/GenlistItem.hpp [new file with mode: 0644]
ucl/include/ucl/gui/Layout.h [new file with mode: 0644]
ucl/include/ucl/gui/Layout.hpp [new file with mode: 0644]
ucl/include/ucl/gui/NaviItem.h [new file with mode: 0644]
ucl/include/ucl/gui/NaviItem.hpp [new file with mode: 0644]
ucl/include/ucl/gui/Naviframe.h [new file with mode: 0644]
ucl/include/ucl/gui/Naviframe.hpp [new file with mode: 0644]
ucl/include/ucl/gui/StyledWidget.h [new file with mode: 0644]
ucl/include/ucl/gui/StyledWidget.hpp [new file with mode: 0644]
ucl/include/ucl/gui/Theme.h [new file with mode: 0644]
ucl/include/ucl/gui/Theme.hpp [new file with mode: 0644]
ucl/include/ucl/gui/Widget.h [new file with mode: 0644]
ucl/include/ucl/gui/Widget.hpp [new file with mode: 0644]
ucl/include/ucl/gui/WidgetItem.h [new file with mode: 0644]
ucl/include/ucl/gui/WidgetItem.hpp [new file with mode: 0644]
ucl/include/ucl/gui/Window.h [new file with mode: 0644]
ucl/include/ucl/gui/Window.hpp [new file with mode: 0644]
ucl/include/ucl/gui/helpers.h [new file with mode: 0644]
ucl/include/ucl/gui/helpers.hpp [new file with mode: 0644]
ucl/include/ucl/gui/stdTheme.h [new file with mode: 0644]
ucl/include/ucl/gui/stdTheme/common.h [new file with mode: 0644]
ucl/include/ucl/gui/stdTheme/layout.h [new file with mode: 0644]
ucl/include/ucl/gui/stdTheme/naviframe.h [new file with mode: 0644]
ucl/include/ucl/gui/types.h [new file with mode: 0644]
ucl/include/ucl/gui/types.hpp [new file with mode: 0644]
ucl/include/ucl/misc/Aspect.h [new file with mode: 0644]
ucl/include/ucl/misc/Aspect.hpp [new file with mode: 0644]
ucl/include/ucl/misc/AutoHandle.h [new file with mode: 0644]
ucl/include/ucl/misc/CString.h [new file with mode: 0644]
ucl/include/ucl/misc/CString.hpp [new file with mode: 0644]
ucl/include/ucl/misc/ConstCString.h [new file with mode: 0644]
ucl/include/ucl/misc/ConstCString.hpp [new file with mode: 0644]
ucl/include/ucl/misc/Event.h [new file with mode: 0644]
ucl/include/ucl/misc/Event.hpp [new file with mode: 0644]
ucl/include/ucl/misc/HashMap.h [new file with mode: 0644]
ucl/include/ucl/misc/HashMap.hpp [new file with mode: 0644]
ucl/include/ucl/misc/RefCountAware.h [new file with mode: 0644]
ucl/include/ucl/misc/RefCountAware.hpp [new file with mode: 0644]
ucl/include/ucl/misc/TString.h [new file with mode: 0644]
ucl/include/ucl/misc/TString.hpp [new file with mode: 0644]
ucl/include/ucl/misc/Timeout.h [new file with mode: 0644]
ucl/include/ucl/misc/Variant.h [new file with mode: 0644]
ucl/include/ucl/misc/Variant.hpp [new file with mode: 0644]
ucl/include/ucl/mvp/GuiPresenter.h [new file with mode: 0644]
ucl/include/ucl/mvp/ListItemPresenter.h [new file with mode: 0644]
ucl/include/ucl/mvp/ListPresenter.h [new file with mode: 0644]
ucl/include/ucl/mvp/types.h [new file with mode: 0644]
ucl/include/ucl/util/delegation.h [new file with mode: 0644]
ucl/include/ucl/util/delegation/BaseDelegate.h [new file with mode: 0644]
ucl/include/ucl/util/delegation/BaseDelegate.hpp [new file with mode: 0644]
ucl/include/ucl/util/delegation/BaseDelegate2.h [new file with mode: 0644]
ucl/include/ucl/util/delegation/BaseDelegate2.hpp [new file with mode: 0644]
ucl/include/ucl/util/delegation/Callback.h [new file with mode: 0644]
ucl/include/ucl/util/delegation/Callback.hpp [new file with mode: 0644]
ucl/include/ucl/util/delegation/Delegate.h [new file with mode: 0644]
ucl/include/ucl/util/delegation/Delegate.hpp [new file with mode: 0644]
ucl/include/ucl/util/delegation/Delegate2.h [new file with mode: 0644]
ucl/include/ucl/util/delegation/Delegate2.hpp [new file with mode: 0644]
ucl/include/ucl/util/delegation/helpers.h [new file with mode: 0644]
ucl/include/ucl/util/delegation/macro.h [new file with mode: 0644]
ucl/include/ucl/util/delegation/shortMacro.h [new file with mode: 0644]
ucl/include/ucl/util/helpers.h [new file with mode: 0644]
ucl/include/ucl/util/helpers.hpp [new file with mode: 0644]
ucl/include/ucl/util/logging.h [new file with mode: 0644]
ucl/include/ucl/util/memory.h [new file with mode: 0644]
ucl/include/ucl/util/memory/BaseRef.h [new file with mode: 0644]
ucl/include/ucl/util/memory/BaseRef.hpp [new file with mode: 0644]
ucl/include/ucl/util/memory/IRefCountObj.h [new file with mode: 0644]
ucl/include/ucl/util/memory/RefCountObj.h [new file with mode: 0644]
ucl/include/ucl/util/memory/RefCountObj.hpp [new file with mode: 0644]
ucl/include/ucl/util/memory/RefCounterMT.h [new file with mode: 0644]
ucl/include/ucl/util/memory/RefCounterMT.hpp [new file with mode: 0644]
ucl/include/ucl/util/memory/RefCounterST.h [new file with mode: 0644]
ucl/include/ucl/util/memory/RefCounterST.hpp [new file with mode: 0644]
ucl/include/ucl/util/memory/ReffedObj.h [new file with mode: 0644]
ucl/include/ucl/util/memory/ReffedObj.hpp [new file with mode: 0644]
ucl/include/ucl/util/memory/SharedRef.h [new file with mode: 0644]
ucl/include/ucl/util/memory/SharedRef.hpp [new file with mode: 0644]
ucl/include/ucl/util/memory/WeakRef.h [new file with mode: 0644]
ucl/include/ucl/util/memory/WeakRef.hpp [new file with mode: 0644]
ucl/include/ucl/util/memory/helpers.h [new file with mode: 0644]
ucl/include/ucl/util/memory/macro.h [new file with mode: 0644]
ucl/include/ucl/util/shortLogs.h [new file with mode: 0644]
ucl/include/ucl/util/smartDelegation.h [new file with mode: 0644]
ucl/include/ucl/util/smartDelegation/WeakDelegate.h [new file with mode: 0644]
ucl/include/ucl/util/smartDelegation/WeakDelegate.hpp [new file with mode: 0644]
ucl/include/ucl/util/smartDelegation/macro.h [new file with mode: 0644]
ucl/include/ucl/util/smartDelegation/shortMacro.h [new file with mode: 0644]
ucl/include/ucl/util/threading.h [new file with mode: 0644]
ucl/include/ucl/util/threading/CondVar.h [new file with mode: 0644]
ucl/include/ucl/util/threading/CondVar.hpp [new file with mode: 0644]
ucl/include/ucl/util/threading/Mutex.h [new file with mode: 0644]
ucl/include/ucl/util/threading/Mutex.hpp [new file with mode: 0644]
ucl/include/ucl/util/threading/MutexLock.h [new file with mode: 0644]
ucl/include/ucl/util/threading/MutexLock.hpp [new file with mode: 0644]
ucl/include/ucl/util/threading/Thread.h [new file with mode: 0644]
ucl/include/ucl/util/threading/Thread.hpp [new file with mode: 0644]
ucl/include/ucl/util/types.h [new file with mode: 0644]
ucl/include/ucl/util/types/Result.h [new file with mode: 0644]
ucl/include/ucl/util/types/Result.hpp [new file with mode: 0644]
ucl/include/ucl/util/types/baseTypes.h [new file with mode: 0644]
ucl/include/ucl/util/types/classTypes.h [new file with mode: 0644]
ucl/source/appfw/InstanceManagerBase.cpp [new file with mode: 0644]
ucl/source/appfw/SysEventProvider.cpp [new file with mode: 0644]
ucl/source/appfw/UIApp.cpp [new file with mode: 0644]
ucl/source/appfw/common.h [new file with mode: 0644]
ucl/source/appfw/helpers.cpp [new file with mode: 0644]
ucl/source/common.h [new file with mode: 0644]
ucl/source/gui/EdjeWidget.cpp [new file with mode: 0644]
ucl/source/gui/ElmWidget.cpp [new file with mode: 0644]
ucl/source/gui/Genlist.cpp [new file with mode: 0644]
ucl/source/gui/Layout.cpp [new file with mode: 0644]
ucl/source/gui/NaviItem.cpp [new file with mode: 0644]
ucl/source/gui/Naviframe.cpp [new file with mode: 0644]
ucl/source/gui/Widget.cpp [new file with mode: 0644]
ucl/source/gui/WidgetItem.cpp [new file with mode: 0644]
ucl/source/gui/Window.cpp [new file with mode: 0644]
ucl/source/gui/common.h [new file with mode: 0644]
ucl/source/misc/Timeout.cpp [new file with mode: 0644]
ucl/source/misc/Variant.cpp [new file with mode: 0644]
ucl/source/misc/common.h [new file with mode: 0644]
ucl/source/mvp/GuiPresenter.cpp [new file with mode: 0644]
ucl/source/mvp/ListItemPresenter.cpp [new file with mode: 0644]
ucl/source/mvp/ListPresenter.cpp [new file with mode: 0644]
ucl/source/mvp/common.h [new file with mode: 0644]
ucl/source/util/logging.cpp [new file with mode: 0644]
ucl/source/util/types/Result.cpp [new file with mode: 0644]
ucl/src/appfw/InstanceManagerBase.cpp [deleted file]
ucl/src/appfw/SysEventProvider.cpp [deleted file]
ucl/src/appfw/UIApp.cpp [deleted file]
ucl/src/appfw/common.h [deleted file]
ucl/src/appfw/helpers.cpp [deleted file]
ucl/src/common.h [deleted file]
ucl/src/gui/EdjeWidget.cpp [deleted file]
ucl/src/gui/ElmWidget.cpp [deleted file]
ucl/src/gui/Genlist.cpp [deleted file]
ucl/src/gui/Layout.cpp [deleted file]
ucl/src/gui/NaviItem.cpp [deleted file]
ucl/src/gui/Naviframe.cpp [deleted file]
ucl/src/gui/Widget.cpp [deleted file]
ucl/src/gui/WidgetItem.cpp [deleted file]
ucl/src/gui/Window.cpp [deleted file]
ucl/src/gui/common.h [deleted file]
ucl/src/misc/Timeout.cpp [deleted file]
ucl/src/misc/Variant.cpp [deleted file]
ucl/src/misc/common.h [deleted file]
ucl/src/mvp/GuiPresenter.cpp [deleted file]
ucl/src/mvp/ListItemPresenter.cpp [deleted file]
ucl/src/mvp/ListPresenter.cpp [deleted file]
ucl/src/mvp/common.h [deleted file]
ucl/src/util/logging.cpp [deleted file]
ucl/src/util/types/Result.cpp [deleted file]

index 74dfbc8de9d29d81f9d831ff1cf875cf505f4a49..ae875a3e26d550edccaddbcfe4aef65fd0990ba8 100644 (file)
--- a/.cproject
+++ b/.cproject
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/lib/dbus-1.0/include&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/lib/glib-2.0/include&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}&quot;"/>
-                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/ucl/inc}&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/ucl/include}&quot;"/>
                                                                </option>
                                                                <option id="sbi.gnu.cpp.compiler.option.frameworks.core.1469916614" name="Tizen-Frameworks" superClass="sbi.gnu.cpp.compiler.option.frameworks.core" valueType="userObjs">
                                                                        <listOptionValue builtIn="false" value="Native_API"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ug-1&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/vconf&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}&quot;"/>
-                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/ucl/inc}&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/ucl/include}&quot;"/>
                                                                </option>
                                                                <option id="sbi.gnu.c.compiler.option.frameworks.core.1478193049" name="Tizen-Frameworks" superClass="sbi.gnu.c.compiler.option.frameworks.core" valueType="userObjs">
                                                                        <listOptionValue builtIn="false" value="Native_API"/>
                                        <sourceEntries>
                                                <entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="call-ui"/>
                                                <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="res"/>
-                                               <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="ucl/inc"/>
-                                               <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="ucl/src"/>
+                                               <entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="ucl/source"/>
                                        </sourceEntries>
                                </configuration>
                        </storageModule>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/lib/dbus-1.0/include&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/lib/glib-2.0/include&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}&quot;"/>
-                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/ucl/inc}&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/ucl/include}&quot;"/>
                                                                </option>
                                                                <option id="sbi.gnu.cpp.compiler.option.frameworks.core.863139267" name="Tizen-Frameworks" superClass="sbi.gnu.cpp.compiler.option.frameworks.core" valueType="userObjs">
                                                                        <listOptionValue builtIn="false" value="Native_API"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ug-1&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/vconf&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}&quot;"/>
-                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/ucl/inc}&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/ucl/include}&quot;"/>
                                                                </option>
                                                                <option id="sbi.gnu.c.compiler.option.frameworks.core.1251626395" name="Tizen-Frameworks" superClass="sbi.gnu.c.compiler.option.frameworks.core" valueType="userObjs">
                                                                        <listOptionValue builtIn="false" value="Native_API"/>
                                        <sourceEntries>
                                                <entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="call-ui"/>
                                                <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="res"/>
-                                               <entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="ucl/inc"/>
-                                               <entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="ucl/src"/>
+                                               <entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="ucl/source"/>
                                        </sourceEntries>
                                </configuration>
                        </storageModule>
index 43fd570540d67dfcf16581567b8c7f7fe243741a..8b27447d0a5243e2d55befe664d7049176e5d63d 100644 (file)
@@ -41,6 +41,10 @@ namespace callui {
 
        constexpr SmartEvent WIN_POWER_KEY_UP_EVENT {"callui,powerkey,up"};
 
+       namespace util {
+
+               using ucl::util::dispose;
+       }
 }
 
 #endif // __CALL_UI_COMMON_H__
index 7b1e3e094897f53dd7ed7f2542353886c56a1f0d..2a163a410b536d02246039421e97d4d83e4591b0 100644 (file)
@@ -14,8 +14,8 @@
  * limitations under the License.
  */
 
-#ifndef __CALL_UI_MODEL_IMPL_ICOMING_CALL_H__
-#define __CALL_UI_MODEL_IMPL_ICOMING_CALL_H__
+#ifndef __CALL_UI_MODEL_IMPL_INCOMING_CALL_H__
+#define __CALL_UI_MODEL_IMPL_INCOMING_CALL_H__
 
 #include <call-manager-ext.h>
 
@@ -58,4 +58,4 @@ namespace callui {
 
 }
 
-#endif // __CALL_UI_MODEL_IMPL_ICOMING_CALL_H__
+#endif // __CALL_UI_MODEL_IMPL_INCOMING_CALL_H__
index 58f62dd65229dbef40ce9bfd1b83fc354b3cc161..7086452aa9f9a7fd06d17049baa95308630a73f6 100644 (file)
@@ -59,9 +59,7 @@ namespace callui {
                        ecore_event_handler_del(m_keyUpEventHandler);
                }
 
-               if (const auto page = m_page.lock()) {
-                       page->exitNoTransition();
-               }
+               util::dispose(m_page);
        }
 
        Result Instance::onCreate(IInstanceContext *const context)
index f2f1fa3294622f13b726cf00c8535d6e4b255a83..4286fdaf91fc9a24e895a603b45af5b532f6435b 100644 (file)
@@ -100,20 +100,27 @@ namespace callui {
                        m_navi->pop();
                        m_item = nullptr;
                } else {
-                       exitNoTransition();
+                       dispose();
                }
        }
 
-       void Page::exitNoTransition()
+       void Page::dispose()
        {
-               if (isAtTop()) {
-                       m_item.del();
-                       dispatchTopPageChanged();
-               } else if (m_item) {
-                       m_item.del();
+               if (m_item) {
+                       if (isAtTop()) {
+                               m_item.del();
+                               dispatchTopPageChanged();
+                       } else {
+                               m_item.del();
+                       }
                }
        }
 
+       bool Page::isDisposed() const
+       {
+               return m_item;
+       }
+
        void Page::popTo()
        {
                if (m_item && !isAtTop()) {
index ef039b366bb20287bfbb825510fd3d03b037490c..59295ec568e46859824b3629d48ffdbf5b2f309e 100644 (file)
 
 #include "ucl/mvp/GuiPresenter.h"
 
-#include "call-ui/types.h"
-
 namespace callui {
 
        UCL_DECLARE_REF_ALIASES(Page);
 
-       class Page : public ucl::GuiPresenter {
+       class Page : public ucl::GuiPresenter,
+                       public ucl::IDisposable {
        public:
                using ExitRequestHandler = ucl::WeakDelegate<void(Page &page)>;
 
@@ -38,7 +37,6 @@ namespace callui {
                bool isAtBottom() const;
 
                void exit();
-               void exitNoTransition();
 
                void popTo();
                void deleteTo();
@@ -50,6 +48,11 @@ namespace callui {
                template <class ...ARGS>
                ucl::NaviItem insertBefore(ARGS &&...args);
 
+               // ucl::IDisposable
+
+               virtual void dispose() override;
+               virtual bool isDisposed() const final override;
+
        protected:
                Page(ucl::IRefCountObj &rc, const ucl::NaviframeSRef &navi,
                                const ExitRequestHandler &onExitRequest);
index b6b31e9d1e2d3c7505f6d994e17a261d3cfb8e0f..2bbffa9bebd8bd4bb639117359dfe269640092ad 100644 (file)
@@ -112,7 +112,7 @@ namespace callui {
                if (!popupEo) {
                        LOG_RETURN(RES_FAIL, "elm_popup_add() failed!");
                }
-               m_popup = makeShared<StyledWidget>(popupEo, true);
+               m_popup = makeShared<StyledWidget>(popupEo);
                m_popup->setStyle(style);
                m_popup->setWeight(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
                show(*m_popup);
@@ -144,7 +144,7 @@ namespace callui {
                elm_genlist_mode_set(glEo, ELM_LIST_COMPRESS);
                elm_genlist_homogeneous_set(glEo, EINA_TRUE);
 
-               m_genlist = makeShared<StyledWidget>(glEo);
+               m_genlist = makeShared<StyledWidget>(glEo, false);
                m_genlist->setWeight(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
                m_genlist->setAlign(EVAS_HINT_FILL, EVAS_HINT_FILL);
 
index 61c8eabb1d33e9076a22773d0681edc5550deedb..0b463c19ae6afe40f7c7b9eb27212824b64d0aeb 100644 (file)
@@ -264,7 +264,6 @@ namespace callui {
        {
                m_widget = Layout::Builder().
                                setTheme(impl::LAYOUT_ACCESSORY_WIDGET).
-                               setIsOwner(true).
                                build(parent);
                if (!m_widget) {
                        LOG_RETURN(RES_FAIL, "Layout::build() failed!");
@@ -322,7 +321,7 @@ namespace callui {
                        LOG_RETURN(RES_FAIL, "eo is NULL");
                }
 
-               m_volumeBtn = makeShared<StyledWidget>(eo, true);
+               m_volumeBtn = makeShared<StyledWidget>(eo);
                m_volumeBtn->setStyle(impl::STYLE_BTN_VOLUME);
                m_volumeBtn->addEventHandler(BTN_CLICKED,
                                WEAK_DELEGATE(AccessoryPresenter::onVolumeBtnClicked,
@@ -342,7 +341,7 @@ namespace callui {
                if (!eo) {
                        LOG_RETURN(RES_FAIL, "eo is NULL");
                }
-               m_muteBtn = makeShared<StyledWidget>(eo, true);
+               m_muteBtn = makeShared<StyledWidget>(eo);
                m_muteBtn->setStyle(impl::STYLE_BTN_MUTE);
                m_muteBtn->addEventHandler(BTN_CLICKED,
                                WEAK_DELEGATE(AccessoryPresenter::onMuteBtnClicked,
@@ -363,7 +362,7 @@ namespace callui {
                if (!eo) {
                        LOG_RETURN(RES_FAIL, "eo is NULL");
                }
-               m_bluetoothBtn = makeShared<StyledWidget>(eo, true);
+               m_bluetoothBtn = makeShared<StyledWidget>(eo);
                m_bluetoothBtn->setStyle(impl::STYLE_BTN_BT);
                m_bluetoothBtn->addEventHandler(BTN_CLICKED,
                                WEAK_DELEGATE(AccessoryPresenter::onBluetoothBtnClicked,
@@ -398,7 +397,7 @@ namespace callui {
                if (!eo) {
                        LOG_RETURN(RES_FAIL, "eo is NULL");
                }
-               m_addContactBtn = makeShared<StyledWidget>(eo, true);
+               m_addContactBtn = makeShared<StyledWidget>(eo);
                m_addContactBtn->setStyle(impl::STYLE_BTN_ADD_CONTACT);
                m_addContactBtn->addEventHandler(BTN_CLICKED,
                                WEAK_DELEGATE(AccessoryPresenter::onAddContactBtnClicked,
index c36741d62bb847adf4a150907264c4a756de5909..1dba75fd88679f0fef6d613ce0184069c77a9f22 100644 (file)
@@ -174,7 +174,6 @@ namespace callui {
        {
                m_widget = Layout::Builder().
                                setTheme(impl::LAYOUT_CALLER_INFO_WIDGET).
-                               setIsOwner(true).
                                build(parent);
                if (!m_widget) {
                        LOG_RETURN(RES_FAIL, "Layout::build() failed!");
@@ -336,7 +335,7 @@ namespace callui {
                        txtStyle = impl::STR_LABEL_SUB_CID_ENABLE;
                }
 
-               m_label = makeShared<StyledWidget>(eo, true);
+               m_label = makeShared<StyledWidget>(eo);
                m_label->setStyle(impl::STYLE_SLIDING_LABEL);
                m_label->setText(txtStyle.format(text.c_str()));
 
@@ -361,7 +360,7 @@ namespace callui {
                if (!eo) {
                        LOG_RETURN(RES_FAIL, "elm_image_add() failed");
                }
-               auto callerId = makeShared<StyledWidget>(eo, true);
+               auto callerId = makeShared<StyledWidget>(eo);
                elm_image_file_set(*callerId, imagePath.c_str(), NULL);
                elm_image_aspect_fixed_set(*callerId, EINA_TRUE);
                elm_image_fill_outside_set(*callerId, EINA_TRUE);
index 983d0fe3155f3b3432e87b4b46649000ec7e5c52..f8f2ee6009b7210a74ff1dab0c724bc3b8070b8b 100644 (file)
@@ -241,7 +241,6 @@ namespace callui {
        {
                m_widget = Layout::Builder().
                                setTheme(impl::LAYOUT_INDICATOR_WIDGET).
-                               setIsOwner(true).
                                build(parent);
                if (!m_widget) {
                        LOG_RETURN(RES_FAIL, "Layout::build() failed!");
@@ -254,6 +253,7 @@ namespace callui {
        {
                m_connLayout = Layout::Builder().
                                setTheme(impl::LAYOUT_CONNECTION).
+                               setIsOwner(false).
                                build(*m_widget);
                if (!m_connLayout) {
                        LOG_RETURN(RES_FAIL, "Layout::build() failed!");
@@ -269,6 +269,7 @@ namespace callui {
        {
                m_rssiLayout = Layout::Builder().
                                setTheme(impl::LAYOUT_RSSI).
+                               setIsOwner(false).
                                build(*m_widget);
                if (!m_rssiLayout) {
                        LOG_RETURN(RES_FAIL, "Layout::build() failed!");
@@ -284,6 +285,7 @@ namespace callui {
        {
                m_batteryLayout = Layout::Builder().
                                setTheme(impl::LAYOUT_BATTERY).
+                               setIsOwner(false).
                                build(*m_widget);
                if (!m_batteryLayout) {
                        LOG_RETURN(RES_FAIL, "Layout::build() failed!");
@@ -299,6 +301,7 @@ namespace callui {
        {
                m_voiceControlLayout = Layout::Builder().
                                setTheme(impl::LAYOUT_VOICE_CONTROL).
+                               setIsOwner(false).
                                build(*m_widget);
                if (!m_voiceControlLayout) {
                        LOG_RETURN(RES_FAIL, "Layout::build() failed!");
@@ -313,6 +316,7 @@ namespace callui {
        {
                m_simLayout = Layout::Builder().
                                setTheme(impl::LAYOUT_SIM).
+                               setIsOwner(false).
                                build(*m_widget);
                if (!m_simLayout) {
                        LOG_RETURN(RES_FAIL, "Layout::build() failed!");
@@ -328,6 +332,7 @@ namespace callui {
        {
                m_hdCallLayout = Layout::Builder().
                                setTheme(impl::LAYOUT_HD_CALL).
+                               setIsOwner(false).
                                build(*m_widget);
                if (!m_hdCallLayout) {
                        LOG_RETURN(RES_FAIL, "Layout::build() failed!");
index a220ee11a9191df58bc2b556b4b3c5fdfed926bb..6aa148cbe68938cbe57809d84f19a6698a0aef31 100644 (file)
@@ -136,9 +136,7 @@ namespace callui {
                        sendActivate(*m_widget);
                }
 
-               if (const auto keypad = m_keypad.lock()) {
-                       keypad->exitNoTransition();
-               }
+               util::dispose(m_keypad);
        }
 
        Result MoreOptionsPresenter::prepare(GuiPresenter &parent,
@@ -170,7 +168,6 @@ namespace callui {
        {
                m_widget = Layout::Builder().
                                setTheme(impl::LAYOUT_DRAWER_PANEL).
-                               setIsOwner(true).
                                build(parent);
 
                if (!m_widget) {
@@ -200,7 +197,7 @@ namespace callui {
                if (!eo) {
                        LOG_RETURN(RES_FAIL, "elm_panel_add() failed!");
                }
-               m_panel = makeShared<StyledWidget>(eo, true);
+               m_panel = makeShared<StyledWidget>(eo);
                elm_panel_orient_set(*m_panel, ELM_PANEL_ORIENT_RIGHT);
                show(*m_panel);
 
@@ -350,7 +347,7 @@ namespace callui {
                if (!eo) {
                        LOG_RETURN_VALUE(RES_FAIL, {}, "elm_button_add() failed!");
                }
-               auto btn = makeShared<StyledWidget>(eo, true);
+               auto btn = makeShared<StyledWidget>(eo);
                btn->setStyle(style);
                btn->setText(txt);
                btn->addEventHandler(BTN_CLICKED, handler);
index c3864d3f79854ed2cc148b2fbaa12d4b64c9001e..c6a14c830d004de83e0f41246eceeb2b6d981f90 100644 (file)
@@ -185,7 +185,6 @@ namespace callui {
        {
                m_widget = Layout::Builder().
                                setTheme(impl::LAYOUT_DRAWER_PANEL).
-                               setIsOwner(true).
                                build(parent);
 
                if (!m_widget) {
@@ -251,7 +250,7 @@ namespace callui {
 
        Result RejectMsgPresenter::createPanel()
        {
-               m_panel = makeShared<StyledWidget>(elm_panel_add(*m_widget), true);
+               m_panel = makeShared<StyledWidget>(elm_panel_add(*m_widget));
                if (!m_panel) {
                        LOG_RETURN(RES_FAIL, "elm_panel_add() failed!");
                }
@@ -275,7 +274,7 @@ namespace callui {
        Result RejectMsgPresenter::createPanelBg()
        {
                m_panelBg = makeShared<ElmWidget>(
-                               evas_object_rectangle_add(evas_object_evas_get(*m_widget)));
+                               evas_object_rectangle_add(evas_object_evas_get(*m_widget)), false);
                if (!m_panelBg) {
                        LOG_RETURN(RES_FAIL, "evas_object_rectangle_add() failed!");
                }
@@ -291,7 +290,6 @@ namespace callui {
        {
                m_panelLy = Layout::Builder().
                                setTheme(impl::LAYOUT_RM_PANEL_CONTENT).
-                               setIsOwner(true).
                                build(*m_panel);
                if (!m_panelLy) {
                        LOG_RETURN(RES_FAIL, "Layout::build failed!");
@@ -304,7 +302,9 @@ namespace callui {
        Result RejectMsgPresenter::createGenlist()
        {
                // Genlist scroller Layout
-               auto circlLy = Layout::Builder().build(*m_panelLy);
+               auto circlLy = Layout::Builder().
+                               setIsOwner(false).
+                               build(*m_panelLy);
                if (!circlLy) {
                        LOG_RETURN(RES_FAIL, "Layout::build failed!");
                }
@@ -322,7 +322,7 @@ namespace callui {
                elm_genlist_mode_set(glEo, ELM_LIST_COMPRESS);
                elm_genlist_homogeneous_set(glEo, EINA_TRUE);
 
-               m_genlist = makeShared<StyledWidget>(glEo, true);
+               m_genlist = makeShared<StyledWidget>(glEo);
                m_genlist->setWeight(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
                m_genlist->setAlign(EVAS_HINT_FILL, EVAS_HINT_FILL);
 
index 638f819b0fe33c7714071719bb77e9f0781aef4b..9d901ec525de0d18c4e7a18c5530003fa3f9e5d8 100644 (file)
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-#ifndef __CALL_UI_PRESENTERS_MISC_MISC_COMMON_H__
-#define __CALL_UI_PRESENTERS_MISC_MISC_COMMON_H__
+#ifndef __CALL_UI_PRESENTERS_MISC_COMMON_H__
+#define __CALL_UI_PRESENTERS_MISC_COMMON_H__
 
 #include "call-ui/presenters/common.h"
 
-#endif // __CALL_UI_PRESENTERS_MISC_MISC_COMMON_H__
+#endif // __CALL_UI_PRESENTERS_MISC_COMMON_H__
index ca920b1d6f5158c35feb9893324807a8bf6e307a..2c06b7528c10d1d1cf5192091d917752ff7f1d21 100644 (file)
@@ -219,7 +219,6 @@ namespace callui {
        {
                m_widget = Layout::Builder().
                                setTheme(impl::LAYOUT_KEYPAD_WIDGET).
-                               setIsOwner(true).
                                build(getNaviframe());
 
                if (!m_widget) {
@@ -237,7 +236,7 @@ namespace callui {
                if (!entry) {
                        LOG_RETURN(RES_FAIL, "elm_entry_add() failed!");
                }
-               m_entry = makeShared<ElmWidget>(entry, true);
+               m_entry = makeShared<ElmWidget>(entry);
 
                static Elm_Entry_Filter_Accept_Set digitsFilterData;
 
@@ -268,7 +267,7 @@ namespace callui {
                                LOG_RETURN(RES_FAIL, "elm_button_add() failed!");
                        }
 
-                       buttonSRef = makeShared<StyledWidget>(button);
+                       buttonSRef = makeShared<StyledWidget>(button, false);
                        buttonSRef->bindToEo();
                        buttonSRef->setData(impl::BTN_DATA_KEY, &(impl::buttonsInfo[i]));
                        buttonSRef->setStyle(impl::buttonsInfo[i].style);
index 95009095d236dc227ccb893098a90de0a7447284..3cf0ef33fc3fb447fc6857a7acea70125d854d82 100644 (file)
@@ -227,7 +227,6 @@ namespace callui {
        {
                m_rmLy = Layout::Builder().
                                setTheme(impl::LAYOUT_REJECT_MSG_WIDGET).
-                               setIsOwner(true).
                                build(*m_widget);
                if (!m_rmLy) {
                        LOG_RETURN(RES_FAIL, "Layout::build() failed!");
@@ -369,7 +368,7 @@ namespace callui {
        Result MainPage::createBottomBtn(const ElmStyle &style, bool setVisible)
        {
                m_bottomBtn = makeShared<StyledWidget>(
-                               elm_button_add(*m_widget), true);
+                               elm_button_add(*m_widget));
                m_bottomBtn->setStyle(style);
 
                m_bottomBtn->addEventHandler(BTN_CLICKED,
@@ -485,7 +484,6 @@ namespace callui {
        {
                m_widget = Layout::Builder().
                                setTheme(impl::LAYOUT_MAIN_WIDGET).
-                               setIsOwner(true).
                                build(getNaviframe());
 
                if (!m_widget) {
index 28cd1741eb0d7c4d04396c9923a3bdfe0875dfd6..060daa99437cf4416fec62e2bb31f07b4dd01033 100644 (file)
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-#ifndef __CALL_UI_PRESENTERS_PAGES_PAGES_COMMON_H__
-#define __CALL_UI_PRESENTERS_PAGES_PAGES_COMMON_H__
+#ifndef __CALL_UI_PRESENTERS_PAGES_COMMON_H__
+#define __CALL_UI_PRESENTERS_PAGES_COMMON_H__
 
 #include "call-ui/presenters/common.h"
 
-#endif // __CALL_UI_PRESENTERS_PAGES_PAGES_COMMON_H__
+#endif // __CALL_UI_PRESENTERS_PAGES_COMMON_H__
index ed7c2aab95142513cb8e16d03cd9691abb1832c9..b16d4c93a4b3614c80a7a7cbb5fbb59a45e7a5b2 100644 (file)
@@ -142,7 +142,6 @@ namespace callui { namespace { namespace impl {
        {
                auto layout = Layout::Builder().
                                setTheme(theme).
-                               setIsOwner(true).
                                build(parent);
                if (!layout) {
                        LOG_RETURN_VALUE(RES_FAIL, {}, "Layout::build() failed!");
@@ -197,7 +196,6 @@ namespace callui {
        {
                auto layout = Layout::Builder().
                                setTheme(impl::LAYOUT_IMG_ACCEPT_REJECT).
-                               setIsOwner(true).
                                build(parent);
                if (!layout) {
                        LOG_RETURN_VALUE(RES_FAIL, {}, "Layout::build() failed!");
@@ -219,7 +217,7 @@ namespace callui {
                        const NotiHandler &acceptHandler,
                        const NotiHandler &rejectHandler,
                        AcceptButtonType acceptBtnType):
-               ElmWidget(&rc, *layout, true),
+               ElmWidget(&rc, *layout, false),
                m_layout(layout.get()),
                m_accHandler(acceptHandler),
                m_rejHandler(rejectHandler),
@@ -339,13 +337,16 @@ namespace callui {
                m_accEventLy = Layout::Builder().
                                setTheme(impl::LAYOUT_EVENT_ACCEPT_REJECT).
                                build(*m_layout);
-               m_accEventLy->setWeight(EXPAND, EXPAND);
+
                m_accEventLy->addEventHandler(WidgetEvent::MOUSE_DOWN,
                                WEAK_DELEGATE(AcceptRejectWidget::onMouseDown, asWeak(*this)));
+
                m_accEventLy->addEventHandler(WidgetEvent::MOUSE_UP,
                                WEAK_DELEGATE(AcceptRejectWidget::onMouseUp, asWeak(*this)));
+
                m_accEventLy->addEventHandler(WidgetEvent::MOUSE_MOVE,
                                WEAK_DELEGATE(AcceptRejectWidget::onMouseMove, asWeak(*this)));
+
                m_layout->setContent(*m_accEventLy,
                                impl::PART_SWL_ACCEPT_FINGER_EVENT);
 
index 3c5b7f04f3d8b073ec5dd182adf41405c2854b8b..f127de4b1b1ff4987bc56e2bb1d3ac2f4f00de1f 100644 (file)
@@ -54,7 +54,6 @@ namespace callui {
        {
                auto layout = Layout::Builder().
                                setTheme(impl::LAYOUT_SLIDER).
-                               setIsOwner(true).
                                build(parent);
                if (!layout) {
                        LOG_RETURN_VALUE(RES_FAIL, {}, "Layout::build() failed!");
@@ -71,7 +70,7 @@ namespace callui {
                        const LayoutSRef &layout,
                        int maxValue,
                        int curValue):
-                               ElmWidget(&rc, *layout, true),
+                               ElmWidget(&rc, *layout, false),
                                m_layout(layout.get()),
                                m_circleLy(elm_layout_add(*m_layout)),
                                m_circleSurf(eext_circle_surface_layout_add(m_circleLy)),
index 2e5cfafa033bb1e13373a01733d8c5668ec131c5..13c06d9778e8a9cbdbb29ade8f8c875282eee282 100644 (file)
@@ -77,7 +77,6 @@ namespace callui {
        {
                auto layout = Layout::Builder().
                                setTheme(impl::LAYOUT_VOLUME).
-                               setIsOwner(true).
                                build(parent);
                if (!layout) {
                        LOG_RETURN_VALUE(RES_FAIL, {}, "Layout::build() failed!");
index 153e8ad6a47d65d3a0519a4fed71b9f0dcfed976..e4f931decf09f649f2a8d5ffc58903dfa08018f3 100644 (file)
@@ -80,7 +80,6 @@ namespace callui { namespace utils {
        {
                const auto result = Layout::Builder().
                                setTheme(impl::LAYOUT_FAKE_ACCESS_OBJECT).
-                               setIsOwner(true).
                                setNeedBindToEo(true).
                                build(parent);
                if (!result) {
@@ -127,7 +126,7 @@ namespace callui { namespace utils {
                                        "elm_access_object_register() failed!");
                }
 
-               return makeShared<ElmWidget>(ao, true);
+               return makeShared<ElmWidget>(ao);
        }
 
        ElmWidgetSRef createAccessObjectFromLyPart(ElmWidget &parent,
@@ -147,7 +146,7 @@ namespace callui { namespace utils {
                                        "elm_access_object_register() failed!");
                }
 
-               return makeShared<ElmWidget>(ao, true);
+               return makeShared<ElmWidget>(ao);
        }
 
        void destroyAccessObject(ElmWidget &ao)
index 0260b0ba8736c5535488ec5b4480bb1306da91cd..7195d9e959dbaac48e3b40d9fce59c67b4b6e3d0 100644 (file)
@@ -9,7 +9,7 @@ type = app
 profile = wearable-4.0
 
 # C/CPP Sources
-USER_SRCS = ucl/src/gui/WidgetItem.cpp src/presenters/InstanceManager.cpp ucl/src/appfw/UIApp.cpp src/model/VoiceControlStateProvider.cpp src/presenters/AcceptDialog.cpp ucl/src/gui/NaviItem.cpp ucl/src/gui/Layout.cpp src/model/IncomingCall.cpp src/presenters/Page.cpp src/resources.cpp src/presenters/DeviceStatePresenter.cpp src/model/ContactInfoProvider.cpp ucl/src/gui/Genlist.cpp ucl/src/gui/Window.cpp src/types.cpp src/presenters/RejectMsgPresenter.cpp src/model/ConnectionStateSource.cpp src/presenters/AccessoryPresenter.cpp src/model/ContactInfo.cpp src/model/EndCall.cpp src/presenters/MainPage.cpp src/view/helpers.cpp ucl/src/mvp/ListItemPresenter.cpp ucl/src/util/types/Result.cpp ucl/src/mvp/ListPresenter.cpp ucl/src/misc/Variant.cpp src/model/CallUI.cpp ucl/src/mvp/GuiPresenter.cpp src/view/VolumeControl.cpp src/view/Slider.cpp src/model/CallInfo.cpp ucl/src/gui/ElmWidget.cpp src/model/SimSlotStateSource.cpp src/presenters/AcceptRejectPresenter.cpp ucl/src/gui/EdjeWidget.cpp ucl/src/gui/Naviframe.cpp src/model/CallManager.cpp ucl/src/misc/Timeout.cpp src/presenters/Instance.cpp ucl/src/gui/Widget.cpp src/model/ActiveCall.cpp src/model/RejectMsgProvider.cpp src/presenters/MoreOptionsPresenter.cpp ucl/src/appfw/SysEventProvider.cpp src/presenters/CallInfoPresenter.cpp src/model/BatteryStateSource.cpp src/model/CallClient.cpp src/model/VoiceControlStateSource.cpp src/model/RssiStateSource.cpp src/model/HdVoiceStateSource.cpp ucl/src/util/logging.cpp src/model/IndicatorStateProvider.cpp src/presenters/KeypadPage.cpp src/presenters/helpers.cpp src/presenters/MotionSensorPresenter.cpp src/main.cpp src/model/MsgClient.cpp src/presenters/IndicatorPresenter.cpp ucl/src/appfw/helpers.cpp src/model/CallUIBuilder.cpp src/presenters/AtspiHighlightHelper.cpp src/presenters/CallStatusPresenter.cpp src/model/ConferenceCallInfo.cpp src/model/HeldCall.cpp src/model/SoundManager.cpp src/model/BluetoothManager.cpp src/model/RejectMsg.cpp src/view/AcceptRejectWidget.cpp ucl/src/appfw/InstanceManagerBase.cpp 
+USER_SRCS = call-ui/view/VolumeControl.cpp call-ui/view/Slider.cpp call-ui/model/impl/CallInfo.cpp call-ui/model/impl/RejectMsgProvider.cpp ucl/source/mvp/GuiPresenter.cpp ucl/source/appfw/InstanceManagerBase.cpp call-ui/model/impl/BatteryStateSource.cpp ucl/source/gui/Widget.cpp call-ui/presenters/base/Page.cpp call-ui/model/impl/IncomingCall.cpp call-ui/presenters/dialogs/AcceptDialog.cpp call-ui/types.cpp ucl/source/appfw/helpers.cpp ucl/source/mvp/ListItemPresenter.cpp call-ui/presenters/misc/helpers.cpp call-ui/model/impl/IndicatorStateProvider.cpp call-ui/model/impl/RejectMsg.cpp call-ui/view/AcceptRejectWidget.cpp ucl/source/misc/Timeout.cpp call-ui/resources.cpp ucl/source/gui/Genlist.cpp call-ui/model/CallUIBuilder.cpp ucl/source/util/types/Result.cpp call-ui/presenters/misc/CallStatusPresenter.cpp call-ui/model/impl/ConferenceCallInfo.cpp call-ui/model/impl/HeldCall.cpp call-ui/model/impl/SoundManager.cpp call-ui/model/impl/BluetoothManager.cpp ucl/source/gui/Layout.cpp call-ui/presenters/misc/MotionSensorPresenter.cpp ucl/source/gui/EdjeWidget.cpp call-ui/model/impl/MsgClient.cpp call-ui/model/impl/RssiStateSource.cpp call-ui/presenters/Instance.cpp call-ui/model/impl/ActiveCall.cpp call-ui/presenters/InstanceManager.cpp call-ui/presenters/misc/MoreOptionsPresenter.cpp call-ui/presenters/misc/IndicatorPresenter.cpp call-ui/model/impl/SimSlotStateSource.cpp call-ui/presenters/misc/AtspiHighlightHelper.cpp ucl/source/gui/Naviframe.cpp call-ui/presenters/misc/AcceptRejectPresenter.cpp call-ui/model/impl/CallUI.cpp ucl/source/gui/WidgetItem.cpp call-ui/presenters/pages/MainPage.cpp ucl/source/gui/NaviItem.cpp ucl/source/gui/ElmWidget.cpp call-ui/presenters/misc/DeviceStatePresenter.cpp call-ui/model/impl/ContactInfoProvider.cpp ucl/source/misc/Variant.cpp call-ui/model/impl/HdVoiceStateSource.cpp call-ui/view/helpers.cpp call-ui/main.cpp call-ui/model/impl/VoiceControlStateProvider.cpp ucl/source/gui/Window.cpp call-ui/model/impl/CallManager.cpp call-ui/model/impl/ConnectionStateSource.cpp call-ui/presenters/misc/RejectMsgPresenter.cpp call-ui/presenters/pages/KeypadPage.cpp call-ui/presenters/misc/CallInfoPresenter.cpp ucl/source/appfw/SysEventProvider.cpp ucl/source/util/logging.cpp ucl/source/appfw/UIApp.cpp call-ui/model/impl/CallClient.cpp call-ui/presenters/misc/AccessoryPresenter.cpp call-ui/model/impl/ContactInfo.cpp call-ui/model/impl/EndCall.cpp call-ui/model/impl/VoiceControlStateSource.cpp ucl/source/mvp/ListPresenter.cpp 
 
 # EDC Sources
 USER_EDCS =  
@@ -36,7 +36,7 @@ USER_OBJS =
 USER_C_INC_DIRS = 
 USER_INC_FILES = 
 ## C++ Compiler
-USER_CPP_INC_DIRS = . ucl/inc 
+USER_CPP_INC_DIRS = . ucl/include 
 USER_CPP_INC_FILES = 
 
 USER_INC_DIRS = $(USER_C_INC_DIRS) $(USER_CPP_INC_DIRS)
diff --git a/ucl/inc/ucl/appfw/IInstance.h b/ucl/inc/ucl/appfw/IInstance.h
deleted file mode 100644 (file)
index bf09205..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_APPFW_I_INSTANCE_H__
-#define __UCL_APPFW_I_INSTANCE_H__
-
-#include "IInstanceContext.h"
-
-namespace ucl {
-
-       UCL_DECLARE_REF_ALIASES(IInstance);
-
-       class IInstance : public Polymorphic {
-       public:
-               virtual Result onCreate(IInstanceContext *context) = 0;
-               virtual void onPause() = 0;
-               virtual void onResume() = 0;
-       };
-}
-
-#endif // __UCL_APPFW_I_INSTANCE_H__
diff --git a/ucl/inc/ucl/appfw/IInstanceAppControlExt.h b/ucl/inc/ucl/appfw/IInstanceAppControlExt.h
deleted file mode 100644 (file)
index 6799a84..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_APPFW_I_INSTANCE_APP_CONTROL_EXT_H__
-#define __UCL_APPFW_I_INSTANCE_APP_CONTROL_EXT_H__
-
-#include "types.h"
-
-namespace ucl {
-
-       class IInstanceAppControlExt : public Polymorphic {
-       public:
-               virtual void onAppControl(app_control_h appControl) = 0;
-       };
-}
-
-#endif // __UCL_APPFW_I_INSTANCE_APP_CONTROL_EXT_H__
diff --git a/ucl/inc/ucl/appfw/IInstanceContext.h b/ucl/inc/ucl/appfw/IInstanceContext.h
deleted file mode 100644 (file)
index b06c177..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_APPFW_I_INSTANCE_CONTEXT_H__
-#define __UCL_APPFW_I_INSTANCE_CONTEXT_H__
-
-#include "types.h"
-
-#include "ucl/gui/Window.h"
-
-namespace ucl {
-
-       class IInstanceContext : public Polymorphic {
-       public:
-               virtual AppType getAppType() const = 0;
-               virtual WindowSRef getWindow() = 0;
-               virtual void exitApp() = 0;
-       };
-}
-
-#endif // __UCL_APPFW_I_INSTANCE_CONTEXT_H__
diff --git a/ucl/inc/ucl/appfw/InstanceManagerBase.h b/ucl/inc/ucl/appfw/InstanceManagerBase.h
deleted file mode 100644 (file)
index 0fdde8c..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_APPFW_INSTANCE_MANAGER_BASE_H__
-#define __UCL_APPFW_INSTANCE_MANAGER_BASE_H__
-
-#include "IInstance.h"
-#include "SysEventProvider.h"
-
-namespace ucl {
-
-       class InstanceManagerBase : public Polymorphic {
-       public:
-               InstanceManagerBase(AppParams appParams);
-               virtual ~InstanceManagerBase();
-
-               const AppParams &getAppParams() const;
-
-               void setSysEventProvider(SysEventProviderUPtr provider);
-
-               virtual IInstanceSRef newInstance() const = 0;
-
-       protected:
-               SysEventProvider &getSysEventProvider() const;
-
-       private:
-               const AppParams m_appParams;
-               SysEventProviderUPtr m_sysEventProvider;
-       };
-}
-
-#endif // __UCL_APPFW_INSTANCE_MANAGER_BASE_H__
diff --git a/ucl/inc/ucl/appfw/SysEventProvider.h b/ucl/inc/ucl/appfw/SysEventProvider.h
deleted file mode 100644 (file)
index 8a72758..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_APPFW_SYS_EVENT_PROVIDER_H__
-#define __UCL_APPFW_SYS_EVENT_PROVIDER_H__
-
-#include <list>
-
-#include "types.h"
-
-namespace ucl {
-
-       class SysEventProvider;
-       using SysEventProviderUPtr = std::unique_ptr<SysEventProvider>;
-
-       class SysEventProvider final : public NonCopyable {
-       public:
-               using EventHandlerAddFunc = int (*)(app_event_handler_h *,
-                               app_event_type_e, app_event_cb, void *);
-               using EventHandlerDelFunc = int (*)(app_event_handler_h);
-
-       public:
-               SysEventProvider(EventHandlerAddFunc addFunc,
-                               EventHandlerDelFunc delFunc);
-               ~SysEventProvider();
-
-               void addEventHandler(const SysEventHandler &handler);
-               void delEventHandler(const SysEventHandler &handler);
-
-       private:
-               int addEventHandler(app_event_handler_h *handler,
-                               app_event_type_e appEvent, app_event_cb cb, void *data);
-               int delEventHandler(app_event_handler_h handler);
-
-               void dispatch(SysEvent sysEvent);
-
-       private:
-               class EventProxy;
-               using EventProxies = std::list<EventProxy>;
-
-       private:
-               const EventHandlerAddFunc m_addFunc;
-               const EventHandlerDelFunc m_delFunc;
-               EventProxies m_eventProxies;
-               Event<SysEventHandler> m_event;
-       };
-}
-
-#include "SysEventProvider.hpp"
-
-#endif // __UCL_APPFW_SYS_EVENT_PROVIDER_H__
diff --git a/ucl/inc/ucl/appfw/SysEventProvider.hpp b/ucl/inc/ucl/appfw/SysEventProvider.hpp
deleted file mode 100644 (file)
index 1d52394..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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.
- */
-
-namespace ucl {
-
-       inline void SysEventProvider::addEventHandler(
-                       const SysEventHandler &handler)
-       {
-               m_event += handler;
-       }
-
-       inline void SysEventProvider::delEventHandler(
-                       const SysEventHandler &handler)
-       {
-               m_event -= handler;
-       }
-}
diff --git a/ucl/inc/ucl/appfw/UIApp.h b/ucl/inc/ucl/appfw/UIApp.h
deleted file mode 100644 (file)
index a8b4dbc..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_APPFW_UI_APP_H__
-#define __UCL_APPFW_UI_APP_H__
-
-#include "IInstanceContext.h"
-
-#include "InstanceManagerBase.h"
-
-namespace ucl {
-
-       class UIApp final : private IInstanceContext {
-       public:
-               UIApp(InstanceManagerBase &instanceMgr);
-               virtual ~UIApp();
-
-               int run(int argc, char *argv[]);
-
-       private:
-               bool onCreate();
-               void onTerminate();
-               void onPause();
-               void onResume();
-               void onAppControl(app_control_h appControl);
-
-               Result configParams();
-               Result createWindow();
-
-               void initSysEventManager();
-               Result createInstance();
-
-               // IInstanceContext //
-
-               virtual AppType getAppType() const final override;
-               virtual WindowSRef getWindow() final override;
-               virtual void exitApp() final override;
-
-       private:
-               InstanceManagerBase &m_instanceMgr;
-               WindowSRef m_window;
-               IInstanceSRef m_instance;
-       };
-}
-
-#endif // __UCL_APPFW_UI_APP_H__
diff --git a/ucl/inc/ucl/appfw/helpers.h b/ucl/inc/ucl/appfw/helpers.h
deleted file mode 100644 (file)
index fe598d9..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_APPFW_HELPERS_H__
-#define __UCL_APPFW_HELPERS_H__
-
-#include "types.h"
-
-namespace ucl {
-
-       std::string getResPath(const char *relativePath);
-}
-
-#endif // __UCL_APPFW_HELPERS_H__
diff --git a/ucl/inc/ucl/appfw/types.h b/ucl/inc/ucl/appfw/types.h
deleted file mode 100644 (file)
index 48f8adc..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_APPFW_TYPES_H__
-#define __UCL_APPFW_TYPES_H__
-
-#include <app_common.h>
-#include <app_control.h>
-
-#include "ucl/util/types.h"
-#include "ucl/util/delegation.h"
-#include "ucl/util/smartDelegation.h"
-
-#include "ucl/misc/HashMap.h"
-#include "ucl/misc/Event.h"
-#include "ucl/misc/AutoHandle.h"
-
-namespace ucl {
-
-       enum class AppType {
-               UI,
-               WIDGET,
-               WATCH
-       };
-
-       enum class AppParam {
-               BASE_SCALE,
-               ACCELERATION_PREFERENECE,
-               WINDOW_TYPE,
-               WINDOW_NAME
-       };
-
-       using AppParams = HashMap<AppParam, Variant>;
-
-       enum class SysEvent {
-               LANGUAGE_CHANGED,
-               REGION_FMT_CHANGED,
-               LOW_MEMORY,
-               LOW_BATTERY,
-               ORIENTATION_CHANGED,
-               SUSPEND_STATE_CHANGED,
-               UPDATE_REQUESTED
-       };
-
-       using SysEventHandler = WeakDelegate<void(SysEvent)>;
-
-       using AutoAppCtrl = AutoHandle<app_control_h, int, app_control_destroy>;
-}
-
-#endif // __UCL_APPFW_TYPES_H__
diff --git a/ucl/inc/ucl/config.h b/ucl/inc/ucl/config.h
deleted file mode 100644 (file)
index cd36042..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_CONFIG_H__
-#define __UCL_CONFIG_H__
-
-#ifdef _DEBUG
-#define UCL_DEBUG
-#endif
-
-#define UCL_DEFINE_GET_UCL_RESULT_DATA 0
-
-#define UCL_LOG_LEVEL_VERBOSE 6
-#define UCL_LOG_LEVEL_DEBUG   5
-#define UCL_LOG_LEVEL_INFO    4
-#define UCL_LOG_LEVEL_WARNING 3
-#define UCL_LOG_LEVEL_ERROR   2
-#define UCL_LOG_LEVEL_FATAL   1
-
-#ifdef UCL_DEBUG
-#define UCL_MAX_LOG_LEVEL UCL_LOG_LEVEL_VERBOSE
-#else
-#define UCL_MAX_LOG_LEVEL UCL_LOG_LEVEL_INFO
-#endif
-
-#define UCL_DEFAULT_LOG_TAG "CALLUI_UCL"
-
-#define UCL_INCLUDE_DELEGATION_SHORT_MACRO_H 1
-#define UCL_INCLUDE_SMART_DELEGATION_SHORT_MACRO_H 1
-
-#endif // __UCL_CONFIG_H__
diff --git a/ucl/inc/ucl/gui/EdjeWidget.h b/ucl/inc/ucl/gui/EdjeWidget.h
deleted file mode 100644 (file)
index 0ee57f0..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_GUI_EDJE_WIDGET_H__
-#define __UCL_GUI_EDJE_WIDGET_H__
-
-#include "ElmWidget.h"
-
-namespace ucl {
-
-       UCL_DECLARE_REF_ALIASES(EdjeWidget);
-
-       class EdjeWidget : public ElmWidget {
-       public:
-               void setText(const TString &value);
-               void setText(const TString &value, EdjePart part);
-
-               TString getText() const;
-               TString getText(EdjePart part) const;
-
-               void setContent(Evas_Object *content);
-               void setContent(Evas_Object *content, EdjePart part);
-               Evas_Object *unsetContent();
-               Evas_Object *unsetContent(EdjePart part);
-
-               Evas_Object *getContent() const;
-               Evas_Object *getContent(EdjePart part) const;
-
-               void emit(EdjeSignal signal, EdjeSignalSrc source =
-                               EdjeSignalSrc(""));
-
-       protected:
-               EdjeWidget(IRefCountObj *rc, Evas_Object *eo, bool isOwner = false);
-       };
-}
-
-#include "EdjeWidget.hpp"
-
-#endif // __UCL_GUI_EDJE_WIDGET_H__
diff --git a/ucl/inc/ucl/gui/EdjeWidget.hpp b/ucl/inc/ucl/gui/EdjeWidget.hpp
deleted file mode 100644 (file)
index 3f989c7..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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.
- */
-
-namespace ucl {
-
-       inline EdjeWidget::EdjeWidget(IRefCountObj *const rc,
-                       Evas_Object *const eo, const bool isOwner) :
-               ElmWidget(rc, eo, isOwner)
-       {
-       }
-
-       inline TString EdjeWidget::getText() const
-       {
-               return elm_object_text_get(getEo());
-       }
-
-       inline TString EdjeWidget::getText(const EdjePart part) const
-       {
-               return elm_object_part_text_get(getEo(), part.name);
-       }
-
-       inline void EdjeWidget::setContent(Evas_Object *const content)
-       {
-               elm_object_content_set(getEo(), content);
-       }
-
-       inline void EdjeWidget::setContent(Evas_Object *const content,
-                       const EdjePart part)
-       {
-               elm_object_part_content_set(getEo(), part.name, content);
-       }
-
-       inline Evas_Object *EdjeWidget::unsetContent()
-       {
-               return elm_object_content_unset(getEo());
-       }
-
-       inline Evas_Object *EdjeWidget::unsetContent(const EdjePart part)
-       {
-               return elm_object_part_content_unset(getEo(), part.name);
-       }
-
-       inline Evas_Object *EdjeWidget::getContent() const
-       {
-               return elm_object_content_get(getEo());
-       }
-
-       inline Evas_Object *EdjeWidget::getContent(const EdjePart part) const
-       {
-               return elm_object_part_content_get(getEo(), part.name);
-       }
-
-       inline void EdjeWidget::emit(const EdjeSignal signal,
-                       const EdjeSignalSrc source)
-       {
-               elm_object_signal_emit(getEo(), signal.name, source.name);
-       }
-}
diff --git a/ucl/inc/ucl/gui/ElmWidget.h b/ucl/inc/ucl/gui/ElmWidget.h
deleted file mode 100644 (file)
index 3856b49..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_GUI_ELM_WIDGET_H__
-#define __UCL_GUI_ELM_WIDGET_H__
-
-#include "Widget.h"
-
-#define UCL_SMART_FWD_ATSPI UCL_SMART_FWD "atspi,"
-
-namespace ucl {
-
-       constexpr SmartEvent ATSPI_ON_GESTURE {UCL_SMART_FWD_ATSPI "gesture"};
-
-       class Window;
-
-       UCL_DECLARE_REF_ALIASES(ElmWidget);
-
-       class ElmWidget : public Widget {
-       public:
-               explicit ElmWidget(Evas_Object *eo, bool isOwner = false);
-               virtual ~ElmWidget();
-
-               void setEnabled(bool value);
-               bool isEnabled() const;
-
-               void setFocusAlowed(bool value);
-               bool isFocusAlowed() const;
-
-               void setTheme(Elm_Theme *th);
-               Elm_Theme *getTheme();
-
-               Evas_Object *getTopWidget() const;
-               Window *getWindow() const;
-
-       protected:
-               friend class ReffedObj<ElmWidget>;
-               ElmWidget(IRefCountObj *rc, Evas_Object *eo, bool isOwner = false);
-
-               virtual void setFocusedImpl(bool value) final override;
-               virtual bool isFocusedImpl() const final override;
-               virtual bool ensureFwdEvent(SmartEvent fwdEvent) override;
-
-       private:
-               Eina_Bool onAtspiGesture(Elm_Atspi_Gesture_Info gestureInfo,
-                                       Evas_Object *obj);
-
-       private:
-               bool m_isAtspiGestureCbSet;
-       };
-
-       // Non-member functions //
-
-       void enable(ElmWidget &widget);
-       void disable(ElmWidget &widget);
-}
-
-#include "ElmWidget.hpp"
-
-#endif // __UCL_GUI_ELM_WIDGET_H__
diff --git a/ucl/inc/ucl/gui/ElmWidget.hpp b/ucl/inc/ucl/gui/ElmWidget.hpp
deleted file mode 100644 (file)
index 0673a57..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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.
- */
-
-namespace ucl {
-
-       inline ElmWidget::ElmWidget(Evas_Object *const eo, const bool isOwner) :
-               ElmWidget(nullptr, eo, isOwner)
-       {
-       }
-
-       inline void ElmWidget::setEnabled(const bool value)
-       {
-               elm_object_disabled_set(getEo(), toEina(!value));
-       }
-
-       inline bool ElmWidget::isEnabled() const
-       {
-               return !elm_object_disabled_get(getEo());
-       }
-
-       inline void ElmWidget::setFocusAlowed(const bool value)
-       {
-               elm_object_focus_allow_set(getEo(), toEina(value));
-       }
-
-       inline bool ElmWidget::isFocusAlowed() const
-       {
-               return elm_object_focus_allow_get(getEo());
-       }
-
-       inline void ElmWidget::setTheme(Elm_Theme *th)
-       {
-               elm_object_theme_set(getEo(), th);
-       }
-
-       inline Elm_Theme *ElmWidget::getTheme()
-       {
-               return elm_object_theme_get(getEo());
-       }
-
-       inline Evas_Object *ElmWidget::getTopWidget() const
-       {
-               return elm_object_top_widget_get(getEo());
-       }
-
-       // Non-member functions //
-
-       inline void enable(ElmWidget &widget)
-       {
-               widget.setEnabled(true);
-       }
-
-       inline void disable(ElmWidget &widget)
-       {
-               widget.setEnabled(false);
-       }
-}
diff --git a/ucl/inc/ucl/gui/Genlist.h b/ucl/inc/ucl/gui/Genlist.h
deleted file mode 100644 (file)
index ebbb43e..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_GUI_GENLIST_H__
-#define __UCL_GUI_GENLIST_H__
-
-#include "StyledWidget.h"
-#include "GenlistItem.h"
-
-namespace ucl {
-
-       UCL_DECLARE_REF_ALIASES(Genlist);
-
-       class Genlist : public StyledWidget {
-       public:
-               enum class Mode {
-                       COMPRESS = ELM_LIST_COMPRESS,
-                       SCROLL = ELM_LIST_SCROLL,
-                       LIMIT = ELM_LIST_LIMIT,
-                       EXPAND = ELM_LIST_EXPAND
-               };
-
-               class Builder final {
-               public:
-                       Builder();
-                       Builder &setStyle(ElmStyle style);
-                       Builder &setMode(Mode mode);
-                       Builder &setHomogeneous(bool value);
-                       Builder &setIsOwner(bool value);
-                       Builder &setNeedBindToEo(bool value);
-                       GenlistSRef build(ElmWidget &parent) const;
-               private:
-                       ElmStyle m_style;
-                       Mode m_mode;
-                       bool m_isHomogeneous;
-                       bool m_isOwner;
-                       bool m_needBindToEo;
-               };
-
-       public:
-               friend class ReffedObj<Genlist>;
-               using StyledWidget::StyledWidget;
-
-               void setMode(Mode mode);
-               Mode getMode() const;
-
-               void setHomogeneous(bool isHomogeneous);
-               bool isHomogeneous() const;
-
-               void updateRealizedItems();
-               void clear();
-
-               GenlistItem append(const Elm_Genlist_Item_Class *itc,
-                               const void *data, SmartCbHandler onSelect = nullptr,
-                               GenlistItem::Type type = GenlistItem::Type::SIMPLE,
-                               GenlistItem parent = nullptr);
-
-               GenlistItem prepend(const Elm_Genlist_Item_Class *itc,
-                               const void *data, SmartCbHandler onSelect = nullptr,
-                               GenlistItem::Type type = GenlistItem::Type::SIMPLE,
-                               GenlistItem parent = nullptr);
-
-               GenlistItem insertAfter(GenlistItem after,
-                               const Elm_Genlist_Item_Class *itc, const void *data,
-                               SmartCbHandler onSelect = nullptr,
-                               GenlistItem::Type type = GenlistItem::Type::SIMPLE,
-                               GenlistItem parent = nullptr);
-
-               GenlistItem insertBefore(GenlistItem before,
-                               const Elm_Genlist_Item_Class *itc, const void *data,
-                               SmartCbHandler onSelect = nullptr,
-                               GenlistItem::Type type = GenlistItem::Type::SIMPLE,
-                               GenlistItem parent = nullptr);
-       };
-}
-
-#include "Genlist.hpp"
-
-#endif // __UCL_GUI_GENLIST_H__
diff --git a/ucl/inc/ucl/gui/Genlist.hpp b/ucl/inc/ucl/gui/Genlist.hpp
deleted file mode 100644 (file)
index d3cfed0..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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.
- */
-
-namespace ucl {
-
-       // Genlist::Builder //
-
-       inline Genlist::Builder::Builder() :
-               m_mode(Mode::COMPRESS),
-               m_isHomogeneous(true),
-               m_isOwner(false),
-               m_needBindToEo(false)
-       {
-       }
-
-       inline Genlist::Builder &Genlist::Builder::setStyle(const ElmStyle style)
-       {
-               m_style = style;
-               return *this;
-       }
-
-       inline Genlist::Builder &Genlist::Builder::setMode(const Mode mode)
-       {
-               m_mode = mode;
-               return *this;
-       }
-
-       inline Genlist::Builder &Genlist::Builder::setHomogeneous(const bool value)
-       {
-               m_isHomogeneous = value;
-               return *this;
-       }
-
-       inline Genlist::Builder &Genlist::Builder::setIsOwner(const bool value)
-       {
-               m_isOwner = value;
-               return *this;
-       }
-
-       inline Genlist::Builder &Genlist::Builder::setNeedBindToEo(const bool value)
-       {
-               m_needBindToEo = value;
-               return *this;
-       }
-
-       // Genlist //
-
-       inline void Genlist::setMode(const Mode mode)
-       {
-               elm_genlist_mode_set(getEo(), static_cast<Elm_List_Mode>(mode));
-       }
-
-       inline Genlist::Mode Genlist::getMode() const
-       {
-               return static_cast<Mode>(elm_genlist_mode_get(getEo()));
-       }
-
-       inline void Genlist::setHomogeneous(const bool isHomogeneous)
-       {
-               elm_genlist_homogeneous_set(getEo(), toEina(isHomogeneous));
-       }
-
-       inline bool Genlist::isHomogeneous() const
-       {
-               return elm_genlist_homogeneous_get(getEo());
-       }
-
-       inline void Genlist::updateRealizedItems()
-       {
-               elm_genlist_realized_items_update(getEo());
-       }
-
-       inline void Genlist::clear()
-       {
-               elm_genlist_clear(getEo());
-       }
-
-       inline GenlistItem Genlist::append(const Elm_Genlist_Item_Class *const itc,
-                       const void *const data, const SmartCbHandler onSelect,
-                       const GenlistItem::Type type, const GenlistItem parent)
-       {
-               return GenlistItem(elm_genlist_item_append(
-                               getEo(), itc, data, parent,
-                               static_cast<Elm_Genlist_Item_Type>(type),
-                               onSelect.getStubA(), onSelect.getData()));
-       }
-
-       inline GenlistItem Genlist::prepend(const Elm_Genlist_Item_Class *const itc,
-                       const void *const data, SmartCbHandler onSelect,
-                       const GenlistItem::Type type, const GenlistItem parent)
-       {
-               return GenlistItem(elm_genlist_item_prepend(
-                               getEo(), itc, data, parent,
-                               static_cast<Elm_Genlist_Item_Type>(type),
-                               onSelect.getStubA(), onSelect.getData()));
-       }
-
-       inline GenlistItem Genlist::insertAfter(const GenlistItem after,
-                       const Elm_Genlist_Item_Class *const itc, const void *const data,
-                       const SmartCbHandler onSelect, const GenlistItem::Type type,
-                       const GenlistItem parent)
-       {
-               return GenlistItem(elm_genlist_item_insert_after(
-                               getEo(), itc, data, parent, after,
-                               static_cast<Elm_Genlist_Item_Type>(type),
-                               onSelect.getStubA(), onSelect.getData()));
-       }
-
-       inline GenlistItem Genlist::insertBefore(const GenlistItem before,
-                       const Elm_Genlist_Item_Class *itc, const void *data,
-                       const SmartCbHandler onSelect, const GenlistItem::Type type,
-                       const GenlistItem parent)
-       {
-               return GenlistItem(elm_genlist_item_insert_before(
-                               getEo(), itc, data, parent, before,
-                               static_cast<Elm_Genlist_Item_Type>(type),
-                               onSelect.getStubA(), onSelect.getData()));
-       }
-}
diff --git a/ucl/inc/ucl/gui/GenlistItem.h b/ucl/inc/ucl/gui/GenlistItem.h
deleted file mode 100644 (file)
index 2c96b9c..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_GUI_GENLIST_ITEM_H__
-#define __UCL_GUI_GENLIST_ITEM_H__
-
-#include "WidgetItem.h"
-
-namespace ucl {
-
-       class GenlistItem final : public WidgetItem {
-       public:
-               enum class Type {
-                       SIMPLE = ELM_GENLIST_ITEM_NONE,
-                       TREE = ELM_GENLIST_ITEM_TREE,
-                       GROUP = ELM_GENLIST_ITEM_GROUP
-               };
-
-               enum class SelectMode {
-                       DEFAULT = ELM_OBJECT_SELECT_MODE_DEFAULT,
-                       ALWAYS = ELM_OBJECT_SELECT_MODE_ALWAYS,
-                       NONE = ELM_OBJECT_SELECT_MODE_NONE,
-                       DISPLAY_ONLY = ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY
-               };
-
-               enum {
-                       FIELD_ALL = ELM_GENLIST_ITEM_FIELD_ALL,
-                       FIELD_TEXT = ELM_GENLIST_ITEM_FIELD_TEXT,
-                       FIELD_CONTENT = ELM_GENLIST_ITEM_FIELD_CONTENT,
-                       FIELD_STATE = ELM_GENLIST_ITEM_FIELD_STATE,
-               };
-
-       public:
-               using WidgetItem::WidgetItem;
-
-               void setSelectMode(SelectMode mode) const;
-               SelectMode getSelectMode() const;
-
-               void setSelected(bool isSelected) const;
-               bool isSelected() const;
-
-               void update() const;
-               void update(const Elm_Genlist_Item_Class *newItc) const;
-               void update(const char *parts, int fields = FIELD_ALL) const;
-       };
-}
-
-#include "GenlistItem.hpp"
-
-#endif // __UCL_GUI_GENLIST_ITEM_H__
diff --git a/ucl/inc/ucl/gui/GenlistItem.hpp b/ucl/inc/ucl/gui/GenlistItem.hpp
deleted file mode 100644 (file)
index 6920a88..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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.
- */
-
-namespace ucl {
-
-       inline void GenlistItem::setSelectMode(const SelectMode mode) const
-       {
-               elm_genlist_item_select_mode_set(getIt(),
-                               static_cast<Elm_Object_Select_Mode>(mode));
-       }
-
-       inline GenlistItem::SelectMode GenlistItem::getSelectMode() const
-       {
-               return static_cast<GenlistItem::SelectMode>(
-                               elm_genlist_item_select_mode_get(getIt()));
-       }
-
-       inline void GenlistItem::setSelected(const bool isSelected) const
-       {
-               elm_genlist_item_selected_set(getIt(), toEina(isSelected));
-       }
-
-       inline bool GenlistItem::isSelected() const
-       {
-               return elm_genlist_item_selected_get(getIt());
-       }
-
-       inline void GenlistItem::update() const
-       {
-               elm_genlist_item_update(getIt());
-       }
-
-       inline void GenlistItem::update(
-                       const Elm_Genlist_Item_Class *const newItc) const
-       {
-               elm_genlist_item_item_class_update(getIt(), newItc);
-       }
-
-       inline void GenlistItem::update(
-                       const char *const parts, const int fields) const
-       {
-               elm_genlist_item_fields_update(getIt(), parts,
-                               static_cast<Elm_Genlist_Item_Field_Type>(fields));
-       }
-}
diff --git a/ucl/inc/ucl/gui/Layout.h b/ucl/inc/ucl/gui/Layout.h
deleted file mode 100644 (file)
index 9eb108e..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_GUI_LAYOUT_H__
-#define __UCL_GUI_LAYOUT_H__
-
-#include "EdjeWidget.h"
-
-namespace ucl {
-
-       UCL_DECLARE_REF_ALIASES(Layout);
-
-       class Layout : public EdjeWidget {
-       public:
-               class Builder final {
-               public:
-                       Builder();
-                       Builder &setTheme(const LayoutTheme &value);
-                       Builder &setEdjeFile(std::string filePath, EdjeGroup group);
-                       Builder &setIsOwner(bool value);
-                       Builder &setNeedBindToEo(bool value);
-                       LayoutSRef build(ElmWidget &parent) const;
-               private:
-                       LayoutTheme m_theme;
-                       std::string m_edjeFilePath;
-                       EdjeGroup m_edjeGroup;
-                       bool m_isOwner;
-                       bool m_needBindToEo;
-               };
-
-       public:
-               friend class ReffedObj<Layout>;
-               using EdjeWidget::EdjeWidget;
-               explicit Layout(Evas_Object *eo, bool isOwner = false);
-
-               bool setTheme(const LayoutTheme &theme);
-               bool setEdjeFile(const std::string &filePath, EdjeGroup group);
-
-               Variant getData(EdjeDataKey key);
-       };
-}
-
-#include "Layout.hpp"
-
-#endif // __UCL_GUI_LAYOUT_H__
diff --git a/ucl/inc/ucl/gui/Layout.hpp b/ucl/inc/ucl/gui/Layout.hpp
deleted file mode 100644 (file)
index e3df1db..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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.
- */
-
-namespace ucl {
-
-       // Layout::Builder //
-
-       inline Layout::Builder::Builder() :
-               m_isOwner(false),
-               m_needBindToEo(false)
-       {
-       }
-
-       inline Layout::Builder &Layout::Builder::setTheme(const LayoutTheme &theme)
-       {
-               m_theme = theme;
-               return *this;
-       }
-
-       inline Layout::Builder &Layout::Builder::setEdjeFile(
-                       std::string filePath, const EdjeGroup group)
-       {
-               m_edjeFilePath = std::move(filePath);
-               m_edjeGroup = group;
-               return *this;
-       }
-
-       inline Layout::Builder &Layout::Builder::setIsOwner(const bool value)
-       {
-               m_isOwner = value;
-               return *this;
-       }
-
-       inline Layout::Builder &Layout::Builder::setNeedBindToEo(const bool value)
-       {
-               m_needBindToEo = value;
-               return *this;
-       }
-
-       // Layout //
-
-       inline Layout::Layout(Evas_Object *const eo, const bool isOwner) :
-               EdjeWidget(nullptr, eo, isOwner)
-       {
-       }
-
-       inline bool Layout::setTheme(const LayoutTheme &theme)
-       {
-               return elm_layout_theme_set(getEo(),
-                               theme.klass, theme.group, theme.style);
-       }
-
-       inline bool Layout::setEdjeFile(const std::string &filePath,
-                       const EdjeGroup group)
-       {
-               return elm_layout_file_set(getEo(), filePath.c_str(), group.name);
-       }
-
-       inline Variant Layout::getData(EdjeDataKey key)
-       {
-               return elm_layout_data_get(getEo(), key);
-       }
-}
diff --git a/ucl/inc/ucl/gui/NaviItem.h b/ucl/inc/ucl/gui/NaviItem.h
deleted file mode 100644 (file)
index 1161847..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_GUI_NAVI_ITEM_H__
-#define __UCL_GUI_NAVI_ITEM_H__
-
-#include "WidgetItem.h"
-
-namespace ucl {
-
-       class NaviItem final : public WidgetItem {
-       public:
-               using PopHandler = Delegate<Eina_Bool(Elm_Object_Item *)>;
-
-       public:
-               using WidgetItem::WidgetItem;
-
-               void setPopHandler(const PopHandler &handler) const;
-
-               void popTo() const;
-               void promote() const;
-
-               void setTitleEnabled(bool value, bool useTransition = false) const;
-               bool isTitleEnabled() const;
-
-               void setTitle(const TString &title) const;
-       };
-}
-
-#include "NaviItem.hpp"
-
-#endif // __UCL_GUI_NAVI_ITEM_H__
diff --git a/ucl/inc/ucl/gui/NaviItem.hpp b/ucl/inc/ucl/gui/NaviItem.hpp
deleted file mode 100644 (file)
index 6b33fe4..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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.
- */
-
-namespace ucl {
-
-       inline void NaviItem::setPopHandler(const PopHandler &handler) const
-       {
-               elm_naviframe_item_pop_cb_set(getIt(),
-                               handler.getStubA(), handler.getData());
-       }
-
-       inline void NaviItem::setTitleEnabled(
-                       const bool value, const bool useTransition) const
-       {
-               elm_naviframe_item_title_enabled_set(getIt(),
-                               toEina(value), toEina(useTransition));
-       }
-
-       inline bool NaviItem::isTitleEnabled() const
-       {
-               return elm_naviframe_item_title_enabled_get(getIt());
-       }
-
-       inline void NaviItem::setTitle(const TString &title) const
-       {
-               if (isEmpty(title)) {
-                       setTitleEnabled(false);
-               } else {
-                       setText(title);
-                       setTitleEnabled(true);
-               }
-       }
-}
diff --git a/ucl/inc/ucl/gui/Naviframe.h b/ucl/inc/ucl/gui/Naviframe.h
deleted file mode 100644 (file)
index 66693f2..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_GUI_NAVIFRAME_H__
-#define __UCL_GUI_NAVIFRAME_H__
-
-#include <vector>
-
-#include "StyledWidget.h"
-#include "NaviItem.h"
-
-namespace ucl {
-
-       constexpr SmartEvent NAVI_TRANSITION_STARTED {"ucl,transition,started"};
-       constexpr SmartEvent NAVI_TRANSITION_FINISHED {"transition,finished"};
-
-       UCL_DECLARE_REF_ALIASES(Naviframe);
-
-       class Naviframe final : public StyledWidget {
-       public:
-               class Builder final {
-               public:
-                       Builder();
-                       Builder &setStyle(ElmStyle value);
-                       Builder &setNeedBindToEo(bool value);
-                       NaviframeSRef build(ElmWidget &parent) const;
-               private:
-                       ElmStyle m_style;
-                       bool m_needBindToEo;
-               };
-
-       public:
-               void setInTransition(bool inTransition);
-               bool isInTransition() const;
-
-               void setAutoBackBtn(bool value);
-               bool isAutoBackBtn() const;
-
-               void setPreservePop(bool value);
-               bool isPreservePop() const;
-
-               void setEventsEnabledOnTransition(bool value);
-               bool isEventsEnabledOnTransition() const;
-
-               Evas_Object *pop();
-
-               NaviItem push(const TString &title,
-                               Evas_Object *backBtn, Evas_Object *moreBtn,
-                               Evas_Object *content, ElmStyle style = nullptr);
-               NaviItem push(const TString &title,
-                               Evas_Object *content, ElmStyle style = nullptr);
-               NaviItem push(Evas_Object *content, ElmStyle style = nullptr);
-
-               NaviItem insertAfter(NaviItem after, const TString &title,
-                               Evas_Object *backBtn, Evas_Object *moreBtn,
-                               Evas_Object *content, ElmStyle style = nullptr);
-               NaviItem insertAfter(NaviItem after, const TString &title,
-                               Evas_Object *content, ElmStyle style = nullptr);
-               NaviItem insertAfter(NaviItem after,
-                               Evas_Object *content, ElmStyle style = nullptr);
-
-               NaviItem insertBefore(NaviItem before, const TString &title,
-                               Evas_Object *backBtn, Evas_Object *moreBtn,
-                               Evas_Object *content, ElmStyle style = nullptr);
-               NaviItem insertBefore(NaviItem before, const TString &title,
-                               Evas_Object *content, ElmStyle style = nullptr);
-               NaviItem insertBefore(NaviItem before,
-                               Evas_Object *content, ElmStyle style = nullptr);
-
-               NaviItem getTopItem()const;
-               NaviItem getBottomItem() const;
-               std::vector<NaviItem> getItems() const;
-
-       private:
-               friend class ReffedObj<Naviframe>;
-               Naviframe(IRefCountObj &rc, Evas_Object *eo);
-
-               void onTransitionFinished(Widget &widget, void *eventInfo);
-
-       private:
-               bool m_isInTransition;
-       };
-}
-
-#include "Naviframe.hpp"
-
-#endif // __UCL_GUI_NAVIFRAME_H__
diff --git a/ucl/inc/ucl/gui/Naviframe.hpp b/ucl/inc/ucl/gui/Naviframe.hpp
deleted file mode 100644 (file)
index e8fdc19..0000000
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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.
- */
-
-namespace ucl {
-
-       // Naviframe::Builder //
-
-       inline Naviframe::Builder::Builder() :
-               m_needBindToEo(true)
-       {
-       }
-
-       inline Naviframe::Builder &Naviframe::Builder::setStyle(
-                       const ElmStyle value)
-       {
-               m_style = value;
-               return *this;
-       }
-
-       inline Naviframe::Builder &Naviframe::Builder::setNeedBindToEo(
-                       const bool value)
-       {
-               m_needBindToEo = value;
-               return *this;
-       }
-
-       // Naviframe //
-
-       inline bool Naviframe::isInTransition() const
-       {
-               return m_isInTransition;
-       }
-
-       inline void Naviframe::setAutoBackBtn(const bool value)
-       {
-               elm_naviframe_prev_btn_auto_pushed_set(getEo(), toEina(value));
-       }
-
-       inline bool Naviframe::isAutoBackBtn() const
-       {
-               return elm_naviframe_prev_btn_auto_pushed_get(getEo());
-       }
-
-       inline void Naviframe::setPreservePop(const bool value)
-       {
-               elm_naviframe_content_preserve_on_pop_set(getEo(), toEina(value));
-       }
-
-       inline bool Naviframe::isPreservePop() const
-       {
-               return elm_naviframe_content_preserve_on_pop_get(getEo());
-       }
-
-       inline void Naviframe::setEventsEnabledOnTransition(const bool value)
-       {
-               elm_naviframe_event_enabled_set(getEo(), toEina(value));
-       }
-
-       inline bool Naviframe::isEventsEnabledOnTransition() const
-       {
-               return elm_naviframe_event_enabled_get(getEo());
-       }
-
-       inline Evas_Object *Naviframe::pop()
-       {
-               auto result = elm_naviframe_item_pop(getEo());
-               if (getBottomItem()) {
-                       setInTransition(true);
-               }
-               return result;
-       }
-
-       inline NaviItem Naviframe::push(const TString &title,
-                       Evas_Object *const backBtn, Evas_Object *const moreBtn,
-                       Evas_Object *const content, const ElmStyle style)
-       {
-               auto result = NaviItem(elm_naviframe_item_push(getEo(),
-                               nullptr, backBtn, moreBtn, content, style.name));
-               result.setTitle(title);
-               if (result != getBottomItem()) {
-                       setInTransition(true);
-               }
-               return result;
-       }
-
-       inline NaviItem Naviframe::push(const TString &title,
-                       Evas_Object *const content, const ElmStyle style)
-       {
-               return push(title, nullptr, nullptr, content, style);
-       }
-
-       inline NaviItem Naviframe::push(
-                       Evas_Object *const content, const ElmStyle style)
-       {
-               return push(nullptr, nullptr, nullptr, content, style);
-       }
-
-       inline NaviItem Naviframe::insertAfter(NaviItem after,
-                       const TString &title,
-                       Evas_Object *const backBtn, Evas_Object *const moreBtn,
-                       Evas_Object *const content, const ElmStyle style)
-       {
-               auto result = NaviItem(elm_naviframe_item_insert_after(getEo(),
-                               after, nullptr, backBtn, moreBtn, content, style.name));
-               result.setTitle(title);
-               return result;
-       }
-
-       inline NaviItem Naviframe::insertAfter(NaviItem after,
-                       const TString &title,
-                       Evas_Object *const content, const ElmStyle style)
-       {
-               return insertAfter(after, title, nullptr, nullptr, content, style);
-       }
-
-       inline NaviItem Naviframe::insertAfter(NaviItem after,
-                       Evas_Object *const content, const ElmStyle style)
-       {
-               return insertAfter(after, nullptr, nullptr, nullptr, content, style);
-       }
-
-       inline NaviItem Naviframe::insertBefore(NaviItem before,
-                       const TString &title,
-                       Evas_Object *const backBtn, Evas_Object *const moreBtn,
-                       Evas_Object *const content, const ElmStyle style)
-       {
-               auto result = NaviItem(elm_naviframe_item_insert_before(getEo(),
-                               before, nullptr, backBtn, moreBtn, content, style.name));
-               result.setTitle(title);
-               return result;
-       }
-
-       inline NaviItem Naviframe::insertBefore(NaviItem before,
-                       const TString &title,
-                       Evas_Object *const content, const ElmStyle style)
-       {
-               return insertAfter(before, title, nullptr, nullptr, content, style);
-       }
-
-       inline NaviItem Naviframe::insertBefore(NaviItem before,
-                       Evas_Object *const content, const ElmStyle style)
-       {
-               return insertAfter(before, nullptr, nullptr, nullptr, content, style);
-       }
-
-       inline NaviItem Naviframe::getTopItem()const
-       {
-               return NaviItem(elm_naviframe_top_item_get(getEo()));
-       }
-
-       inline NaviItem Naviframe::getBottomItem() const
-       {
-               return NaviItem(elm_naviframe_bottom_item_get(getEo()));
-       }
-
-       inline std::vector<NaviItem> Naviframe::getItems() const
-       {
-               std::vector<NaviItem> result;
-
-               Eina_List *const items = elm_naviframe_items_get(getEo());
-               Eina_List *l = nullptr;
-               void *data = nullptr;
-
-               EINA_LIST_FOREACH(items, l, data) {
-                       result.emplace_back(static_cast<Elm_Object_Item *>(data));
-               }
-
-               eina_list_free(items);
-
-               return result;
-       }
-}
diff --git a/ucl/inc/ucl/gui/StyledWidget.h b/ucl/inc/ucl/gui/StyledWidget.h
deleted file mode 100644 (file)
index 2a0280c..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_GUI_STYLED_WIDGET_H__
-#define __UCL_GUI_STYLED_WIDGET_H__
-
-#include "EdjeWidget.h"
-
-namespace ucl {
-
-       UCL_DECLARE_REF_ALIASES(StyledWidget);
-
-       class StyledWidget : public EdjeWidget {
-       public:
-               friend class ReffedObj<StyledWidget>;
-               using EdjeWidget::EdjeWidget;
-               explicit StyledWidget(Evas_Object *eo, bool isOwner = false);
-
-               void setStyle(ElmStyle style);
-       };
-}
-
-#include "StyledWidget.hpp"
-
-#endif // __UCL_GUI_STYLED_WIDGET_H__
diff --git a/ucl/inc/ucl/gui/StyledWidget.hpp b/ucl/inc/ucl/gui/StyledWidget.hpp
deleted file mode 100644 (file)
index cb32329..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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.
- */
-
-namespace ucl {
-
-       inline StyledWidget::StyledWidget(
-                       Evas_Object *const eo, const bool isOwner) :
-               EdjeWidget(nullptr, eo, isOwner)
-       {
-       }
-
-       inline void StyledWidget::setStyle(const ElmStyle style)
-       {
-               elm_object_style_set(getEo(), style.name);
-       }
-}
diff --git a/ucl/inc/ucl/gui/Theme.h b/ucl/inc/ucl/gui/Theme.h
deleted file mode 100644 (file)
index d8b5b31..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_GUI_THEME_H__
-#define __UCL_GUI_THEME_H__
-
-#include "types.h"
-
-namespace ucl {
-
-       class Theme final : NonCopyable {
-       public:
-               static Theme create();
-
-               friend void swap(Theme &x, Theme &y);
-
-       public:
-               Theme();
-               Theme(std::nullptr_t);
-               explicit Theme(Elm_Theme *th, bool isOwner = false);
-               Theme(Theme &&tmp);
-               Theme &operator=(Theme &&tmp);
-               ~Theme();
-
-               Elm_Theme *getTh();
-               const Elm_Theme *getTh() const;
-
-               operator Elm_Theme *();
-               operator const Elm_Theme *() const;
-
-               void addExtension(const std::string edjePath);
-               void addOverlay(const std::string edjePath);
-
-       private:
-               Elm_Theme *m_th;
-               bool m_isOwner;
-       };
-
-       // Non-member functions //
-
-       bool isValid(const Theme &item);
-}
-
-#include "Theme.hpp"
-
-#endif // __UCL_GUI_THEME_H__
diff --git a/ucl/inc/ucl/gui/Theme.hpp b/ucl/inc/ucl/gui/Theme.hpp
deleted file mode 100644 (file)
index 65910df..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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.
- */
-
-namespace ucl {
-
-       inline Theme Theme::create()
-       {
-               Elm_Theme *const th = elm_theme_new();
-               if (th) {
-                       elm_theme_ref_set(th, nullptr);
-               }
-               return Theme(th, true);
-       }
-
-       inline Theme::Theme() :
-               m_th(nullptr),
-               m_isOwner(false)
-       {
-       }
-
-       inline Theme::Theme(std::nullptr_t) :
-               Theme()
-       {
-       }
-
-       inline Theme::Theme(Elm_Theme *const th, const bool isOwner) :
-               m_th(th),
-               m_isOwner(isOwner)
-       {
-       }
-
-       inline Theme::Theme(Theme &&tmp)
-       {
-               m_th = tmp.m_th;
-               tmp.m_th = nullptr;
-       }
-
-       inline Theme &Theme::operator=(Theme &&tmp)
-       {
-               swap(*this, tmp);
-               return *this;
-       }
-
-       inline Theme::~Theme()
-       {
-               if (m_isOwner && m_th) {
-                       elm_theme_free(m_th);
-               }
-       }
-
-       inline Elm_Theme *Theme::getTh()
-       {
-               return m_th;
-       }
-
-       inline const Elm_Theme *Theme::getTh() const
-       {
-               return m_th;
-       }
-
-       inline Theme::operator Elm_Theme *()
-       {
-               return getTh();
-       }
-
-       inline Theme::operator const Elm_Theme *() const
-       {
-               return getTh();
-       }
-
-       inline void Theme::addExtension(const std::string edjePath)
-       {
-               elm_theme_extension_add(getTh(), edjePath.c_str());
-       }
-
-       inline void Theme::addOverlay(const std::string edjePath)
-       {
-               elm_theme_overlay_add(getTh(), edjePath.c_str());
-       }
-
-       // Non-member functions //
-
-       inline bool isValid(const Theme &item)
-       {
-               return !!item.getTh();
-       }
-
-       inline void swap(Theme &x, Theme &y)
-       {
-               std::swap(x.m_th, y.m_th);
-               std::swap(x.m_isOwner, y.m_isOwner);
-       }
-}
diff --git a/ucl/inc/ucl/gui/Widget.h b/ucl/inc/ucl/gui/Widget.h
deleted file mode 100644 (file)
index e60c5ec..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_GUI_WIDGET_H__
-#define __UCL_GUI_WIDGET_H__
-
-#include <list>
-
-#include "types.h"
-
-#include "ucl/misc/RefCountAware.h"
-
-#define UCL_SMART_FWD "ucl,fwd,"
-
-namespace ucl {
-
-       UCL_DECLARE_REF_ALIASES(Widget);
-
-       class Widget : public RefCountAware {
-       public:
-               static constexpr auto EXPAND = EVAS_HINT_EXPAND;
-               static constexpr auto FILL = EVAS_HINT_FILL;
-
-       public:
-               explicit Widget(Evas_Object *eo, bool isOwner = false);
-               virtual ~Widget();
-
-               void bindToEo();
-               void unbindFromEo();
-
-               void setIsOwner(bool value);
-
-               Evas_Object *getEo();
-               const Evas_Object *getEo() const;
-
-               operator Evas_Object *();
-               operator const Evas_Object *() const;
-
-               Evas *getEvas() const;
-
-               void setData(EoDataKey key, void *data);
-               void delData(EoDataKey key);
-               void *getData(EoDataKey key) const;
-
-               void addEventHandler(WidgetEvent event, WidgetEventHandler handler);
-               void addEventHandler(SmartEvent event, WidgetEventHandler handler);
-
-               void delEventHandler(WidgetEvent event, WidgetEventHandler handler);
-               void delEventHandler(SmartEvent event, WidgetEventHandler handler);
-
-               void callEvent(SmartEvent event, void *eventInfo = nullptr);
-
-               void markForDeletion();
-
-               void setVisible(bool value);
-               bool isVisible() const;
-
-               void setColor(int r, int g, int b, int a = 255);
-               void setColor(int l, int a = 255);
-               void getColor(int &r, int &g, int &b, int &a) const;
-
-               void calculate();
-
-               void setGeometry(int x, int y, int w, int h);
-               void move(int x, int y);
-               void resize(int w, int h);
-
-               void getGeometry(int *x, int *y, int *w, int *h) const;
-
-               void setWeight(double w, double h);
-               void setAlign(double w, double h);
-               void setMin(int w, int h);
-               void setMax(int w, int h);
-
-               void getWeight(double *w, double *h) const;
-               void getAlign(double *w, double *h) const;
-               void getMin(int *w, int *h) const;
-               void getMax(int *w, int *h) const;
-
-               void setARHint(WidgetARHint arControl, int w, int h);
-               void getARHint(WidgetARHint &arControl, int &w, int &h);
-
-               void setFocused(bool value);
-               bool isFocused() const;
-
-       protected:
-               friend class ReffedObj<Widget>;
-               Widget(IRefCountObj *rc, Evas_Object *eo, bool isOwner = false);
-
-               virtual void setFocusedImpl(bool value);
-               virtual bool isFocusedImpl() const;
-               virtual bool ensureFwdEvent(SmartEvent fwdEvent);
-
-       private:
-               class EventProxy;
-               using EventProxies = std::list<EventProxy>;
-               using EventProxiesIt = EventProxies::iterator;
-
-       private:
-               void updateRefs();
-
-               void updateEoRef();
-               bool needKeepEoRef() const;
-               void updateSelfRef();
-               bool needKeepSelfRef() const;
-
-               void setSelfRefUnique(const bool value);
-
-               void onEoDel(Evas *e, Evas_Object *obj, void *event_info);
-
-               void delEventProxy(const EventProxiesIt it);
-
-       public:
-               // This section MUST be public!
-               // Signal to RefCountObj<T, C> to call onUniqueChanged()
-               enum { _ENABLE_ON_UNIQUE_CHANGED_DISPATCH };
-
-       protected:
-               // This section MAY be protected
-               void onUniqueChanged(bool isUnique);
-
-       private:
-               Evas_Object *m_eo;
-               EventProxies m_eventProxies;
-               WidgetSRef m_selfRef;
-               bool m_isOwner;
-               bool m_isBoundToEo;
-               bool m_isEoRefKept;
-               bool m_isSelfRefUnique;
-       };
-
-       // Non-member functions //
-
-       void getPosition(const Widget &widget, int *x, int *y);
-       void getSize(const Widget &widget, int *w, int *h);
-
-       void show(Widget &widget);
-       void hide(Widget &widget);
-
-       void makeTransparent(Widget &widget);
-       void makeWhite(Widget &widget);
-
-       void focus(Widget &widget);
-       void unfocus(Widget &widget);
-
-       void expand(Widget &widget);
-       void fill(Widget &widget);
-       void expandAndFill(Widget &widget);
-
-       bool operator==(const Widget &lhs, const Widget &rhs);
-       bool operator!=(const Widget &lhs, const Widget &rhs);
-}
-
-#include "Widget.hpp"
-
-#endif // __UCL_GUI_WIDGET_H__
diff --git a/ucl/inc/ucl/gui/Widget.hpp b/ucl/inc/ucl/gui/Widget.hpp
deleted file mode 100644 (file)
index 95da66a..0000000
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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.
- */
-
-namespace ucl { namespace { namespace impl {
-
-       constexpr auto WIDGET_DATA_NAME = "__WIDGET_DATA_NAME__";
-}}}
-
-namespace ucl {
-
-       inline Widget::Widget(Evas_Object *const eo, const bool isOwner) :
-               Widget(nullptr, eo, isOwner)
-       {
-       }
-
-       inline void Widget::setIsOwner(const bool value)
-       {
-               if (value != m_isOwner) {
-                       m_isOwner = value;
-                       updateRefs();
-               }
-       }
-
-       inline Evas_Object *Widget::getEo()
-       {
-               return m_eo;
-       }
-
-       inline const Evas_Object *Widget::getEo() const
-       {
-               return m_eo;
-       }
-
-       inline Widget::operator Evas_Object *()
-       {
-               return getEo();
-       }
-
-       inline Widget::operator const Evas_Object *() const
-       {
-               return getEo();
-       }
-
-       inline Evas *Widget::getEvas() const
-       {
-               return evas_object_evas_get(getEo());
-       }
-
-       inline void Widget::setData(const EoDataKey key, void *const data)
-       {
-               evas_object_data_set(getEo(), key.name, data);
-       }
-
-       inline void Widget::delData(const EoDataKey key)
-       {
-               evas_object_data_del(getEo(), key.name);
-       }
-
-       inline void *Widget::getData(const EoDataKey key) const
-       {
-               return evas_object_data_get(getEo(), key.name);
-       }
-
-       inline void Widget::callEvent(SmartEvent event, void *eventInfo)
-       {
-               evas_object_smart_callback_call(getEo(), event, eventInfo);
-       }
-
-       inline void Widget::markForDeletion()
-       {
-               evas_object_del(getEo());
-       }
-
-       inline void Widget::setVisible(bool value)
-       {
-               if (value) {
-                       evas_object_show(getEo());
-               } else {
-                       evas_object_hide(getEo());
-               }
-       }
-
-       inline bool Widget::isVisible() const
-       {
-               return evas_object_visible_get(getEo());
-       }
-
-       inline void Widget::setColor(const int r, const int g,
-                       const int b, const int a)
-       {
-               evas_object_color_set(getEo(), r, g, b, a);
-       }
-
-       inline void Widget::setColor(const int l, const int a)
-       {
-               evas_object_color_set(getEo(), l, l, l, a);
-       }
-
-       inline void Widget::getColor(int &r, int &g, int &b, int &a) const
-       {
-               evas_object_color_get(getEo(), &r, &g, &b, &a);
-       }
-
-       inline void Widget::calculate()
-       {
-               evas_object_smart_calculate(getEo());
-       }
-
-       inline void Widget::setGeometry(const int x, const int y,
-                       const int w, const int h)
-       {
-               evas_object_geometry_set(getEo(), x, y, w, h);
-       }
-
-       inline void Widget::move(const int x, const int y)
-       {
-               evas_object_move(getEo(), x, y);
-       }
-
-       inline void Widget::resize(const int w, const int h)
-       {
-               evas_object_resize(getEo(), w, h);
-       }
-
-       inline void Widget::getGeometry(int *const x, int *const y,
-                       int *const w, int *const h) const
-       {
-               evas_object_geometry_get(getEo(), x, y, w, h);
-       }
-
-       inline void Widget::setWeight(const double w, const double h)
-       {
-               evas_object_size_hint_weight_set(getEo(), w, h);
-       }
-
-       inline void Widget::setAlign(const double w, const double h)
-       {
-               evas_object_size_hint_align_set(getEo(), w, h);
-       }
-
-       inline void Widget::setMin(const int w, const int h)
-       {
-               evas_object_size_hint_min_set(getEo(), w, h);
-       }
-
-       inline void Widget::setMax(const int w, const int h)
-       {
-               evas_object_size_hint_max_set(getEo(), w, h);
-       }
-
-       inline void Widget::getWeight(double *const w, double *const h) const
-       {
-               evas_object_size_hint_weight_get(getEo(), w, h);
-       }
-
-       inline void Widget::getAlign(double *const w, double *const h) const
-       {
-               evas_object_size_hint_align_get(getEo(), w, h);
-       }
-
-       inline void Widget::getMin(int *const w, int *const h) const
-       {
-               evas_object_size_hint_min_get(getEo(), w, h);
-       }
-
-       inline void Widget::getMax(int *const w, int *const h) const
-       {
-               evas_object_size_hint_max_get(getEo(), w, h);
-       }
-
-       inline void Widget::setARHint(WidgetARHint arControl, int w, int h)
-       {
-               evas_object_size_hint_aspect_set(getEo(),
-                               static_cast<Evas_Aspect_Control>(arControl), w, h);
-       }
-
-       inline void Widget::getARHint(WidgetARHint &arControl, int &w, int &h)
-       {
-               Evas_Aspect_Control tmp = EVAS_ASPECT_CONTROL_NEITHER;
-               evas_object_size_hint_aspect_get(getEo(), &tmp, &w, &h);
-               arControl = static_cast<WidgetARHint>(tmp);
-       }
-
-       inline void Widget::setFocused(const bool value)
-       {
-               setFocusedImpl(value);
-       }
-
-       inline bool Widget::isFocused() const
-       {
-               return isFocusedImpl();
-       }
-
-       // Non-member functions //
-
-       inline void getPosition(const Widget &widget, int *x, int *y)
-       {
-               widget.getGeometry(x, y, nullptr, nullptr);
-       }
-
-       inline void getSize(const Widget &widget, int *w, int *h)
-       {
-               widget.getGeometry(nullptr, nullptr, w, h);
-       }
-
-       inline void show(Widget &widget)
-       {
-               widget.setVisible(true);
-       }
-
-       inline void hide(Widget &widget)
-       {
-               widget.setVisible(false);
-       }
-
-       inline void makeTransparent(Widget &widget)
-       {
-               widget.setColor(0, 0);
-       }
-
-       inline void makeWhite(Widget &widget)
-       {
-               widget.setColor(255);
-       }
-
-       inline void focus(Widget &widget)
-       {
-               widget.setFocused(true);
-       }
-
-       inline void unfocus(Widget &widget)
-       {
-               widget.setFocused(false);
-       }
-
-       inline void expand(Widget &widget)
-       {
-               widget.setWeight(Widget::EXPAND, Widget::EXPAND);
-       }
-
-       inline void fill(Widget &widget)
-       {
-               widget.setAlign(Widget::FILL, Widget::FILL);
-       }
-
-       inline void expandAndFill(Widget &widget)
-       {
-               expand(widget);
-               fill(widget);
-       }
-
-       inline bool operator==(const Widget &lhs, const Widget &rhs)
-       {
-               return (lhs.getEo() == rhs.getEo());
-       }
-
-       inline bool operator!=(const Widget &lhs, const Widget &rhs)
-       {
-               return (lhs.getEo() != rhs.getEo());
-       }
-}
diff --git a/ucl/inc/ucl/gui/WidgetItem.h b/ucl/inc/ucl/gui/WidgetItem.h
deleted file mode 100644 (file)
index 7794444..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_GUI_WIDGET_ITEM_H__
-#define __UCL_GUI_WIDGET_ITEM_H__
-
-#include "Widget.h"
-
-namespace ucl {
-
-       class WidgetItem {
-       public:
-               constexpr WidgetItem();
-               constexpr WidgetItem(std::nullptr_t);
-               explicit WidgetItem(Elm_Object_Item *it);
-
-               Elm_Object_Item *getIt() const;
-
-               operator Elm_Object_Item *() const;
-               operator bool() const;
-
-               Evas_Object *getWidget() const;
-
-               void setDelCallback(Evas_Smart_Cb cb) const;
-
-               void del();
-
-               void setData(void *data) const;
-               void *getData() const;
-
-               void setEnabled(bool value) const;
-               bool isEnabled() const;
-
-               void setStyle(ElmStyle style) const;
-
-               void setText(const TString &value) const;
-               void setText(const TString &value, EdjePart part) const;
-
-               TString getText() const;
-               TString getText(EdjePart part) const;
-
-               void setContent(Evas_Object *content) const;
-               void setContent(Evas_Object *content, EdjePart part) const;
-               Evas_Object *unsetContent() const;
-               Evas_Object *unsetContent(EdjePart part) const;
-
-               Evas_Object *getContent() const;
-               Evas_Object *getContent(EdjePart part) const;
-
-               void emit(EdjeSignal signal,EdjeSignalSrc source =
-                               EdjeSignalSrc("")) const;
-
-       private:
-               Elm_Object_Item *m_it;
-       };
-
-       // Non-member functions //
-
-       void enable(WidgetItem item);
-       void disable(WidgetItem item);
-
-       bool operator==(WidgetItem lhs, WidgetItem rhs);
-       bool operator!=(WidgetItem lhs, WidgetItem rhs);
-}
-
-#include "WidgetItem.hpp"
-
-#endif // __UCL_GUI_WIDGET_ITEM_H__
diff --git a/ucl/inc/ucl/gui/WidgetItem.hpp b/ucl/inc/ucl/gui/WidgetItem.hpp
deleted file mode 100644 (file)
index 26b6cbd..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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.
- */
-
-namespace ucl {
-
-       constexpr WidgetItem::WidgetItem() :
-               m_it(nullptr)
-       {
-       }
-
-       constexpr WidgetItem::WidgetItem(std::nullptr_t) :
-               WidgetItem()
-       {
-       }
-
-       inline WidgetItem::WidgetItem(Elm_Object_Item *const it) :
-               m_it(it)
-       {
-       }
-
-       inline Elm_Object_Item *WidgetItem::getIt() const
-       {
-               return m_it;
-       }
-
-       inline WidgetItem::operator Elm_Object_Item *() const
-       {
-               return m_it;
-       }
-
-       inline WidgetItem::operator bool() const
-       {
-               return !!m_it;
-       }
-
-       inline Evas_Object *WidgetItem::getWidget() const
-       {
-               return elm_object_item_widget_get(getIt());
-       }
-
-       inline void WidgetItem::setDelCallback(const Evas_Smart_Cb cb) const
-       {
-               elm_object_item_del_cb_set(getIt(), cb);
-       }
-
-       inline void WidgetItem::del()
-       {
-               elm_object_item_del(m_it);
-               m_it = nullptr;
-       }
-
-       inline void WidgetItem::setData(void *const data) const
-       {
-               elm_object_item_data_set(getIt(), data);
-       }
-
-       inline void *WidgetItem::getData() const
-       {
-               return elm_object_item_data_get(getIt());
-       }
-
-       inline void WidgetItem::setEnabled(const bool value) const
-       {
-               elm_object_item_disabled_set(getIt(), toEina(!value));
-       }
-
-       inline bool WidgetItem::isEnabled() const
-       {
-               return (elm_object_item_disabled_get(getIt()) ? false : true);
-       }
-
-       inline void WidgetItem::setStyle(const ElmStyle style) const
-       {
-               elm_object_item_style_set(getIt(), style.name);
-       }
-
-       inline TString WidgetItem::getText() const
-       {
-               return elm_object_item_text_get(getIt());
-       }
-
-       inline TString WidgetItem::getText(const EdjePart part) const
-       {
-               return elm_object_item_part_text_get(getIt(), part.name);
-       }
-
-       inline void WidgetItem::setContent(Evas_Object *const content) const
-       {
-               elm_object_item_content_set(getIt(), content);
-       }
-
-       inline void WidgetItem::setContent(Evas_Object *const content,
-                       const EdjePart part) const
-       {
-               elm_object_item_part_content_set(getIt(), part.name, content);
-       }
-
-       inline Evas_Object *WidgetItem::unsetContent() const
-       {
-               return elm_object_item_content_unset(getIt());
-       }
-
-       inline Evas_Object *WidgetItem::unsetContent(const EdjePart part) const
-       {
-               return elm_object_item_part_content_unset(getIt(), part.name);
-       }
-
-       inline Evas_Object *WidgetItem::getContent() const
-       {
-               return elm_object_item_content_get(getIt());
-       }
-
-       inline Evas_Object *WidgetItem::getContent(const EdjePart part) const
-       {
-               return elm_object_item_part_content_get(getIt(), part.name);
-       }
-
-       inline void WidgetItem::emit(const EdjeSignal signal,
-                       const EdjeSignalSrc source) const
-       {
-               elm_object_item_signal_emit(getIt(), signal.name, source.name);
-       }
-
-       // Non-member functions //
-
-       inline void enable(const WidgetItem item)
-       {
-               item.setEnabled(true);
-       }
-
-       inline void disable(const WidgetItem item)
-       {
-               item.setEnabled(false);
-       }
-
-       inline bool operator==(const WidgetItem lhs, const WidgetItem rhs)
-       {
-               return (lhs.getIt() == rhs.getIt());
-       }
-
-       inline bool operator!=(const WidgetItem lhs, const WidgetItem rhs)
-       {
-               return (lhs.getIt() != rhs.getIt());
-       }
-}
diff --git a/ucl/inc/ucl/gui/Window.h b/ucl/inc/ucl/gui/Window.h
deleted file mode 100644 (file)
index 9aa598d..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_GUI_WINDOW_H__
-#define __UCL_GUI_WINDOW_H__
-
-#include <vector>
-
-#include "StyledWidget.h"
-
-namespace ucl {
-
-       constexpr SmartEvent WIN_ROTATION_CHANGED {"wm,rotation,changed"};
-
-       UCL_DECLARE_REF_ALIASES(Window);
-
-       class Window final : public ElmWidget {
-       public:
-               enum class Type {
-                       BASIC = ELM_WIN_BASIC
-               };
-
-               class Builder final {
-               public:
-                       Builder();
-
-                       Builder &setWinEo(Evas_Object *value);
-
-                       Builder &setType(Type type);
-                       Builder &setName(std::string value);
-
-                       Builder &setTitle(std::string value);
-                       Builder &setSetIndicatorVisible(bool value);
-                       Builder &setRotations(std::vector<int> value);
-
-                       Builder &setIsOwner(bool value);
-                       Builder &setNeedBindToEo(bool value);
-
-                       WindowSRef build() const;
-               private:
-                       std::string m_name;
-                       std::string m_title;
-                       std::vector<int> m_rotations;
-                       Evas_Object *m_winEo;
-                       Type m_type;
-                       bool m_isIndicatorVisible;
-                       bool m_isOwner;
-                       bool m_isOwnerWasSet;
-                       bool m_needBindToEo;
-               };
-
-       public:
-               StyledWidget &getConformant();
-               const StyledWidget &getConformant() const;
-
-               void getScreenSize(int *w, int *h) const;
-
-               void setTitle(const std::string &title);
-               std::string getTitle() const;
-
-               void setIndicatorVisible(bool value);
-               bool isIndicatorVisible() const;
-
-               bool isRotationsSupported() const;
-               void setRotations(const std::vector<int> &value);
-
-               void lower();
-
-       private:
-               friend class ReffedObj<Window>;
-               Window(IRefCountObj *rc, Evas_Object *eo,
-                               bool isOwner, Evas_Object *conform);
-
-       private:
-               StyledWidget m_conform;
-       };
-
-       // Non-member functions //
-
-       // Window //
-
-       void showIndicator(Window &win);
-       void hideIndicator(Window &win);
-
-       // Window::Type //
-
-       bool isValid(Window::Type winType);
-}
-
-#include "Window.hpp"
-
-#endif // __UCL_GUI_WINDOW_H__
diff --git a/ucl/inc/ucl/gui/Window.hpp b/ucl/inc/ucl/gui/Window.hpp
deleted file mode 100644 (file)
index d5b1828..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 <algorithm>
-
-namespace ucl {
-
-       // Window::Builder //
-
-       inline Window::Builder::Builder() :
-               m_rotations({0}),
-               m_winEo(nullptr),
-               m_type(Type::BASIC),
-               m_isIndicatorVisible(false),
-               m_isOwner(false),
-               m_isOwnerWasSet(false),
-               m_needBindToEo(true)
-       {
-       }
-
-       inline Window::Builder &Window::Builder::setWinEo(Evas_Object *const value)
-       {
-               m_winEo = value;
-               return *this;
-       }
-
-       inline Window::Builder &Window::Builder::setType(const Type type)
-       {
-               m_type = type;
-               return *this;
-       }
-
-       inline Window::Builder &Window::Builder::setName(std::string value)
-       {
-               m_name = std::move(value);
-               return *this;
-       }
-
-       inline Window::Builder &Window::Builder::setTitle(std::string value)
-       {
-               m_title = std::move(value);
-               return *this;
-       }
-
-       inline Window::Builder &Window::Builder::setSetIndicatorVisible(
-                       const bool value)
-       {
-               m_isIndicatorVisible = value;
-               return *this;
-       }
-
-       inline Window::Builder &Window::Builder::setRotations(
-                       std::vector<int> value)
-       {
-               m_rotations = std::move(value);
-               return *this;
-       }
-
-       inline Window::Builder &Window::Builder::setIsOwner(const bool value)
-       {
-               m_isOwner = value;
-               m_isOwnerWasSet = true;
-               return *this;
-       }
-
-       inline Window::Builder &Window::Builder::setNeedBindToEo(const bool value)
-       {
-               m_needBindToEo = value;
-               return *this;
-       }
-
-       // Window //
-
-       inline Window::Window(IRefCountObj *const rc, Evas_Object *const eo,
-                       const bool isOwner, Evas_Object *const conform) :
-               ElmWidget(rc, eo, isOwner),
-               m_conform(conform)
-       {
-       }
-
-       inline StyledWidget &Window::getConformant()
-       {
-               return m_conform;
-       }
-
-       inline const StyledWidget &Window::getConformant() const
-       {
-               return m_conform;
-       }
-
-       inline void Window::getScreenSize(int *const w, int *const h) const
-       {
-               elm_win_screen_size_get(getEo(), nullptr, nullptr, w, h);
-       }
-
-       inline void Window::setTitle(const std::string &title)
-       {
-               elm_win_title_set(getEo(), title.c_str());
-       }
-
-       inline std::string Window::getTitle() const
-       {
-               return nz(elm_win_title_get(getEo()));
-       }
-
-       inline void Window::setIndicatorVisible(bool value)
-       {
-               if (value) {
-                       elm_win_indicator_mode_set(getEo(), ELM_WIN_INDICATOR_SHOW);
-               } else {
-                       elm_win_indicator_mode_set(getEo(), ELM_WIN_INDICATOR_HIDE);
-               }
-       }
-
-       inline bool Window::isIndicatorVisible() const
-       {
-               return (elm_win_indicator_mode_get(getEo()) == ELM_WIN_INDICATOR_SHOW);
-       }
-
-       inline bool Window::isRotationsSupported() const
-       {
-               return elm_win_wm_rotation_supported_get(getEo());
-       }
-
-       inline void Window::setRotations(const std::vector<int> &value)
-       {
-               elm_win_wm_rotation_available_rotations_set(getEo(),
-                               value.data(), value.size());
-       }
-
-       inline void Window::lower()
-       {
-               elm_win_lower(getEo());
-       }
-
-       // Non-member functions //
-
-       // Window //
-
-       inline void showIndicator(Window &win)
-       {
-               win.setIndicatorVisible(true);
-       }
-
-       inline void hideIndicator(Window &win)
-       {
-               win.setIndicatorVisible(false);
-       }
-
-       // Window::Type //
-
-       inline bool isValid(Window::Type winType)
-       {
-               switch (winType) {
-               case Window::Type::BASIC:
-                       return true;
-               }
-               return false;
-       }
-}
diff --git a/ucl/inc/ucl/gui/helpers.h b/ucl/inc/ucl/gui/helpers.h
deleted file mode 100644 (file)
index d42eccb..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_GUI_HELPERS_H__
-#define __UCL_GUI_HELPERS_H__
-
-#include "Widget.h"
-
-namespace ucl {
-
-       // Converts Evas_Object to Widget pointer //
-
-       Widget *asWidget(Evas_Object *eo);
-       const Widget *asWidget(const Evas_Object *eo);
-
-       // Widget casting functions from Evas_Object //
-
-       template <class WIDGET_TYPE>
-       inline auto staticWidgetCast(Evas_Object *eo) ->
-                       decltype(static_cast<WIDGET_TYPE *>(asWidget(eo)))
-       {
-               return static_cast<WIDGET_TYPE *>(asWidget(eo));
-       }
-
-       template <class WIDGET_TYPE>
-       inline auto staticWidgetCast(const Evas_Object *eo) ->
-                       decltype(static_cast<WIDGET_TYPE *>(asWidget(eo)))
-       {
-               return static_cast<WIDGET_TYPE *>(asWidget(eo));
-       }
-
-       template <class WIDGET_TYPE>
-       inline auto dynamicWidgetCast(Evas_Object *eo) ->
-                       decltype(dynamic_cast<WIDGET_TYPE *>(asWidget(eo)))
-       {
-               return dynamic_cast<WIDGET_TYPE *>(asWidget(eo));
-       }
-
-       template <class WIDGET_TYPE>
-       inline auto dynamicWidgetCast(const Evas_Object *eo) ->
-                       decltype(dynamic_cast<WIDGET_TYPE *>(asWidget(eo)))
-       {
-               return dynamic_cast<WIDGET_TYPE *>(asWidget(eo));
-       }
-
-       template <class WIDGET_TYPE>
-       inline auto staticWidgetRefCast(Evas_Object *eo) ->
-                       decltype(asShared(staticWidgetCast<WIDGET_TYPE>(eo)))
-       {
-               return asShared(staticWidgetCast<WIDGET_TYPE>(eo));
-       }
-
-       template <class WIDGET_TYPE>
-       inline auto staticWidgetRefCast(const Evas_Object *eo) ->
-                       decltype(asShared(staticWidgetCast<WIDGET_TYPE>(eo)))
-       {
-               return asShared(staticWidgetCast<WIDGET_TYPE>(eo));
-       }
-
-       template <class WIDGET_TYPE>
-       inline auto dynamicWidgetRefCast(Evas_Object *eo) ->
-                       decltype(asShared(dynamicWidgetCast<WIDGET_TYPE>(eo)))
-       {
-               return asShared(dynamicWidgetCast<WIDGET_TYPE>(eo));
-       }
-
-       template <class WIDGET_TYPE>
-       inline auto dynamicWidgetRefCast(const Evas_Object *eo) ->
-                       decltype(asShared(dynamicWidgetCast<WIDGET_TYPE>(eo)))
-       {
-               return asShared(dynamicWidgetCast<WIDGET_TYPE>(eo));
-       }
-}
-
-#include "helpers.hpp"
-
-#endif // __UCL_GUI_HELPERS_H__
diff --git a/ucl/inc/ucl/gui/helpers.hpp b/ucl/inc/ucl/gui/helpers.hpp
deleted file mode 100644 (file)
index 29df283..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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.
- */
-
-namespace ucl {
-
-       inline Widget *asWidget(Evas_Object *eo)
-       {
-               return static_cast<Widget *>(
-                               evas_object_data_get(eo, impl::WIDGET_DATA_NAME));
-
-       }
-
-       inline const Widget *asWidget(const Evas_Object *eo)
-       {
-               return static_cast<const Widget *>(
-                               evas_object_data_get(eo, impl::WIDGET_DATA_NAME));
-       }
-}
diff --git a/ucl/inc/ucl/gui/stdTheme.h b/ucl/inc/ucl/gui/stdTheme.h
deleted file mode 100644 (file)
index 13202cc..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_GUI_STD_THEME_H__
-#define __UCL_GUI_STD_THEME_H__
-
-#include "stdTheme/common.h"
-#include "stdTheme/layout.h"
-#include "stdTheme/naviframe.h"
-
-#endif // __UCL_GUI_STD_THEME_H__
diff --git a/ucl/inc/ucl/gui/stdTheme/common.h b/ucl/inc/ucl/gui/stdTheme/common.h
deleted file mode 100644 (file)
index 7ec81b9..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_GUI_STD_THEME_COMMON_H__
-#define __UCL_GUI_STD_THEME_COMMON_H__
-
-#include "ucl/gui/types.h"
-
-namespace ucl {
-
-       // Styles //
-
-       constexpr ElmStyle STYLE_DEFAULT {"default"};
-
-       // Parts //
-
-       constexpr EdjePart PART_TEXT  {"elm.text"};
-       constexpr EdjePart PART_TITLE {"elm.text.title"};
-
-       constexpr EdjePart PART_CONTENT {"elm.swallow.content"};
-       constexpr EdjePart PART_ICON    {"elm.swallow.icon"};
-       constexpr EdjePart PART_BUTTON  {"elm.swallow.button"};
-}
-
-#endif // __UCL_GUI_STD_THEME_COMMON_H__
diff --git a/ucl/inc/ucl/gui/stdTheme/layout.h b/ucl/inc/ucl/gui/stdTheme/layout.h
deleted file mode 100644 (file)
index 79ff426..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_GUI_STD_THEME_LAYOUT_H__
-#define __UCL_GUI_STD_THEME_LAYOUT_H__
-
-#include "common.h"
-
-namespace ucl {
-
-       constexpr LayoutTheme LAYOUT_DEFAULT {"layout", "application", "default"};
-
-       constexpr LayoutTheme LAYOUT_NO_CONTENTS
-                       {"layout", "nocontents", "default"};
-}
-
-#endif // __UCL_GUI_STD_THEME_LAYOUT_H__
diff --git a/ucl/inc/ucl/gui/stdTheme/naviframe.h b/ucl/inc/ucl/gui/stdTheme/naviframe.h
deleted file mode 100644 (file)
index fd99fdc..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_GUI_STD_THEME_NAVIFRAME_H__
-#define __UCL_GUI_STD_THEME_NAVIFRAME_H__
-
-#include "common.h"
-
-namespace ucl {
-
-       constexpr ElmStyle NAVIFRAME_EMPTY {"empty"};
-}
-
-#endif // __UCL_GUI_STD_THEME_NAVIFRAME_H__
diff --git a/ucl/inc/ucl/gui/types.h b/ucl/inc/ucl/gui/types.h
deleted file mode 100644 (file)
index 6d43d76..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_GUI_TYPES_H__
-#define __UCL_GUI_TYPES_H__
-
-#include <Elementary.h>
-
-#include "ucl/util/types.h"
-#include "ucl/util/memory.h"
-#include "ucl/util/delegation.h"
-#include "ucl/util/smartDelegation.h"
-
-#include "ucl/misc/Aspect.h"
-#include "ucl/misc/TString.h"
-#include "ucl/misc/ConstCString.h"
-#include "ucl/misc/Variant.h"
-
-namespace ucl {
-
-       // Aspects //
-
-       struct EdjePart : Aspect<EdjePart> { using Aspect::Aspect; };
-       struct EdjeGroup : Aspect<EdjeGroup> { using Aspect::Aspect; };
-       struct EdjeDataKey : Aspect<EdjeDataKey> { using Aspect::Aspect; };
-
-       struct EdjeSignal : Aspect<EdjeSignal> { using Aspect::Aspect; };
-       struct EdjeSignalSrc : Aspect<EdjeSignalSrc> { using Aspect::Aspect; };
-
-       struct ElmStyle : Aspect<ElmStyle> { using Aspect::Aspect; };
-
-       struct SmartEvent : Aspect<SmartEvent> { using Aspect::Aspect; };
-
-       struct EoDataKey : Aspect<EoDataKey> { using Aspect::Aspect; };
-
-       // Delegates //
-
-       using SmartCbHandler = Delegate<void(Evas_Object *obj, void *eventInfo)>;
-
-       // WidgetEventHandler //
-
-       class Widget;
-
-       using WidgetEventHandler =
-                       WeakDelegate<void(Widget &widget, void *eventInfo)>;
-
-       // WidgetEvent //
-
-       enum class WidgetEvent {
-               DEL  = EVAS_CALLBACK_DEL,
-
-               MOUSE_IN    = EVAS_CALLBACK_MOUSE_IN,
-               MOUSE_OUT   = EVAS_CALLBACK_MOUSE_OUT,
-               MOUSE_DOWN  = EVAS_CALLBACK_MOUSE_DOWN,
-               MOUSE_UP    = EVAS_CALLBACK_MOUSE_UP,
-               MOUSE_MOVE  = EVAS_CALLBACK_MOUSE_MOVE,
-               MOUSE_WHEEL = EVAS_CALLBACK_MOUSE_WHEEL,
-
-               MULTI_DOWN = EVAS_CALLBACK_MULTI_DOWN,
-               MULTI_UP   = EVAS_CALLBACK_MULTI_UP,
-               MULTI_MOVE = EVAS_CALLBACK_MULTI_MOVE,
-
-               MOVE    = EVAS_CALLBACK_MOVE,
-               RESIZE  = EVAS_CALLBACK_RESIZE,
-               RESTACK = EVAS_CALLBACK_RESTACK,
-
-               CHANGED_SIZE_HINTS = EVAS_CALLBACK_CHANGED_SIZE_HINTS,
-
-               KEY_DOWN  = EVAS_CALLBACK_KEY_DOWN,
-               KEY_UP    = EVAS_CALLBACK_KEY_UP,
-               FOCUS_IN  = EVAS_CALLBACK_FOCUS_IN,
-               FOCUS_OUT = EVAS_CALLBACK_FOCUS_OUT,
-
-               SHOW = EVAS_CALLBACK_SHOW,
-               HIDE = EVAS_CALLBACK_HIDE,
-
-               HOLD = EVAS_CALLBACK_HOLD,
-
-               IMAGE_PRELOADED = EVAS_CALLBACK_IMAGE_PRELOADED
-       };
-
-       // AtspiGestureEventInfo //
-
-       struct AtspiGestureEventInfo final {
-               Elm_Atspi_Gesture_Info gestureInfo;
-               bool preventDefault;
-               bool stopPropagation;
-       };
-
-       // WidgetARHint //
-
-       enum class WidgetARHint
-       {
-               NEITHER = EVAS_ASPECT_CONTROL_NEITHER,
-               HORIZONTAL = EVAS_ASPECT_CONTROL_HORIZONTAL,
-               VERTICAL = EVAS_ASPECT_CONTROL_VERTICAL,
-               BOTH = EVAS_ASPECT_CONTROL_BOTH
-       };
-
-       // LayoutTheme //
-
-       struct LayoutTheme final {
-               const char *klass;
-               const char *group;
-               const char *style;
-
-               constexpr LayoutTheme();
-               constexpr LayoutTheme(std::nullptr_t);
-               constexpr LayoutTheme(const char *klass,
-                               const char *group, const char *style);
-       };
-
-       // LayoutTheme non-member functions //
-
-       constexpr bool isValid(const LayoutTheme &value);
-}
-
-#include "types.hpp"
-
-#endif // __UCL_GUI_TYPES_H__
diff --git a/ucl/inc/ucl/gui/types.hpp b/ucl/inc/ucl/gui/types.hpp
deleted file mode 100644 (file)
index 7f128c8..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 "ucl/util/helpers.h"
-
-namespace ucl {
-
-       // LayoutTheme //
-
-       constexpr LayoutTheme::LayoutTheme() :
-               klass(nullptr),
-               group(nullptr),
-               style(nullptr)
-       {
-       }
-
-       constexpr LayoutTheme::LayoutTheme(std::nullptr_t) :
-               LayoutTheme()
-       {
-       }
-
-       constexpr LayoutTheme::LayoutTheme(const char *klass,
-                       const char *group, const char *style) :
-               klass(klass),
-               group(group),
-               style(style)
-       {
-       }
-
-       // LayoutTheme non-member functions //
-
-       constexpr bool isValid(const LayoutTheme &value)
-       {
-               return (isNotEmpty(value.klass) && isNotEmpty(value.group) &&
-                                       isNotEmpty(value.style));
-       }
-}
diff --git a/ucl/inc/ucl/misc/Aspect.h b/ucl/inc/ucl/misc/Aspect.h
deleted file mode 100644 (file)
index 0c55bf6..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_MISC_ASPECT_H__
-#define __UCL_MISC_ASPECT_H__
-
-#include "ucl/util/types.h"
-
-namespace ucl {
-
-       template <class CHILD>
-       struct Aspect {
-               const char *name;
-
-               constexpr Aspect();
-               constexpr Aspect(std::nullptr_t);
-               explicit constexpr Aspect(const char *name);
-
-               constexpr operator const char *() const;
-
-               struct Hash final {
-                       size_t operator()(const Aspect &key) const;
-               };
-       };
-
-       // Non-member functions //
-
-       template <class CHILD>
-       constexpr bool isValid(Aspect<CHILD> aspect);
-
-       template <class CHILD>
-       constexpr bool operator==(Aspect<CHILD> lhs, Aspect<CHILD> rhs);
-       template <class CHILD>
-       constexpr bool operator!=(Aspect<CHILD> lhs, Aspect<CHILD> rhs);
-}
-
-#include "Aspect.hpp"
-
-#endif // __UCL_MISC_ASPECT_H__
diff --git a/ucl/inc/ucl/misc/Aspect.hpp b/ucl/inc/ucl/misc/Aspect.hpp
deleted file mode 100644 (file)
index 9894681..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 <cstring>
-
-#include "ucl/util/helpers.h"
-
-namespace ucl {
-
-       // Aspect<CHILD>::Hash //
-
-       template <class CHILD>
-       size_t Aspect<CHILD>::Hash::operator()(const Aspect<CHILD> &key) const
-       {
-               constexpr size_t PRIME = 31;
-               size_t result = 0;
-               for (size_t i = 0; (key.name[i] != '\0'); ++i) {
-                       result *= PRIME;
-                       result += key.name[i];
-               }
-               return result;
-       }
-
-       // Aspect<CHILD> //
-
-       template <class CHILD>
-       constexpr Aspect<CHILD>::Aspect() :
-               name(nullptr)
-       {
-       }
-
-       template <class CHILD>
-       constexpr Aspect<CHILD>::Aspect(std::nullptr_t) :
-               Aspect()
-       {
-       }
-
-       template <class CHILD>
-       constexpr Aspect<CHILD>::Aspect(const char *name) :
-               name(name)
-       {
-       }
-
-       template <class CHILD>
-       constexpr Aspect<CHILD>::operator const char *() const
-       {
-               return name;
-       }
-
-       // Non-member functions //
-
-       template <class CHILD>
-       constexpr bool isValid(const Aspect<CHILD> aspect)
-       {
-               return isNotEmpty(aspect);
-       }
-
-       template <class CHILD>
-       constexpr bool operator==(Aspect<CHILD> lhs, Aspect<CHILD> rhs)
-       {
-               return (strCmpSafe(lhs.name, rhs.name) == 0);
-       }
-
-       template <class CHILD>
-       constexpr bool operator!=(Aspect<CHILD> lhs, Aspect<CHILD> rhs)
-       {
-               return (strCmpSafe(lhs.name, rhs.name) != 0);
-       }
-}
diff --git a/ucl/inc/ucl/misc/AutoHandle.h b/ucl/inc/ucl/misc/AutoHandle.h
deleted file mode 100644 (file)
index 27c19f4..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_MISC_AUTO_HANDLE_H__
-#define __UCL_MISC_AUTO_HANDLE_H__
-
-#include "ucl/util/types.h"
-
-namespace ucl {
-
-       template <class HANDLE, class DEL_RET, DEL_RET(*DEL_FUNC)(HANDLE)>
-       struct AutoHandle final : ucl::NonCopyable {
-               using Handle = HANDLE;
-
-               HANDLE value;
-
-               AutoHandle() :
-                       value()
-               {
-               }
-
-               AutoHandle(std::nullptr_t) :
-                       AutoHandle()
-               {
-               }
-
-               AutoHandle(HANDLE value) :
-                       value(value)
-               {
-               }
-
-               ~AutoHandle()
-               {
-                       if (value) {
-                               DEL_FUNC(value);
-                       }
-               }
-
-               AutoHandle(AutoHandle &&src) :
-                       value(src.value)
-               {
-                       src.value = nullptr;
-               }
-
-               AutoHandle &operator=(AutoHandle src)
-               {
-                       swap(*this, src);
-                       return *this;
-               }
-
-               AutoHandle &operator=(HANDLE value)
-               {
-                       AutoHandle src{value};
-                       swap(*this, src);
-                       return *this;
-               }
-
-               HANDLE *operator&()
-               {
-                       return &value;
-               }
-
-               operator HANDLE()
-               {
-                       return value;
-               }
-       };
-
-       // Non-member functions //
-
-       template <class HANDLE, class DEL_RET, DEL_RET(*DEL_FUNC)(HANDLE)>
-       inline void swap(AutoHandle<HANDLE, DEL_RET, DEL_FUNC> &x,
-                       AutoHandle<HANDLE, DEL_RET, DEL_FUNC> &y) noexcept
-       {
-               std::swap(x.value, y.value);
-       }
-}
-
-#endif // __UCL_MISC_AUTO_HANDLE_H__
diff --git a/ucl/inc/ucl/misc/CString.h b/ucl/inc/ucl/misc/CString.h
deleted file mode 100644 (file)
index 396f37d..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_MISC_CSTRING_H__
-#define __UCL_MISC_CSTRING_H__
-
-#include "ucl/util/types.h"
-
-namespace ucl {
-
-       class CString final : public NonCopyable {
-       public:
-               friend void swap(CString &x, CString &y) noexcept;
-
-               static CString dup(const char *ptr);
-               static CString takeover(char *ptr) noexcept;
-
-               CString() noexcept;
-               CString(std::nullptr_t) noexcept;
-               CString(CString &&s) noexcept;
-               CString(const std::string &s);
-               ~CString() noexcept;
-
-               CString &operator=(CString s) noexcept;
-
-               bool isEmpty() const;
-
-               char *release() noexcept;
-
-               char *get() const noexcept;
-
-       private:
-               explicit CString(char *ptr) noexcept;
-
-       private:
-               char *m_ptr;
-       };
-}
-
-#include "CString.hpp"
-
-#endif // __UCL_MISC_CSTRING_H__
diff --git a/ucl/inc/ucl/misc/CString.hpp b/ucl/inc/ucl/misc/CString.hpp
deleted file mode 100644 (file)
index 086b3c2..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 "ucl/util/helpers.h"
-
-namespace ucl {
-
-       // CString //
-
-       inline CString CString::dup(const char *const ptr)
-       {
-               return CString(strDupSafe(ptr));
-       }
-
-       inline CString CString::takeover(char *const ptr) noexcept
-       {
-               return CString(ptr);
-       }
-
-       inline CString::CString(char *const ptr) noexcept :
-               m_ptr(ptr)
-       {
-       }
-
-       inline CString::CString() noexcept :
-               m_ptr(nullptr)
-       {
-       }
-
-       inline CString::CString(std::nullptr_t) noexcept :
-               CString()
-       {
-       }
-
-       inline CString::CString(CString &&s) noexcept :
-               m_ptr(s.m_ptr)
-       {
-               s.m_ptr = nullptr;
-       }
-
-       inline CString::CString(const std::string &s) :
-               m_ptr(s.empty() ? nullptr : strdup(s.c_str()))
-       {
-       }
-
-       inline CString::~CString() noexcept
-       {
-               free(m_ptr);
-       }
-
-       inline CString &CString::operator=(CString s) noexcept
-       {
-               swap(*this, s);
-               return *this;
-       }
-
-       inline bool CString::isEmpty() const
-       {
-               return !m_ptr;
-       }
-
-       inline char *CString::release() noexcept
-       {
-               char *const result = m_ptr;
-               m_ptr = nullptr;
-               return result;
-       }
-
-       inline char *CString::get() const noexcept
-       {
-               return m_ptr;
-       }
-
-       // Non-member functions //
-
-       inline void swap(CString &x, CString &y) noexcept
-       {
-               std::swap(x.m_ptr, y.m_ptr);
-       }
-}
diff --git a/ucl/inc/ucl/misc/ConstCString.h b/ucl/inc/ucl/misc/ConstCString.h
deleted file mode 100644 (file)
index 7f600f0..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_MISC_CONST_CSTRING_H__
-#define __UCL_MISC_CONST_CSTRING_H__
-
-#include "CString.h"
-
-namespace ucl {
-
-       class ConstCString final : public NonCopyable {
-       public:
-               friend void swap(ConstCString &x, ConstCString &y) noexcept;
-
-               static ConstCString wrap(const char *ptr) noexcept;
-
-               ConstCString() noexcept;
-               ConstCString(std::nullptr_t) noexcept;
-               ConstCString(ConstCString &&s) noexcept;
-               ConstCString(CString &&s) noexcept;
-               ~ConstCString() noexcept;
-
-               ConstCString &operator=(ConstCString s) noexcept;
-
-               bool isEmpty() const;
-
-               const char *get() const noexcept;
-
-       private:
-               explicit ConstCString(const char *ptr) noexcept;
-
-       private:
-               const char *m_ptr;
-               bool m_isOwner;
-       };
-}
-
-#include "ConstCString.hpp"
-
-#endif // __UCL_MISC_CONST_CSTRING_H__
diff --git a/ucl/inc/ucl/misc/ConstCString.hpp b/ucl/inc/ucl/misc/ConstCString.hpp
deleted file mode 100644 (file)
index 50df605..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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.
- */
-
-namespace ucl {
-
-       // ConstCString //
-
-       inline ConstCString ConstCString::wrap(const char *ptr) noexcept
-       {
-               return ConstCString(ptr);
-       }
-
-       inline ConstCString::ConstCString(const char *ptr) noexcept :
-               m_ptr(ptr),
-               m_isOwner(false)
-       {
-       }
-
-       inline ConstCString::ConstCString() noexcept :
-               m_ptr(nullptr),
-               m_isOwner(false)
-       {
-       }
-
-       inline ConstCString::ConstCString(std::nullptr_t) noexcept :
-               ConstCString()
-       {
-       }
-
-       inline ConstCString::ConstCString(ConstCString &&s) noexcept :
-               m_ptr(s.m_ptr),
-               m_isOwner(s.m_isOwner)
-       {
-               s.m_isOwner = false;
-       }
-
-       inline ConstCString::ConstCString(CString &&s) noexcept :
-               m_ptr(s.release()),
-               m_isOwner(true)
-       {
-       }
-
-       inline ConstCString::~ConstCString() noexcept
-       {
-               if (m_isOwner) {
-                       free(const_cast<char *>(m_ptr));
-               }
-       }
-
-       inline ConstCString &ConstCString::operator=(ConstCString s) noexcept
-       {
-               swap(*this, s);
-               return *this;
-       }
-
-       inline bool ConstCString::isEmpty() const
-       {
-               return !m_ptr;
-       }
-
-       inline const char *ConstCString::get() const noexcept
-       {
-               return m_ptr;
-       }
-
-       // Non-member functions //
-
-       inline void swap(ConstCString &x, ConstCString &y) noexcept
-       {
-               std::swap(x.m_ptr, y.m_ptr);
-               std::swap(x.m_isOwner, y.m_isOwner);
-       }
-}
diff --git a/ucl/inc/ucl/misc/Event.h b/ucl/inc/ucl/misc/Event.h
deleted file mode 100644 (file)
index cd27f29..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_MISC_EVENT_H__
-#define __UCL_MISC_EVENT_H__
-
-#include <vector>
-
-#include "ucl/util/types.h"
-
-namespace ucl {
-
-       template <class DELEGATE>
-       class Event final {
-       public:
-               Event();
-
-               template <class DELEGATE2>
-               void operator+=(DELEGATE2 &&delegate);
-               template <class DELEGATE2>
-               void operator-=(const DELEGATE2 &delegate);
-
-               bool isEmpty() const;
-
-               template <class ...ARGS>
-               void dispatch(ARGS &&...args);
-               template <class PREDICATE, class ...ARGS>
-               void dispatchPred(PREDICATE &&pred, ARGS &&...args);
-
-       private:
-               template <class DO_INVOKE, class ...ARGS>
-               void dispatchImpl(const DO_INVOKE &doInvoke, ARGS &&...args);
-
-               void lock();
-               void unlock();
-               bool isLocked() const;
-
-               void defrag();
-
-       private:
-               std::vector<DELEGATE> m_delegates;
-               int m_lockCount;
-               bool m_isFragmented;
-       };
-}
-
-#include "Event.hpp"
-
-#endif // __UCL_MISC_EVENT_H__
diff --git a/ucl/inc/ucl/misc/Event.hpp b/ucl/inc/ucl/misc/Event.hpp
deleted file mode 100644 (file)
index ed4e402..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 <algorithm>
-
-namespace ucl { namespace { namespace impl {
-
-       template <class PREDICATE, class DELEGATE, class ...ARGS>
-       auto doInvokePred(PREDICATE &&pred,
-                       const DELEGATE &delegate, ARGS &&...args) ->
-                               decltype(pred(delegate(std::forward<ARGS>(args)...)))
-       {
-               return pred(delegate(std::forward<ARGS>(args)...));
-       }
-
-       template <class DELEGATE, class PREDICATE, class ...ARGS>
-       auto doInvokePred(PREDICATE &&pred,
-                       const DELEGATE &delegate, ARGS &&...args) -> decltype(pred())
-       {
-               delegate(std::forward<ARGS>(args)...);
-               return pred();
-       }
-}}}
-
-namespace ucl {
-
-       template <class DELEGATE>
-       Event<DELEGATE>::Event() :
-               m_lockCount(0),
-               m_isFragmented(false)
-       {
-       }
-
-       template <class DELEGATE>
-       template <class DELEGATE2>
-       void Event<DELEGATE>::operator+=(DELEGATE2 &&delegate)
-       {
-               m_delegates.emplace_back(std::forward<DELEGATE2>(delegate));
-       }
-
-       template <class DELEGATE>
-       template <class DELEGATE2>
-       void Event<DELEGATE>::operator-=(const DELEGATE2 &delegate)
-       {
-               const auto it = std::find(
-                               m_delegates.begin(), m_delegates.end(), delegate);
-               if (it != m_delegates.end()) {
-                       if (isLocked()) {
-                               *it = {};
-                               m_isFragmented = true;
-                       } else {
-                               m_delegates.erase(it);
-                       }
-               }
-       }
-
-       template <class DELEGATE>
-       bool Event<DELEGATE>::isEmpty() const
-       {
-               return m_delegates.empty();
-       }
-
-       template <class DELEGATE>
-       template <class ...ARGS>
-       void Event<DELEGATE>::dispatch(ARGS &&...args)
-       {
-               dispatchImpl(
-                       [](const DELEGATE &delegate, ARGS &&...args)
-                       {
-                               delegate(std::forward<ARGS>(args)...);
-                               return true;
-                       },
-                       std::forward<ARGS>(args)...);
-       }
-
-       template <class DELEGATE>
-       template <class PREDICATE, class ...ARGS>
-       void Event<DELEGATE>::dispatchPred(PREDICATE &&pred, ARGS &&...args)
-       {
-               dispatchImpl(
-                       [&pred](const DELEGATE &delegate, ARGS &&...args)
-                       {
-                               return impl::doInvokePred(std::forward<PREDICATE>(pred),
-                                               delegate, std::forward<ARGS>(args)...);
-                       },
-                       std::forward<ARGS>(args)...);
-       }
-
-       template <class DELEGATE>
-       template <class DO_INVOKE, class ...ARGS>
-       void Event<DELEGATE>::dispatchImpl(const DO_INVOKE &doInvoke, ARGS &&...args)
-       {
-               lock();
-               const auto size = m_delegates.size();
-               for (size_t i = 0; i < size; ++i) {
-                       const auto &delegate = m_delegates[i];
-                       if (delegate) {
-                               if (!doInvoke(delegate, std::forward<ARGS>(args)...)) {
-                                       break;
-                               }
-                       } else {
-                               m_isFragmented = true;
-                       }
-               }
-               unlock();
-               defrag();
-       }
-
-       template <class DELEGATE>
-       void Event<DELEGATE>::lock()
-       {
-               ++m_lockCount;
-       }
-
-       template <class DELEGATE>
-       void Event<DELEGATE>::unlock()
-       {
-               --m_lockCount;
-       }
-
-       template <class DELEGATE>
-       bool Event<DELEGATE>::isLocked() const
-       {
-               return (m_lockCount > 0);
-       }
-
-       template <class DELEGATE>
-       void Event<DELEGATE>::defrag()
-       {
-               if (m_isFragmented) {
-                       m_isFragmented = false;
-                       m_delegates.erase(
-                               std::remove_if(m_delegates.begin(), m_delegates.end(),
-                                       [](const DELEGATE &delegate) -> bool
-                                       {
-                                               return !delegate;
-                                       }),
-                               m_delegates.end());
-               }
-       }
-}
diff --git a/ucl/inc/ucl/misc/HashMap.h b/ucl/inc/ucl/misc/HashMap.h
deleted file mode 100644 (file)
index 8470fed..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_MISC_HASH_MAP_H__
-#define __UCL_MISC_HASH_MAP_H__
-
-#include <unordered_map>
-
-#include "Variant.h"
-
-namespace ucl {
-
-       template <class KEY, class VALUE>
-       class HashMap;
-
-       template <class VALUE>
-       using Dict = HashMap<std::string, VALUE>;
-
-       using VarDict = Dict<Variant>;
-
-       template <class KEY, class VALUE>
-       class HashMap final {
-       public:
-               template <class VALUE2>
-               HashMap &set(const KEY &key, VALUE2 &&value);
-               HashMap &unset(const KEY &key);
-
-               template <class VALUE2>
-               bool get(const KEY &key, VALUE2 &value) const;
-               VALUE get(const KEY &key) const;
-
-               void clear();
-
-       private:
-               template <class ENUM_CLASS>
-               struct EnumClassHash final {
-                       size_t operator()(ENUM_CLASS key) const {
-                               return static_cast<size_t>(key);
-                       }
-               };
-
-               template <class KEY2, class = void>
-               struct GetHash final {
-                       using Type = std::hash<KEY2>;
-               };
-
-               template <class KEY2>
-               struct GetHash<KEY2, typename std::enable_if<
-                               std::is_enum<KEY2>::value>::type> {
-                       using Type = EnumClassHash<KEY2>;
-               };
-
-               template <class KEY2>
-               struct GetHash<KEY2, typename std::enable_if<
-                               std::is_class<typename KEY2::Hash>::value>::type> {
-                       using Type = typename KEY2::Hash;
-               };
-
-               using Hash = typename GetHash<KEY>::Type;
-
-       private:
-               std::unordered_map<KEY, VALUE, Hash> m_map;
-       };
-}
-
-#include "HashMap.hpp"
-
-#endif // __UCL_MISC_HASH_MAP_H__
diff --git a/ucl/inc/ucl/misc/HashMap.hpp b/ucl/inc/ucl/misc/HashMap.hpp
deleted file mode 100644 (file)
index 2ba4ffd..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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.
- */
-
-namespace ucl {
-
-       template <class KEY, class VALUE>
-       template <class VALUE2>
-       inline HashMap<KEY, VALUE> &HashMap<KEY, VALUE>::
-                       set(const KEY &key, VALUE2 &&value)
-       {
-               m_map.emplace(key, std::forward<VALUE2>(value));
-               return *this;
-       }
-
-       template <class KEY, class VALUE>
-       inline HashMap<KEY, VALUE> &HashMap<KEY, VALUE>::
-                       unset(const KEY &key)
-       {
-               m_map.erase(key);
-               return *this;
-       }
-
-       template <class KEY, class VALUE>
-       template <class VALUE2>
-       inline bool HashMap<KEY, VALUE>::
-                       get(const KEY &key, VALUE2 &value) const
-       {
-               const auto it = m_map.find(key);
-               if (it == m_map.end()) {
-                       return false;
-               }
-               value = it->second;
-               return true;
-       }
-
-       template <class KEY, class VALUE>
-       inline VALUE HashMap<KEY, VALUE>::
-                       get(const KEY &key) const
-       {
-               const auto it = m_map.find(key);
-               if (it == m_map.end()) {
-                       return {};
-               }
-               return it->second;
-       }
-
-       template <class KEY, class VALUE>
-       inline void HashMap<KEY, VALUE>::clear()
-       {
-               m_map.clear();
-       }
-}
diff --git a/ucl/inc/ucl/misc/RefCountAware.h b/ucl/inc/ucl/misc/RefCountAware.h
deleted file mode 100644 (file)
index 6ea5ee9..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_MISC_REF_COUNT_AWARE_H__
-#define __UCL_MISC_REF_COUNT_AWARE_H__
-
-#include "ucl/util/types.h"
-#include "ucl/util/memory.h"
-
-namespace ucl {
-
-       UCL_DECLARE_REF_ALIASES(RefCountAware);
-
-       class RefCountAware : public Polymorphic {
-       public:
-               bool isShared() const;
-               UInt getUseCount() const;
-               const void *getObjPtr() const;
-
-               template <class T>
-               SharedRef<T> asSharedThis(T *thisAlias) const;
-
-               template <class T>
-               WeakRef<T> asWeakThis(T *thisAlias) const;
-
-       protected:
-               RefCountAware(IRefCountObj *rc);
-               virtual ~RefCountAware() = default;
-
-       public:
-               // This section MUST be public!
-               // Signal to RefCountObj<T, C> to pass IRefCountObj to constructor
-               enum { _IS_REF_COUNT_AWARE };
-
-       private:
-               IRefCountObj *const m_rc;
-       };
-
-       // Non-member functions //
-
-       template <class T>
-       SharedRef<T> asShared(T &obj);
-       template <class T>
-       SharedRef<T> asShared(T *obj);
-
-       template <class T>
-       WeakRef<T> asWeak(T &obj);
-       template <class T>
-       WeakRef<T> asWeak(T *obj);
-
-       template <class T, class U, class = typename
-                       std::enable_if<!std::is_same<T, U>::value>::type>
-       SharedRef<T> asShared(U &obj);
-       template <class T, class U, class = typename
-                       std::enable_if<!std::is_same<T, U>::value>::type>
-       SharedRef<T> asShared(U *obj);
-
-       template <class T, class U, class = typename
-                       std::enable_if<!std::is_same<T, U>::value>::type>
-       WeakRef<T> asWeak(U &obj);
-       template <class T, class U, class = typename
-                       std::enable_if<!std::is_same<T, U>::value>::type>
-       WeakRef<T> asWeak(U *obj);
-
-       template <class T, class U, class = typename
-                       std::enable_if<!std::is_same<T, const U>::value>::type>
-       SharedRef<const T> asShared(const U &obj);
-       template <class T, class U, class = typename
-                       std::enable_if<!std::is_same<T, const U>::value>::type>
-       SharedRef<const T> asShared(const U *obj);
-
-       template <class T, class U, class = typename
-                       std::enable_if<!std::is_same<T, const U>::value>::type>
-       WeakRef<const T> asWeak(const U &obj);
-       template <class T, class U, class = typename
-                       std::enable_if<!std::is_same<T, const U>::value>::type>
-       WeakRef<const T> asWeak(const U *obj);
-}
-
-#include "RefCountAware.hpp"
-
-#endif // __UCL_MISC_REF_COUNT_AWARE_H__
diff --git a/ucl/inc/ucl/misc/RefCountAware.hpp b/ucl/inc/ucl/misc/RefCountAware.hpp
deleted file mode 100644 (file)
index 8fb3812..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 "ucl/util/logging.h"
-
-namespace ucl {
-
-       inline RefCountAware::RefCountAware(IRefCountObj *const rc) :
-               m_rc(rc)
-       {
-       }
-
-       inline bool RefCountAware::isShared() const
-       {
-               return !!m_rc;
-       }
-
-       inline UInt RefCountAware::getUseCount() const
-       {
-               if (!isShared()) {
-                       UCL_ELOG("NOT SHARED: %s", typeid(*this).name());
-                       return 0;
-               }
-               return m_rc->getUseCount();
-       }
-
-       inline const void *RefCountAware::getObjPtr() const
-       {
-               if (!isShared()) {
-                       UCL_ELOG("NOT SHARED: %s", typeid(*this).name());
-                       return nullptr;
-               }
-               return m_rc->getObjPtr();
-       }
-
-       template <class T>
-       inline SharedRef<T> RefCountAware::asSharedThis(T *const thisAlias) const
-       {
-               if (!isShared()) {
-                       UCL_ELOG("NOT SHARED: %s", typeid(*this).name());
-                       return {};
-               }
-               return {m_rc, thisAlias};
-       }
-
-       template <class T>
-       inline WeakRef<T> RefCountAware::asWeakThis(T *const thisAlias) const
-       {
-               if (!isShared()) {
-                       UCL_ELOG("NOT SHARED: %s", typeid(*this).name());
-                       return {};
-               }
-               return {m_rc, thisAlias};
-       }
-
-       // Non-member functions //
-
-       template <class T>
-       inline SharedRef<T> asShared(T &obj)
-       {
-               return obj.template asSharedThis<T>(&obj);
-       }
-
-       template <class T>
-       inline SharedRef<T> asShared(T *obj)
-       {
-               if (!obj) return {};
-               return obj->template asSharedThis<T>(obj);
-       }
-
-       template <class T>
-       inline WeakRef<T> asWeak(T &obj)
-       {
-               return obj.template asWeakThis<T>(&obj);
-       }
-
-       template <class T>
-       inline WeakRef<T> asWeak(T *obj)
-       {
-               if (!obj) return {};
-               return obj->template asWeakThis<T>(obj);
-       }
-
-       template <class T, class U, class>
-       inline SharedRef<T> asShared(U &obj)
-       {
-               return obj.template asSharedThis<T>(&obj);
-       }
-
-       template <class T, class U, class>
-       inline SharedRef<T> asShared(U *obj)
-       {
-               if (!obj) return {};
-               return obj->template asSharedThis<T>(obj);
-       }
-
-       template <class T, class U, class>
-       inline WeakRef<T> asWeak(U &obj)
-       {
-               return obj.template asWeakThis<T>(&obj);
-       }
-
-       template <class T, class U, class>
-       inline WeakRef<T> asWeak(U *obj)
-       {
-               if (!obj) return {};
-               return obj->template asWeakThis<T>(obj);
-       }
-
-       template <class T, class U, class>
-       inline SharedRef<const T> asShared(const U &obj)
-       {
-               return obj.template asSharedThis<const T>(&obj);
-       }
-
-       template <class T, class U, class>
-       inline SharedRef<const T> asShared(const U *obj)
-       {
-               if (!obj) return {};
-               return obj->template asSharedThis<const T>(obj);
-       }
-
-       template <class T, class U, class>
-       inline WeakRef<const T> asWeak(const U &obj)
-       {
-               return obj.template asWeakThis<const T>(&obj);
-       }
-
-       template <class T, class U, class>
-       inline WeakRef<const T> asWeak(const U *obj)
-       {
-               if (!obj) return {};
-               return obj->template asWeakThis<const T>(obj);
-       }
-}
diff --git a/ucl/inc/ucl/misc/TString.h b/ucl/inc/ucl/misc/TString.h
deleted file mode 100644 (file)
index 71ca2d9..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_MISC_T_STRING_H__
-#define __UCL_MISC_T_STRING_H__
-
-#include "ucl/util/types.h"
-
-namespace ucl {
-
-       class TString final {
-       public:
-               TString();
-
-               /**
-                * Constructs TString from std::string and domain
-                *
-                * @param str     Text string or string id if translatable.
-                * @param domain  Valid domain name or "" for default domain,
-                *                nullptr - if string is not translatable
-                */
-               TString(const std::string &str, const char *domain);
-               TString(const std::string &str, bool translatable = false);
-
-               TString(std::string &&str, const char *domain);
-               TString(std::string &&str, bool translatable = false);
-
-               TString(const char *str, const char *domain);
-               TString(const char *str, bool translatable = false);
-
-               bool isEmpty() const;
-
-               bool isTranslatable() const;
-               bool hasDomain() const;
-               const char *getDomain() const;
-
-               const std::string &getStr() const;
-               operator const std::string &() const;
-
-               const char *getCStr() const;
-               operator const char *() const;
-
-               const char *translate() const;
-
-               template <typename ...ARGS>
-               std::string format(ARGS ...args) const;
-
-       private:
-               const char *doTranslate(const char *strId) const;
-
-       private:
-               std::string m_str;
-               const char *m_domain;
-       };
-}
-
-#include "TString.hpp"
-
-#endif // __UCL_MISC_T_STRING_H__
diff --git a/ucl/inc/ucl/misc/TString.hpp b/ucl/inc/ucl/misc/TString.hpp
deleted file mode 100644 (file)
index 01c1327..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 <libintl.h>
-#include <app_i18n.h>
-
-#include "ucl/util/helpers.h"
-
-namespace ucl {
-
-       inline TString::TString() :
-               m_domain(nullptr)
-       {
-       }
-
-       inline TString::TString(const std::string &str, const char *const domain) :
-               m_str(str),
-               m_domain(m_str.empty() ? nullptr : domain)
-       {
-       }
-
-       inline TString::TString(const std::string &str, const bool translatable) :
-               TString(str, (translatable ? "" : nullptr))
-       {
-       }
-
-       inline TString::TString(std::string &&str, const char *const domain) :
-               m_str(std::move(str)),
-               m_domain(m_str.empty() ? nullptr : domain)
-       {
-       }
-
-       inline TString::TString(std::string &&str, const bool translatable) :
-               TString(std::move(str), (translatable ? "" : nullptr))
-       {
-       }
-
-       inline TString::TString(const char *const str, const char *const domain) :
-               TString(std::string(nz(str)), domain)
-       {
-       }
-
-       inline TString::TString(const char *const str, const bool translatable) :
-               TString(std::string(nz(str)), (translatable ? "" : nullptr))
-       {
-       }
-
-       inline bool TString::isEmpty() const
-       {
-               return m_str.empty();
-       }
-
-       inline const std::string &TString::getStr() const
-       {
-               return m_str;
-       }
-
-       inline TString::operator const std::string &() const
-       {
-               return m_str;
-       }
-
-       inline const char *TString::getCStr() const
-       {
-               return m_str.c_str();
-       }
-
-       inline TString::operator const char *() const
-       {
-               return m_str.c_str();
-       }
-
-       inline bool TString::isTranslatable() const
-       {
-               return (m_domain != nullptr);
-       }
-
-       inline bool TString::hasDomain() const
-       {
-               return isNotEmpty(m_domain);
-       }
-
-       inline const char *TString::getDomain() const
-       {
-               return m_domain;
-       }
-
-       inline const char *TString::translate() const
-       {
-               if (!m_domain) {
-                       return getCStr();
-               }
-               return doTranslate(getCStr());
-       }
-
-       inline const char *TString::doTranslate(const char *const strId) const
-       {
-               if (m_domain[0] == '\0') {
-                       return i18n_get_text(strId);
-               }
-               return dgettext(m_domain, strId);
-       }
-
-       template <typename ...ARGS>
-       inline std::string TString::format(ARGS ...args) const
-       {
-               constexpr auto STR_LEN_ADJUST = 1.7f;
-
-               const char *fmt = m_str.c_str();
-               size_t fmtLen = m_str.length();
-
-               if (m_domain) {
-                       fmt = doTranslate(fmt);
-                       fmtLen = strlen(fmt);
-               }
-
-               size_t strLen = static_cast<size_t>(fmtLen * STR_LEN_ADJUST);
-
-               std::string result;
-
-               while (1) {
-                       result.resize(strLen);
-                       const size_t n = snprintf(&result[0], strLen, fmt, args...);
-                       if (n < strLen) {
-                               result.resize(n);
-                               break;
-                       }
-                       strLen = n + 1;
-               }
-
-               return result;
-       }
-}
diff --git a/ucl/inc/ucl/misc/Timeout.h b/ucl/inc/ucl/misc/Timeout.h
deleted file mode 100644 (file)
index 165265c..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_MISC_TIMEOUT_H__
-#define __UCL_MISC_TIMEOUT_H__
-
-#include <Ecore.h>
-
-#include "ucl/util/types.h"
-#include "ucl/util/smartDelegation.h"
-
-namespace ucl {
-
-       UCL_DECLARE_REF_ALIASES(Timeout);
-
-       class Timeout final : public NonCopyable {
-       public:
-               using TimeoutHandler = WeakDelegate<void(Timeout *sender)>;
-
-       public:
-               static TimeoutSRef create(double timeoutSec,
-                               const TimeoutHandler &handler);
-
-               bool isExpired() const;
-
-       private:
-               friend class ReffedObj<Timeout>;
-               Timeout(const TimeoutHandler &handler);
-               ~Timeout();
-
-               Result prepare(double timeoutSec);
-
-               Eina_Bool onTimer();
-
-       private:
-               Ecore_Timer *m_timer;
-               TimeoutHandler m_handler;
-       };
-}
-
-#endif // __UCL_MISC_TIMEOUT_H__
diff --git a/ucl/inc/ucl/misc/Variant.h b/ucl/inc/ucl/misc/Variant.h
deleted file mode 100644 (file)
index 6542358..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_MISC_VARIANT_H__
-#define __UCL_MISC_VARIANT_H__
-
-#include <array>
-#include <vector>
-#include <initializer_list>
-
-#include "ConstCString.h"
-
-namespace ucl {
-
-       class Variant;
-
-       using VarVector = std::vector<Variant>;
-
-       template <size_t N>
-       using VarArray = std::array<Variant, N>;
-
-       struct VarInitList final {
-               VarInitList(const std::initializer_list<Variant> &il) : il(il) {}
-               const std::initializer_list<Variant> &il;
-       };
-
-       class Variant final {
-       public:
-               enum Type {
-                       TYPE_NIL,
-                       TYPE_BOOLEAN,
-                       TYPE_INTEGER,
-                       TYPE_FLOAT,
-                       TYPE_DOUBLE,
-                       TYPE_STRING,
-                       TYPE_ARRAY
-               };
-
-       public:
-               friend void swap(Variant &x, Variant &y) noexcept;
-
-               friend bool operator==(const Variant &lhs, const Variant &rhs) noexcept;
-               friend bool operator!=(const Variant &lhs, const Variant &rhs) noexcept;
-
-       public:
-               Variant() noexcept;
-               Variant(std::nullptr_t) noexcept;
-
-               Variant(bool aBool) noexcept;
-               Variant(int anInt) noexcept;
-               Variant(float aFloat) noexcept;
-               Variant(double aDouble) noexcept;
-
-               Variant(const char *aString);
-               Variant(const char *aString, int length);
-               Variant(const std::string &aString);
-
-               Variant(std::nullptr_t, int arrayLength);
-               Variant(const Variant *anArray, int length);
-               Variant(const VarVector &anArray);
-               template <size_t N>
-               Variant(const VarArray<N> &anArray);
-               Variant(const VarInitList &anArray);
-
-               ~Variant();
-
-               Variant(const Variant &v);
-               Variant(Variant &&v) noexcept;
-
-               Variant &operator=(Variant v);
-
-               Type getType() const noexcept;
-               int getLength() const noexcept;
-               bool isEmpty() const noexcept;
-
-               bool asBool() const noexcept;
-               int asInt() const noexcept;
-               float asFloat() const noexcept;
-               double asDouble() const noexcept;
-
-               ConstCString asString() const noexcept;
-
-               Variant *asArray() noexcept;
-               const Variant *asArray() const noexcept;
-
-               Variant *begin() noexcept;
-               Variant *end() noexcept;
-               const Variant *begin() const noexcept;
-               const Variant *end() const noexcept;
-
-               Variant &operator[](int index) noexcept;
-               const Variant &operator[](int index) const noexcept;
-
-               explicit operator bool() const noexcept;
-               explicit operator int() const noexcept;
-               explicit operator float() const noexcept;
-               explicit operator double() const noexcept;
-
-               bool operator==(Variant::Type rhs) const noexcept;
-               bool operator!=(Variant::Type rhs) const noexcept;
-
-       private:
-               const char *getStr() const noexcept;
-
-       public:
-               union {
-                       uint8_t m_type;
-                       struct {
-                               uint64_t qw1;
-                               uint64_t qw2;
-                       } m_raw;
-                       struct { uint8_t type; bool value; } m_aBool;
-                       struct { uint8_t type; int value; } m_anInt;
-                       struct { uint8_t type; float value; } m_aFloat;
-                       struct { uint8_t type; double value; } m_aDouble;
-                       struct {
-                               uint8_t type;
-                               char buffer[sizeof(m_raw) - 1];
-                       } m_aSmallStr;
-                       struct {
-                               uint8_t type;
-                               int length;
-                               char *data;
-                       } m_aString;
-                       struct {
-                               uint8_t type;
-                               int length;
-                               Variant *data;
-                       } m_anArray;
-               };
-       };
-}
-
-#include "Variant.hpp"
-
-#endif // __UCL_MISC_VARIANT_H__
diff --git a/ucl/inc/ucl/misc/Variant.hpp b/ucl/inc/ucl/misc/Variant.hpp
deleted file mode 100644 (file)
index fe6d977..0000000
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 <cstring>
-
-namespace ucl { namespace { namespace impl {
-
-       constexpr auto TYPE_MASK = 0x0F;
-
-       constexpr auto FLAG_SMALL_STR = 0x80;
-       constexpr auto TYPE_SMALL_STR = (Variant::TYPE_STRING | FLAG_SMALL_STR);
-
-       constexpr auto TMP_STR_BUFF_SIZE = 32;
-}}}
-
-namespace ucl {
-
-       // Variant //
-
-       inline Variant::Variant() noexcept :
-               m_type(TYPE_NIL)
-       {
-       }
-
-       inline Variant::Variant(std::nullptr_t) noexcept :
-               Variant()
-       {
-       }
-
-       inline Variant::Variant(const bool aBool) noexcept :
-               m_type(TYPE_BOOLEAN)
-       {
-               m_aBool.value = aBool;
-       }
-
-       inline Variant::Variant(const int anInt) noexcept :
-               m_type(TYPE_INTEGER)
-       {
-               m_anInt.value = anInt;
-       }
-
-       inline Variant::Variant(const float aFloat) noexcept :
-               m_type(TYPE_FLOAT)
-       {
-               m_aFloat.value = aFloat;
-       }
-
-       inline Variant::Variant(const double aDouble) noexcept :
-               m_type(TYPE_DOUBLE)
-       {
-               m_aDouble.value = aDouble;
-       }
-
-       inline Variant::Variant(const char *const aString) :
-               Variant(aString, -1)
-       {
-       }
-
-       inline Variant::Variant(const std::string &aString) :
-               Variant(aString.c_str(), aString.size())
-       {
-       }
-
-       inline Variant::Variant(const VarVector &anArray) :
-               Variant(anArray.data(), anArray.size())
-       {
-       }
-
-       template <size_t N>
-       inline Variant::Variant(const VarArray<N> &anArray) :
-               Variant(anArray.data(), anArray.size())
-       {
-       }
-
-       inline Variant::Variant(const VarInitList &anArray) :
-               Variant(anArray.il.begin(), anArray.il.size())
-       {
-       }
-
-       inline Variant::~Variant()
-       {
-               switch (m_type) {
-               case TYPE_STRING:
-                       free(m_aString.data);
-                       break;
-               case TYPE_ARRAY:
-                       delete[] m_anArray.data;
-                       break;
-               }
-       }
-
-       inline Variant::Variant(Variant &&v) noexcept :
-               m_type(v.m_type)
-       {
-               switch (m_type) {
-               case TYPE_NIL:
-                       break;
-               case TYPE_STRING:
-                       m_aString.data = v.m_aString.data;
-                       m_aString.length = v.m_aString.length;
-                       v.m_type = TYPE_NIL;
-                       break;
-               case TYPE_ARRAY:
-                       m_anArray.data = v.m_anArray.data;
-                       m_anArray.length = v.m_anArray.length;
-                       v.m_type = TYPE_NIL;
-                       break;
-               default:
-                       m_raw = v.m_raw;
-                       break;
-               }
-       }
-
-       inline Variant &Variant::operator=(Variant v)
-       {
-               swap(*this, v);
-               return *this;
-       }
-
-       inline Variant::Type Variant::getType() const noexcept
-       {
-               return Type(m_type & impl::TYPE_MASK);
-       }
-
-       inline int Variant::getLength() const noexcept
-       {
-               switch (m_type) {
-               case TYPE_NIL:
-                       return 0;
-               case TYPE_STRING:
-                       return m_aString.length;
-               case TYPE_ARRAY:
-                       return m_anArray.length;
-               case impl::TYPE_SMALL_STR:
-                       return strlen(m_aSmallStr.buffer);
-               }
-               return 1;
-       }
-
-       inline bool Variant::isEmpty() const noexcept
-       {
-               return (getLength() == 0);
-       }
-
-       inline const char *Variant::getStr() const noexcept
-       {
-               return ((m_type == TYPE_STRING) ? m_aString.data : m_aSmallStr.buffer);
-       }
-
-       inline Variant *Variant::asArray() noexcept
-       {
-               return begin();
-       }
-
-       inline const Variant *Variant::asArray() const noexcept
-       {
-               return begin();
-       }
-
-       inline Variant *Variant::begin() noexcept
-       {
-               return ((m_type == TYPE_ARRAY) ? m_anArray.data : this);
-       }
-
-       inline Variant *Variant::end() noexcept
-       {
-               return ((m_type == TYPE_ARRAY) ?
-                               (m_anArray.data + m_anArray.length) : (this + 1));
-       }
-
-       inline const Variant *Variant::begin() const noexcept
-       {
-               return const_cast<Variant *>(this)->begin();
-       }
-
-       inline const Variant *Variant::end() const noexcept
-       {
-               return const_cast<Variant *>(this)->end();
-       }
-
-       inline Variant &Variant::operator[](int index) noexcept
-       {
-               return asArray()[index];
-       }
-
-       inline const Variant &Variant::operator[](int index) const noexcept
-       {
-               return asArray()[index];
-       }
-
-       inline Variant::operator bool() const noexcept
-       {
-               return asBool();
-       }
-
-       inline Variant::operator int() const noexcept
-       {
-               return asInt();
-       }
-
-       inline Variant::operator float() const noexcept
-       {
-               return asFloat();
-       }
-
-       inline Variant::operator double() const noexcept
-       {
-               return asDouble();
-       }
-
-       inline bool Variant::operator==(const Variant::Type rhs) const noexcept
-       {
-               return (m_type == rhs);
-       }
-
-       inline bool Variant::operator!=(const Variant::Type rhs) const noexcept
-       {
-               return (m_type != rhs);
-       }
-
-       // Non-member functions //
-
-       inline void swap(Variant &x, Variant &y) noexcept
-       {
-               static_assert(sizeof(Variant) == sizeof(Variant::m_raw),
-                               "Invalid Variant data structure!");
-               static_assert(std::is_standard_layout<Variant>::value,
-                               "Variant has not standard layout!");
-               std::swap(x.m_raw, y.m_raw);
-       }
-
-       inline bool operator!=(const Variant &lhs, const Variant &rhs) noexcept
-       {
-               return !(lhs == rhs);
-       }
-}
diff --git a/ucl/inc/ucl/mvp/GuiPresenter.h b/ucl/inc/ucl/mvp/GuiPresenter.h
deleted file mode 100644 (file)
index 5a94af4..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_MVP_GUI_PRESENTER_H__
-#define __UCL_MVP_GUI_PRESENTER_H__
-
-#include <unordered_set>
-
-#include "ucl/gui/Window.h"
-
-#include "types.h"
-
-namespace ucl {
-
-       UCL_DECLARE_REF_ALIASES(GuiPresenter);
-
-       class GuiPresenter : public RefCountAware {
-       public:
-               struct DeactivatorInfo final {
-                       const void *deactivator;
-                       bool isBroadcast;
-               };
-
-       public:
-               bool isActive() const;
-               bool isDeactivatedBy(const void *deactivator) const;
-
-               void activateBy(const void *deactivator);
-               void deactivateBy(const void *deactivator);
-
-               void addDeactivatorSource(Widget &source);
-               void delDeactivatorSource(Widget &source);
-
-       protected:
-               enum {
-                       PF_ADD_DEACTIVATOR_SOURCES = 1,
-                       PF_ADD_SELF_EXCEPT = 2,
-
-                       PF_PASSIVE = 0,
-                       PF_DEACTIVATOR = (PF_ADD_DEACTIVATOR_SOURCES | PF_ADD_SELF_EXCEPT),
-                       PF_DEFAULT = PF_ADD_DEACTIVATOR_SOURCES
-               };
-
-       protected:
-               GuiPresenter(IRefCountObj &rc);
-               virtual ~GuiPresenter();
-
-               Result prepare(ElmWidget &widget, int flags = PF_DEFAULT);
-               Result prepare(GuiPresenter &parent, int flags = PF_DEFAULT);
-
-               Window &getWindow();
-               bool isWindowReady() const;
-
-               void addDeactivatorException(const void *deactivator);
-               void setDeactivatorSink(const WidgetSRef &sink);
-
-               void sendActivate(Widget &sender);
-               void sendDeactivate(Widget &sender);
-
-               void broadcastActivate();
-               void broadcastDeactivate();
-
-               virtual void onActivate();
-               virtual void onDeactivate();
-               virtual void onActivateBy(const DeactivatorInfo &info);
-               virtual void onDeactivateBy(const DeactivatorInfo &info);
-
-       private:
-               void sendDeactivator(Widget &sender,
-                               SmartEvent event, const void *deactivator);
-               void broadcastDeactivator(SmartEvent event,
-                               const void *deactivator);
-
-               void sendDeactivatorInfo(Widget &sender, SmartEvent event,
-                               const DeactivatorInfo &info);
-
-               void activateByImpl(const DeactivatorInfo &info);
-               void deactivateByImpl(const DeactivatorInfo &info);
-
-               void onActivateBySmart(Widget &widget, void *eventInfo);
-               void onDeactivateBySmart(Widget &widget, void *eventInfo);
-
-       private:
-               std::unordered_set<const void *> m_deactivatorExceptions;
-               std::unordered_set<const void *> m_deactivators;
-               WindowSRef m_window;
-               WidgetSRef m_sink;
-               WidgetWRef m_parentSink;
-               bool m_hasBuildInSources;
-               bool m_isChild;
-               bool m_isPrepared;
-       };
-}
-
-#endif // __UCL_MVP_GUI_PRESENTER_H__
diff --git a/ucl/inc/ucl/mvp/ListItemPresenter.h b/ucl/inc/ucl/mvp/ListItemPresenter.h
deleted file mode 100644 (file)
index 2c90f42..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_MVP_LIST_ITEM_PRESENTER_H__
-#define __UCL_MVP_LIST_ITEM_PRESENTER_H__
-
-#include "ucl/gui/GenlistItem.h"
-
-#include "ucl/misc/HashMap.h"
-
-#include "types.h"
-
-namespace ucl {
-
-       UCL_DECLARE_REF_ALIASES(ListItemPresenter);
-
-       class ListItemPresenter : public RefCountAware,
-                       public IDisposable {
-       public:
-               // IDisposable //
-
-               virtual void dispose() final override;
-               virtual bool isDisposed() const final override;
-
-       protected:
-               friend class ListPresenter;
-
-               UCL_DECLARE_REF_ALIASES(ItemClass);
-               UCL_DECLARE_REF_ALIASES(ItemClassCache);
-
-               // Flags
-               enum {
-                       PF_AUTO_UNSELECT = 1
-               };
-
-               struct ItemInsertionParams {
-                       ElmStyle itemStyle;
-                       GenlistItem::Type itemType;
-
-                       ItemInsertionParams(ElmStyle itemStyle,
-                                       GenlistItem::Type itemType = GenlistItem::Type::SIMPLE) :
-                               itemStyle(itemStyle), itemType(itemType) {}
-               };
-
-               class ItemClass final : public NonCopyable {
-               public:
-                       static ItemClassSRef newInstance(ElmStyle itemStyle);
-               public:
-                       Elm_Genlist_Item_Class *get();
-               private:
-                       friend class ReffedObj<ItemClass>;
-                       ItemClass(ElmStyle itemStyle);
-                       ~ItemClass();
-               private:
-                       Elm_Genlist_Item_Class *const m_itc;
-               };
-
-               class ItemClassCache final : public NonCopyable {
-               public:
-                       ItemClassSRef getItemClass(ElmStyle itemStyle);
-                       void purge();
-               private:
-                       HashMap<ElmStyle, ItemClassSRef> m_itcMap;
-               };
-
-       protected:
-               ListItemPresenter(IRefCountObj &rc);
-               virtual ~ListItemPresenter();
-
-               void setFlags(int flags);
-               int getFlags() const;
-
-               bool isActive() const;
-
-               GenlistItem getItem();
-               ItemClassCacheSRef getItemClassCache();
-
-               Result updateItemStyle(ElmStyle newItemStyle);
-
-               virtual ItemInsertionParams getItemInsertionParams() = 0;
-
-               virtual void onItemAttached();
-               virtual void onItemDetached();
-
-               virtual CString getItemPartText(EdjePart part);
-               virtual WidgetSRef getItemPartContent(EdjePart part);
-               virtual bool getItemPartState(EdjePart part);
-
-               virtual void onItemSelected();
-               virtual void onItemRealized();
-               virtual void onItemUnrealized();
-               virtual void onItemHighlighted();
-               virtual void onItemUnhighlighted();
-
-       private:
-               void attachItem(GenlistItem item,
-                               const ItemClassCacheSRef &itcCache,
-                               const SharedRef<bool> &isActiveRef);
-
-               void deleteDetachedItem(bool silent = false);
-               void detachItem(bool silent = false);
-
-               void onItemSelectedHook();
-               void onItemDel(Evas_Object *obj, void *eventInfo);
-
-       private:
-               ListItemPresenterSRef m_selfRef;
-               GenlistItem m_item;
-               ItemClassCacheWRef m_itcCache;
-               SharedRef<bool> m_isActiveRef;
-               int m_flags;
-       };
-}
-
-#endif // __UCL_MVP_LIST_ITEM_PRESENTER_H__
diff --git a/ucl/inc/ucl/mvp/ListPresenter.h b/ucl/inc/ucl/mvp/ListPresenter.h
deleted file mode 100644 (file)
index 1d62e41..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_MVP_LIST_PRESENTER_H__
-#define __UCL_MVP_LIST_PRESENTER_H__
-
-#include "ucl/gui/Genlist.h"
-
-#include "GuiPresenter.h"
-#include "ListItemPresenter.h"
-
-namespace ucl {
-
-       UCL_DECLARE_REF_ALIASES(ListPresenter);
-
-       class ListPresenter final : public GuiPresenter {
-       public:
-               enum {
-                       FLAG_HOMOGENEOUS = (1 << 0),
-                       FLAG_CALC_X_MIN = (1 << 1),
-                       FLAG_CALC_Y_MIN = (1 << 2),
-
-                       FLAG_NOTIFY_REALIZED = (1 << 8),
-                       FLAG_NOTIFY_UNREALIZED = (1 << 9),
-                       FLAG_NOTIFY_HIGHLIGHTED = (1 << 10),
-                       FLAG_NOTIFY_UNHIGHLIGHTED = (1 << 11),
-               };
-
-               class Builder final {
-               public:
-                       Builder();
-                       Builder &setStyle(ElmStyle style);
-                       Builder &setFlags(int flags);
-                       Builder &setParentWidget(const ElmWidgetSRef &parentWidget);
-                       ListPresenterSRef build(GuiPresenter &parent) const;
-               private:
-                       ucl::ElmWidgetSRef m_parentWidget;
-                       ElmStyle m_style;
-                       int m_flags;
-               };
-
-       public:
-               Genlist &getWidget();
-
-               void clear();
-
-               Result append(ListItemPresenter &itemPresenter,
-                               ListItemPresenter *parent = nullptr);
-
-               Result prepend(ListItemPresenter &itemPresenter,
-                               ListItemPresenter *parent = nullptr);
-
-               Result insertAfter(const ListItemPresenter &after,
-                               ListItemPresenter &itemPresenter,
-                               ListItemPresenter *parent = nullptr);
-
-               Result insertBefore(const ListItemPresenter &before,
-                               ListItemPresenter &itemPresenter,
-                               ListItemPresenter *parent = nullptr);
-
-       private:
-               friend class ReffedObj<ListPresenter>;
-               ListPresenter(IRefCountObj &rc);
-               virtual ~ListPresenter();
-
-               Result prepare(GuiPresenter &parent, ElmWidget &parentWidget,
-                               ElmStyle style, int flags);
-
-               template <class INSERT_FUNC>
-               Result insert(ListItemPresenter &itemPresenter,
-                               ListItemPresenter *parent,
-                               INSERT_FUNC &&insertFunc);
-
-               template <class INSERT_FUNC>
-               Result insertRelative(const ListItemPresenter &relative,
-                               ListItemPresenter &itemPresenter,
-                               ListItemPresenter *parent, INSERT_FUNC &&insertFunc);
-
-               void setIsActiveRef(bool value);
-
-               void onItemSelected(Widget &widget, void *eventInfo);
-
-               void onItemRealized(Widget &widget, void *eventInfo);
-               void onItemUnrealized(Widget &widget, void *eventInfo);
-               void onItemHighlighted(Widget &widget, void *eventInfo);
-               void onItemUnhighlighted(Widget &widget, void *eventInfo);
-
-               // GuiPresenter //
-
-               virtual void onActivate() final override;
-               virtual void onDeactivate() final override;
-
-       private:
-               GenlistSRef m_genlist;
-               ListItemPresenter::ItemClassCacheSRef m_itcCache;
-               SharedRef<bool> m_isActiveRef;
-       };
-}
-
-#endif // __UCL_MVP_LIST_PRESENTER_H__
diff --git a/ucl/inc/ucl/mvp/types.h b/ucl/inc/ucl/mvp/types.h
deleted file mode 100644 (file)
index 6c263e2..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_MVP_TYPES_H__
-#define __UCL_MVP_TYPES_H__
-
-#include "ucl/gui/types.h"
-
-#endif // __UCL_MVP_TYPES_H__
diff --git a/ucl/inc/ucl/util/delegation.h b/ucl/inc/ucl/util/delegation.h
deleted file mode 100644 (file)
index a624c08..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_UTIL_DELEGATION_H__
-#define __UCL_UTIL_DELEGATION_H__
-
-#include "delegation/Callback.h"
-
-#include "delegation/BaseDelegate.h"
-#include "delegation/BaseDelegate2.h"
-
-#include "delegation/Delegate.h"
-#include "delegation/Delegate2.h"
-
-#include "delegation/helpers.h"
-#include "delegation/macro.h"
-
-#if (UCL_INCLUDE_DELEGATION_SHORT_MACRO_H)
-#include "delegation/shortMacro.h"
-#endif
-
-#endif // __UCL_UTIL_DELEGATION_H__
diff --git a/ucl/inc/ucl/util/delegation/BaseDelegate.h b/ucl/inc/ucl/util/delegation/BaseDelegate.h
deleted file mode 100644 (file)
index 62b92ff..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_UTIL_DELEGATION_BASE_DELEGATE_H__
-#define __UCL_UTIL_DELEGATION_BASE_DELEGATE_H__
-
-#include "Callback.h"
-
-namespace ucl {
-
-       template <class FUNC_SIG, class DATA>
-       class BaseDelegate;
-
-       template <class FUNC_SIG, class DATA>
-       class BaseDelegate2;
-
-       template <class R, class ...ARGS, class DATA>
-       class BaseDelegate<R(ARGS...), DATA> {
-       public:
-               using Cb = Callback<R(ARGS...)>;
-               using StubA = typename Cb::StubA;
-
-       public:
-               constexpr BaseDelegate() noexcept;
-               constexpr BaseDelegate(std::nullptr_t) noexcept;
-
-               template <class FUNC_SIG>
-               BaseDelegate(const BaseDelegate2<FUNC_SIG, DATA> &d) noexcept;
-               template <class FUNC_SIG>
-               BaseDelegate(BaseDelegate2<FUNC_SIG, DATA> &&d) noexcept;
-
-               void reset() noexcept;
-
-               const DATA &getData() const noexcept;
-               StubA getStubA() const noexcept;
-               operator bool() const noexcept;
-
-       protected:
-               BaseDelegate(const DATA &data, StubA stubA) noexcept;
-
-       protected:
-               DATA m_data;
-               StubA m_stubA;
-       };
-}
-
-#include "BaseDelegate.hpp"
-
-#endif // __UCL_UTIL_DELEGATION_BASE_DELEGATE_H__
diff --git a/ucl/inc/ucl/util/delegation/BaseDelegate.hpp b/ucl/inc/ucl/util/delegation/BaseDelegate.hpp
deleted file mode 100644 (file)
index f25c0a7..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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.
- */
-
-namespace ucl {
-
-       template <class R, class ...ARGS, class DATA>
-       constexpr BaseDelegate<R(ARGS...), DATA>::BaseDelegate() noexcept :
-               m_data(nullptr),
-               m_stubA(nullptr)
-       {
-       }
-
-       template <class R, class ...ARGS, class DATA>
-       constexpr BaseDelegate<R(ARGS...), DATA>::
-                       BaseDelegate(std::nullptr_t) noexcept :
-               BaseDelegate()
-       {
-       }
-
-       template <class R, class ...ARGS, class DATA>
-       inline BaseDelegate<R(ARGS...), DATA>::
-                       BaseDelegate(const DATA &data, StubA stubA) noexcept :
-               m_data(data),
-               m_stubA(stubA)
-       {
-       }
-
-       template <class R, class ...ARGS, class DATA>
-       template <class FUNC_SIG>
-       inline BaseDelegate<R(ARGS...), DATA>::
-                       BaseDelegate(const BaseDelegate2<FUNC_SIG, DATA> &d) noexcept :
-               m_data(d.m_data),
-               m_stubA(d.m_stubA)
-       {
-       }
-
-       template <class R, class ...ARGS, class DATA>
-       template <class FUNC_SIG>
-       inline BaseDelegate<R(ARGS...), DATA>::
-                       BaseDelegate(BaseDelegate2<FUNC_SIG, DATA> &&d) noexcept :
-               m_data(std::move(d.m_data)),
-               m_stubA(d.m_stubA)
-       {
-       }
-
-       template <class R, class ...ARGS, class DATA>
-       inline void BaseDelegate<R(ARGS...), DATA>::reset() noexcept
-       {
-               *this = {};
-       }
-
-       template <class R, class ...ARGS, class DATA>
-       inline const DATA &BaseDelegate<R(ARGS...), DATA>::getData() const noexcept
-       {
-               return m_data;
-       }
-
-       template <class R, class ...ARGS, class DATA>
-       inline typename BaseDelegate<R(ARGS...), DATA>::StubA
-                       BaseDelegate<R(ARGS...), DATA>::getStubA() const noexcept
-       {
-               return m_stubA;
-       }
-
-       template <class R, class ...ARGS, class DATA>
-       inline BaseDelegate<R(ARGS...), DATA>::operator bool() const noexcept
-       {
-               return !!m_data;
-       }
-}
diff --git a/ucl/inc/ucl/util/delegation/BaseDelegate2.h b/ucl/inc/ucl/util/delegation/BaseDelegate2.h
deleted file mode 100644 (file)
index ff3b635..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_UTIL_DELEGATION_BASE_DELEGATE2_H__
-#define __UCL_UTIL_DELEGATION_BASE_DELEGATE2_H__
-
-#include "BaseDelegate.h"
-
-namespace ucl {
-
-       template <class FUNC_SIG, class DATA>
-       class BaseDelegate2;
-
-       template <class R, class ...ARGS, class DATA>
-       class BaseDelegate2<R(ARGS...), DATA> :
-                       public BaseDelegate<R(ARGS...), DATA> {
-       public:
-               using Cb = typename BaseDelegate2::Cb;
-               using StubA = typename Cb::StubA;
-               using StubB = typename Cb::StubB;
-
-       public:
-               using BaseDelegate<R(ARGS...), DATA>::BaseDelegate;
-
-               StubB getStubB() const noexcept;
-
-       protected:
-               BaseDelegate2(const DATA &data, StubA stubA, StubB stubB) noexcept;
-
-       private:
-               StubB m_stubB;
-       };
-}
-
-#include "BaseDelegate2.hpp"
-
-#endif // __UCL_UTIL_DELEGATION_BASE_DELEGATE2_H__
diff --git a/ucl/inc/ucl/util/delegation/BaseDelegate2.hpp b/ucl/inc/ucl/util/delegation/BaseDelegate2.hpp
deleted file mode 100644 (file)
index 6d8efa7..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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.
- */
-
-namespace ucl {
-
-       template <class R, class ...ARGS, class DATA>
-       inline BaseDelegate2<R(ARGS...), DATA>::
-                       BaseDelegate2(const DATA &data, StubA stubA, StubB stubB) noexcept :
-               BaseDelegate<R(ARGS...), DATA>(data, stubA),
-               m_stubB(stubB)
-       {
-       }
-
-       template <class R, class ...ARGS, class DATA>
-       inline typename BaseDelegate2<R(ARGS...), DATA>::StubB
-                       BaseDelegate2<R(ARGS...), DATA>::getStubB() const noexcept
-       {
-               return m_stubB;
-       }
-}
diff --git a/ucl/inc/ucl/util/delegation/Callback.h b/ucl/inc/ucl/util/delegation/Callback.h
deleted file mode 100644 (file)
index 69724be..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_UTIL_DELEGATION_CALLBACK_H__
-#define __UCL_UTIL_DELEGATION_CALLBACK_H__
-
-#include "ucl/util/types/baseTypes.h"
-
-namespace ucl {
-
-       template <class FUNC_SIG>
-       class Callback;
-
-       template <class R, class ...ARGS>
-       class Callback<R(ARGS...)> {
-       public:
-               using StubA = R(*)(void *, ARGS...);
-               using StubB = R(*)(ARGS..., void *);
-
-       public:
-               template <class CLASS, R(CLASS::*METHOD)(ARGS...)>
-               static R stubA(void *data, ARGS ...args);
-               template <class CLASS, R(CLASS::*METHOD)(ARGS...)>
-               static R stubB(ARGS ...args, void *data);
-
-               template <class CLASS, R(CLASS::*METHOD)(ARGS...) const>
-               static R stubA(void *data, ARGS ...args);
-               template <class CLASS, R(CLASS::*METHOD)(ARGS...) const>
-               static R stubB(ARGS ...args, void *data);
-
-               template <class CLASS, R(*FUNC)(CLASS &, ARGS...)>
-               static R stubA2A(void *data, ARGS ...args);
-               template <class CLASS, R(*FUNC)(CLASS &, ARGS...)>
-               static R stubB2A(ARGS ...args, void *data);
-
-               template <class CLASS, R(*FUNC)(ARGS..., CLASS &)>
-               static R stubA2B(void *data, ARGS ...args);
-               template <class CLASS, R(*FUNC)(ARGS..., CLASS &)>
-               static R stubB2B(ARGS ...args, void *data);
-
-               template <class HANDLE, R(*FUNC)(HANDLE, ARGS...)>
-               static R stubA2A(void *data, ARGS ...args);
-               template <class HANDLE, R(*FUNC)(HANDLE, ARGS...)>
-               static R stubB2A(ARGS ...args, void *data);
-
-               template <class HANDLE, R(*FUNC)(ARGS..., HANDLE)>
-               static R stubA2B(void *data, ARGS ...args);
-               template <class HANDLE, R(*FUNC)(ARGS..., HANDLE)>
-               static R stubB2B(ARGS ...args, void *data);
-
-               template <R(*FUNC)(ARGS...)>
-               static R stubA2V(void *data, ARGS ...args);
-               template <R(*FUNC)(ARGS...)>
-               static R stubB2V(ARGS ...args, void *data);
-       };
-}
-
-#include "Callback.hpp"
-
-#endif // __UCL_UTIL_DELEGATION_CALLBACK_H__
diff --git a/ucl/inc/ucl/util/delegation/Callback.hpp b/ucl/inc/ucl/util/delegation/Callback.hpp
deleted file mode 100644 (file)
index 28d2145..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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.
- */
-
-namespace ucl {
-
-       template <class R, class ...ARGS>
-       template <class CLASS, R(CLASS::*METHOD)(ARGS...)>
-       inline R Callback<R(ARGS...)>::stubA(void *data, ARGS ...args)
-       {
-               return (static_cast<CLASS *>(data)->*METHOD)(
-                               std::forward<ARGS>(args)...);
-       }
-
-       template <class R, class ...ARGS>
-       template <class CLASS, R(CLASS::*METHOD)(ARGS...)>
-       inline R Callback<R(ARGS...)>::stubB(ARGS ...args, void *data)
-       {
-               return (static_cast<CLASS *>(data)->*METHOD)(
-                               std::forward<ARGS>(args)...);
-       }
-
-       template <class R, class ...ARGS>
-       template <class CLASS, R(CLASS::*METHOD)(ARGS...) const>
-       inline R Callback<R(ARGS...)>::stubA(void *data, ARGS ...args)
-       {
-               return (static_cast<const CLASS *>(data)->*METHOD)(
-                               std::forward<ARGS>(args)...);
-       }
-
-       template <class R, class ...ARGS>
-       template <class CLASS, R(CLASS::*METHOD)(ARGS...) const>
-       inline R Callback<R(ARGS...)>::stubB(ARGS ...args, void *data)
-       {
-               return (static_cast<const CLASS *>(data)->*METHOD)(
-                               std::forward<ARGS>(args)...);
-       }
-
-       template <class R, class ...ARGS>
-       template <class CLASS, R(*FUNC)(CLASS &, ARGS...)>
-       inline R Callback<R(ARGS...)>::stubA2A(void *data, ARGS ...args)
-       {
-               return FUNC(*static_cast<CLASS *>(data), std::forward<ARGS>(args)...);
-       }
-
-       template <class R, class ...ARGS>
-       template <class CLASS, R(*FUNC)(CLASS &, ARGS...)>
-       inline R Callback<R(ARGS...)>::stubB2A(ARGS ...args, void *data)
-       {
-               return FUNC(*static_cast<CLASS *>(data), std::forward<ARGS>(args)...);
-       }
-
-       template <class R, class ...ARGS>
-       template <class CLASS, R(*FUNC)(ARGS..., CLASS &)>
-       inline R Callback<R(ARGS...)>::stubA2B(void *data, ARGS ...args)
-       {
-               return FUNC(std::forward<ARGS>(args)..., *static_cast<CLASS *>(data));
-       }
-
-       template <class R, class ...ARGS>
-       template <class CLASS, R(*FUNC)(ARGS..., CLASS &)>
-       inline R Callback<R(ARGS...)>::stubB2B(ARGS ...args, void *data)
-       {
-               return FUNC(std::forward<ARGS>(args)..., *static_cast<CLASS *>(data));
-       }
-
-       template <class R, class ...ARGS>
-       template <class HANDLE, R(*FUNC)(HANDLE, ARGS...)>
-       inline R Callback<R(ARGS...)>::stubA2A(void *data, ARGS ...args)
-       {
-               return FUNC(static_cast<HANDLE>(data), std::forward<ARGS>(args)...);
-       }
-
-       template <class R, class ...ARGS>
-       template <class HANDLE, R(*FUNC)(HANDLE, ARGS...)>
-       inline R Callback<R(ARGS...)>::stubB2A(ARGS ...args, void *data)
-       {
-               return FUNC(static_cast<HANDLE>(data), std::forward<ARGS>(args)...);
-       }
-
-       template <class R, class ...ARGS>
-       template <class HANDLE, R(*FUNC)(ARGS..., HANDLE)>
-       inline R Callback<R(ARGS...)>::stubA2B(void *data, ARGS ...args)
-       {
-               return FUNC(std::forward<ARGS>(args)..., static_cast<HANDLE>(data));
-       }
-
-       template <class R, class ...ARGS>
-       template <class HANDLE, R(*FUNC)(ARGS..., HANDLE)>
-       inline R Callback<R(ARGS...)>::stubB2B(ARGS ...args, void *data)
-       {
-               return FUNC(std::forward<ARGS>(args)..., static_cast<HANDLE>(data));
-       }
-
-       template <class R, class ...ARGS>
-       template <R(*FUNC)(ARGS...)>
-       inline R Callback<R(ARGS...)>::stubA2V(void *data, ARGS ...args)
-       {
-               return FUNC(std::forward<ARGS>(args)...);
-       }
-
-       template <class R, class ...ARGS>
-       template <R(*FUNC)(ARGS...)>
-       inline R Callback<R(ARGS...)>::stubB2V(ARGS ...args, void *data)
-       {
-               return FUNC(std::forward<ARGS>(args)...);
-       }
-}
diff --git a/ucl/inc/ucl/util/delegation/Delegate.h b/ucl/inc/ucl/util/delegation/Delegate.h
deleted file mode 100644 (file)
index e1e7416..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_UTIL_DELEGATION_DELEGATE_H__
-#define __UCL_UTIL_DELEGATION_DELEGATE_H__
-
-#include "BaseDelegate.h"
-
-namespace ucl {
-
-       template <class FUNC_SIG>
-       class Delegate;
-
-       template <class R, class ...ARGS>
-       class Delegate<R(ARGS...)> : public BaseDelegate<R(ARGS...), void *> {
-       public:
-               using BaseDelegate<R(ARGS...), void *>::BaseDelegate;
-
-               R operator()(ARGS ...args) const;
-
-               template <class CLASS, R(CLASS::*METHOD)(ARGS...)>
-               static Delegate make(CLASS *data) noexcept;
-               template <class CLASS, R(CLASS::*METHOD)(ARGS...) const>
-               static Delegate make(const CLASS *data) noexcept;
-
-               template <class CLASS, R(*FUNC)(CLASS &, ARGS...)>
-               static Delegate makeA(CLASS &data) noexcept;
-               template <class CLASS, R(*FUNC)(ARGS..., CLASS &)>
-               static Delegate makeB(CLASS &data) noexcept;
-
-               template <class HANDLE, R(*FUNC)(HANDLE, ARGS...)>
-               static Delegate makeA(HANDLE data) noexcept;
-               template <class HANDLE, R(*FUNC)(ARGS..., HANDLE)>
-               static Delegate makeB(HANDLE data) noexcept;
-
-               template <R(*FUNC)(ARGS...)>
-               static Delegate make() noexcept;
-       };
-}
-
-#include "Delegate.hpp"
-
-#endif // __UCL_UTIL_DELEGATION_DELEGATE_H__
diff --git a/ucl/inc/ucl/util/delegation/Delegate.hpp b/ucl/inc/ucl/util/delegation/Delegate.hpp
deleted file mode 100644 (file)
index 632ec24..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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.
- */
-
-namespace ucl {
-
-       template <class R, class ...ARGS>
-       inline R Delegate<R(ARGS...)>::operator()(ARGS ...args) const
-       {
-               return this->m_stubA(this->m_data, std::forward<ARGS>(args)...);
-       }
-
-       template <class R, class ...ARGS>
-       template <class CLASS, R(CLASS::*METHOD)(ARGS...)>
-       inline Delegate<R(ARGS...)>
-                       Delegate<R(ARGS...)>::make(CLASS *const data) noexcept
-       {
-               return {static_cast<void *>(data),
-                               Delegate::Cb::template stubA<CLASS, METHOD>};
-       }
-
-       template <class R, class ...ARGS>
-       template <class CLASS, R(CLASS::*METHOD)(ARGS...) const>
-       inline Delegate<R(ARGS...)>
-                       Delegate<R(ARGS...)>::make(const CLASS *const data) noexcept
-       {
-               return {static_cast<void *>(const_cast<CLASS *>(data)),
-                               Delegate::Cb::template stubA<CLASS, METHOD>};
-       }
-
-       template <class R, class ...ARGS>
-       template <class CLASS, R(*FUNC)(CLASS &, ARGS...)>
-       inline Delegate<R(ARGS...)>
-                       Delegate<R(ARGS...)>::makeA(CLASS &data) noexcept
-       {
-               return {const_cast<void *>(static_cast<const void *>(&data)),
-                               Delegate::Cb::template stubA2A<CLASS, FUNC>};
-       }
-
-       template <class R, class ...ARGS>
-       template <class CLASS, R(*FUNC)(ARGS..., CLASS &)>
-       inline Delegate<R(ARGS...)>
-                       Delegate<R(ARGS...)>::makeB(CLASS &data) noexcept
-       {
-               return {const_cast<void *>(static_cast<const void *>(&data)),
-                               Delegate::Cb::template stubA2B<CLASS, FUNC>};
-       }
-
-       template <class R, class ...ARGS>
-       template <class HANDLE, R(*FUNC)(HANDLE, ARGS...)>
-       inline Delegate<R(ARGS...)>
-                       Delegate<R(ARGS...)>::makeA(const HANDLE data) noexcept
-       {
-               return {const_cast<void *>(static_cast<const void *>(data)),
-                               Delegate::Cb::template stubA2A<HANDLE, FUNC>};
-       }
-
-       template <class R, class ...ARGS>
-       template <class HANDLE, R(*FUNC)(ARGS..., HANDLE)>
-       inline Delegate<R(ARGS...)>
-                       Delegate<R(ARGS...)>::makeB(const HANDLE data) noexcept
-       {
-               return {const_cast<void *>(static_cast<const void *>(data)),
-                               Delegate::Cb::template stubA2B<HANDLE, FUNC>};
-       }
-
-       template <class R, class ...ARGS>
-       template <R(*FUNC)(ARGS...)>
-       inline Delegate<R(ARGS...)>
-                       Delegate<R(ARGS...)>::make() noexcept
-       {
-               return {nullptr, Delegate::Cb::template stubA2V<FUNC>};
-       }
-}
diff --git a/ucl/inc/ucl/util/delegation/Delegate2.h b/ucl/inc/ucl/util/delegation/Delegate2.h
deleted file mode 100644 (file)
index 56ff3fb..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_UTIL_DELEGATION_DELEGATE2_H__
-#define __UCL_UTIL_DELEGATION_DELEGATE2_H__
-
-#include "BaseDelegate2.h"
-
-namespace ucl {
-
-       template <class FUNC_SIG>
-       class Delegate2;
-
-       template <class R, class ...ARGS>
-       class Delegate2<R(ARGS...)> : public BaseDelegate2<R(ARGS...), void *> {
-       public:
-               using BaseDelegate2<R(ARGS...), void *>::BaseDelegate2;
-
-               R operator()(ARGS ...args) const;
-
-               template <class CLASS, R(CLASS::*METHOD)(ARGS...)>
-               static Delegate2 make(CLASS *data) noexcept;
-               template <class CLASS, R(CLASS::*METHOD)(ARGS...) const>
-               static Delegate2 make(const CLASS *data) noexcept;
-
-               template <class CLASS, R(*FUNC)(CLASS &, ARGS...)>
-               static Delegate2 makeA(CLASS &data) noexcept;
-               template <class CLASS, R(*FUNC)(ARGS..., CLASS &)>
-               static Delegate2 makeB(CLASS &data) noexcept;
-
-               template <class HANDLE, R(*FUNC)(HANDLE, ARGS...)>
-               static Delegate2 makeA(HANDLE data) noexcept;
-               template <class HANDLE, R(*FUNC)(ARGS..., HANDLE)>
-               static Delegate2 makeB(HANDLE data) noexcept;
-
-               template <R(*FUNC)(ARGS...)>
-               static Delegate2 make() noexcept;
-       };
-}
-
-#include "Delegate2.hpp"
-
-#endif // __UCL_UTIL_DELEGATION_DELEGATE2_H__
diff --git a/ucl/inc/ucl/util/delegation/Delegate2.hpp b/ucl/inc/ucl/util/delegation/Delegate2.hpp
deleted file mode 100644 (file)
index 085ba46..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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.
- */
-
-namespace ucl {
-
-       template <class R, class ...ARGS>
-       inline R Delegate2<R(ARGS...)>::operator()(ARGS ...args) const
-       {
-               return this->m_stubA(this->m_data, std::forward<ARGS>(args)...);
-       }
-
-       template <class R, class ...ARGS>
-       template <class CLASS, R(CLASS::*METHOD)(ARGS...)>
-       inline Delegate2<R(ARGS...)>
-                       Delegate2<R(ARGS...)>::make(CLASS *const data) noexcept
-       {
-               return {static_cast<void *>(data),
-                               Delegate2::Cb::template stubA<CLASS, METHOD>,
-                               Delegate2::Cb::template stubB<CLASS, METHOD>};
-       }
-
-       template <class R, class ...ARGS>
-       template <class CLASS, R(CLASS::*METHOD)(ARGS...) const>
-       inline Delegate2<R(ARGS...)>
-                       Delegate2<R(ARGS...)>::make(const CLASS *const data) noexcept
-       {
-               return {static_cast<void *>(const_cast<CLASS *>(data)),
-                               Delegate2::Cb::template stubA<CLASS, METHOD>,
-                               Delegate2::Cb::template stubB<CLASS, METHOD>};
-       }
-
-       template <class R, class ...ARGS>
-       template <class CLASS, R(*FUNC)(CLASS &, ARGS...)>
-       inline Delegate2<R(ARGS...)>
-                       Delegate2<R(ARGS...)>::makeA(CLASS &data) noexcept
-       {
-               return {const_cast<void *>(static_cast<const void *>(&data)),
-                               Delegate2::Cb::template stubA2A<CLASS, FUNC>,
-                               Delegate2::Cb::template stubB2A<CLASS, FUNC>};
-       }
-
-       template <class R, class ...ARGS>
-       template <class CLASS, R(*FUNC)(ARGS..., CLASS &)>
-       inline Delegate2<R(ARGS...)>
-                       Delegate2<R(ARGS...)>::makeB(CLASS &data) noexcept
-       {
-               return {const_cast<void *>(static_cast<const void *>(&data)),
-                               Delegate2::Cb::template stubA2B<CLASS, FUNC>,
-                               Delegate2::Cb::template stubB2B<CLASS, FUNC>};
-       }
-
-       template <class R, class ...ARGS>
-       template <class HANDLE, R(*FUNC)(HANDLE, ARGS...)>
-       inline Delegate2<R(ARGS...)>
-                       Delegate2<R(ARGS...)>::makeA(const HANDLE data) noexcept
-       {
-               return {const_cast<void *>(static_cast<const void *>(data)),
-                               Delegate2::Cb::template stubA2A<HANDLE, FUNC>,
-                               Delegate2::Cb::template stubB2A<HANDLE, FUNC>};
-       }
-
-       template <class R, class ...ARGS>
-       template <class HANDLE, R(*FUNC)(ARGS..., HANDLE)>
-       inline Delegate2<R(ARGS...)>
-                       Delegate2<R(ARGS...)>::makeB(const HANDLE data) noexcept
-       {
-               return {const_cast<void *>(static_cast<const void *>(data)),
-                               Delegate2::Cb::template stubA2B<HANDLE, FUNC>,
-                               Delegate2::Cb::template stubB2B<HANDLE, FUNC>};
-       }
-
-       template <class R, class ...ARGS>
-       template <R(*FUNC)(ARGS...)>
-       inline Delegate2<R(ARGS...)>
-                       Delegate2<R(ARGS...)>::make() noexcept
-       {
-               return {nullptr,
-                               Delegate2::Cb::template stubA2V<FUNC>,
-                               Delegate2::Cb::template stubB2V<FUNC>};
-       }
-}
diff --git a/ucl/inc/ucl/util/delegation/helpers.h b/ucl/inc/ucl/util/delegation/helpers.h
deleted file mode 100644 (file)
index 54ebb99..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_UTIL_DELEGATION_HELPERS_H__
-#define __UCL_UTIL_DELEGATION_HELPERS_H__
-
-namespace ucl {
-
-       // Automatic function signature detection for a specific type //
-
-       template <template <typename ...> class T, class TAG, class FUNC>
-       struct AutoFuncSig;
-
-       template <template <typename ...> class T,
-                        class R, class CLASS, class ...ARGS>
-       struct AutoFuncSig<T, void *, R(CLASS::*)(ARGS...)> {
-               using Data = CLASS;
-               using Type = T<R(ARGS...)>;
-       };
-
-       template <template <typename ...> class T,
-                       class CLASS, class R, class ...ARGS>
-       struct AutoFuncSig<T, void *, R(CLASS::*)(ARGS...) const> {
-               using Data = CLASS;
-               using Type = T<R(ARGS...)>;
-       };
-
-       template <template <typename ...> class T,
-                       class CLASS, class R, class ...ARGS>
-       struct AutoFuncSig<T, void *, R(*)(CLASS &, ARGS...)> {
-               using Data = CLASS;
-               using Type = T<R(ARGS...)>;
-       };
-
-       template <template <typename ...> class T,
-                       class HANDLE, class R, class ...ARGS>
-       struct AutoFuncSig<T, void *, R(*)(HANDLE, ARGS...)> {
-               using Data = HANDLE;
-               using Type = T<R(ARGS...)>;
-       };
-
-       template <template <typename ...> class T,
-                       class R, class ...ARGS>
-       struct AutoFuncSig<T, void, R(*)(ARGS...)> {
-               using Type = T<R(ARGS...)>;
-       };
-
-       // Relation operators //
-
-       template <class R, class ...ARGS, class DATA1, class DATA2>
-       inline bool operator==(const BaseDelegate<R(ARGS...), DATA1> &lhs,
-                       const BaseDelegate<R(ARGS...), DATA2> &rhs) noexcept
-       {
-               return ((lhs.getStubA() == rhs.getStubA()) && (
-                               lhs.getData() == rhs.getData()));
-       }
-
-       template <class R, class ...ARGS, class DATA1, class DATA2>
-       inline bool operator!=(const BaseDelegate<R(ARGS...), DATA1> &lhs,
-                       const BaseDelegate<R(ARGS...), DATA2> &rhs) noexcept
-       {
-               return ((lhs.getStubA() != rhs.getStubA()) || (
-                               lhs.getData() != rhs.getData()));
-       }
-
-       template <class R, class ...ARGS, class DATA1, class DATA2>
-       inline bool operator<(const BaseDelegate<R(ARGS...), DATA1> &lhs,
-                       const BaseDelegate<R(ARGS...), DATA2> &rhs) noexcept
-       {
-               return ((lhs.getStubA() < rhs.getStubA()) ||
-                               ((lhs.getStubA() == rhs.getStubA()) && (
-                                       lhs.getData() < rhs.getData())));
-       }
-
-       template <class R, class ...ARGS, class DATA1, class DATA2>
-       inline bool operator<=(const BaseDelegate<R(ARGS...), DATA1> &lhs,
-                       const BaseDelegate<R(ARGS...), DATA2> &rhs) noexcept
-       {
-               return ((lhs.getStubA() < rhs.getStubA()) ||
-                               ((lhs.getStubA() == rhs.getStubA()) && (
-                                       lhs.getData() <= rhs.getData())));
-       }
-
-       template <class R, class ...ARGS, class DATA1, class DATA2>
-       inline bool operator>(const BaseDelegate<R(ARGS...), DATA1> &lhs,
-                       const BaseDelegate<R(ARGS...), DATA2> &rhs) noexcept
-       {
-               return ((lhs.getStubA() > rhs.getStubA()) ||
-                               ((lhs.getStubA() == rhs.getStubA()) && (
-                                       lhs.getData() > rhs.getData())));
-       }
-
-       template <class R, class ...ARGS, class DATA1, class DATA2>
-       inline bool operator>=(const BaseDelegate<R(ARGS...), DATA1> &lhs,
-                       const BaseDelegate<R(ARGS...), DATA2> &rhs) noexcept
-       {
-               return ((lhs.getStubA() > rhs.getStubA()) ||
-                               ((lhs.getStubA() == rhs.getStubA()) && (
-                                       lhs.getData() >= rhs.getData())));
-       }
-}
-
-#endif // __UCL_UTIL_DELEGATION_HELPERS_H__
diff --git a/ucl/inc/ucl/util/delegation/macro.h b/ucl/inc/ucl/util/delegation/macro.h
deleted file mode 100644 (file)
index 62bf88f..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_UTIL_DELEGATION_MACRO_H__
-#define __UCL_UTIL_DELEGATION_MACRO_H__
-
-// Helper macro to simplify use of AutoFuncSig template
-
-#define _UCL_AFS(DELEGATE, FUNC) \
-               ::ucl::AutoFuncSig<DELEGATE, void *, decltype(&FUNC)>
-
-// Helper macro to automatically generate different delegate objects //
-
-#define _UCL_DELEGATE(DELEGATE, FUNC, DATA) (_UCL_AFS(DELEGATE, FUNC):: \
-               Type::make<_UCL_AFS(DELEGATE, FUNC)::Data, &FUNC>(DATA))
-
-#define _UCL_DELEGATE_A(DELEGATE, FUNC, DATA) (_UCL_AFS(DELEGATE, FUNC):: \
-               Type::makeA<_UCL_AFS(DELEGATE, FUNC)::Data, &FUNC>(DATA))
-
-#define _UCL_DELEGATE_V(DELEGATE, FUNC) \
-               (::ucl::AutoFuncSig<DELEGATE, void, decltype(&FUNC)>::\
-                       Type::make<&FUNC>())
-
-// Helper macro to automatically generate Delegate objects //
-
-#define UCL_DELEGATE(FUNC, DATA) _UCL_DELEGATE(::ucl::Delegate, FUNC, DATA)
-#define UCL_DELEGATE_A(FUNC, DATA) _UCL_DELEGATE_A(::ucl::Delegate, FUNC, DATA)
-#define UCL_DELEGATE_V(FUNC) _UCL_DELEGATE_V(::ucl::Delegate, FUNC)
-
-// Helper macro to automatically generate Delegate2 objects //
-
-#define UCL_DELEGATE2(FUNC, DATA) _UCL_DELEGATE(::ucl::Delegate2, FUNC, DATA)
-#define UCL_DELEGATE2_A(FUNC, DATA) \
-               _UCL_DELEGATE_A(::ucl::Delegate2, FUNC, DATA)
-#define UCL_DELEGATE2_V(FUNC) _UCL_DELEGATE_V(::ucl::Delegate2, FUNC)
-
-// Helper macro to automatically generate Callback stubs //
-
-#define UCL_CALLBACK_A(FUNC) (&_UCL_AFS(::ucl::Callback, FUNC):: \
-               Type::stubA<_UCL_AFS(::ucl::Callback, FUNC)::Data, &FUNC>)
-#define UCL_CALLBACK_B(FUNC) (&_UCL_AFS(::ucl::Callback, FUNC):: \
-               Type::stubB<_UCL_AFS(::ucl::Callback, FUNC)::Data, &FUNC>)
-
-#define UCL_CALLBACK_A2A(FUNC) (&_UCL_AFS(::ucl::Callback, FUNC)::Type:: \
-               stubA2A<_UCL_AFS(::ucl::Callback, FUNC)::Data, &FUNC>)
-#define UCL_CALLBACK_B2A(FUNC) (&_UCL_AFS(::ucl::Callback, FUNC)::Type:: \
-               stubB2A<_UCL_AFS(::ucl::Callback, FUNC)::Data, &FUNC>)
-
-#define UCL_CALLBACK_A2V(FUNC) (&::ucl::AutoFuncSig<::ucl::Callback, void, \
-               decltype(&FUNC)>::Type::stubA2V<&FUNC>)
-#define UCL_CALLBACK_B2V(FUNC) (&::ucl::AutoFuncSig<::ucl::Callback, void, \
-               decltype(&FUNC)>::Type::stubB2V<&FUNC>)
-
-#endif // __UCL_UTIL_DELEGATION_MACRO_H__
diff --git a/ucl/inc/ucl/util/delegation/shortMacro.h b/ucl/inc/ucl/util/delegation/shortMacro.h
deleted file mode 100644 (file)
index 3837977..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_UTIL_DELEGATION_SHORT_MACRO_H__
-#define __UCL_UTIL_DELEGATION_SHORT_MACRO_H__
-
-// Helper macro to automatically generate Delegate objects //
-
-#define DELEGATE(FUNC, DATA)    UCL_DELEGATE(FUNC, DATA)
-#define DELEGATE_A(FUNC, DATA)  UCL_DELEGATE_A(FUNC, DATA)
-#define DELEGATE_V(FUNC)        UCL_DELEGATE_V(FUNC)
-
-// Helper macro to automatically generate Delegate2 objects //
-
-#define DELEGATE2(FUNC, DATA)    UCL_DELEGATE2(FUNC, DATA)
-#define DELEGATE2_A(FUNC, DATA)  UCL_DELEGATE2_A(FUNC, DATA)
-#define DELEGATE2_V(FUNC)        UCL_DELEGATE2_V(FUNC)
-
-// Helper macro to automatically generate Callback stubs //
-
-#define CALLBACK_A(FUNC)  UCL_CALLBACK_A(FUNC)
-#define CALLBACK_B(FUNC)  UCL_CALLBACK_B(FUNC)
-
-#define CALLBACK_A2A(FUNC)  UCL_CALLBACK_A2A(FUNC)
-#define CALLBACK_B2A(FUNC)  UCL_CALLBACK_B2A(FUNC)
-
-#define CALLBACK_A2V(FUNC)  UCL_CALLBACK_A2V(FUNC)
-#define CALLBACK_B2V(FUNC)  UCL_CALLBACK_B2V(FUNC)
-
-#endif // __UCL_UTIL_DELEGATION_SHORT_MACRO_H__
diff --git a/ucl/inc/ucl/util/helpers.h b/ucl/inc/ucl/util/helpers.h
deleted file mode 100644 (file)
index 87485b0..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_UTIL_HELPERS_H__
-#define __UCL_UTIL_HELPERS_H__
-
-#include "types/baseTypes.h"
-
-namespace ucl {
-
-       constexpr Eina_Bool toEina(bool value);
-
-       // "nz()" - "Not Zero" functions
-       // return "zValue" if "!value" is true
-       constexpr const char *nz(const char *value, const char *zValue = "");
-
-       // "ne()" - "Not Empty" functions
-       // return "eValue" if "isEmpty(value)" is true
-       constexpr const char *ne(const char *value, const char *eValue = nullptr);
-
-       constexpr bool isEmpty(const char *value);
-
-       template <class T>
-       constexpr auto isEmpty(const T &value) -> decltype(value.empty())
-       {
-               return value.empty();
-       }
-
-       template <class T>
-       constexpr auto isEmpty(const T &value) -> decltype(value.isEmpty())
-       {
-               return value.isEmpty();
-       }
-
-       template <class T>
-       constexpr auto isEmpty(const T &value) -> decltype(isEmpty(*value))
-       {
-               return (!value || isEmpty(*value));
-       }
-
-       template <class T>
-       constexpr bool isNotEmpty(T &&value);
-
-       template <class T>
-       constexpr bool isNotValid(T &&value);
-
-       char *strDupSafe(const char *value);
-       int strCmpSafe(const char *lhs, const char *rhs);
-
-       template <class T1, class T2>
-       inline auto dynamicCast(T2 &&src) -> decltype(
-                       dynamic_cast<T1>(std::forward<T2>(src)))
-       {
-               return dynamic_cast<T1>(std::forward<T2>(src));
-       }
-
-       template <class T1, class T2>
-       inline auto constCast(T2 &&src) -> decltype(
-                       const_cast<T1>(std::forward<T2>(src)))
-       {
-               return const_cast<T1>(std::forward<T2>(src));
-       }
-
-       template <class T>
-       constexpr const T &min(const T &a, const T &b);
-
-       template <class T>
-       constexpr const T &max(const T &a, const T &b);
-
-       template <class T>
-       constexpr bool isPot(T value)
-       {
-               return (((value - 1) & value) == 0);
-       }
-
-       template <uint MULTIPLE, class T>
-       constexpr T ceilDiv(T value);
-
-       template <uint MULTIPLE, class T>
-       constexpr typename std::enable_if<isPot(MULTIPLE), T>::type
-                       roundUp(T value)
-       {
-               return ((value + (MULTIPLE - 1)) & ~static_cast<T>(MULTIPLE - 1));
-       }
-
-       template <uint MULTIPLE, class T>
-       constexpr typename std::enable_if<!isPot(MULTIPLE), T>::type
-                       roundUp(T value)
-       {
-               return (ceilDiv<MULTIPLE>(value) * MULTIPLE);
-       }
-}
-
-namespace ucl { namespace util {
-
-       template <class T>
-       std::unique_ptr<T> makeUnique(T *p);
-}}
-
-#include "helpers.hpp"
-
-#endif // __UCL_UTIL_HELPERS_H__
diff --git a/ucl/inc/ucl/util/helpers.hpp b/ucl/inc/ucl/util/helpers.hpp
deleted file mode 100644 (file)
index a7606f8..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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.
- */
-
-namespace ucl {
-
-       constexpr Eina_Bool toEina(const bool value)
-       {
-               return (value ? EINA_TRUE : EINA_FALSE);
-       }
-
-       constexpr const char *nz(const char *const value, const char *const zValue)
-       {
-               return (value ? value : zValue);
-       }
-
-       template <class T>
-       constexpr bool isNotEmpty(T &&value)
-       {
-               return !isEmpty(std::forward<T>(value));
-       }
-
-       constexpr const char *ne(const char *const value, const char *const eValue)
-       {
-               return (isNotEmpty(value) ? value : eValue);
-       }
-
-       constexpr bool isEmpty(const char *const value)
-       {
-               return (!value || (value[0] == '\0'));
-       }
-
-       template <class T>
-       constexpr bool isNotValid(T &&value)
-       {
-               return !isValid(std::forward<T>(value));
-       }
-
-       inline char *strDupSafe(const char *const value)
-       {
-               return (value ? strdup(value) : nullptr);
-       }
-
-       inline int strCmpSafe(const char *lhs, const char *rhs)
-       {
-               return strcmp(nz(lhs), nz(rhs));
-       }
-
-       template <class T>
-       constexpr const T &min(const T &a, const T &b)
-       {
-               return ((a < b) ? a : b);
-       }
-
-       template <class T>
-       constexpr const T &max(const T &a, const T &b)
-       {
-               return ((a > b) ? a : b);
-       }
-
-       template <uint MULTIPLE, class T>
-       constexpr T ceilDiv(T value)
-       {
-               return ((value + (MULTIPLE - 1)) / MULTIPLE);
-       }
-}
-
-namespace ucl { namespace util {
-
-       template <class T>
-       inline std::unique_ptr<T> makeUnique(T *const p)
-       {
-               return std::unique_ptr<T>(p);
-       }
-}}
diff --git a/ucl/inc/ucl/util/logging.h b/ucl/inc/ucl/util/logging.h
deleted file mode 100644 (file)
index 804a513..0000000
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_UTIL_LOGGING_H__
-#define __UCL_UTIL_LOGGING_H__
-
-#include <assert.h>
-
-#include <dlog.h>
-
-#include "types/Result.h"
-
-::ucl::ResultData getUCLResultData(::ucl::Result result);
-
-#ifndef UCL_LOG_LEVEL
-#define UCL_LOG_LEVEL UCL_MAX_LOG_LEVEL
-#elif UCL_LOG_LEVEL > UCL_MAX_LOG_LEVEL
-#undef UCL_LOG_LEVEL
-#define UCL_LOG_LEVEL UCL_MAX_LOG_LEVEL
-#endif
-
-#ifndef UCL_LOG_TAG
-#define UCL_LOG_TAG UCL_DEFAULT_LOG_TAG
-#endif
-
-#ifndef __MODULE__
-#define __MODULE__ (strrchr(__FILE__, '/') ? \
-               strrchr(__FILE__, '/') + 1 : __FILE__)
-#endif
-
-// Base macros for writing logs without result code
-#define UCL_ULOG(prio, fmt, ...) dlog_print( \
-       (log_priority)prio, UCL_LOG_TAG, "%s: %s(%d) > " fmt, \
-       __MODULE__, __func__, __LINE__, ##__VA_ARGS__)
-
-// Base macros for writing logs WITH result code
-#define UCL_URESDATALOG(prio, resdata, fmt, ...) dlog_print( \
-       (log_priority)prio, UCL_LOG_TAG, "%s: %s(%d) > " fmt " {%s}", \
-       __MODULE__, __func__, __LINE__, ##__VA_ARGS__, resdata.name)
-
-#define UCL_URESLOG(prio, result, fmt, ...) do { \
-       const ::ucl::ResultData &resdata = ::getUCLResultData(result); \
-       UCL_URESDATALOG(prio, resdata, fmt, ##__VA_ARGS__);} while (false)
-
-#if UCL_LOG_LEVEL >= UCL_LOG_LEVEL_VERBOSE
-#define UCL_VLOG(msg, ...) UCL_ULOG(DLOG_VERBOSE, msg, ##__VA_ARGS__)
-#define UCL_VRESLOG(result, msg, ...) \
-               UCL_URESLOG(DLOG_VERBOSE, result, msg, ##__VA_ARGS__)
-#else
-#define UCL_VLOG(msg, ...) do {} while (false)
-#define UCL_VRESLOG(result, msg, ...) do {} while (false)
-#endif
-
-#if UCL_LOG_LEVEL >= UCL_LOG_LEVEL_DEBUG
-#define UCL_DLOG(msg, ...) UCL_ULOG(DLOG_DEBUG, msg, ##__VA_ARGS__)
-#define UCL_DRESLOG(result, msg, ...) \
-               UCL_URESLOG(DLOG_DEBUG, result, msg, ##__VA_ARGS__)
-#else
-#define UCL_DLOG(msg, ...) do {} while (false)
-#define UCL_DRESLOG(result, msg, ...) do {} while (false)
-#endif
-
-#if UCL_LOG_LEVEL >= UCL_LOG_LEVEL_INFO
-#define UCL_ILOG(msg, ...) UCL_ULOG(DLOG_INFO, msg, ##__VA_ARGS__)
-#define UCL_IRESLOG(result, msg, ...) \
-               UCL_URESLOG(DLOG_INFO, result, msg, ##__VA_ARGS__)
-#else
-#define UCL_ILOG(msg, ...) do {} while (false)
-#define UCL_IRESLOG(result, msg, ...) do {} while (false)
-#endif
-
-#if UCL_LOG_LEVEL >= UCL_LOG_LEVEL_WARNING
-#define UCL_WLOG(msg, ...) UCL_ULOG(DLOG_WARN, msg, ##__VA_ARGS__)
-#define UCL_WRESLOG(result, msg, ...) \
-               UCL_URESLOG(DLOG_WARN, result, msg, ##__VA_ARGS__)
-#else
-#define UCL_WLOG(msg, ...) do {} while (false)
-#define UCL_WRESLOG(result, msg, ...) do {} while (false)
-#endif
-
-#if UCL_LOG_LEVEL >= UCL_LOG_LEVEL_ERROR
-#define UCL_ELOG(msg, ...) UCL_ULOG(DLOG_ERROR, msg, ##__VA_ARGS__)
-#define UCL_ERESLOG(result, msg, ...) \
-               UCL_URESLOG(DLOG_ERROR, result, msg, ##__VA_ARGS__)
-#else
-#define UCL_ELOG(msg, ...) do {} while (false)
-#define UCL_ERESLOG(result, msg, ...) do {} while (false)
-#endif
-
-#if UCL_LOG_LEVEL >= UCL_LOG_LEVEL_FATAL
-#define UCL_FLOG(msg, ...) UCL_ULOG(DLOG_FATAL, msg, ##__VA_ARGS__)
-#define UCL_FRESLOG(result, msg, ...) UCL_URESLOG( \
-       DLOG_FATAL, result, msg, ##__VA_ARGS__)
-#else
-#define UCL_FLOG(msg, ...) do {} while (false)
-#define UCL_FRESLOG(result, msg, ...) do {} while (false)
-#endif
-
-#if UCL_LOG_LEVEL >= UCL_LOG_LEVEL_ERROR
-
-// Simple macros for writing logs WITH result
-// code and automatic log priority determination
-#define UCL_RESLOG(result, msg, ...) { \
-       const ::ucl::ResultData &resdata = ::getUCLResultData(result); \
-       UCL_URESDATALOG(resdata.logPrio, \
-                       resdata, msg, ##__VA_ARGS__);} while (false)
-
-#else
-#define UCL_RESLOG(result, msg, ...) do {} while (false)
-#endif
-
-#define UCL_ASSERT(expr, msg, ...) \
-       do { \
-               if (!(expr)) { \
-                       UCL_FLOG(msg, ##__VA_ARGS__); \
-                       assert(false); \
-               } \
-       } while (false)
-
-#define UCL_FAIL_RETURN(result, msg, ...) \
-       do { \
-               const ::ucl::Result __RESULT__ = (result); \
-               if (isBad(__RESULT__)) { \
-                       UCL_RESLOG(__RESULT__, msg, ##__VA_ARGS__); \
-                       return __RESULT__; \
-               } \
-       } while (false)
-
-#define UCL_FAIL_RETURN_VALUE(result, value, msg, ...) \
-       do { \
-               const ::ucl::Result __RESULT__ = (result); \
-               if (isBad(__RESULT__)) { \
-                       UCL_RESLOG(__RESULT__, msg, ##__VA_ARGS__); \
-                       return value; \
-               } \
-       } while (false)
-
-#define UCL_FAIL_RETURN_VOID(result, msg, ...) \
-       do { \
-               const ::ucl::Result __RESULT__ = (result); \
-               if (isBad(__RESULT__)) { \
-                       UCL_RESLOG(__RESULT__, msg, ##__VA_ARGS__); \
-                       return; \
-               } \
-       } while (false)
-
-#define UCL_LOG_RETURN(result, msg, ...) \
-       do { \
-               const ::ucl::Result __RESULT__ = (result); \
-               UCL_RESLOG(__RESULT__, msg, ##__VA_ARGS__); \
-               return __RESULT__; \
-       } while (false)
-
-#define UCL_LOG_RETURN_VALUE(result, value, msg, ...) \
-       do { \
-               const ::ucl::Result __RESULT__ = (result); \
-               UCL_RESLOG(__RESULT__, msg, ##__VA_ARGS__); \
-               return value; \
-       } while (false)
-
-#define UCL_LOG_RETURN_VOID(result, msg, ...) \
-       do { \
-               const ::ucl::Result __RESULT__ = (result); \
-               UCL_RESLOG(__RESULT__, msg, ##__VA_ARGS__); \
-               return; \
-       } while (false)
-
-#define UCL_FAIL_BREAK(result, msg, ...) \
-       do { \
-               const ::ucl::Result __RESULT__ = (result); \
-               if (isBad(__RESULT__)) { \
-                       UCL_RESLOG(__RESULT__, msg, ##__VA_ARGS__); \
-                       break; \
-               } \
-       } while (false)
-
-#define UCL_LOG_BREAK(result, msg, ...) \
-       do { \
-               const ::ucl::Result __RESULT__ = (result); \
-               UCL_RESLOG(__RESULT__, msg, ##__VA_ARGS__); \
-               break; \
-       } while (false)
-
-#define UCL_FAIL_LOG(result, msg, ...) \
-       do { \
-               const ::ucl::Result __RESULT__ = (result); \
-               if (isBad(__RESULT__)) { \
-                       UCL_RESLOG(__RESULT__, msg, ##__VA_ARGS__); \
-               } \
-       } while (false)
-
-#endif // __UCL_UTIL_LOGGING_H__
diff --git a/ucl/inc/ucl/util/memory.h b/ucl/inc/ucl/util/memory.h
deleted file mode 100644 (file)
index cc33960..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_UTIL_MEMORY_H__
-#define __UCL_UTIL_MEMORY_H__
-
-#include "memory/RefCountObj.h"
-
-#include "memory/BaseRef.h"
-#include "memory/SharedRef.h"
-#include "memory/WeakRef.h"
-
-#include "memory/helpers.h"
-#include "memory/macro.h"
-
-#endif // __UCL_UTIL_MEMORY_H__
diff --git a/ucl/inc/ucl/util/memory/BaseRef.h b/ucl/inc/ucl/util/memory/BaseRef.h
deleted file mode 100644 (file)
index 8146eae..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_UTIL_MEMORY_BASE_REF_H__
-#define __UCL_UTIL_MEMORY_BASE_REF_H__
-
-#include "IRefCountObj.h"
-
-namespace ucl {
-
-       template <class T>
-       class BaseRef {
-       public:
-               using Type = T;
-
-               template <class U>
-               friend class BaseRef;
-               template <class U>
-               friend class SharedRef;
-               template <class U>
-               friend class WeakRef;
-
-       public:
-               UInt getUseCount() const noexcept;
-
-       protected:
-               constexpr BaseRef() noexcept;
-               BaseRef(IRefCountObj *rc, T *ptr) noexcept;
-               BaseRef(BaseRef<T> &&r) noexcept;
-               template <class U>
-               BaseRef(BaseRef<U> &&r) noexcept;
-
-       protected:
-               IRefCountObj *m_rc;
-               T *m_ptr;
-       };
-}
-
-#include "BaseRef.hpp"
-
-#endif // __UCL_UTIL_MEMORY_BASE_REF_H__
diff --git a/ucl/inc/ucl/util/memory/BaseRef.hpp b/ucl/inc/ucl/util/memory/BaseRef.hpp
deleted file mode 100644 (file)
index 312c38e..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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.
- */
-
-namespace ucl {
-
-       template <class T>
-       constexpr BaseRef<T>::BaseRef() noexcept :
-               m_rc(nullptr),
-               m_ptr(nullptr)
-       {
-       }
-
-       template <class T>
-       inline BaseRef<T>::BaseRef(
-                       IRefCountObj *const rc, T *const ptr) noexcept :
-               m_rc(rc),
-               m_ptr(ptr)
-       {
-       }
-
-       template <class T>
-       inline BaseRef<T>::BaseRef(BaseRef<T> &&r) noexcept :
-               m_rc(r.m_rc),
-               m_ptr(r.m_ptr)
-       {
-               r.m_rc = nullptr;
-               r.m_ptr = nullptr;
-       }
-
-       template <class T>
-       template <class U>
-       inline BaseRef<T>::BaseRef(BaseRef<U> &&r) noexcept :
-               m_rc(r.m_rc),
-               m_ptr(r.m_ptr)
-       {
-               r.m_rc = nullptr;
-               r.m_ptr = nullptr;
-       }
-
-       template <class T>
-       inline UInt BaseRef<T>::getUseCount() const noexcept
-       {
-               return (m_rc ? m_rc->getUseCount() : 0);
-       }
-}
diff --git a/ucl/inc/ucl/util/memory/IRefCountObj.h b/ucl/inc/ucl/util/memory/IRefCountObj.h
deleted file mode 100644 (file)
index 69d6a1c..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_UTIL_MEMORY_I_REF_COUNT_OBJ_H__
-#define __UCL_UTIL_MEMORY_I_REF_COUNT_OBJ_H__
-
-#include "ucl/util/types/classTypes.h"
-
-namespace ucl {
-
-       class IRefCountObj : public Polymorphic {
-       public:
-               virtual void ref() noexcept = 0;
-               virtual void unref() noexcept = 0;
-               virtual bool refNz() noexcept = 0;
-               virtual void refWeak() noexcept = 0;
-               virtual void unrefWeak() noexcept = 0;
-               virtual UInt getUseCount() const noexcept = 0;
-               virtual const void *getObjPtr() const noexcept = 0;
-       protected:
-               virtual ~IRefCountObj() = default;
-       };
-}
-
-#endif // __UCL_UTIL_MEMORY_I_REF_COUNT_OBJ_H__
diff --git a/ucl/inc/ucl/util/memory/RefCountObj.h b/ucl/inc/ucl/util/memory/RefCountObj.h
deleted file mode 100644 (file)
index 7237aa4..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_UTIL_MEMORY_REF_COUNT_OBJ_H__
-#define __UCL_UTIL_MEMORY_REF_COUNT_OBJ_H__
-
-#include "IRefCountObj.h"
-#include "ReffedObj.h"
-
-namespace ucl {
-
-       template <class T, class C>
-       class RefCountObj final : public IRefCountObj {
-       public:
-               template <class ...ARGS>
-               RefCountObj(ARGS &&...args);
-
-               T *getObj() noexcept;
-
-               // IRefCountObj //
-
-               virtual void ref() noexcept final override;
-               virtual void unref() noexcept final override;
-               virtual bool refNz() noexcept final override;
-               virtual void refWeak() noexcept final override;
-               virtual void unrefWeak() noexcept final override;
-               virtual UInt getUseCount() const noexcept final override;
-               virtual const void *getObjPtr() const noexcept final override;
-
-       private:
-               template <class T2, class = char[1]>
-               struct IsRefCountAware : std::false_type {};
-               template <class T2>
-               struct IsRefCountAware<T2, char[T2::_IS_REF_COUNT_AWARE * 0 + 1]> :
-                               std::true_type {};
-
-               template <class T2, class = char[1]>
-               struct IsOnUniqueAware : std::false_type {};
-               template <class T2>
-               struct IsOnUniqueAware<T2,
-                               char[T2::_ENABLE_ON_UNIQUE_CHANGED_DISPATCH * 0 + 1]> :
-                               std::true_type {};
-
-       private:
-               virtual ~RefCountObj() = default;
-
-               template <class T2, class ...ARGS, class =
-                               typename std::enable_if<!IsRefCountAware<T2>::value>::type>
-               void createObj(const P<0> &, ARGS &&...args)
-               {
-                       m_obj.create(std::forward<ARGS>(args)...);
-               }
-
-               template <class T2, class ...ARGS, class =
-                               typename std::enable_if<IsRefCountAware<T2>::value>::type>
-               auto createObj(const P<1> &, ARGS &&...args) -> decltype(
-                               ReffedObj<T>::template check<T2>(
-                                               (IRefCountObj *)0, std::forward<ARGS>(args)...))
-               {
-                       m_obj.create(static_cast<IRefCountObj *>(this),
-                                       std::forward<ARGS>(args)...);
-               }
-
-               template <class T2, class ...ARGS, class =
-                               typename std::enable_if<IsRefCountAware<T2>::value>::type>
-               auto createObj(const P<2> &, ARGS &&...args) -> decltype(
-                               ReffedObj<T>::template check<T2>(
-                                               *(IRefCountObj *)0, std::forward<ARGS>(args)...))
-               {
-                       m_obj.create(*static_cast<IRefCountObj *>(this),
-                                       std::forward<ARGS>(args)...);
-               }
-
-               void dispatchOnUniqueChanged(const bool isUnique)
-               {
-                       dispatchOnUniqueChanged<T>(P<1>(), isUnique);
-               }
-
-               template <class T2>
-               void dispatchOnUniqueChanged(...)
-               {
-               }
-
-               template <class T2, class =
-                               typename std::enable_if<IsOnUniqueAware<T2>::value>::type>
-               void dispatchOnUniqueChanged(const P<1> &, const bool isUnique)
-               {
-                       m_obj.template dispatchOnUniqueChanged<T>(isUnique);
-               }
-
-       private:
-               ReffedObj<T> m_obj;
-               C m_useCounter;
-               C m_weakCounter;
-       };
-}
-
-#include "RefCountObj.hpp"
-
-#endif // __UCL_UTIL_MEMORY_REF_COUNT_OBJ_H__
diff --git a/ucl/inc/ucl/util/memory/RefCountObj.hpp b/ucl/inc/ucl/util/memory/RefCountObj.hpp
deleted file mode 100644 (file)
index 8a2c065..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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.
- */
-
-namespace ucl {
-
-       template <class T, class C>
-       template <class ...ARGS>
-       inline RefCountObj<T, C>::RefCountObj(ARGS &&...args) :
-               m_useCounter(1),
-               m_weakCounter(1)
-       {
-               createObj<T>(P<2>(), std::forward<ARGS>(args)...);
-       }
-
-       template <class T, class C>
-       inline T *RefCountObj<T, C>::getObj() noexcept
-       {
-               return m_obj.get();
-       }
-
-       template <class T, class C>
-       inline void RefCountObj<T, C>::ref() noexcept
-       {
-               if (m_useCounter.ref() == 2) {
-                       dispatchOnUniqueChanged(false);
-               }
-       }
-
-       template <class T, class C>
-       inline void RefCountObj<T, C>::unref() noexcept
-       {
-               const auto newCount = m_useCounter.unref();
-               if (newCount == 0) {
-                       m_obj.destroy();
-                       unrefWeak();
-               } else if (newCount == 1) {
-                       dispatchOnUniqueChanged(true);
-               }
-       }
-
-       template <class T, class C>
-       inline bool RefCountObj<T, C>::refNz() noexcept
-       {
-               const auto newCount = m_useCounter.refNz();
-               if (newCount == 0) {
-                       return false;
-               }
-               if (newCount == 2) {
-                       dispatchOnUniqueChanged(false);
-               }
-               return true;
-       }
-
-       template <class T, class C>
-       inline void RefCountObj<T, C>::refWeak() noexcept
-       {
-               m_weakCounter.ref();
-       }
-
-       template <class T, class C>
-       inline void RefCountObj<T, C>::unrefWeak() noexcept
-       {
-               if (m_weakCounter.unref() == 0) {
-                       delete this;
-               }
-       }
-
-       template <class T, class C>
-       inline UInt RefCountObj<T, C>::getUseCount() const noexcept
-       {
-               return m_useCounter.get();
-       }
-
-       template <class T, class C>
-       inline const void *RefCountObj<T, C>::getObjPtr() const noexcept
-       {
-               return m_obj.get();
-       }
-}
diff --git a/ucl/inc/ucl/util/memory/RefCounterMT.h b/ucl/inc/ucl/util/memory/RefCounterMT.h
deleted file mode 100644 (file)
index 1d2fb95..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_UTIL_MEMORY_REF_COUNTER_MT_H__
-#define __UCL_UTIL_MEMORY_REF_COUNTER_MT_H__
-
-#include "ucl/util/types/baseTypes.h"
-
-namespace ucl {
-
-       class RefCounterMT final {
-       public:
-               explicit RefCounterMT(const UInt count = 0) noexcept;
-
-               UInt ref() noexcept;
-               UInt unref() noexcept;
-               UInt refNz() noexcept;
-
-               UInt get() const noexcept;
-
-       private:
-               std::atomic<UInt> m_counter;
-       };
-}
-
-#include "RefCounterMT.hpp"
-
-#endif // __UCL_UTIL_MEMORY_REF_COUNTER_MT_H__
diff --git a/ucl/inc/ucl/util/memory/RefCounterMT.hpp b/ucl/inc/ucl/util/memory/RefCounterMT.hpp
deleted file mode 100644 (file)
index 1ff459b..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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.
- */
-
-namespace ucl {
-
-       inline RefCounterMT::RefCounterMT(const UInt count) noexcept :
-               m_counter(count)
-       {
-       }
-
-       inline UInt RefCounterMT::ref() noexcept
-       {
-               return (m_counter.fetch_add(1, std::memory_order_acq_rel) + 1);
-       }
-
-       inline UInt RefCounterMT::unref() noexcept
-       {
-               return (m_counter.fetch_sub(1, std::memory_order_acq_rel) - 1);
-       }
-
-       inline UInt RefCounterMT::refNz() noexcept
-       {
-               auto curCount = m_counter.load(std::memory_order_relaxed);
-               for (;;) {
-                       if (curCount == 0) {
-                               return 0;
-                       }
-                       const auto newCount = (curCount + 1);
-                       if (m_counter.compare_exchange_weak(curCount, newCount,
-                                       std::memory_order_acq_rel, std::memory_order_relaxed)) {
-                               return newCount;
-                       }
-               }
-       }
-
-       inline UInt RefCounterMT::get() const noexcept
-       {
-               return m_counter.load(std::memory_order_relaxed);
-       }
-}
diff --git a/ucl/inc/ucl/util/memory/RefCounterST.h b/ucl/inc/ucl/util/memory/RefCounterST.h
deleted file mode 100644 (file)
index 30e5e35..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_UTIL_MEMORY_REF_COUNTER_ST_H__
-#define __UCL_UTIL_MEMORY_REF_COUNTER_ST_H__
-
-#include "ucl/util/types/baseTypes.h"
-
-namespace ucl {
-
-       class RefCounterST final {
-       public:
-               explicit RefCounterST(const UInt count = 0) noexcept;
-
-               UInt ref() noexcept;
-               UInt unref() noexcept;
-               UInt refNz() noexcept;
-
-               UInt get() const noexcept;
-
-       private:
-               UInt m_counter;
-       };
-}
-
-#include "RefCounterST.hpp"
-
-#endif // __UCL_UTIL_MEMORY_REF_COUNTER_ST_H__
diff --git a/ucl/inc/ucl/util/memory/RefCounterST.hpp b/ucl/inc/ucl/util/memory/RefCounterST.hpp
deleted file mode 100644 (file)
index 45781c7..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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.
- */
-
-namespace ucl {
-
-       inline RefCounterST::RefCounterST(const UInt count) noexcept :
-               m_counter(count)
-       {
-       }
-
-       inline UInt RefCounterST::ref() noexcept
-       {
-               return (++m_counter);
-       }
-
-       inline UInt RefCounterST::unref() noexcept
-       {
-               return (--m_counter);
-       }
-
-       inline UInt RefCounterST::refNz() noexcept
-       {
-               if (m_counter == 0) {
-                       return 0;
-               }
-               return ref();
-       }
-
-       inline UInt RefCounterST::get() const noexcept
-       {
-               return m_counter;
-       }
-}
diff --git a/ucl/inc/ucl/util/memory/ReffedObj.h b/ucl/inc/ucl/util/memory/ReffedObj.h
deleted file mode 100644 (file)
index c521544..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_UTIL_MEMORY_REFFED_OBJ_H__
-#define __UCL_UTIL_MEMORY_REFFED_OBJ_H__
-
-#include "RefCounterST.h"
-#include "RefCounterMT.h"
-
-namespace ucl {
-
-       template <class T, class C>
-       class RefCountObj;
-
-       template <class T>
-       class ReffedObj final {
-       private:
-               friend class RefCountObj<T, RefCounterST>;
-               friend class RefCountObj<T, RefCounterMT>;
-
-               template <class ...ARGS>
-               void create(ARGS &&...args);
-               void destroy() noexcept;
-
-               T *get() noexcept;
-               const T *get() const noexcept;
-
-               template <class T2>
-               void dispatchOnUniqueChanged(bool isUnique);
-
-       private:
-               template <class T2, class ...ARGS>
-               static constexpr auto check(ARGS &&...args) -> decltype(
-                               (void)(new T2(std::forward<ARGS>(args)...)))
-               {
-                       return;
-               }
-
-       private:
-               typename std::aligned_storage<sizeof(T), alignof(T)>::type m_obj;
-       };
-}
-
-#include "ReffedObj.hpp"
-
-#endif // __UCL_UTIL_MEMORY_REFFED_OBJ_H__
diff --git a/ucl/inc/ucl/util/memory/ReffedObj.hpp b/ucl/inc/ucl/util/memory/ReffedObj.hpp
deleted file mode 100644 (file)
index cfc1e84..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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.
- */
-
-namespace ucl {
-
-       template <class T>
-       template <class ...ARGS>
-       inline void ReffedObj<T>::create(ARGS &&...args)
-       {
-               new (get()) T(std::forward<ARGS>(args)...);
-       }
-
-       template <class T>
-       inline void ReffedObj<T>::destroy() noexcept
-       {
-               get()->~T();
-       }
-
-       template <class T>
-       inline T *ReffedObj<T>::get() noexcept
-       {
-               return static_cast<T *>(static_cast<void *>(&m_obj));
-       }
-
-       template <class T>
-       inline const T *ReffedObj<T>::get() const noexcept
-       {
-               return static_cast<const T *>(static_cast<const void *>(&m_obj));
-       }
-
-       template <class T>
-       template <class T2>
-       inline void ReffedObj<T>::dispatchOnUniqueChanged(const bool isUnique)
-       {
-               get()->onUniqueChanged(isUnique);
-       }
-}
diff --git a/ucl/inc/ucl/util/memory/SharedRef.h b/ucl/inc/ucl/util/memory/SharedRef.h
deleted file mode 100644 (file)
index 396d176..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_UTIL_MEMORY_SHARED_REF_H__
-#define __UCL_UTIL_MEMORY_SHARED_REF_H__
-
-#include "BaseRef.h"
-
-namespace ucl {
-
-       template <class T>
-       class SharedRef final : public BaseRef<T> {
-       public:
-               template <class U>
-               friend void swap(SharedRef<U> &x, SharedRef<U> &y) noexcept;
-
-               template <class T2, class U>
-               friend SharedRef<T2> staticRefCast(const SharedRef<U> &r) noexcept;
-               template <class T2, class U>
-               friend SharedRef<T2> dynamicRefCast(const SharedRef<U> &r) noexcept;
-
-       public:
-               constexpr SharedRef() noexcept;
-               constexpr SharedRef(std::nullptr_t) noexcept;
-
-               SharedRef(IRefCountObj *rc, T *ptr) noexcept;
-               SharedRef(IRefCountObj *rc, T *ptr, bool noRef) noexcept;
-
-               SharedRef(const SharedRef<T> &r) noexcept;
-               template <class U>
-               SharedRef(const SharedRef<U> &r) noexcept;
-
-               SharedRef(SharedRef<T> &&r) noexcept;
-               template <class U>
-               SharedRef(SharedRef<U> &&r) noexcept;
-
-               ~SharedRef();
-
-               SharedRef<T> &operator=(SharedRef<T> r) noexcept;
-
-               void reset() noexcept;
-
-               T *get() const noexcept;
-               operator bool() const noexcept;
-
-               T *operator->() const noexcept;
-               typename std::add_lvalue_reference<T>::type operator*() const noexcept;
-
-               template <class U, class = typename std::enable_if<
-                       std::is_convertible<T *, U *>::value && (
-                               std::is_same<typename std::remove_cv<U>::type, void>::value ||
-                               std::is_same<typename std::remove_cv<U>::type,
-                                       typename std::remove_cv<T>::type>::value)>::type>
-               operator const SharedRef<U> &() const noexcept
-               {
-                       return reinterpret_cast<const SharedRef<U> &>(*this);
-               }
-       };
-
-       // Non-member functions //
-
-       template <class T, class ...ARGS>
-       SharedRef<T> makeShared(ARGS &&...args);
-       template <class T, class ...ARGS>
-       SharedRef<T> makeSharedMT(ARGS &&...args);
-
-       template <class T, class U>
-       const SharedRef<T> &constRefCast(const SharedRef<U> &r) noexcept;
-       template <class T, class U>
-       SharedRef<T> &&constRefCast(SharedRef<U> &&r) noexcept;
-}
-
-#include "SharedRef.hpp"
-
-#endif // __UCL_UTIL_MEMORY_SHARED_REF_H__
diff --git a/ucl/inc/ucl/util/memory/SharedRef.hpp b/ucl/inc/ucl/util/memory/SharedRef.hpp
deleted file mode 100644 (file)
index f085b9c..0000000
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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.
- */
-
-namespace ucl {
-
-       template <class T>
-       constexpr SharedRef<T>::SharedRef() noexcept
-       {
-       }
-
-       template <class T>
-       constexpr SharedRef<T>::SharedRef(std::nullptr_t) noexcept
-       {
-       }
-
-       template <class T>
-       inline SharedRef<T>::SharedRef(
-                       IRefCountObj *const rc, T *const ptr) noexcept :
-               BaseRef<T>(rc, ptr)
-       {
-               this->m_rc->ref();
-       }
-
-       template <class T>
-       inline SharedRef<T>::SharedRef(
-                       IRefCountObj *const rc, T *const ptr, bool noRef) noexcept :
-               BaseRef<T>(rc, ptr)
-       {
-       }
-
-       template <class T>
-       inline SharedRef<T>::SharedRef(const SharedRef<T> &r) noexcept :
-               BaseRef<T>(r.m_rc, r.m_ptr)
-       {
-               if (this->m_rc) {
-                       this->m_rc->ref();
-               }
-       }
-
-       template <class T>
-       template <class U>
-       inline SharedRef<T>::SharedRef(const SharedRef<U> &r) noexcept :
-               BaseRef<T>(r.m_rc, r.m_ptr)
-       {
-               if (this->m_rc) {
-                       this->m_rc->ref();
-               }
-       }
-
-       template <class T>
-       inline SharedRef<T>::SharedRef(SharedRef<T> &&r) noexcept :
-               BaseRef<T>(std::move(r))
-       {
-       }
-
-       template <class T>
-       template <class U>
-       inline SharedRef<T>::SharedRef(SharedRef<U> &&r) noexcept :
-               BaseRef<T>(std::move(r))
-       {
-       }
-
-       template <class T>
-       inline SharedRef<T>::~SharedRef()
-       {
-               if (this->m_rc) {
-                       this->m_rc->unref();
-               }
-       }
-
-       template <class T>
-       inline SharedRef<T> &SharedRef<T>::operator=(SharedRef<T> r) noexcept
-       {
-               swap(*this, r);
-               return *this;
-       }
-
-       template <class T>
-       inline void SharedRef<T>::reset() noexcept
-       {
-               *this = {};
-       }
-
-       template <class T>
-       inline T *SharedRef<T>::get() const noexcept
-       {
-               return this->m_ptr;
-       }
-
-       template <class T>
-       inline SharedRef<T>::operator bool() const noexcept
-       {
-               return !!this->m_ptr;
-       }
-
-       template <class T>
-       inline T *SharedRef<T>::operator->() const noexcept
-       {
-               return this->m_ptr;
-       }
-
-       template <class T>
-       inline typename std::add_lvalue_reference<T>::type
-                       SharedRef<T>::operator*() const noexcept
-       {
-               return *this->m_ptr;
-       }
-
-       // Non-member functions //
-
-       template <class T, class ...ARGS>
-       SharedRef<T> makeShared(ARGS &&...args)
-       {
-               const auto rc = new RefCountObj<T, RefCounterST>(
-                               std::forward<ARGS>(args)...);
-               return {rc, rc->getObj(), true};
-       }
-
-       template <class T, class ...ARGS>
-       SharedRef<T> makeSharedMT(ARGS &&...args)
-       {
-               const auto rc = new RefCountObj<T, RefCounterMT>(
-                               std::forward<ARGS>(args)...);
-               return {rc, rc->getObj(), true};
-       }
-
-       template <class T>
-       inline void swap(SharedRef<T> &x, SharedRef<T> &y) noexcept
-       {
-               std::swap(x.m_rc, y.m_rc);
-               std::swap(x.m_ptr, y.m_ptr);
-       }
-
-       template <class T, class U>
-       inline SharedRef<T> staticRefCast(const SharedRef<U> &r) noexcept
-       {
-               return {r.m_rc, static_cast<T *>(r.get())};
-       }
-
-       template <class T, class U>
-       inline SharedRef<T> dynamicRefCast(const SharedRef<U> &r) noexcept
-       {
-               const auto ptr = dynamic_cast<T *>(r.get());
-               if (!ptr) {
-                       return {};
-               }
-               return {r.m_rc, ptr};
-       }
-
-       template <class T, class U>
-       inline const SharedRef<T> &constRefCast(const SharedRef<U> &r) noexcept
-       {
-               (void)const_cast<T *>((U *)nullptr);
-               return reinterpret_cast<const SharedRef<T> &>(r);
-       }
-
-       template <class T, class U>
-       inline SharedRef<T> &&constRefCast(SharedRef<U> &&r) noexcept
-       {
-               (void)const_cast<T *>((U *)nullptr);
-               return reinterpret_cast<SharedRef<T> &&>(r);
-       }
-}
diff --git a/ucl/inc/ucl/util/memory/WeakRef.h b/ucl/inc/ucl/util/memory/WeakRef.h
deleted file mode 100644 (file)
index 4cccbe6..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_UTIL_MEMORY_WEAK_REF_H__
-#define __UCL_UTIL_MEMORY_WEAK_REF_H__
-
-#include "SharedRef.h"
-
-namespace ucl {
-
-       template <class T>
-       class WeakRef final : public BaseRef<T> {
-       public:
-               template <class U>
-               friend void swap(WeakRef<U> &x, WeakRef<U> &y) noexcept;
-
-               template <class T2, class U>
-               friend WeakRef<T2> staticRefCast(const WeakRef<U> &r) noexcept;
-               template <class T2, class U>
-               friend WeakRef<T2> dynamicRefCast(const WeakRef<U> &r) noexcept;
-
-       public:
-               constexpr WeakRef() noexcept;
-               constexpr WeakRef(std::nullptr_t) noexcept;
-
-               WeakRef(IRefCountObj *rc, T *ptr) noexcept;
-
-               WeakRef(const WeakRef<T> &r) noexcept;
-               template <class U>
-               WeakRef(const BaseRef<U> &r) noexcept;
-
-               WeakRef(WeakRef<T> &&r) noexcept;
-               template <class U>
-               WeakRef(WeakRef<U> &&r) noexcept;
-
-               ~WeakRef();
-
-               WeakRef<T> &operator=(WeakRef<T> r) noexcept;
-
-               void reset() noexcept;
-
-               SharedRef<T> lock() const noexcept;
-
-               T *getUnsafePtr() const noexcept;
-               operator bool() const noexcept;
-
-               template <class U, class = typename std::enable_if<
-                       std::is_convertible<T *, U *>::value && (
-                               std::is_same<typename std::remove_cv<U>::type, void>::value ||
-                               std::is_same<typename std::remove_cv<U>::type,
-                                       typename std::remove_cv<T>::type>::value)>::type>
-               operator const WeakRef<U> &() const noexcept
-               {
-                       return reinterpret_cast<const WeakRef<U> &>(*this);
-               }
-       };
-
-       // Non-member functions //
-
-       template <class T>
-       WeakRef<T> makeWeak(const SharedRef<T> &r) noexcept;
-
-       template <class T, class U>
-       const WeakRef<T> &constRefCast(const WeakRef<U> &r) noexcept;
-       template <class T, class U>
-       WeakRef<T> &&constRefCast(WeakRef<U> &&r) noexcept;
-}
-
-#include "WeakRef.hpp"
-
-#endif // __UCL_UTIL_MEMORY_WEAK_REF_H__
diff --git a/ucl/inc/ucl/util/memory/WeakRef.hpp b/ucl/inc/ucl/util/memory/WeakRef.hpp
deleted file mode 100644 (file)
index 6634f3c..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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.
- */
-
-namespace ucl {
-
-       template <class T>
-       constexpr WeakRef<T>::WeakRef() noexcept
-       {
-       }
-
-       template <class T>
-       constexpr WeakRef<T>::WeakRef(std::nullptr_t) noexcept
-       {
-       }
-
-       template <class T>
-       inline WeakRef<T>::WeakRef(
-                       IRefCountObj *const rc, T *const ptr) noexcept :
-               BaseRef<T>(rc, ptr)
-       {
-               this->m_rc->refWeak();
-       }
-
-       template <class T>
-       inline WeakRef<T>::WeakRef(const WeakRef<T> &r) noexcept :
-               BaseRef<T>(r.m_rc, r.m_ptr)
-       {
-               if (this->m_rc) {
-                       this->m_rc->refWeak();
-               }
-       }
-
-       template <class T>
-       template <class U>
-       inline WeakRef<T>::WeakRef(const BaseRef<U> &r) noexcept :
-               BaseRef<T>(r.m_rc, r.m_ptr)
-       {
-               if (this->m_rc) {
-                       this->m_rc->refWeak();
-               }
-       }
-
-       template <class T>
-       inline WeakRef<T>::WeakRef(WeakRef<T> &&r) noexcept :
-               BaseRef<T>(std::move(r))
-       {
-       }
-
-       template <class T>
-       template <class U>
-       inline WeakRef<T>::WeakRef(WeakRef<U> &&r) noexcept :
-               BaseRef<T>(std::move(r))
-       {
-       }
-
-       template <class T>
-       inline WeakRef<T>::~WeakRef()
-       {
-               if (this->m_rc) {
-                       this->m_rc->unrefWeak();
-               }
-       }
-
-       template <class T>
-       inline WeakRef<T> &WeakRef<T>::operator=(WeakRef<T> r) noexcept
-       {
-               swap(*this, r);
-               return *this;
-       }
-
-       template <class T>
-       inline void WeakRef<T>::reset() noexcept
-       {
-               *this = {};
-       }
-
-       template <class T>
-       inline SharedRef<T> WeakRef<T>::lock() const noexcept
-       {
-               if (this->m_rc && this->m_rc->refNz()) {
-                       return {this->m_rc, this->m_ptr, true};
-               }
-               return {};
-       }
-
-       template <class T>
-       inline T *WeakRef<T>::getUnsafePtr() const noexcept
-       {
-               return (operator bool() ? this->m_ptr : nullptr);
-       }
-
-       template <class T>
-       inline WeakRef<T>::operator bool() const noexcept
-       {
-               return (this->m_rc && (this->m_rc->getUseCount() > 0));
-       }
-
-       // Non-member functions //
-
-       template <class T>
-       inline WeakRef<T> makeWeak(const SharedRef<T> &r) noexcept
-       {
-               return r;
-       }
-
-       template <class T>
-       inline void swap(WeakRef<T> &x, WeakRef<T> &y) noexcept
-       {
-               std::swap(x.m_rc, y.m_rc);
-               std::swap(x.m_ptr, y.m_ptr);
-       }
-
-       template <class T, class U>
-       inline WeakRef<T> staticRefCast(const WeakRef<U> &r) noexcept
-       {
-               return {r.m_rc, static_cast<T *>(r.getUnsafePtr())};
-       }
-
-       template <class T, class U>
-       inline WeakRef<T> dynamicRefCast(const WeakRef<U> &r) noexcept
-       {
-               const auto ptr = dynamic_cast<T *>(r.getUnsafePtr());
-               if (!ptr) {
-                       return {};
-               }
-               return {r.m_rc, ptr};
-       }
-
-       template <class T, class U>
-       inline const WeakRef<T> &constRefCast(const WeakRef<U> &r) noexcept
-       {
-               (void)const_cast<T *>((U *)nullptr);
-               return reinterpret_cast<const WeakRef<T> &>(r);
-       }
-
-       template <class T, class U>
-       inline WeakRef<T> &&constRefCast(WeakRef<U> &&r) noexcept
-       {
-               (void)const_cast<T *>((U *)nullptr);
-               return reinterpret_cast<WeakRef<T> &&>(r);
-       }
-}
diff --git a/ucl/inc/ucl/util/memory/helpers.h b/ucl/inc/ucl/util/memory/helpers.h
deleted file mode 100644 (file)
index bef907b..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_UTIL_MEMORY_HELPERS_H__
-#define __UCL_UTIL_MEMORY_HELPERS_H__
-
-namespace ucl {
-
-       // Generic casting functions //
-
-       template <class T, class U>
-       inline auto dynamicCast(const U &src) noexcept -> decltype(
-                       dynamicRefCast<typename T::Type>(src))
-       {
-               return dynamicRefCast<typename T::Type>(src);
-       }
-
-       template <class T, class U>
-       inline auto constCast(U &&src) noexcept -> decltype(
-                       constRefCast<typename T::Type>(std::forward<U>(src)))
-       {
-               return constRefCast<typename T::Type>(std::forward<U>(src));
-       }
-
-       // Relation operators //
-
-       namespace himpl {
-
-               template <class T, class = typename std::enable_if<
-                       !std::is_base_of<BaseRef<typename T::Type>, T>::value>::type>
-               inline const T &getCmpPtr(const T &ptr) noexcept
-               {
-                       return ptr;
-               }
-
-               template <class T>
-               inline T *getCmpPtr(const SharedRef<T> &r) noexcept
-               {
-                       return r.get();
-               }
-
-               template <class T>
-               inline T *getCmpPtr(const WeakRef<T> &r) noexcept
-               {
-                       return r.getUnsafePtr();
-               }
-       }
-
-       template <class T, class U, class = typename std::enable_if<
-               std::is_base_of<BaseRef<typename T::Type>, T>::value ||
-               std::is_base_of<BaseRef<typename U::Type>, U>::value>::type>
-       inline bool operator==(const T &lhs, const U &rhs) noexcept
-       {
-               return (himpl::getCmpPtr(lhs) == himpl::getCmpPtr(rhs));
-       }
-
-       template <class T, class U, class = typename std::enable_if<
-               std::is_base_of<BaseRef<typename T::Type>, T>::value ||
-               std::is_base_of<BaseRef<typename U::Type>, U>::value>::type>
-       inline bool operator!=(const T &lhs, const U &rhs) noexcept
-       {
-               return (himpl::getCmpPtr(lhs) != himpl::getCmpPtr(rhs));
-       }
-
-       template <class T, class U, class = typename std::enable_if<
-               std::is_base_of<BaseRef<typename T::Type>, T>::value ||
-               std::is_base_of<BaseRef<typename U::Type>, U>::value>::type>
-       inline bool operator<(const T &lhs, const U &rhs) noexcept
-       {
-               return (himpl::getCmpPtr(lhs) < himpl::getCmpPtr(rhs));
-       }
-
-       template <class T, class U, class = typename std::enable_if<
-               std::is_base_of<BaseRef<typename T::Type>, T>::value ||
-               std::is_base_of<BaseRef<typename U::Type>, U>::value>::type>
-       inline bool operator<=(const T &lhs, const U &rhs) noexcept
-       {
-               return (himpl::getCmpPtr(lhs) <= himpl::getCmpPtr(rhs));
-       }
-
-       template <class T, class U, class = typename std::enable_if<
-               std::is_base_of<BaseRef<typename T::Type>, T>::value ||
-               std::is_base_of<BaseRef<typename U::Type>, U>::value>::type>
-       inline bool operator>(const T &lhs, const U &rhs) noexcept
-       {
-               return (himpl::getCmpPtr(lhs) > himpl::getCmpPtr(rhs));
-       }
-
-       template <class T, class U, class = typename std::enable_if<
-               std::is_base_of<BaseRef<typename T::Type>, T>::value ||
-               std::is_base_of<BaseRef<typename U::Type>, U>::value>::type>
-       inline bool operator>=(const T &lhs, const U &rhs) noexcept
-       {
-               return (himpl::getCmpPtr(lhs) >= himpl::getCmpPtr(rhs));
-       }
-
-       template <class T, class = typename std::enable_if<
-               std::is_base_of<BaseRef<typename T::Type>, T>::value>::type>
-       inline bool operator==(const T &lhs, std::nullptr_t rhs) noexcept
-       {
-               return !lhs;
-       }
-
-       template <class T, class = typename std::enable_if<
-               std::is_base_of<BaseRef<typename T::Type>, T>::value>::type>
-       bool operator==(std::nullptr_t lhs, const T &rhs) noexcept
-       {
-               return !rhs;
-       }
-
-       template <class T, class = typename std::enable_if<
-               std::is_base_of<BaseRef<typename T::Type>, T>::value>::type>
-       bool operator!=(const T &lhs, std::nullptr_t rhs) noexcept
-       {
-               return lhs;
-       }
-
-       template <class T, class = typename std::enable_if<
-               std::is_base_of<BaseRef<typename T::Type>, T>::value>::type>
-       bool operator!=(std::nullptr_t lhs, const T &rhs) noexcept
-       {
-               return rhs;
-       }
-}
-
-#endif // __UCL_UTIL_MEMORY_HELPERS_H__
diff --git a/ucl/inc/ucl/util/memory/macro.h b/ucl/inc/ucl/util/memory/macro.h
deleted file mode 100644 (file)
index b97175a..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_UTIL_MEMORY_MACRO_H__
-#define __UCL_UTIL_MEMORY_MACRO_H__
-
-#define UCL_DECLARE_REF_ALIASES(CLASS_NAME) \
-               class CLASS_NAME; \
-               using CLASS_NAME##SRef = ::ucl::SharedRef<CLASS_NAME>; \
-               using CLASS_NAME##WRef = ::ucl::WeakRef<CLASS_NAME>; \
-               using CLASS_NAME##SCRef = ::ucl::SharedRef<const CLASS_NAME>; \
-               using CLASS_NAME##WCRef = ::ucl::WeakRef<const CLASS_NAME>
-
-#define UCL_USING_REF_ALIASES(CLASS_NAME) \
-               using CLASS_NAME; \
-               using CLASS_NAME##SRef; \
-               using CLASS_NAME##WRef; \
-               using CLASS_NAME##SCRef; \
-               using CLASS_NAME##WCRef; \
-
-#endif // __UCL_UTIL_MEMORY_MACRO_H__
diff --git a/ucl/inc/ucl/util/shortLogs.h b/ucl/inc/ucl/util/shortLogs.h
deleted file mode 100644 (file)
index 02f8bbf..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_UTIL_SHORT_LOGS_H__
-#define __UCL_UTIL_SHORT_LOGS_H__
-
-#undef ULOG
-#undef URESDATALOG
-#undef URESLOG
-
-#undef VLOG
-#undef DLOG
-#undef ILOG
-#undef WLOG
-#undef ELOG
-#undef FLOG
-
-#undef VRESLOG
-#undef DRESLOG
-#undef IRESLOG
-#undef WRESLOG
-#undef ERESLOG
-#undef FRESLOG
-
-#undef RESLOG
-
-#undef RETVM_IF
-#undef RETM_IF
-
-#undef FAIL_RETURN
-#undef FAIL_RETURN_VALUE
-#undef FAIL_RETURN_VOID
-#undef FAIL_BREAK
-#undef FAIL_LOG
-
-#undef LOG_RETURN
-#undef LOG_RETURN_VALUE
-#undef LOG_RETURN_VOID
-#undef LOG_BREAK
-
-#define ULOG         UCL_ULOG
-#define URESDATALOG  UCL_URESDATALOG
-#define URESLOG      UCL_URESLOG
-
-#define VLOG  UCL_VLOG
-#define DLOG  UCL_DLOG
-#define ILOG  UCL_ILOG
-#define WLOG  UCL_WLOG
-#define ELOG  UCL_ELOG
-#define FLOG  UCL_FLOG
-
-#define VRESLOG  UCL_VRESLOG
-#define DRESLOG  UCL_DRESLOG
-#define IRESLOG  UCL_IRESLOG
-#define WRESLOG  UCL_WRESLOG
-#define ERESLOG  UCL_ERESLOG
-#define FRESLOG  UCL_FRESLOG
-
-#define RESLOG  UCL_RESLOG
-
-#define FAIL_RETURN        UCL_FAIL_RETURN
-#define FAIL_RETURN_VALUE  UCL_FAIL_RETURN_VALUE
-#define FAIL_RETURN_VOID   UCL_FAIL_RETURN_VOID
-#define FAIL_BREAK         UCL_FAIL_BREAK
-#define FAIL_LOG           UCL_FAIL_LOG
-
-#define LOG_RETURN        UCL_LOG_RETURN
-#define LOG_RETURN_VALUE  UCL_LOG_RETURN_VALUE
-#define LOG_RETURN_VOID   UCL_LOG_RETURN_VOID
-#define LOG_BREAK         UCL_LOG_BREAK
-
-#endif // __UCL_UTIL_SHORT_LOGS_H__
diff --git a/ucl/inc/ucl/util/smartDelegation.h b/ucl/inc/ucl/util/smartDelegation.h
deleted file mode 100644 (file)
index 6714411..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_UTIL_SMART_DELEGATION_H__
-#define __UCL_UTIL_SMART_DELEGATION_H__
-
-#include "smartDelegation/WeakDelegate.h"
-
-#include "smartDelegation/macro.h"
-
-#if (UCL_INCLUDE_SMART_DELEGATION_SHORT_MACRO_H)
-#include "smartDelegation/shortMacro.h"
-#endif
-
-#endif // __UCL_UTIL_SMART_DELEGATION_H__
diff --git a/ucl/inc/ucl/util/smartDelegation/WeakDelegate.h b/ucl/inc/ucl/util/smartDelegation/WeakDelegate.h
deleted file mode 100644 (file)
index 97e1ae8..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_UTIL_SMART_DELEGATION_WEAK_DELEGATE_H__
-#define __UCL_UTIL_SMART_DELEGATION_WEAK_DELEGATE_H__
-
-#include "ucl/util/delegation.h"
-#include "ucl/util/memory.h"
-
-namespace ucl {
-
-       template <class FUNC_SIG>
-       class WeakDelegate;
-
-       template <class R, class ...ARGS>
-       class WeakDelegate<R(ARGS...)> :
-                       public BaseDelegate<R(ARGS...), WeakRef<void>> {
-       public:
-               using BaseDelegate<R(ARGS...), WeakRef<void>>::BaseDelegate;
-
-               R operator()(ARGS ...args) const;
-
-               template <class CLASS, R(CLASS::*METHOD)(ARGS...)>
-               static WeakDelegate make(const WeakRef<CLASS> &data) noexcept;
-
-               template <class CLASS, R(CLASS::*METHOD)(ARGS...) const>
-               static WeakDelegate make(const WeakRef<const CLASS> &data) noexcept;
-       };
-}
-
-#include "WeakDelegate.hpp"
-
-#endif // __UCL_UTIL_SMART_DELEGATION_WEAK_DELEGATE_H__
diff --git a/ucl/inc/ucl/util/smartDelegation/WeakDelegate.hpp b/ucl/inc/ucl/util/smartDelegation/WeakDelegate.hpp
deleted file mode 100644 (file)
index fa7b3f8..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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.
- */
-
-namespace ucl {
-
-       template <class R, class ...ARGS>
-       inline R WeakDelegate<R(ARGS...)>::operator()(ARGS ...args) const
-       {
-               const auto tmp = this->m_data.lock();
-               if (tmp) {
-                       return this->m_stubA(tmp.get(), std::forward<ARGS>(args)...);
-               }
-               return R();
-       }
-
-       template <class R, class ...ARGS>
-       template <class CLASS, R(CLASS::*METHOD)(ARGS...)>
-       inline WeakDelegate<R(ARGS...)> WeakDelegate<R(ARGS...)>::make(
-                       const WeakRef<CLASS> &data) noexcept
-       {
-               return {data, WeakDelegate::Cb::template stubA<CLASS, METHOD>};
-       }
-
-       template <class R, class ...ARGS>
-       template <class CLASS, R(CLASS::*METHOD)(ARGS...) const>
-       inline WeakDelegate<R(ARGS...)> WeakDelegate<R(ARGS...)>::make(
-                       const WeakRef<const CLASS> &data) noexcept
-       {
-               return {constRefCast<CLASS>(data),
-                               WeakDelegate::Cb::template stubA<CLASS, METHOD>};
-       }
-}
diff --git a/ucl/inc/ucl/util/smartDelegation/macro.h b/ucl/inc/ucl/util/smartDelegation/macro.h
deleted file mode 100644 (file)
index b117820..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_UTIL_SMART_DELEGATION_MACRO_H__
-#define __UCL_UTIL_SMART_DELEGATION_MACRO_H__
-
-#define UCL_WEAK_DELEGATE(FUNC, DATA) \
-               _UCL_DELEGATE(::ucl::WeakDelegate, FUNC, DATA)
-
-#endif // __UCL_UTIL_SMART_DELEGATION_MACRO_H__
diff --git a/ucl/inc/ucl/util/smartDelegation/shortMacro.h b/ucl/inc/ucl/util/smartDelegation/shortMacro.h
deleted file mode 100644 (file)
index ddf5e35..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_UTIL_SMART_DELEGATION_SHORT_MACRO_H__
-#define __UCL_UTIL_SMART_DELEGATION_SHORT_MACRO_H__
-
-#define WEAK_DELEGATE(FUNC, DATA) UCL_WEAK_DELEGATE(FUNC, DATA)
-
-#endif // __UCL_UTIL_SMART_DELEGATION_SHORT_MACRO_H__
diff --git a/ucl/inc/ucl/util/threading.h b/ucl/inc/ucl/util/threading.h
deleted file mode 100644 (file)
index 4595b1b..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_UTIL_THREADING_H__
-#define __UCL_UTIL_THREADING_H__
-
-#include "threading/Thread.h"
-#include "threading/Mutex.h"
-#include "threading/MutexLock.h"
-#include "threading/CondVar.h"
-
-#endif // __UCL_UTIL_THREADING_H__
diff --git a/ucl/inc/ucl/util/threading/CondVar.h b/ucl/inc/ucl/util/threading/CondVar.h
deleted file mode 100644 (file)
index e73a763..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_UTIL_THREADING_COND_VAR_H__
-#define __UCL_UTIL_THREADING_COND_VAR_H__
-
-#include "MutexLock.h"
-
-namespace ucl {
-
-       class CondVar final : public NonCopyable {
-       public:
-               CondVar();
-               ~CondVar();
-               void wait(MutexLock &lock);
-               void notify();
-               void notifyAll();
-               pthread_cond_t *getHandle();
-       private:
-               pthread_cond_t m_cond;
-       };
-}
-
-#include "CondVar.hpp"
-
-#endif // __UCL_UTIL_THREADING_COND_VAR_H__
diff --git a/ucl/inc/ucl/util/threading/CondVar.hpp b/ucl/inc/ucl/util/threading/CondVar.hpp
deleted file mode 100644 (file)
index 09b0ae0..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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.
- */
-
-namespace ucl {
-
-       inline CondVar::CondVar() :
-               m_cond()
-       {
-               pthread_cond_init(&m_cond, NULL);
-       }
-
-       inline CondVar::~CondVar()
-       {
-               pthread_cond_destroy(&m_cond);
-       }
-
-       inline void CondVar::wait(MutexLock &lock)
-       {
-               pthread_cond_wait(&m_cond, lock.getMutex().getHandle());
-       }
-
-       inline void CondVar::notify()
-       {
-               pthread_cond_signal(&m_cond);
-       }
-
-       inline void CondVar::notifyAll()
-       {
-               pthread_cond_broadcast(&m_cond);
-       }
-
-       inline pthread_cond_t *CondVar::getHandle()
-       {
-               return &m_cond;
-       }
-}
diff --git a/ucl/inc/ucl/util/threading/Mutex.h b/ucl/inc/ucl/util/threading/Mutex.h
deleted file mode 100644 (file)
index eda90ff..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_UTIL_THREADING_MUTEX_H__
-#define __UCL_UTIL_THREADING_MUTEX_H__
-
-// Use pthread because Tizen 3.0 officially not support C++ 11
-// And there were problems with threading in C++ 11 and Tizen 3.0
-#include <pthread.h>
-
-#include "ucl/util/types/classTypes.h"
-
-namespace ucl {
-
-       class Mutex final : public NonCopyable {
-       public:
-               Mutex(bool recursive = false);
-               ~Mutex();
-               void lock();
-               void unlock();
-               pthread_mutex_t *getHandle();
-       private:
-               pthread_mutex_t m_mutex;
-       };
-}
-
-#include "Mutex.hpp"
-
-#endif // __UCL_UTIL_THREADING_MUTEX_H__
diff --git a/ucl/inc/ucl/util/threading/Mutex.hpp b/ucl/inc/ucl/util/threading/Mutex.hpp
deleted file mode 100644 (file)
index c3b75be..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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.
- */
-
-namespace ucl {
-
-       inline Mutex::Mutex(const bool recursive) :
-               m_mutex()
-       {
-               if (recursive) {
-                       pthread_mutexattr_t attr = {};
-                       pthread_mutexattr_init(&attr);
-                       pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
-                       pthread_mutex_init(&m_mutex, &attr);
-                       pthread_mutexattr_destroy(&attr);
-               } else {
-                       pthread_mutex_init(&m_mutex, nullptr);
-               }
-       }
-
-       inline Mutex::~Mutex()
-       {
-               pthread_mutex_destroy(&m_mutex);
-       }
-
-       inline void Mutex::lock()
-       {
-               pthread_mutex_lock(&m_mutex);
-       }
-
-       inline void Mutex::unlock()
-       {
-               pthread_mutex_unlock(&m_mutex);
-       }
-
-       inline pthread_mutex_t *Mutex::getHandle()
-       {
-               return &m_mutex;
-       }
-}
diff --git a/ucl/inc/ucl/util/threading/MutexLock.h b/ucl/inc/ucl/util/threading/MutexLock.h
deleted file mode 100644 (file)
index 062837f..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_UTIL_THREADING_MUTEX_LOCK_H__
-#define __UCL_UTIL_THREADING_MUTEX_LOCK_H__
-
-#include "Mutex.h"
-
-namespace ucl {
-
-       class MutexLock final : public NonCopyable {
-       public:
-               MutexLock(Mutex &mutex);
-               ~MutexLock();
-               Mutex &getMutex();
-       private:
-               Mutex &m_mutex;
-       };
-}
-
-#include "MutexLock.hpp"
-
-#endif // __UCL_UTIL_THREADING_MUTEX_LOCK_H__
diff --git a/ucl/inc/ucl/util/threading/MutexLock.hpp b/ucl/inc/ucl/util/threading/MutexLock.hpp
deleted file mode 100644 (file)
index a30d995..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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.
- */
-
-namespace ucl {
-
-       inline MutexLock::MutexLock(Mutex &mutex) :
-               m_mutex(mutex)
-       {
-               mutex.lock();
-       }
-
-       inline MutexLock::~MutexLock()
-       {
-               m_mutex.unlock();
-       }
-
-       inline Mutex &MutexLock::getMutex()
-       {
-               return m_mutex;
-       }
-}
diff --git a/ucl/inc/ucl/util/threading/Thread.h b/ucl/inc/ucl/util/threading/Thread.h
deleted file mode 100644 (file)
index 0839921..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_UTIL_THREADING_THREAD_H__
-#define __UCL_UTIL_THREADING_THREAD_H__
-
-// Use pthread because Tizen 3.0 officially not support C++ 11
-// And there were problems with threading in C++ 11 and Tizen 3.0
-#include <pthread.h>
-
-#include "ucl/util/types/classTypes.h"
-
-namespace ucl {
-
-       class Thread final : public NonCopyable {
-       public:
-               Thread();
-               template <class FUNC>
-               explicit Thread(FUNC &&func);
-               ~Thread();
-
-               bool wasStarted() const;
-               bool wasJoinded() const;
-
-               template <class FUNC>
-               bool start(FUNC &&func);
-               void join();
-
-               pthread_t *getHandle();
-
-       private:
-               std::function<void()> m_func;
-               pthread_t m_thread;
-               bool m_wasStarted;
-               bool m_wasJoined;
-       };
-}
-
-#include "Thread.hpp"
-
-#endif // __UCL_UTIL_THREADING_THREAD_H__
diff --git a/ucl/inc/ucl/util/threading/Thread.hpp b/ucl/inc/ucl/util/threading/Thread.hpp
deleted file mode 100644 (file)
index 74259c1..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 "ucl/util/logging.h"
-
-namespace ucl {
-
-       inline Thread::Thread() :
-               m_thread(),
-               m_wasStarted(false),
-               m_wasJoined(false)
-       {
-       }
-
-       template <class FUNC>
-       inline Thread::Thread(FUNC &&func) :
-               Thread()
-       {
-               start(func);
-       }
-
-       inline Thread::~Thread()
-       {
-               if (!m_wasJoined) {
-                       join();
-               }
-       }
-
-       inline bool Thread::wasStarted() const
-       {
-               return m_wasStarted;
-       }
-
-       inline bool Thread::wasJoinded() const
-       {
-               return m_wasJoined;
-       }
-
-       template <class FUNC>
-       inline bool Thread::start(FUNC &&func)
-       {
-               if (m_wasStarted) {
-                       UCL_WLOG("Already started!");
-                       return false;
-               }
-               m_func = std::forward<FUNC>(func);
-               const int res = pthread_create(&m_thread, NULL,
-                       [](void *data) -> void *
-                       {
-                               static_cast<Thread *>(data)->m_func();
-                               return nullptr;
-                       },
-                       this);
-               if (res != 0) {
-                       UCL_ELOG("pthread_create() failed: %d", res);
-                       m_func = {};
-                       return false;
-               }
-               m_wasStarted = true;
-               return true;
-       }
-
-       inline void Thread::join()
-       {
-               if (!m_wasStarted) {
-                       UCL_WLOG("Not stared started!");
-                       return;
-               }
-               if (m_wasJoined) {
-                       UCL_WLOG("Already joined!");
-                       return;
-               }
-               m_wasJoined = true;
-               pthread_join(m_thread, NULL);
-               m_func = {};
-       }
-
-       inline pthread_t *Thread::getHandle()
-       {
-               return ((m_wasStarted && !m_wasJoined) ? &m_thread : NULL);
-       }
-}
diff --git a/ucl/inc/ucl/util/types.h b/ucl/inc/ucl/util/types.h
deleted file mode 100644 (file)
index 70a33d3..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_UTIL_TYPES_H__
-#define __UCL_UTIL_TYPES_H__
-
-#include "types/baseTypes.h"
-#include "types/classTypes.h"
-#include "types/Result.h"
-
-#endif // __UCL_UTIL_TYPES_H__
diff --git a/ucl/inc/ucl/util/types/Result.h b/ucl/inc/ucl/util/types/Result.h
deleted file mode 100644 (file)
index 099223f..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_UTIL_TYPES_RESULT_H__
-#define __UCL_UTIL_TYPES_RESULT_H__
-
-#include "baseTypes.h"
-
-namespace ucl {
-
-       // ResultData declaration //
-
-       struct ResultData final {
-               const char *name;
-               int logPrio;
-       };
-
-       // Result declaration //
-
-       struct Result final {
-               int value;
-
-               Result() = default;
-
-               template <class VALUE, class = char(*)[VALUE::_UCL_RESULT * 0 + 1]>
-               constexpr Result(const VALUE &v) : value(v) {}
-       };
-
-       // Result non-member functions //
-
-       const ResultData &getResultData(Result result);
-
-       constexpr bool isGood(Result result);
-       constexpr bool isBad(Result result);
-
-       constexpr bool operator==(Result lhs, Result rhs);
-       constexpr bool operator!=(Result lhs, Result rhs);
-
-       // Basic Result values //
-
-       enum {
-               _UCL_RESULT,
-
-               RES_OK    = 0,
-               RES_FALSE = 1,
-               _RES_END,
-
-               RES_FAIL              = -1,
-               RES_INVALID_ARGUMENTS = -2,
-               RES_ILLEGAL_STATE     = -3,
-               RES_OUT_OF_MEMORY     = -4,
-               RES_IO_ERROR          = -5,
-               RES_NOT_SUPPORTED     = -6,
-               RES_INVALID_DATA      = -7,
-               RES_FATAL             = -8,
-               // TODO MUST match previous item!
-               _RES_BEGIN            = RES_FATAL
-       };
-}
-
-#include "Result.hpp"
-
-#endif // __UCL_UTIL_TYPES_RESULT_H__
diff --git a/ucl/inc/ucl/util/types/Result.hpp b/ucl/inc/ucl/util/types/Result.hpp
deleted file mode 100644 (file)
index c83db4c..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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.
- */
-
-namespace ucl {
-
-       constexpr bool isGood(const Result result)
-       {
-               return (result.value >= RES_OK);
-       }
-
-       constexpr bool isBad(const Result result)
-       {
-               return !isGood(result);
-       }
-
-       constexpr bool operator==(const Result lhs, const Result rhs)
-       {
-               return (lhs.value == rhs.value);
-       }
-
-       constexpr bool operator!=(const Result lhs, const Result rhs)
-       {
-               return (lhs.value != rhs.value);
-       }
-}
diff --git a/ucl/inc/ucl/util/types/baseTypes.h b/ucl/inc/ucl/util/types/baseTypes.h
deleted file mode 100644 (file)
index c5062db..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_UTIL_TYPES_BASE_TYPES_H__
-#define __UCL_UTIL_TYPES_BASE_TYPES_H__
-
-#include <cstddef>
-#include <cstdlib>
-#include <cstdint>
-
-#include <string>
-#include <memory>
-#include <atomic>
-#include <functional>
-#include <type_traits>
-#include <utility>
-
-#include <Eina.h>
-
-#include "ucl/config.h"
-
-namespace ucl {
-       using UInt = unsigned int;
-}
-
-#endif // __UCL_UTIL_TYPES_BASE_TYPES_H__
diff --git a/ucl/inc/ucl/util/types/classTypes.h b/ucl/inc/ucl/util/types/classTypes.h
deleted file mode 100644 (file)
index 5c708d2..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_UTIL_TYPES_CLASS_TYPES_H__
-#define __UCL_UTIL_TYPES_CLASS_TYPES_H__
-
-#include "baseTypes.h"
-
-namespace ucl {
-
-       class NonCopyable {
-       public:
-               NonCopyable(const NonCopyable &) = delete;
-               NonCopyable &operator=(const NonCopyable &) = delete;
-       protected:
-               NonCopyable() = default;
-               ~NonCopyable() = default;
-       };
-
-       class Polymorphic : public NonCopyable {
-       protected:
-               Polymorphic() = default;
-               virtual ~Polymorphic() = default;
-       };
-
-       class IDisposable : public Polymorphic {
-       public:
-               virtual void dispose() = 0;
-               virtual bool isDisposed() const = 0;
-       protected:
-               virtual ~IDisposable() = default;
-       };
-
-       template <class IPRODUCT>
-       class IFactory : public Polymorphic {
-       public:
-               using IProduct = IPRODUCT;
-       public:
-               virtual IPRODUCT *newInstance() const = 0;
-       protected:
-               virtual ~IFactory() = default;
-       };
-
-       template <class PRODUCT, class IPRODUCT>
-       class Factory final : public IFactory<IPRODUCT> {
-       public:
-               using Product = PRODUCT;
-       public:
-               virtual IPRODUCT *newInstance() const final override
-               {
-                       return new PRODUCT();
-               }
-       };
-
-       // Priority selector for SFINAE functions
-       template <int N>
-       struct P : P<N - 1> {};
-       template <>
-       struct P<0> {};
-}
-
-#endif // __UCL_UTIL_TYPES_CLASS_TYPES_H__
diff --git a/ucl/include/ucl/appfw/IInstance.h b/ucl/include/ucl/appfw/IInstance.h
new file mode 100644 (file)
index 0000000..bf09205
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_APPFW_I_INSTANCE_H__
+#define __UCL_APPFW_I_INSTANCE_H__
+
+#include "IInstanceContext.h"
+
+namespace ucl {
+
+       UCL_DECLARE_REF_ALIASES(IInstance);
+
+       class IInstance : public Polymorphic {
+       public:
+               virtual Result onCreate(IInstanceContext *context) = 0;
+               virtual void onPause() = 0;
+               virtual void onResume() = 0;
+       };
+}
+
+#endif // __UCL_APPFW_I_INSTANCE_H__
diff --git a/ucl/include/ucl/appfw/IInstanceAppControlExt.h b/ucl/include/ucl/appfw/IInstanceAppControlExt.h
new file mode 100644 (file)
index 0000000..6799a84
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_APPFW_I_INSTANCE_APP_CONTROL_EXT_H__
+#define __UCL_APPFW_I_INSTANCE_APP_CONTROL_EXT_H__
+
+#include "types.h"
+
+namespace ucl {
+
+       class IInstanceAppControlExt : public Polymorphic {
+       public:
+               virtual void onAppControl(app_control_h appControl) = 0;
+       };
+}
+
+#endif // __UCL_APPFW_I_INSTANCE_APP_CONTROL_EXT_H__
diff --git a/ucl/include/ucl/appfw/IInstanceContext.h b/ucl/include/ucl/appfw/IInstanceContext.h
new file mode 100644 (file)
index 0000000..b06c177
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_APPFW_I_INSTANCE_CONTEXT_H__
+#define __UCL_APPFW_I_INSTANCE_CONTEXT_H__
+
+#include "types.h"
+
+#include "ucl/gui/Window.h"
+
+namespace ucl {
+
+       class IInstanceContext : public Polymorphic {
+       public:
+               virtual AppType getAppType() const = 0;
+               virtual WindowSRef getWindow() = 0;
+               virtual void exitApp() = 0;
+       };
+}
+
+#endif // __UCL_APPFW_I_INSTANCE_CONTEXT_H__
diff --git a/ucl/include/ucl/appfw/InstanceManagerBase.h b/ucl/include/ucl/appfw/InstanceManagerBase.h
new file mode 100644 (file)
index 0000000..0fdde8c
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_APPFW_INSTANCE_MANAGER_BASE_H__
+#define __UCL_APPFW_INSTANCE_MANAGER_BASE_H__
+
+#include "IInstance.h"
+#include "SysEventProvider.h"
+
+namespace ucl {
+
+       class InstanceManagerBase : public Polymorphic {
+       public:
+               InstanceManagerBase(AppParams appParams);
+               virtual ~InstanceManagerBase();
+
+               const AppParams &getAppParams() const;
+
+               void setSysEventProvider(SysEventProviderUPtr provider);
+
+               virtual IInstanceSRef newInstance() const = 0;
+
+       protected:
+               SysEventProvider &getSysEventProvider() const;
+
+       private:
+               const AppParams m_appParams;
+               SysEventProviderUPtr m_sysEventProvider;
+       };
+}
+
+#endif // __UCL_APPFW_INSTANCE_MANAGER_BASE_H__
diff --git a/ucl/include/ucl/appfw/SysEventProvider.h b/ucl/include/ucl/appfw/SysEventProvider.h
new file mode 100644 (file)
index 0000000..8a72758
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_APPFW_SYS_EVENT_PROVIDER_H__
+#define __UCL_APPFW_SYS_EVENT_PROVIDER_H__
+
+#include <list>
+
+#include "types.h"
+
+namespace ucl {
+
+       class SysEventProvider;
+       using SysEventProviderUPtr = std::unique_ptr<SysEventProvider>;
+
+       class SysEventProvider final : public NonCopyable {
+       public:
+               using EventHandlerAddFunc = int (*)(app_event_handler_h *,
+                               app_event_type_e, app_event_cb, void *);
+               using EventHandlerDelFunc = int (*)(app_event_handler_h);
+
+       public:
+               SysEventProvider(EventHandlerAddFunc addFunc,
+                               EventHandlerDelFunc delFunc);
+               ~SysEventProvider();
+
+               void addEventHandler(const SysEventHandler &handler);
+               void delEventHandler(const SysEventHandler &handler);
+
+       private:
+               int addEventHandler(app_event_handler_h *handler,
+                               app_event_type_e appEvent, app_event_cb cb, void *data);
+               int delEventHandler(app_event_handler_h handler);
+
+               void dispatch(SysEvent sysEvent);
+
+       private:
+               class EventProxy;
+               using EventProxies = std::list<EventProxy>;
+
+       private:
+               const EventHandlerAddFunc m_addFunc;
+               const EventHandlerDelFunc m_delFunc;
+               EventProxies m_eventProxies;
+               Event<SysEventHandler> m_event;
+       };
+}
+
+#include "SysEventProvider.hpp"
+
+#endif // __UCL_APPFW_SYS_EVENT_PROVIDER_H__
diff --git a/ucl/include/ucl/appfw/SysEventProvider.hpp b/ucl/include/ucl/appfw/SysEventProvider.hpp
new file mode 100644 (file)
index 0000000..1d52394
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+namespace ucl {
+
+       inline void SysEventProvider::addEventHandler(
+                       const SysEventHandler &handler)
+       {
+               m_event += handler;
+       }
+
+       inline void SysEventProvider::delEventHandler(
+                       const SysEventHandler &handler)
+       {
+               m_event -= handler;
+       }
+}
diff --git a/ucl/include/ucl/appfw/UIApp.h b/ucl/include/ucl/appfw/UIApp.h
new file mode 100644 (file)
index 0000000..a8b4dbc
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_APPFW_UI_APP_H__
+#define __UCL_APPFW_UI_APP_H__
+
+#include "IInstanceContext.h"
+
+#include "InstanceManagerBase.h"
+
+namespace ucl {
+
+       class UIApp final : private IInstanceContext {
+       public:
+               UIApp(InstanceManagerBase &instanceMgr);
+               virtual ~UIApp();
+
+               int run(int argc, char *argv[]);
+
+       private:
+               bool onCreate();
+               void onTerminate();
+               void onPause();
+               void onResume();
+               void onAppControl(app_control_h appControl);
+
+               Result configParams();
+               Result createWindow();
+
+               void initSysEventManager();
+               Result createInstance();
+
+               // IInstanceContext //
+
+               virtual AppType getAppType() const final override;
+               virtual WindowSRef getWindow() final override;
+               virtual void exitApp() final override;
+
+       private:
+               InstanceManagerBase &m_instanceMgr;
+               WindowSRef m_window;
+               IInstanceSRef m_instance;
+       };
+}
+
+#endif // __UCL_APPFW_UI_APP_H__
diff --git a/ucl/include/ucl/appfw/helpers.h b/ucl/include/ucl/appfw/helpers.h
new file mode 100644 (file)
index 0000000..fe598d9
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_APPFW_HELPERS_H__
+#define __UCL_APPFW_HELPERS_H__
+
+#include "types.h"
+
+namespace ucl {
+
+       std::string getResPath(const char *relativePath);
+}
+
+#endif // __UCL_APPFW_HELPERS_H__
diff --git a/ucl/include/ucl/appfw/types.h b/ucl/include/ucl/appfw/types.h
new file mode 100644 (file)
index 0000000..48f8adc
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_APPFW_TYPES_H__
+#define __UCL_APPFW_TYPES_H__
+
+#include <app_common.h>
+#include <app_control.h>
+
+#include "ucl/util/types.h"
+#include "ucl/util/delegation.h"
+#include "ucl/util/smartDelegation.h"
+
+#include "ucl/misc/HashMap.h"
+#include "ucl/misc/Event.h"
+#include "ucl/misc/AutoHandle.h"
+
+namespace ucl {
+
+       enum class AppType {
+               UI,
+               WIDGET,
+               WATCH
+       };
+
+       enum class AppParam {
+               BASE_SCALE,
+               ACCELERATION_PREFERENECE,
+               WINDOW_TYPE,
+               WINDOW_NAME
+       };
+
+       using AppParams = HashMap<AppParam, Variant>;
+
+       enum class SysEvent {
+               LANGUAGE_CHANGED,
+               REGION_FMT_CHANGED,
+               LOW_MEMORY,
+               LOW_BATTERY,
+               ORIENTATION_CHANGED,
+               SUSPEND_STATE_CHANGED,
+               UPDATE_REQUESTED
+       };
+
+       using SysEventHandler = WeakDelegate<void(SysEvent)>;
+
+       using AutoAppCtrl = AutoHandle<app_control_h, int, app_control_destroy>;
+}
+
+#endif // __UCL_APPFW_TYPES_H__
diff --git a/ucl/include/ucl/config.h b/ucl/include/ucl/config.h
new file mode 100644 (file)
index 0000000..cd36042
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_CONFIG_H__
+#define __UCL_CONFIG_H__
+
+#ifdef _DEBUG
+#define UCL_DEBUG
+#endif
+
+#define UCL_DEFINE_GET_UCL_RESULT_DATA 0
+
+#define UCL_LOG_LEVEL_VERBOSE 6
+#define UCL_LOG_LEVEL_DEBUG   5
+#define UCL_LOG_LEVEL_INFO    4
+#define UCL_LOG_LEVEL_WARNING 3
+#define UCL_LOG_LEVEL_ERROR   2
+#define UCL_LOG_LEVEL_FATAL   1
+
+#ifdef UCL_DEBUG
+#define UCL_MAX_LOG_LEVEL UCL_LOG_LEVEL_VERBOSE
+#else
+#define UCL_MAX_LOG_LEVEL UCL_LOG_LEVEL_INFO
+#endif
+
+#define UCL_DEFAULT_LOG_TAG "CALLUI_UCL"
+
+#define UCL_INCLUDE_DELEGATION_SHORT_MACRO_H 1
+#define UCL_INCLUDE_SMART_DELEGATION_SHORT_MACRO_H 1
+
+#endif // __UCL_CONFIG_H__
diff --git a/ucl/include/ucl/gui/EdjeWidget.h b/ucl/include/ucl/gui/EdjeWidget.h
new file mode 100644 (file)
index 0000000..8d045c4
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_GUI_EDJE_WIDGET_H__
+#define __UCL_GUI_EDJE_WIDGET_H__
+
+#include "ElmWidget.h"
+
+namespace ucl {
+
+       UCL_DECLARE_REF_ALIASES(EdjeWidget);
+
+       class EdjeWidget : public ElmWidget {
+       public:
+               void setText(const TString &value);
+               void setText(const TString &value, EdjePart part);
+
+               TString getText() const;
+               TString getText(EdjePart part) const;
+
+               void setContent(Evas_Object *content);
+               void setContent(Evas_Object *content, EdjePart part);
+               Evas_Object *unsetContent();
+               Evas_Object *unsetContent(EdjePart part);
+
+               Evas_Object *getContent() const;
+               Evas_Object *getContent(EdjePart part) const;
+
+               void emit(EdjeSignal signal, EdjeSignalSrc source =
+                               EdjeSignalSrc(""));
+
+       protected:
+               EdjeWidget(IRefCountObj *rc, Evas_Object *eo, bool isOwner = true);
+       };
+}
+
+#include "EdjeWidget.hpp"
+
+#endif // __UCL_GUI_EDJE_WIDGET_H__
diff --git a/ucl/include/ucl/gui/EdjeWidget.hpp b/ucl/include/ucl/gui/EdjeWidget.hpp
new file mode 100644 (file)
index 0000000..3f989c7
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+namespace ucl {
+
+       inline EdjeWidget::EdjeWidget(IRefCountObj *const rc,
+                       Evas_Object *const eo, const bool isOwner) :
+               ElmWidget(rc, eo, isOwner)
+       {
+       }
+
+       inline TString EdjeWidget::getText() const
+       {
+               return elm_object_text_get(getEo());
+       }
+
+       inline TString EdjeWidget::getText(const EdjePart part) const
+       {
+               return elm_object_part_text_get(getEo(), part.name);
+       }
+
+       inline void EdjeWidget::setContent(Evas_Object *const content)
+       {
+               elm_object_content_set(getEo(), content);
+       }
+
+       inline void EdjeWidget::setContent(Evas_Object *const content,
+                       const EdjePart part)
+       {
+               elm_object_part_content_set(getEo(), part.name, content);
+       }
+
+       inline Evas_Object *EdjeWidget::unsetContent()
+       {
+               return elm_object_content_unset(getEo());
+       }
+
+       inline Evas_Object *EdjeWidget::unsetContent(const EdjePart part)
+       {
+               return elm_object_part_content_unset(getEo(), part.name);
+       }
+
+       inline Evas_Object *EdjeWidget::getContent() const
+       {
+               return elm_object_content_get(getEo());
+       }
+
+       inline Evas_Object *EdjeWidget::getContent(const EdjePart part) const
+       {
+               return elm_object_part_content_get(getEo(), part.name);
+       }
+
+       inline void EdjeWidget::emit(const EdjeSignal signal,
+                       const EdjeSignalSrc source)
+       {
+               elm_object_signal_emit(getEo(), signal.name, source.name);
+       }
+}
diff --git a/ucl/include/ucl/gui/ElmWidget.h b/ucl/include/ucl/gui/ElmWidget.h
new file mode 100644 (file)
index 0000000..f967cc3
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_GUI_ELM_WIDGET_H__
+#define __UCL_GUI_ELM_WIDGET_H__
+
+#include "Widget.h"
+
+#define UCL_SMART_FWD_ATSPI UCL_SMART_FWD "atspi,"
+
+namespace ucl {
+
+       constexpr SmartEvent ATSPI_ON_GESTURE {UCL_SMART_FWD_ATSPI "gesture"};
+
+       class Window;
+
+       UCL_DECLARE_REF_ALIASES(ElmWidget);
+
+       class ElmWidget : public Widget {
+       public:
+               explicit ElmWidget(Evas_Object *eo, bool isOwner = true);
+               virtual ~ElmWidget();
+
+               void setEnabled(bool value);
+               bool isEnabled() const;
+
+               void setFocusAlowed(bool value);
+               bool isFocusAlowed() const;
+
+               void setTheme(Elm_Theme *th);
+               Elm_Theme *getTheme();
+
+               Evas_Object *getTopWidget() const;
+               Window *getWindow() const;
+
+       protected:
+               friend class ReffedObj<ElmWidget>;
+               ElmWidget(IRefCountObj *rc, Evas_Object *eo, bool isOwner = true);
+
+               virtual void setFocusedImpl(bool value) final override;
+               virtual bool isFocusedImpl() const final override;
+               virtual bool ensureFwdEvent(SmartEvent fwdEvent) override;
+
+       private:
+               Eina_Bool onAtspiGesture(Elm_Atspi_Gesture_Info gestureInfo,
+                                       Evas_Object *obj);
+
+       private:
+               bool m_isAtspiGestureCbSet;
+       };
+
+       // Non-member functions //
+
+       void enable(ElmWidget &widget);
+       void disable(ElmWidget &widget);
+}
+
+#include "ElmWidget.hpp"
+
+#endif // __UCL_GUI_ELM_WIDGET_H__
diff --git a/ucl/include/ucl/gui/ElmWidget.hpp b/ucl/include/ucl/gui/ElmWidget.hpp
new file mode 100644 (file)
index 0000000..0673a57
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+namespace ucl {
+
+       inline ElmWidget::ElmWidget(Evas_Object *const eo, const bool isOwner) :
+               ElmWidget(nullptr, eo, isOwner)
+       {
+       }
+
+       inline void ElmWidget::setEnabled(const bool value)
+       {
+               elm_object_disabled_set(getEo(), toEina(!value));
+       }
+
+       inline bool ElmWidget::isEnabled() const
+       {
+               return !elm_object_disabled_get(getEo());
+       }
+
+       inline void ElmWidget::setFocusAlowed(const bool value)
+       {
+               elm_object_focus_allow_set(getEo(), toEina(value));
+       }
+
+       inline bool ElmWidget::isFocusAlowed() const
+       {
+               return elm_object_focus_allow_get(getEo());
+       }
+
+       inline void ElmWidget::setTheme(Elm_Theme *th)
+       {
+               elm_object_theme_set(getEo(), th);
+       }
+
+       inline Elm_Theme *ElmWidget::getTheme()
+       {
+               return elm_object_theme_get(getEo());
+       }
+
+       inline Evas_Object *ElmWidget::getTopWidget() const
+       {
+               return elm_object_top_widget_get(getEo());
+       }
+
+       // Non-member functions //
+
+       inline void enable(ElmWidget &widget)
+       {
+               widget.setEnabled(true);
+       }
+
+       inline void disable(ElmWidget &widget)
+       {
+               widget.setEnabled(false);
+       }
+}
diff --git a/ucl/include/ucl/gui/Genlist.h b/ucl/include/ucl/gui/Genlist.h
new file mode 100644 (file)
index 0000000..366eccf
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_GUI_GENLIST_H__
+#define __UCL_GUI_GENLIST_H__
+
+#include "StyledWidget.h"
+#include "GenlistItem.h"
+
+namespace ucl {
+
+       UCL_DECLARE_REF_ALIASES(Genlist);
+
+       class Genlist final : public StyledWidget {
+       public:
+               enum class Mode {
+                       COMPRESS = ELM_LIST_COMPRESS,
+                       SCROLL = ELM_LIST_SCROLL,
+                       LIMIT = ELM_LIST_LIMIT,
+                       EXPAND = ELM_LIST_EXPAND
+               };
+
+               class Builder final {
+               public:
+                       Builder();
+                       Builder &setStyle(ElmStyle style);
+                       Builder &setMode(Mode mode);
+                       Builder &setHomogeneous(bool value);
+                       Builder &setIsOwner(bool value);
+                       Builder &setNeedBindToEo(bool value);
+                       GenlistSRef build(ElmWidget &parent) const;
+               private:
+                       ElmStyle m_style;
+                       Mode m_mode;
+                       bool m_isHomogeneous;
+                       bool m_isOwner;
+                       bool m_needBindToEo;
+               };
+
+       public:
+               friend class ReffedObj<Genlist>;
+               using StyledWidget::StyledWidget;
+
+               void setMode(Mode mode);
+               Mode getMode() const;
+
+               void setHomogeneous(bool isHomogeneous);
+               bool isHomogeneous() const;
+
+               void updateRealizedItems();
+               void clear();
+
+               GenlistItem append(const Elm_Genlist_Item_Class *itc,
+                               const void *data, SmartCbHandler onSelect = nullptr,
+                               GenlistItem::Type type = GenlistItem::Type::SIMPLE,
+                               GenlistItem parent = nullptr);
+
+               GenlistItem prepend(const Elm_Genlist_Item_Class *itc,
+                               const void *data, SmartCbHandler onSelect = nullptr,
+                               GenlistItem::Type type = GenlistItem::Type::SIMPLE,
+                               GenlistItem parent = nullptr);
+
+               GenlistItem insertAfter(GenlistItem after,
+                               const Elm_Genlist_Item_Class *itc, const void *data,
+                               SmartCbHandler onSelect = nullptr,
+                               GenlistItem::Type type = GenlistItem::Type::SIMPLE,
+                               GenlistItem parent = nullptr);
+
+               GenlistItem insertBefore(GenlistItem before,
+                               const Elm_Genlist_Item_Class *itc, const void *data,
+                               SmartCbHandler onSelect = nullptr,
+                               GenlistItem::Type type = GenlistItem::Type::SIMPLE,
+                               GenlistItem parent = nullptr);
+       };
+}
+
+#include "Genlist.hpp"
+
+#endif // __UCL_GUI_GENLIST_H__
diff --git a/ucl/include/ucl/gui/Genlist.hpp b/ucl/include/ucl/gui/Genlist.hpp
new file mode 100644 (file)
index 0000000..3c93031
--- /dev/null
@@ -0,0 +1,132 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+namespace ucl {
+
+       // Genlist::Builder //
+
+       inline Genlist::Builder::Builder() :
+               m_mode(Mode::COMPRESS),
+               m_isHomogeneous(true),
+               m_isOwner(true),
+               m_needBindToEo(false)
+       {
+       }
+
+       inline Genlist::Builder &Genlist::Builder::setStyle(const ElmStyle style)
+       {
+               m_style = style;
+               return *this;
+       }
+
+       inline Genlist::Builder &Genlist::Builder::setMode(const Mode mode)
+       {
+               m_mode = mode;
+               return *this;
+       }
+
+       inline Genlist::Builder &Genlist::Builder::setHomogeneous(const bool value)
+       {
+               m_isHomogeneous = value;
+               return *this;
+       }
+
+       inline Genlist::Builder &Genlist::Builder::setIsOwner(const bool value)
+       {
+               m_isOwner = value;
+               return *this;
+       }
+
+       inline Genlist::Builder &Genlist::Builder::setNeedBindToEo(const bool value)
+       {
+               m_needBindToEo = value;
+               return *this;
+       }
+
+       // Genlist //
+
+       inline void Genlist::setMode(const Mode mode)
+       {
+               elm_genlist_mode_set(getEo(), static_cast<Elm_List_Mode>(mode));
+       }
+
+       inline Genlist::Mode Genlist::getMode() const
+       {
+               return static_cast<Mode>(elm_genlist_mode_get(getEo()));
+       }
+
+       inline void Genlist::setHomogeneous(const bool isHomogeneous)
+       {
+               elm_genlist_homogeneous_set(getEo(), toEina(isHomogeneous));
+       }
+
+       inline bool Genlist::isHomogeneous() const
+       {
+               return elm_genlist_homogeneous_get(getEo());
+       }
+
+       inline void Genlist::updateRealizedItems()
+       {
+               elm_genlist_realized_items_update(getEo());
+       }
+
+       inline void Genlist::clear()
+       {
+               elm_genlist_clear(getEo());
+       }
+
+       inline GenlistItem Genlist::append(const Elm_Genlist_Item_Class *const itc,
+                       const void *const data, const SmartCbHandler onSelect,
+                       const GenlistItem::Type type, const GenlistItem parent)
+       {
+               return GenlistItem(elm_genlist_item_append(
+                               getEo(), itc, data, parent,
+                               static_cast<Elm_Genlist_Item_Type>(type),
+                               onSelect.getStubA(), onSelect.getData()));
+       }
+
+       inline GenlistItem Genlist::prepend(const Elm_Genlist_Item_Class *const itc,
+                       const void *const data, SmartCbHandler onSelect,
+                       const GenlistItem::Type type, const GenlistItem parent)
+       {
+               return GenlistItem(elm_genlist_item_prepend(
+                               getEo(), itc, data, parent,
+                               static_cast<Elm_Genlist_Item_Type>(type),
+                               onSelect.getStubA(), onSelect.getData()));
+       }
+
+       inline GenlistItem Genlist::insertAfter(const GenlistItem after,
+                       const Elm_Genlist_Item_Class *const itc, const void *const data,
+                       const SmartCbHandler onSelect, const GenlistItem::Type type,
+                       const GenlistItem parent)
+       {
+               return GenlistItem(elm_genlist_item_insert_after(
+                               getEo(), itc, data, parent, after,
+                               static_cast<Elm_Genlist_Item_Type>(type),
+                               onSelect.getStubA(), onSelect.getData()));
+       }
+
+       inline GenlistItem Genlist::insertBefore(const GenlistItem before,
+                       const Elm_Genlist_Item_Class *itc, const void *data,
+                       const SmartCbHandler onSelect, const GenlistItem::Type type,
+                       const GenlistItem parent)
+       {
+               return GenlistItem(elm_genlist_item_insert_before(
+                               getEo(), itc, data, parent, before,
+                               static_cast<Elm_Genlist_Item_Type>(type),
+                               onSelect.getStubA(), onSelect.getData()));
+       }
+}
diff --git a/ucl/include/ucl/gui/GenlistItem.h b/ucl/include/ucl/gui/GenlistItem.h
new file mode 100644 (file)
index 0000000..2c96b9c
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_GUI_GENLIST_ITEM_H__
+#define __UCL_GUI_GENLIST_ITEM_H__
+
+#include "WidgetItem.h"
+
+namespace ucl {
+
+       class GenlistItem final : public WidgetItem {
+       public:
+               enum class Type {
+                       SIMPLE = ELM_GENLIST_ITEM_NONE,
+                       TREE = ELM_GENLIST_ITEM_TREE,
+                       GROUP = ELM_GENLIST_ITEM_GROUP
+               };
+
+               enum class SelectMode {
+                       DEFAULT = ELM_OBJECT_SELECT_MODE_DEFAULT,
+                       ALWAYS = ELM_OBJECT_SELECT_MODE_ALWAYS,
+                       NONE = ELM_OBJECT_SELECT_MODE_NONE,
+                       DISPLAY_ONLY = ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY
+               };
+
+               enum {
+                       FIELD_ALL = ELM_GENLIST_ITEM_FIELD_ALL,
+                       FIELD_TEXT = ELM_GENLIST_ITEM_FIELD_TEXT,
+                       FIELD_CONTENT = ELM_GENLIST_ITEM_FIELD_CONTENT,
+                       FIELD_STATE = ELM_GENLIST_ITEM_FIELD_STATE,
+               };
+
+       public:
+               using WidgetItem::WidgetItem;
+
+               void setSelectMode(SelectMode mode) const;
+               SelectMode getSelectMode() const;
+
+               void setSelected(bool isSelected) const;
+               bool isSelected() const;
+
+               void update() const;
+               void update(const Elm_Genlist_Item_Class *newItc) const;
+               void update(const char *parts, int fields = FIELD_ALL) const;
+       };
+}
+
+#include "GenlistItem.hpp"
+
+#endif // __UCL_GUI_GENLIST_ITEM_H__
diff --git a/ucl/include/ucl/gui/GenlistItem.hpp b/ucl/include/ucl/gui/GenlistItem.hpp
new file mode 100644 (file)
index 0000000..6920a88
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+namespace ucl {
+
+       inline void GenlistItem::setSelectMode(const SelectMode mode) const
+       {
+               elm_genlist_item_select_mode_set(getIt(),
+                               static_cast<Elm_Object_Select_Mode>(mode));
+       }
+
+       inline GenlistItem::SelectMode GenlistItem::getSelectMode() const
+       {
+               return static_cast<GenlistItem::SelectMode>(
+                               elm_genlist_item_select_mode_get(getIt()));
+       }
+
+       inline void GenlistItem::setSelected(const bool isSelected) const
+       {
+               elm_genlist_item_selected_set(getIt(), toEina(isSelected));
+       }
+
+       inline bool GenlistItem::isSelected() const
+       {
+               return elm_genlist_item_selected_get(getIt());
+       }
+
+       inline void GenlistItem::update() const
+       {
+               elm_genlist_item_update(getIt());
+       }
+
+       inline void GenlistItem::update(
+                       const Elm_Genlist_Item_Class *const newItc) const
+       {
+               elm_genlist_item_item_class_update(getIt(), newItc);
+       }
+
+       inline void GenlistItem::update(
+                       const char *const parts, const int fields) const
+       {
+               elm_genlist_item_fields_update(getIt(), parts,
+                               static_cast<Elm_Genlist_Item_Field_Type>(fields));
+       }
+}
diff --git a/ucl/include/ucl/gui/Layout.h b/ucl/include/ucl/gui/Layout.h
new file mode 100644 (file)
index 0000000..d349f92
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_GUI_LAYOUT_H__
+#define __UCL_GUI_LAYOUT_H__
+
+#include "EdjeWidget.h"
+
+namespace ucl {
+
+       UCL_DECLARE_REF_ALIASES(Layout);
+
+       class Layout : public EdjeWidget {
+       public:
+               class Builder final {
+               public:
+                       Builder();
+                       Builder &setTheme(const LayoutTheme &value);
+                       Builder &setEdjeFile(std::string filePath, EdjeGroup group);
+                       Builder &setIsOwner(bool value);
+                       Builder &setNeedBindToEo(bool value);
+                       LayoutSRef build(ElmWidget &parent) const;
+               private:
+                       LayoutTheme m_theme;
+                       std::string m_edjeFilePath;
+                       EdjeGroup m_edjeGroup;
+                       bool m_isOwner;
+                       bool m_needBindToEo;
+               };
+
+       public:
+               friend class ReffedObj<Layout>;
+               using EdjeWidget::EdjeWidget;
+               explicit Layout(Evas_Object *eo, bool isOwner = true);
+
+               bool setTheme(const LayoutTheme &theme);
+               bool setEdjeFile(const std::string &filePath, EdjeGroup group);
+
+               Variant getData(EdjeDataKey key);
+       };
+}
+
+#include "Layout.hpp"
+
+#endif // __UCL_GUI_LAYOUT_H__
diff --git a/ucl/include/ucl/gui/Layout.hpp b/ucl/include/ucl/gui/Layout.hpp
new file mode 100644 (file)
index 0000000..d6d18a3
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+namespace ucl {
+
+       // Layout::Builder //
+
+       inline Layout::Builder::Builder() :
+               m_isOwner(true),
+               m_needBindToEo(false)
+       {
+       }
+
+       inline Layout::Builder &Layout::Builder::setTheme(const LayoutTheme &theme)
+       {
+               m_theme = theme;
+               return *this;
+       }
+
+       inline Layout::Builder &Layout::Builder::setEdjeFile(
+                       std::string filePath, const EdjeGroup group)
+       {
+               m_edjeFilePath = std::move(filePath);
+               m_edjeGroup = group;
+               return *this;
+       }
+
+       inline Layout::Builder &Layout::Builder::setIsOwner(const bool value)
+       {
+               m_isOwner = value;
+               return *this;
+       }
+
+       inline Layout::Builder &Layout::Builder::setNeedBindToEo(const bool value)
+       {
+               m_needBindToEo = value;
+               return *this;
+       }
+
+       // Layout //
+
+       inline Layout::Layout(Evas_Object *const eo, const bool isOwner) :
+               EdjeWidget(nullptr, eo, isOwner)
+       {
+       }
+
+       inline bool Layout::setTheme(const LayoutTheme &theme)
+       {
+               return elm_layout_theme_set(getEo(),
+                               theme.klass, theme.group, theme.style);
+       }
+
+       inline bool Layout::setEdjeFile(const std::string &filePath,
+                       const EdjeGroup group)
+       {
+               return elm_layout_file_set(getEo(), filePath.c_str(), group.name);
+       }
+
+       inline Variant Layout::getData(EdjeDataKey key)
+       {
+               return elm_layout_data_get(getEo(), key);
+       }
+}
diff --git a/ucl/include/ucl/gui/NaviItem.h b/ucl/include/ucl/gui/NaviItem.h
new file mode 100644 (file)
index 0000000..1161847
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_GUI_NAVI_ITEM_H__
+#define __UCL_GUI_NAVI_ITEM_H__
+
+#include "WidgetItem.h"
+
+namespace ucl {
+
+       class NaviItem final : public WidgetItem {
+       public:
+               using PopHandler = Delegate<Eina_Bool(Elm_Object_Item *)>;
+
+       public:
+               using WidgetItem::WidgetItem;
+
+               void setPopHandler(const PopHandler &handler) const;
+
+               void popTo() const;
+               void promote() const;
+
+               void setTitleEnabled(bool value, bool useTransition = false) const;
+               bool isTitleEnabled() const;
+
+               void setTitle(const TString &title) const;
+       };
+}
+
+#include "NaviItem.hpp"
+
+#endif // __UCL_GUI_NAVI_ITEM_H__
diff --git a/ucl/include/ucl/gui/NaviItem.hpp b/ucl/include/ucl/gui/NaviItem.hpp
new file mode 100644 (file)
index 0000000..6b33fe4
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+namespace ucl {
+
+       inline void NaviItem::setPopHandler(const PopHandler &handler) const
+       {
+               elm_naviframe_item_pop_cb_set(getIt(),
+                               handler.getStubA(), handler.getData());
+       }
+
+       inline void NaviItem::setTitleEnabled(
+                       const bool value, const bool useTransition) const
+       {
+               elm_naviframe_item_title_enabled_set(getIt(),
+                               toEina(value), toEina(useTransition));
+       }
+
+       inline bool NaviItem::isTitleEnabled() const
+       {
+               return elm_naviframe_item_title_enabled_get(getIt());
+       }
+
+       inline void NaviItem::setTitle(const TString &title) const
+       {
+               if (isEmpty(title)) {
+                       setTitleEnabled(false);
+               } else {
+                       setText(title);
+                       setTitleEnabled(true);
+               }
+       }
+}
diff --git a/ucl/include/ucl/gui/Naviframe.h b/ucl/include/ucl/gui/Naviframe.h
new file mode 100644 (file)
index 0000000..66693f2
--- /dev/null
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_GUI_NAVIFRAME_H__
+#define __UCL_GUI_NAVIFRAME_H__
+
+#include <vector>
+
+#include "StyledWidget.h"
+#include "NaviItem.h"
+
+namespace ucl {
+
+       constexpr SmartEvent NAVI_TRANSITION_STARTED {"ucl,transition,started"};
+       constexpr SmartEvent NAVI_TRANSITION_FINISHED {"transition,finished"};
+
+       UCL_DECLARE_REF_ALIASES(Naviframe);
+
+       class Naviframe final : public StyledWidget {
+       public:
+               class Builder final {
+               public:
+                       Builder();
+                       Builder &setStyle(ElmStyle value);
+                       Builder &setNeedBindToEo(bool value);
+                       NaviframeSRef build(ElmWidget &parent) const;
+               private:
+                       ElmStyle m_style;
+                       bool m_needBindToEo;
+               };
+
+       public:
+               void setInTransition(bool inTransition);
+               bool isInTransition() const;
+
+               void setAutoBackBtn(bool value);
+               bool isAutoBackBtn() const;
+
+               void setPreservePop(bool value);
+               bool isPreservePop() const;
+
+               void setEventsEnabledOnTransition(bool value);
+               bool isEventsEnabledOnTransition() const;
+
+               Evas_Object *pop();
+
+               NaviItem push(const TString &title,
+                               Evas_Object *backBtn, Evas_Object *moreBtn,
+                               Evas_Object *content, ElmStyle style = nullptr);
+               NaviItem push(const TString &title,
+                               Evas_Object *content, ElmStyle style = nullptr);
+               NaviItem push(Evas_Object *content, ElmStyle style = nullptr);
+
+               NaviItem insertAfter(NaviItem after, const TString &title,
+                               Evas_Object *backBtn, Evas_Object *moreBtn,
+                               Evas_Object *content, ElmStyle style = nullptr);
+               NaviItem insertAfter(NaviItem after, const TString &title,
+                               Evas_Object *content, ElmStyle style = nullptr);
+               NaviItem insertAfter(NaviItem after,
+                               Evas_Object *content, ElmStyle style = nullptr);
+
+               NaviItem insertBefore(NaviItem before, const TString &title,
+                               Evas_Object *backBtn, Evas_Object *moreBtn,
+                               Evas_Object *content, ElmStyle style = nullptr);
+               NaviItem insertBefore(NaviItem before, const TString &title,
+                               Evas_Object *content, ElmStyle style = nullptr);
+               NaviItem insertBefore(NaviItem before,
+                               Evas_Object *content, ElmStyle style = nullptr);
+
+               NaviItem getTopItem()const;
+               NaviItem getBottomItem() const;
+               std::vector<NaviItem> getItems() const;
+
+       private:
+               friend class ReffedObj<Naviframe>;
+               Naviframe(IRefCountObj &rc, Evas_Object *eo);
+
+               void onTransitionFinished(Widget &widget, void *eventInfo);
+
+       private:
+               bool m_isInTransition;
+       };
+}
+
+#include "Naviframe.hpp"
+
+#endif // __UCL_GUI_NAVIFRAME_H__
diff --git a/ucl/include/ucl/gui/Naviframe.hpp b/ucl/include/ucl/gui/Naviframe.hpp
new file mode 100644 (file)
index 0000000..e8fdc19
--- /dev/null
@@ -0,0 +1,185 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+namespace ucl {
+
+       // Naviframe::Builder //
+
+       inline Naviframe::Builder::Builder() :
+               m_needBindToEo(true)
+       {
+       }
+
+       inline Naviframe::Builder &Naviframe::Builder::setStyle(
+                       const ElmStyle value)
+       {
+               m_style = value;
+               return *this;
+       }
+
+       inline Naviframe::Builder &Naviframe::Builder::setNeedBindToEo(
+                       const bool value)
+       {
+               m_needBindToEo = value;
+               return *this;
+       }
+
+       // Naviframe //
+
+       inline bool Naviframe::isInTransition() const
+       {
+               return m_isInTransition;
+       }
+
+       inline void Naviframe::setAutoBackBtn(const bool value)
+       {
+               elm_naviframe_prev_btn_auto_pushed_set(getEo(), toEina(value));
+       }
+
+       inline bool Naviframe::isAutoBackBtn() const
+       {
+               return elm_naviframe_prev_btn_auto_pushed_get(getEo());
+       }
+
+       inline void Naviframe::setPreservePop(const bool value)
+       {
+               elm_naviframe_content_preserve_on_pop_set(getEo(), toEina(value));
+       }
+
+       inline bool Naviframe::isPreservePop() const
+       {
+               return elm_naviframe_content_preserve_on_pop_get(getEo());
+       }
+
+       inline void Naviframe::setEventsEnabledOnTransition(const bool value)
+       {
+               elm_naviframe_event_enabled_set(getEo(), toEina(value));
+       }
+
+       inline bool Naviframe::isEventsEnabledOnTransition() const
+       {
+               return elm_naviframe_event_enabled_get(getEo());
+       }
+
+       inline Evas_Object *Naviframe::pop()
+       {
+               auto result = elm_naviframe_item_pop(getEo());
+               if (getBottomItem()) {
+                       setInTransition(true);
+               }
+               return result;
+       }
+
+       inline NaviItem Naviframe::push(const TString &title,
+                       Evas_Object *const backBtn, Evas_Object *const moreBtn,
+                       Evas_Object *const content, const ElmStyle style)
+       {
+               auto result = NaviItem(elm_naviframe_item_push(getEo(),
+                               nullptr, backBtn, moreBtn, content, style.name));
+               result.setTitle(title);
+               if (result != getBottomItem()) {
+                       setInTransition(true);
+               }
+               return result;
+       }
+
+       inline NaviItem Naviframe::push(const TString &title,
+                       Evas_Object *const content, const ElmStyle style)
+       {
+               return push(title, nullptr, nullptr, content, style);
+       }
+
+       inline NaviItem Naviframe::push(
+                       Evas_Object *const content, const ElmStyle style)
+       {
+               return push(nullptr, nullptr, nullptr, content, style);
+       }
+
+       inline NaviItem Naviframe::insertAfter(NaviItem after,
+                       const TString &title,
+                       Evas_Object *const backBtn, Evas_Object *const moreBtn,
+                       Evas_Object *const content, const ElmStyle style)
+       {
+               auto result = NaviItem(elm_naviframe_item_insert_after(getEo(),
+                               after, nullptr, backBtn, moreBtn, content, style.name));
+               result.setTitle(title);
+               return result;
+       }
+
+       inline NaviItem Naviframe::insertAfter(NaviItem after,
+                       const TString &title,
+                       Evas_Object *const content, const ElmStyle style)
+       {
+               return insertAfter(after, title, nullptr, nullptr, content, style);
+       }
+
+       inline NaviItem Naviframe::insertAfter(NaviItem after,
+                       Evas_Object *const content, const ElmStyle style)
+       {
+               return insertAfter(after, nullptr, nullptr, nullptr, content, style);
+       }
+
+       inline NaviItem Naviframe::insertBefore(NaviItem before,
+                       const TString &title,
+                       Evas_Object *const backBtn, Evas_Object *const moreBtn,
+                       Evas_Object *const content, const ElmStyle style)
+       {
+               auto result = NaviItem(elm_naviframe_item_insert_before(getEo(),
+                               before, nullptr, backBtn, moreBtn, content, style.name));
+               result.setTitle(title);
+               return result;
+       }
+
+       inline NaviItem Naviframe::insertBefore(NaviItem before,
+                       const TString &title,
+                       Evas_Object *const content, const ElmStyle style)
+       {
+               return insertAfter(before, title, nullptr, nullptr, content, style);
+       }
+
+       inline NaviItem Naviframe::insertBefore(NaviItem before,
+                       Evas_Object *const content, const ElmStyle style)
+       {
+               return insertAfter(before, nullptr, nullptr, nullptr, content, style);
+       }
+
+       inline NaviItem Naviframe::getTopItem()const
+       {
+               return NaviItem(elm_naviframe_top_item_get(getEo()));
+       }
+
+       inline NaviItem Naviframe::getBottomItem() const
+       {
+               return NaviItem(elm_naviframe_bottom_item_get(getEo()));
+       }
+
+       inline std::vector<NaviItem> Naviframe::getItems() const
+       {
+               std::vector<NaviItem> result;
+
+               Eina_List *const items = elm_naviframe_items_get(getEo());
+               Eina_List *l = nullptr;
+               void *data = nullptr;
+
+               EINA_LIST_FOREACH(items, l, data) {
+                       result.emplace_back(static_cast<Elm_Object_Item *>(data));
+               }
+
+               eina_list_free(items);
+
+               return result;
+       }
+}
diff --git a/ucl/include/ucl/gui/StyledWidget.h b/ucl/include/ucl/gui/StyledWidget.h
new file mode 100644 (file)
index 0000000..223a293
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_GUI_STYLED_WIDGET_H__
+#define __UCL_GUI_STYLED_WIDGET_H__
+
+#include "EdjeWidget.h"
+
+namespace ucl {
+
+       UCL_DECLARE_REF_ALIASES(StyledWidget);
+
+       class StyledWidget : public EdjeWidget {
+       public:
+               friend class ReffedObj<StyledWidget>;
+               using EdjeWidget::EdjeWidget;
+               explicit StyledWidget(Evas_Object *eo, bool isOwner = true);
+
+               void setStyle(ElmStyle style);
+       };
+}
+
+#include "StyledWidget.hpp"
+
+#endif // __UCL_GUI_STYLED_WIDGET_H__
diff --git a/ucl/include/ucl/gui/StyledWidget.hpp b/ucl/include/ucl/gui/StyledWidget.hpp
new file mode 100644 (file)
index 0000000..cb32329
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+namespace ucl {
+
+       inline StyledWidget::StyledWidget(
+                       Evas_Object *const eo, const bool isOwner) :
+               EdjeWidget(nullptr, eo, isOwner)
+       {
+       }
+
+       inline void StyledWidget::setStyle(const ElmStyle style)
+       {
+               elm_object_style_set(getEo(), style.name);
+       }
+}
diff --git a/ucl/include/ucl/gui/Theme.h b/ucl/include/ucl/gui/Theme.h
new file mode 100644 (file)
index 0000000..d8b5b31
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_GUI_THEME_H__
+#define __UCL_GUI_THEME_H__
+
+#include "types.h"
+
+namespace ucl {
+
+       class Theme final : NonCopyable {
+       public:
+               static Theme create();
+
+               friend void swap(Theme &x, Theme &y);
+
+       public:
+               Theme();
+               Theme(std::nullptr_t);
+               explicit Theme(Elm_Theme *th, bool isOwner = false);
+               Theme(Theme &&tmp);
+               Theme &operator=(Theme &&tmp);
+               ~Theme();
+
+               Elm_Theme *getTh();
+               const Elm_Theme *getTh() const;
+
+               operator Elm_Theme *();
+               operator const Elm_Theme *() const;
+
+               void addExtension(const std::string edjePath);
+               void addOverlay(const std::string edjePath);
+
+       private:
+               Elm_Theme *m_th;
+               bool m_isOwner;
+       };
+
+       // Non-member functions //
+
+       bool isValid(const Theme &item);
+}
+
+#include "Theme.hpp"
+
+#endif // __UCL_GUI_THEME_H__
diff --git a/ucl/include/ucl/gui/Theme.hpp b/ucl/include/ucl/gui/Theme.hpp
new file mode 100644 (file)
index 0000000..65910df
--- /dev/null
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+namespace ucl {
+
+       inline Theme Theme::create()
+       {
+               Elm_Theme *const th = elm_theme_new();
+               if (th) {
+                       elm_theme_ref_set(th, nullptr);
+               }
+               return Theme(th, true);
+       }
+
+       inline Theme::Theme() :
+               m_th(nullptr),
+               m_isOwner(false)
+       {
+       }
+
+       inline Theme::Theme(std::nullptr_t) :
+               Theme()
+       {
+       }
+
+       inline Theme::Theme(Elm_Theme *const th, const bool isOwner) :
+               m_th(th),
+               m_isOwner(isOwner)
+       {
+       }
+
+       inline Theme::Theme(Theme &&tmp)
+       {
+               m_th = tmp.m_th;
+               tmp.m_th = nullptr;
+       }
+
+       inline Theme &Theme::operator=(Theme &&tmp)
+       {
+               swap(*this, tmp);
+               return *this;
+       }
+
+       inline Theme::~Theme()
+       {
+               if (m_isOwner && m_th) {
+                       elm_theme_free(m_th);
+               }
+       }
+
+       inline Elm_Theme *Theme::getTh()
+       {
+               return m_th;
+       }
+
+       inline const Elm_Theme *Theme::getTh() const
+       {
+               return m_th;
+       }
+
+       inline Theme::operator Elm_Theme *()
+       {
+               return getTh();
+       }
+
+       inline Theme::operator const Elm_Theme *() const
+       {
+               return getTh();
+       }
+
+       inline void Theme::addExtension(const std::string edjePath)
+       {
+               elm_theme_extension_add(getTh(), edjePath.c_str());
+       }
+
+       inline void Theme::addOverlay(const std::string edjePath)
+       {
+               elm_theme_overlay_add(getTh(), edjePath.c_str());
+       }
+
+       // Non-member functions //
+
+       inline bool isValid(const Theme &item)
+       {
+               return !!item.getTh();
+       }
+
+       inline void swap(Theme &x, Theme &y)
+       {
+               std::swap(x.m_th, y.m_th);
+               std::swap(x.m_isOwner, y.m_isOwner);
+       }
+}
diff --git a/ucl/include/ucl/gui/Widget.h b/ucl/include/ucl/gui/Widget.h
new file mode 100644 (file)
index 0000000..ac47866
--- /dev/null
@@ -0,0 +1,169 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_GUI_WIDGET_H__
+#define __UCL_GUI_WIDGET_H__
+
+#include <list>
+
+#include "types.h"
+
+#include "ucl/misc/RefCountAware.h"
+
+#define UCL_SMART_FWD "ucl,fwd,"
+
+namespace ucl {
+
+       UCL_DECLARE_REF_ALIASES(Widget);
+
+       class Widget : public RefCountAware {
+       public:
+               static constexpr auto EXPAND = EVAS_HINT_EXPAND;
+               static constexpr auto FILL = EVAS_HINT_FILL;
+
+       public:
+               explicit Widget(Evas_Object *eo, bool isOwner = true);
+               virtual ~Widget();
+
+               void bindToEo();
+               void unbindFromEo();
+
+               void setIsOwner(bool value);
+
+               Evas_Object *getEo();
+               const Evas_Object *getEo() const;
+
+               operator Evas_Object *();
+               operator const Evas_Object *() const;
+
+               Evas *getEvas() const;
+
+               void setData(EoDataKey key, void *data);
+               void delData(EoDataKey key);
+               void *getData(EoDataKey key) const;
+
+               void addEventHandler(WidgetEvent event, WidgetEventHandler handler);
+               void addEventHandler(SmartEvent event, WidgetEventHandler handler);
+
+               void delEventHandler(WidgetEvent event, WidgetEventHandler handler);
+               void delEventHandler(SmartEvent event, WidgetEventHandler handler);
+
+               void callEvent(SmartEvent event, void *eventInfo = nullptr);
+
+               void markForDeletion();
+
+               void setVisible(bool value);
+               bool isVisible() const;
+
+               void setColor(int r, int g, int b, int a = 255);
+               void setColor(int l, int a = 255);
+               void getColor(int &r, int &g, int &b, int &a) const;
+
+               void calculate();
+
+               void setGeometry(int x, int y, int w, int h);
+               void move(int x, int y);
+               void resize(int w, int h);
+
+               void getGeometry(int *x, int *y, int *w, int *h) const;
+
+               void setWeight(double w, double h);
+               void setAlign(double w, double h);
+               void setMin(int w, int h);
+               void setMax(int w, int h);
+
+               void getWeight(double *w, double *h) const;
+               void getAlign(double *w, double *h) const;
+               void getMin(int *w, int *h) const;
+               void getMax(int *w, int *h) const;
+
+               void setARHint(WidgetARHint arControl, int w, int h);
+               void getARHint(WidgetARHint &arControl, int &w, int &h);
+
+               void setFocused(bool value);
+               bool isFocused() const;
+
+       protected:
+               friend class ReffedObj<Widget>;
+               Widget(IRefCountObj *rc, Evas_Object *eo, bool isOwner = true);
+
+               virtual void setFocusedImpl(bool value);
+               virtual bool isFocusedImpl() const;
+               virtual bool ensureFwdEvent(SmartEvent fwdEvent);
+
+       private:
+               class EventProxy;
+               using EventProxies = std::list<EventProxy>;
+               using EventProxiesIt = EventProxies::iterator;
+
+       private:
+               void updateRefs();
+
+               void updateEoRef();
+               bool needKeepEoRef() const;
+               void updateSelfRef();
+               bool needKeepSelfRef() const;
+
+               void setSelfRefUnique(const bool value);
+
+               void onEoDel(Evas *e, Evas_Object *obj, void *event_info);
+
+               void delEventProxy(const EventProxiesIt it);
+
+       public:
+               // This section MUST be public!
+               // Signal to RefCountObj<T, C> to call onUniqueChanged()
+               enum { _ENABLE_ON_UNIQUE_CHANGED_DISPATCH };
+
+       protected:
+               // This section MAY be protected
+               void onUniqueChanged(bool isUnique);
+
+       private:
+               Evas_Object *m_eo;
+               EventProxies m_eventProxies;
+               WidgetSRef m_selfRef;
+               bool m_isOwner;
+               bool m_isBoundToEo;
+               bool m_isEoRefKept;
+               bool m_isSelfRefUnique;
+       };
+
+       // Non-member functions //
+
+       void getPosition(const Widget &widget, int *x, int *y);
+       void getSize(const Widget &widget, int *w, int *h);
+
+       void show(Widget &widget);
+       void hide(Widget &widget);
+
+       void makeTransparent(Widget &widget);
+       void makeWhite(Widget &widget);
+
+       void focus(Widget &widget);
+       void unfocus(Widget &widget);
+
+       void expand(Widget &widget);
+       void fill(Widget &widget);
+       void expandAndFill(Widget &widget);
+
+       bool operator==(const Widget &lhs, const Widget &rhs);
+       bool operator!=(const Widget &lhs, const Widget &rhs);
+}
+
+#include "Widget.hpp"
+
+#endif // __UCL_GUI_WIDGET_H__
diff --git a/ucl/include/ucl/gui/Widget.hpp b/ucl/include/ucl/gui/Widget.hpp
new file mode 100644 (file)
index 0000000..95da66a
--- /dev/null
@@ -0,0 +1,274 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+namespace ucl { namespace { namespace impl {
+
+       constexpr auto WIDGET_DATA_NAME = "__WIDGET_DATA_NAME__";
+}}}
+
+namespace ucl {
+
+       inline Widget::Widget(Evas_Object *const eo, const bool isOwner) :
+               Widget(nullptr, eo, isOwner)
+       {
+       }
+
+       inline void Widget::setIsOwner(const bool value)
+       {
+               if (value != m_isOwner) {
+                       m_isOwner = value;
+                       updateRefs();
+               }
+       }
+
+       inline Evas_Object *Widget::getEo()
+       {
+               return m_eo;
+       }
+
+       inline const Evas_Object *Widget::getEo() const
+       {
+               return m_eo;
+       }
+
+       inline Widget::operator Evas_Object *()
+       {
+               return getEo();
+       }
+
+       inline Widget::operator const Evas_Object *() const
+       {
+               return getEo();
+       }
+
+       inline Evas *Widget::getEvas() const
+       {
+               return evas_object_evas_get(getEo());
+       }
+
+       inline void Widget::setData(const EoDataKey key, void *const data)
+       {
+               evas_object_data_set(getEo(), key.name, data);
+       }
+
+       inline void Widget::delData(const EoDataKey key)
+       {
+               evas_object_data_del(getEo(), key.name);
+       }
+
+       inline void *Widget::getData(const EoDataKey key) const
+       {
+               return evas_object_data_get(getEo(), key.name);
+       }
+
+       inline void Widget::callEvent(SmartEvent event, void *eventInfo)
+       {
+               evas_object_smart_callback_call(getEo(), event, eventInfo);
+       }
+
+       inline void Widget::markForDeletion()
+       {
+               evas_object_del(getEo());
+       }
+
+       inline void Widget::setVisible(bool value)
+       {
+               if (value) {
+                       evas_object_show(getEo());
+               } else {
+                       evas_object_hide(getEo());
+               }
+       }
+
+       inline bool Widget::isVisible() const
+       {
+               return evas_object_visible_get(getEo());
+       }
+
+       inline void Widget::setColor(const int r, const int g,
+                       const int b, const int a)
+       {
+               evas_object_color_set(getEo(), r, g, b, a);
+       }
+
+       inline void Widget::setColor(const int l, const int a)
+       {
+               evas_object_color_set(getEo(), l, l, l, a);
+       }
+
+       inline void Widget::getColor(int &r, int &g, int &b, int &a) const
+       {
+               evas_object_color_get(getEo(), &r, &g, &b, &a);
+       }
+
+       inline void Widget::calculate()
+       {
+               evas_object_smart_calculate(getEo());
+       }
+
+       inline void Widget::setGeometry(const int x, const int y,
+                       const int w, const int h)
+       {
+               evas_object_geometry_set(getEo(), x, y, w, h);
+       }
+
+       inline void Widget::move(const int x, const int y)
+       {
+               evas_object_move(getEo(), x, y);
+       }
+
+       inline void Widget::resize(const int w, const int h)
+       {
+               evas_object_resize(getEo(), w, h);
+       }
+
+       inline void Widget::getGeometry(int *const x, int *const y,
+                       int *const w, int *const h) const
+       {
+               evas_object_geometry_get(getEo(), x, y, w, h);
+       }
+
+       inline void Widget::setWeight(const double w, const double h)
+       {
+               evas_object_size_hint_weight_set(getEo(), w, h);
+       }
+
+       inline void Widget::setAlign(const double w, const double h)
+       {
+               evas_object_size_hint_align_set(getEo(), w, h);
+       }
+
+       inline void Widget::setMin(const int w, const int h)
+       {
+               evas_object_size_hint_min_set(getEo(), w, h);
+       }
+
+       inline void Widget::setMax(const int w, const int h)
+       {
+               evas_object_size_hint_max_set(getEo(), w, h);
+       }
+
+       inline void Widget::getWeight(double *const w, double *const h) const
+       {
+               evas_object_size_hint_weight_get(getEo(), w, h);
+       }
+
+       inline void Widget::getAlign(double *const w, double *const h) const
+       {
+               evas_object_size_hint_align_get(getEo(), w, h);
+       }
+
+       inline void Widget::getMin(int *const w, int *const h) const
+       {
+               evas_object_size_hint_min_get(getEo(), w, h);
+       }
+
+       inline void Widget::getMax(int *const w, int *const h) const
+       {
+               evas_object_size_hint_max_get(getEo(), w, h);
+       }
+
+       inline void Widget::setARHint(WidgetARHint arControl, int w, int h)
+       {
+               evas_object_size_hint_aspect_set(getEo(),
+                               static_cast<Evas_Aspect_Control>(arControl), w, h);
+       }
+
+       inline void Widget::getARHint(WidgetARHint &arControl, int &w, int &h)
+       {
+               Evas_Aspect_Control tmp = EVAS_ASPECT_CONTROL_NEITHER;
+               evas_object_size_hint_aspect_get(getEo(), &tmp, &w, &h);
+               arControl = static_cast<WidgetARHint>(tmp);
+       }
+
+       inline void Widget::setFocused(const bool value)
+       {
+               setFocusedImpl(value);
+       }
+
+       inline bool Widget::isFocused() const
+       {
+               return isFocusedImpl();
+       }
+
+       // Non-member functions //
+
+       inline void getPosition(const Widget &widget, int *x, int *y)
+       {
+               widget.getGeometry(x, y, nullptr, nullptr);
+       }
+
+       inline void getSize(const Widget &widget, int *w, int *h)
+       {
+               widget.getGeometry(nullptr, nullptr, w, h);
+       }
+
+       inline void show(Widget &widget)
+       {
+               widget.setVisible(true);
+       }
+
+       inline void hide(Widget &widget)
+       {
+               widget.setVisible(false);
+       }
+
+       inline void makeTransparent(Widget &widget)
+       {
+               widget.setColor(0, 0);
+       }
+
+       inline void makeWhite(Widget &widget)
+       {
+               widget.setColor(255);
+       }
+
+       inline void focus(Widget &widget)
+       {
+               widget.setFocused(true);
+       }
+
+       inline void unfocus(Widget &widget)
+       {
+               widget.setFocused(false);
+       }
+
+       inline void expand(Widget &widget)
+       {
+               widget.setWeight(Widget::EXPAND, Widget::EXPAND);
+       }
+
+       inline void fill(Widget &widget)
+       {
+               widget.setAlign(Widget::FILL, Widget::FILL);
+       }
+
+       inline void expandAndFill(Widget &widget)
+       {
+               expand(widget);
+               fill(widget);
+       }
+
+       inline bool operator==(const Widget &lhs, const Widget &rhs)
+       {
+               return (lhs.getEo() == rhs.getEo());
+       }
+
+       inline bool operator!=(const Widget &lhs, const Widget &rhs)
+       {
+               return (lhs.getEo() != rhs.getEo());
+       }
+}
diff --git a/ucl/include/ucl/gui/WidgetItem.h b/ucl/include/ucl/gui/WidgetItem.h
new file mode 100644 (file)
index 0000000..7794444
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_GUI_WIDGET_ITEM_H__
+#define __UCL_GUI_WIDGET_ITEM_H__
+
+#include "Widget.h"
+
+namespace ucl {
+
+       class WidgetItem {
+       public:
+               constexpr WidgetItem();
+               constexpr WidgetItem(std::nullptr_t);
+               explicit WidgetItem(Elm_Object_Item *it);
+
+               Elm_Object_Item *getIt() const;
+
+               operator Elm_Object_Item *() const;
+               operator bool() const;
+
+               Evas_Object *getWidget() const;
+
+               void setDelCallback(Evas_Smart_Cb cb) const;
+
+               void del();
+
+               void setData(void *data) const;
+               void *getData() const;
+
+               void setEnabled(bool value) const;
+               bool isEnabled() const;
+
+               void setStyle(ElmStyle style) const;
+
+               void setText(const TString &value) const;
+               void setText(const TString &value, EdjePart part) const;
+
+               TString getText() const;
+               TString getText(EdjePart part) const;
+
+               void setContent(Evas_Object *content) const;
+               void setContent(Evas_Object *content, EdjePart part) const;
+               Evas_Object *unsetContent() const;
+               Evas_Object *unsetContent(EdjePart part) const;
+
+               Evas_Object *getContent() const;
+               Evas_Object *getContent(EdjePart part) const;
+
+               void emit(EdjeSignal signal,EdjeSignalSrc source =
+                               EdjeSignalSrc("")) const;
+
+       private:
+               Elm_Object_Item *m_it;
+       };
+
+       // Non-member functions //
+
+       void enable(WidgetItem item);
+       void disable(WidgetItem item);
+
+       bool operator==(WidgetItem lhs, WidgetItem rhs);
+       bool operator!=(WidgetItem lhs, WidgetItem rhs);
+}
+
+#include "WidgetItem.hpp"
+
+#endif // __UCL_GUI_WIDGET_ITEM_H__
diff --git a/ucl/include/ucl/gui/WidgetItem.hpp b/ucl/include/ucl/gui/WidgetItem.hpp
new file mode 100644 (file)
index 0000000..26b6cbd
--- /dev/null
@@ -0,0 +1,158 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+namespace ucl {
+
+       constexpr WidgetItem::WidgetItem() :
+               m_it(nullptr)
+       {
+       }
+
+       constexpr WidgetItem::WidgetItem(std::nullptr_t) :
+               WidgetItem()
+       {
+       }
+
+       inline WidgetItem::WidgetItem(Elm_Object_Item *const it) :
+               m_it(it)
+       {
+       }
+
+       inline Elm_Object_Item *WidgetItem::getIt() const
+       {
+               return m_it;
+       }
+
+       inline WidgetItem::operator Elm_Object_Item *() const
+       {
+               return m_it;
+       }
+
+       inline WidgetItem::operator bool() const
+       {
+               return !!m_it;
+       }
+
+       inline Evas_Object *WidgetItem::getWidget() const
+       {
+               return elm_object_item_widget_get(getIt());
+       }
+
+       inline void WidgetItem::setDelCallback(const Evas_Smart_Cb cb) const
+       {
+               elm_object_item_del_cb_set(getIt(), cb);
+       }
+
+       inline void WidgetItem::del()
+       {
+               elm_object_item_del(m_it);
+               m_it = nullptr;
+       }
+
+       inline void WidgetItem::setData(void *const data) const
+       {
+               elm_object_item_data_set(getIt(), data);
+       }
+
+       inline void *WidgetItem::getData() const
+       {
+               return elm_object_item_data_get(getIt());
+       }
+
+       inline void WidgetItem::setEnabled(const bool value) const
+       {
+               elm_object_item_disabled_set(getIt(), toEina(!value));
+       }
+
+       inline bool WidgetItem::isEnabled() const
+       {
+               return (elm_object_item_disabled_get(getIt()) ? false : true);
+       }
+
+       inline void WidgetItem::setStyle(const ElmStyle style) const
+       {
+               elm_object_item_style_set(getIt(), style.name);
+       }
+
+       inline TString WidgetItem::getText() const
+       {
+               return elm_object_item_text_get(getIt());
+       }
+
+       inline TString WidgetItem::getText(const EdjePart part) const
+       {
+               return elm_object_item_part_text_get(getIt(), part.name);
+       }
+
+       inline void WidgetItem::setContent(Evas_Object *const content) const
+       {
+               elm_object_item_content_set(getIt(), content);
+       }
+
+       inline void WidgetItem::setContent(Evas_Object *const content,
+                       const EdjePart part) const
+       {
+               elm_object_item_part_content_set(getIt(), part.name, content);
+       }
+
+       inline Evas_Object *WidgetItem::unsetContent() const
+       {
+               return elm_object_item_content_unset(getIt());
+       }
+
+       inline Evas_Object *WidgetItem::unsetContent(const EdjePart part) const
+       {
+               return elm_object_item_part_content_unset(getIt(), part.name);
+       }
+
+       inline Evas_Object *WidgetItem::getContent() const
+       {
+               return elm_object_item_content_get(getIt());
+       }
+
+       inline Evas_Object *WidgetItem::getContent(const EdjePart part) const
+       {
+               return elm_object_item_part_content_get(getIt(), part.name);
+       }
+
+       inline void WidgetItem::emit(const EdjeSignal signal,
+                       const EdjeSignalSrc source) const
+       {
+               elm_object_item_signal_emit(getIt(), signal.name, source.name);
+       }
+
+       // Non-member functions //
+
+       inline void enable(const WidgetItem item)
+       {
+               item.setEnabled(true);
+       }
+
+       inline void disable(const WidgetItem item)
+       {
+               item.setEnabled(false);
+       }
+
+       inline bool operator==(const WidgetItem lhs, const WidgetItem rhs)
+       {
+               return (lhs.getIt() == rhs.getIt());
+       }
+
+       inline bool operator!=(const WidgetItem lhs, const WidgetItem rhs)
+       {
+               return (lhs.getIt() != rhs.getIt());
+       }
+}
diff --git a/ucl/include/ucl/gui/Window.h b/ucl/include/ucl/gui/Window.h
new file mode 100644 (file)
index 0000000..9aa598d
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_GUI_WINDOW_H__
+#define __UCL_GUI_WINDOW_H__
+
+#include <vector>
+
+#include "StyledWidget.h"
+
+namespace ucl {
+
+       constexpr SmartEvent WIN_ROTATION_CHANGED {"wm,rotation,changed"};
+
+       UCL_DECLARE_REF_ALIASES(Window);
+
+       class Window final : public ElmWidget {
+       public:
+               enum class Type {
+                       BASIC = ELM_WIN_BASIC
+               };
+
+               class Builder final {
+               public:
+                       Builder();
+
+                       Builder &setWinEo(Evas_Object *value);
+
+                       Builder &setType(Type type);
+                       Builder &setName(std::string value);
+
+                       Builder &setTitle(std::string value);
+                       Builder &setSetIndicatorVisible(bool value);
+                       Builder &setRotations(std::vector<int> value);
+
+                       Builder &setIsOwner(bool value);
+                       Builder &setNeedBindToEo(bool value);
+
+                       WindowSRef build() const;
+               private:
+                       std::string m_name;
+                       std::string m_title;
+                       std::vector<int> m_rotations;
+                       Evas_Object *m_winEo;
+                       Type m_type;
+                       bool m_isIndicatorVisible;
+                       bool m_isOwner;
+                       bool m_isOwnerWasSet;
+                       bool m_needBindToEo;
+               };
+
+       public:
+               StyledWidget &getConformant();
+               const StyledWidget &getConformant() const;
+
+               void getScreenSize(int *w, int *h) const;
+
+               void setTitle(const std::string &title);
+               std::string getTitle() const;
+
+               void setIndicatorVisible(bool value);
+               bool isIndicatorVisible() const;
+
+               bool isRotationsSupported() const;
+               void setRotations(const std::vector<int> &value);
+
+               void lower();
+
+       private:
+               friend class ReffedObj<Window>;
+               Window(IRefCountObj *rc, Evas_Object *eo,
+                               bool isOwner, Evas_Object *conform);
+
+       private:
+               StyledWidget m_conform;
+       };
+
+       // Non-member functions //
+
+       // Window //
+
+       void showIndicator(Window &win);
+       void hideIndicator(Window &win);
+
+       // Window::Type //
+
+       bool isValid(Window::Type winType);
+}
+
+#include "Window.hpp"
+
+#endif // __UCL_GUI_WINDOW_H__
diff --git a/ucl/include/ucl/gui/Window.hpp b/ucl/include/ucl/gui/Window.hpp
new file mode 100644 (file)
index 0000000..d5b1828
--- /dev/null
@@ -0,0 +1,173 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 <algorithm>
+
+namespace ucl {
+
+       // Window::Builder //
+
+       inline Window::Builder::Builder() :
+               m_rotations({0}),
+               m_winEo(nullptr),
+               m_type(Type::BASIC),
+               m_isIndicatorVisible(false),
+               m_isOwner(false),
+               m_isOwnerWasSet(false),
+               m_needBindToEo(true)
+       {
+       }
+
+       inline Window::Builder &Window::Builder::setWinEo(Evas_Object *const value)
+       {
+               m_winEo = value;
+               return *this;
+       }
+
+       inline Window::Builder &Window::Builder::setType(const Type type)
+       {
+               m_type = type;
+               return *this;
+       }
+
+       inline Window::Builder &Window::Builder::setName(std::string value)
+       {
+               m_name = std::move(value);
+               return *this;
+       }
+
+       inline Window::Builder &Window::Builder::setTitle(std::string value)
+       {
+               m_title = std::move(value);
+               return *this;
+       }
+
+       inline Window::Builder &Window::Builder::setSetIndicatorVisible(
+                       const bool value)
+       {
+               m_isIndicatorVisible = value;
+               return *this;
+       }
+
+       inline Window::Builder &Window::Builder::setRotations(
+                       std::vector<int> value)
+       {
+               m_rotations = std::move(value);
+               return *this;
+       }
+
+       inline Window::Builder &Window::Builder::setIsOwner(const bool value)
+       {
+               m_isOwner = value;
+               m_isOwnerWasSet = true;
+               return *this;
+       }
+
+       inline Window::Builder &Window::Builder::setNeedBindToEo(const bool value)
+       {
+               m_needBindToEo = value;
+               return *this;
+       }
+
+       // Window //
+
+       inline Window::Window(IRefCountObj *const rc, Evas_Object *const eo,
+                       const bool isOwner, Evas_Object *const conform) :
+               ElmWidget(rc, eo, isOwner),
+               m_conform(conform)
+       {
+       }
+
+       inline StyledWidget &Window::getConformant()
+       {
+               return m_conform;
+       }
+
+       inline const StyledWidget &Window::getConformant() const
+       {
+               return m_conform;
+       }
+
+       inline void Window::getScreenSize(int *const w, int *const h) const
+       {
+               elm_win_screen_size_get(getEo(), nullptr, nullptr, w, h);
+       }
+
+       inline void Window::setTitle(const std::string &title)
+       {
+               elm_win_title_set(getEo(), title.c_str());
+       }
+
+       inline std::string Window::getTitle() const
+       {
+               return nz(elm_win_title_get(getEo()));
+       }
+
+       inline void Window::setIndicatorVisible(bool value)
+       {
+               if (value) {
+                       elm_win_indicator_mode_set(getEo(), ELM_WIN_INDICATOR_SHOW);
+               } else {
+                       elm_win_indicator_mode_set(getEo(), ELM_WIN_INDICATOR_HIDE);
+               }
+       }
+
+       inline bool Window::isIndicatorVisible() const
+       {
+               return (elm_win_indicator_mode_get(getEo()) == ELM_WIN_INDICATOR_SHOW);
+       }
+
+       inline bool Window::isRotationsSupported() const
+       {
+               return elm_win_wm_rotation_supported_get(getEo());
+       }
+
+       inline void Window::setRotations(const std::vector<int> &value)
+       {
+               elm_win_wm_rotation_available_rotations_set(getEo(),
+                               value.data(), value.size());
+       }
+
+       inline void Window::lower()
+       {
+               elm_win_lower(getEo());
+       }
+
+       // Non-member functions //
+
+       // Window //
+
+       inline void showIndicator(Window &win)
+       {
+               win.setIndicatorVisible(true);
+       }
+
+       inline void hideIndicator(Window &win)
+       {
+               win.setIndicatorVisible(false);
+       }
+
+       // Window::Type //
+
+       inline bool isValid(Window::Type winType)
+       {
+               switch (winType) {
+               case Window::Type::BASIC:
+                       return true;
+               }
+               return false;
+       }
+}
diff --git a/ucl/include/ucl/gui/helpers.h b/ucl/include/ucl/gui/helpers.h
new file mode 100644 (file)
index 0000000..d42eccb
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_GUI_HELPERS_H__
+#define __UCL_GUI_HELPERS_H__
+
+#include "Widget.h"
+
+namespace ucl {
+
+       // Converts Evas_Object to Widget pointer //
+
+       Widget *asWidget(Evas_Object *eo);
+       const Widget *asWidget(const Evas_Object *eo);
+
+       // Widget casting functions from Evas_Object //
+
+       template <class WIDGET_TYPE>
+       inline auto staticWidgetCast(Evas_Object *eo) ->
+                       decltype(static_cast<WIDGET_TYPE *>(asWidget(eo)))
+       {
+               return static_cast<WIDGET_TYPE *>(asWidget(eo));
+       }
+
+       template <class WIDGET_TYPE>
+       inline auto staticWidgetCast(const Evas_Object *eo) ->
+                       decltype(static_cast<WIDGET_TYPE *>(asWidget(eo)))
+       {
+               return static_cast<WIDGET_TYPE *>(asWidget(eo));
+       }
+
+       template <class WIDGET_TYPE>
+       inline auto dynamicWidgetCast(Evas_Object *eo) ->
+                       decltype(dynamic_cast<WIDGET_TYPE *>(asWidget(eo)))
+       {
+               return dynamic_cast<WIDGET_TYPE *>(asWidget(eo));
+       }
+
+       template <class WIDGET_TYPE>
+       inline auto dynamicWidgetCast(const Evas_Object *eo) ->
+                       decltype(dynamic_cast<WIDGET_TYPE *>(asWidget(eo)))
+       {
+               return dynamic_cast<WIDGET_TYPE *>(asWidget(eo));
+       }
+
+       template <class WIDGET_TYPE>
+       inline auto staticWidgetRefCast(Evas_Object *eo) ->
+                       decltype(asShared(staticWidgetCast<WIDGET_TYPE>(eo)))
+       {
+               return asShared(staticWidgetCast<WIDGET_TYPE>(eo));
+       }
+
+       template <class WIDGET_TYPE>
+       inline auto staticWidgetRefCast(const Evas_Object *eo) ->
+                       decltype(asShared(staticWidgetCast<WIDGET_TYPE>(eo)))
+       {
+               return asShared(staticWidgetCast<WIDGET_TYPE>(eo));
+       }
+
+       template <class WIDGET_TYPE>
+       inline auto dynamicWidgetRefCast(Evas_Object *eo) ->
+                       decltype(asShared(dynamicWidgetCast<WIDGET_TYPE>(eo)))
+       {
+               return asShared(dynamicWidgetCast<WIDGET_TYPE>(eo));
+       }
+
+       template <class WIDGET_TYPE>
+       inline auto dynamicWidgetRefCast(const Evas_Object *eo) ->
+                       decltype(asShared(dynamicWidgetCast<WIDGET_TYPE>(eo)))
+       {
+               return asShared(dynamicWidgetCast<WIDGET_TYPE>(eo));
+       }
+}
+
+#include "helpers.hpp"
+
+#endif // __UCL_GUI_HELPERS_H__
diff --git a/ucl/include/ucl/gui/helpers.hpp b/ucl/include/ucl/gui/helpers.hpp
new file mode 100644 (file)
index 0000000..29df283
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+namespace ucl {
+
+       inline Widget *asWidget(Evas_Object *eo)
+       {
+               return static_cast<Widget *>(
+                               evas_object_data_get(eo, impl::WIDGET_DATA_NAME));
+
+       }
+
+       inline const Widget *asWidget(const Evas_Object *eo)
+       {
+               return static_cast<const Widget *>(
+                               evas_object_data_get(eo, impl::WIDGET_DATA_NAME));
+       }
+}
diff --git a/ucl/include/ucl/gui/stdTheme.h b/ucl/include/ucl/gui/stdTheme.h
new file mode 100644 (file)
index 0000000..13202cc
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_GUI_STD_THEME_H__
+#define __UCL_GUI_STD_THEME_H__
+
+#include "stdTheme/common.h"
+#include "stdTheme/layout.h"
+#include "stdTheme/naviframe.h"
+
+#endif // __UCL_GUI_STD_THEME_H__
diff --git a/ucl/include/ucl/gui/stdTheme/common.h b/ucl/include/ucl/gui/stdTheme/common.h
new file mode 100644 (file)
index 0000000..7ec81b9
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_GUI_STD_THEME_COMMON_H__
+#define __UCL_GUI_STD_THEME_COMMON_H__
+
+#include "ucl/gui/types.h"
+
+namespace ucl {
+
+       // Styles //
+
+       constexpr ElmStyle STYLE_DEFAULT {"default"};
+
+       // Parts //
+
+       constexpr EdjePart PART_TEXT  {"elm.text"};
+       constexpr EdjePart PART_TITLE {"elm.text.title"};
+
+       constexpr EdjePart PART_CONTENT {"elm.swallow.content"};
+       constexpr EdjePart PART_ICON    {"elm.swallow.icon"};
+       constexpr EdjePart PART_BUTTON  {"elm.swallow.button"};
+}
+
+#endif // __UCL_GUI_STD_THEME_COMMON_H__
diff --git a/ucl/include/ucl/gui/stdTheme/layout.h b/ucl/include/ucl/gui/stdTheme/layout.h
new file mode 100644 (file)
index 0000000..79ff426
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_GUI_STD_THEME_LAYOUT_H__
+#define __UCL_GUI_STD_THEME_LAYOUT_H__
+
+#include "common.h"
+
+namespace ucl {
+
+       constexpr LayoutTheme LAYOUT_DEFAULT {"layout", "application", "default"};
+
+       constexpr LayoutTheme LAYOUT_NO_CONTENTS
+                       {"layout", "nocontents", "default"};
+}
+
+#endif // __UCL_GUI_STD_THEME_LAYOUT_H__
diff --git a/ucl/include/ucl/gui/stdTheme/naviframe.h b/ucl/include/ucl/gui/stdTheme/naviframe.h
new file mode 100644 (file)
index 0000000..fd99fdc
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_GUI_STD_THEME_NAVIFRAME_H__
+#define __UCL_GUI_STD_THEME_NAVIFRAME_H__
+
+#include "common.h"
+
+namespace ucl {
+
+       constexpr ElmStyle NAVIFRAME_EMPTY {"empty"};
+}
+
+#endif // __UCL_GUI_STD_THEME_NAVIFRAME_H__
diff --git a/ucl/include/ucl/gui/types.h b/ucl/include/ucl/gui/types.h
new file mode 100644 (file)
index 0000000..6d43d76
--- /dev/null
@@ -0,0 +1,133 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_GUI_TYPES_H__
+#define __UCL_GUI_TYPES_H__
+
+#include <Elementary.h>
+
+#include "ucl/util/types.h"
+#include "ucl/util/memory.h"
+#include "ucl/util/delegation.h"
+#include "ucl/util/smartDelegation.h"
+
+#include "ucl/misc/Aspect.h"
+#include "ucl/misc/TString.h"
+#include "ucl/misc/ConstCString.h"
+#include "ucl/misc/Variant.h"
+
+namespace ucl {
+
+       // Aspects //
+
+       struct EdjePart : Aspect<EdjePart> { using Aspect::Aspect; };
+       struct EdjeGroup : Aspect<EdjeGroup> { using Aspect::Aspect; };
+       struct EdjeDataKey : Aspect<EdjeDataKey> { using Aspect::Aspect; };
+
+       struct EdjeSignal : Aspect<EdjeSignal> { using Aspect::Aspect; };
+       struct EdjeSignalSrc : Aspect<EdjeSignalSrc> { using Aspect::Aspect; };
+
+       struct ElmStyle : Aspect<ElmStyle> { using Aspect::Aspect; };
+
+       struct SmartEvent : Aspect<SmartEvent> { using Aspect::Aspect; };
+
+       struct EoDataKey : Aspect<EoDataKey> { using Aspect::Aspect; };
+
+       // Delegates //
+
+       using SmartCbHandler = Delegate<void(Evas_Object *obj, void *eventInfo)>;
+
+       // WidgetEventHandler //
+
+       class Widget;
+
+       using WidgetEventHandler =
+                       WeakDelegate<void(Widget &widget, void *eventInfo)>;
+
+       // WidgetEvent //
+
+       enum class WidgetEvent {
+               DEL  = EVAS_CALLBACK_DEL,
+
+               MOUSE_IN    = EVAS_CALLBACK_MOUSE_IN,
+               MOUSE_OUT   = EVAS_CALLBACK_MOUSE_OUT,
+               MOUSE_DOWN  = EVAS_CALLBACK_MOUSE_DOWN,
+               MOUSE_UP    = EVAS_CALLBACK_MOUSE_UP,
+               MOUSE_MOVE  = EVAS_CALLBACK_MOUSE_MOVE,
+               MOUSE_WHEEL = EVAS_CALLBACK_MOUSE_WHEEL,
+
+               MULTI_DOWN = EVAS_CALLBACK_MULTI_DOWN,
+               MULTI_UP   = EVAS_CALLBACK_MULTI_UP,
+               MULTI_MOVE = EVAS_CALLBACK_MULTI_MOVE,
+
+               MOVE    = EVAS_CALLBACK_MOVE,
+               RESIZE  = EVAS_CALLBACK_RESIZE,
+               RESTACK = EVAS_CALLBACK_RESTACK,
+
+               CHANGED_SIZE_HINTS = EVAS_CALLBACK_CHANGED_SIZE_HINTS,
+
+               KEY_DOWN  = EVAS_CALLBACK_KEY_DOWN,
+               KEY_UP    = EVAS_CALLBACK_KEY_UP,
+               FOCUS_IN  = EVAS_CALLBACK_FOCUS_IN,
+               FOCUS_OUT = EVAS_CALLBACK_FOCUS_OUT,
+
+               SHOW = EVAS_CALLBACK_SHOW,
+               HIDE = EVAS_CALLBACK_HIDE,
+
+               HOLD = EVAS_CALLBACK_HOLD,
+
+               IMAGE_PRELOADED = EVAS_CALLBACK_IMAGE_PRELOADED
+       };
+
+       // AtspiGestureEventInfo //
+
+       struct AtspiGestureEventInfo final {
+               Elm_Atspi_Gesture_Info gestureInfo;
+               bool preventDefault;
+               bool stopPropagation;
+       };
+
+       // WidgetARHint //
+
+       enum class WidgetARHint
+       {
+               NEITHER = EVAS_ASPECT_CONTROL_NEITHER,
+               HORIZONTAL = EVAS_ASPECT_CONTROL_HORIZONTAL,
+               VERTICAL = EVAS_ASPECT_CONTROL_VERTICAL,
+               BOTH = EVAS_ASPECT_CONTROL_BOTH
+       };
+
+       // LayoutTheme //
+
+       struct LayoutTheme final {
+               const char *klass;
+               const char *group;
+               const char *style;
+
+               constexpr LayoutTheme();
+               constexpr LayoutTheme(std::nullptr_t);
+               constexpr LayoutTheme(const char *klass,
+                               const char *group, const char *style);
+       };
+
+       // LayoutTheme non-member functions //
+
+       constexpr bool isValid(const LayoutTheme &value);
+}
+
+#include "types.hpp"
+
+#endif // __UCL_GUI_TYPES_H__
diff --git a/ucl/include/ucl/gui/types.hpp b/ucl/include/ucl/gui/types.hpp
new file mode 100644 (file)
index 0000000..7f128c8
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 "ucl/util/helpers.h"
+
+namespace ucl {
+
+       // LayoutTheme //
+
+       constexpr LayoutTheme::LayoutTheme() :
+               klass(nullptr),
+               group(nullptr),
+               style(nullptr)
+       {
+       }
+
+       constexpr LayoutTheme::LayoutTheme(std::nullptr_t) :
+               LayoutTheme()
+       {
+       }
+
+       constexpr LayoutTheme::LayoutTheme(const char *klass,
+                       const char *group, const char *style) :
+               klass(klass),
+               group(group),
+               style(style)
+       {
+       }
+
+       // LayoutTheme non-member functions //
+
+       constexpr bool isValid(const LayoutTheme &value)
+       {
+               return (isNotEmpty(value.klass) && isNotEmpty(value.group) &&
+                                       isNotEmpty(value.style));
+       }
+}
diff --git a/ucl/include/ucl/misc/Aspect.h b/ucl/include/ucl/misc/Aspect.h
new file mode 100644 (file)
index 0000000..0c55bf6
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_MISC_ASPECT_H__
+#define __UCL_MISC_ASPECT_H__
+
+#include "ucl/util/types.h"
+
+namespace ucl {
+
+       template <class CHILD>
+       struct Aspect {
+               const char *name;
+
+               constexpr Aspect();
+               constexpr Aspect(std::nullptr_t);
+               explicit constexpr Aspect(const char *name);
+
+               constexpr operator const char *() const;
+
+               struct Hash final {
+                       size_t operator()(const Aspect &key) const;
+               };
+       };
+
+       // Non-member functions //
+
+       template <class CHILD>
+       constexpr bool isValid(Aspect<CHILD> aspect);
+
+       template <class CHILD>
+       constexpr bool operator==(Aspect<CHILD> lhs, Aspect<CHILD> rhs);
+       template <class CHILD>
+       constexpr bool operator!=(Aspect<CHILD> lhs, Aspect<CHILD> rhs);
+}
+
+#include "Aspect.hpp"
+
+#endif // __UCL_MISC_ASPECT_H__
diff --git a/ucl/include/ucl/misc/Aspect.hpp b/ucl/include/ucl/misc/Aspect.hpp
new file mode 100644 (file)
index 0000000..9894681
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 <cstring>
+
+#include "ucl/util/helpers.h"
+
+namespace ucl {
+
+       // Aspect<CHILD>::Hash //
+
+       template <class CHILD>
+       size_t Aspect<CHILD>::Hash::operator()(const Aspect<CHILD> &key) const
+       {
+               constexpr size_t PRIME = 31;
+               size_t result = 0;
+               for (size_t i = 0; (key.name[i] != '\0'); ++i) {
+                       result *= PRIME;
+                       result += key.name[i];
+               }
+               return result;
+       }
+
+       // Aspect<CHILD> //
+
+       template <class CHILD>
+       constexpr Aspect<CHILD>::Aspect() :
+               name(nullptr)
+       {
+       }
+
+       template <class CHILD>
+       constexpr Aspect<CHILD>::Aspect(std::nullptr_t) :
+               Aspect()
+       {
+       }
+
+       template <class CHILD>
+       constexpr Aspect<CHILD>::Aspect(const char *name) :
+               name(name)
+       {
+       }
+
+       template <class CHILD>
+       constexpr Aspect<CHILD>::operator const char *() const
+       {
+               return name;
+       }
+
+       // Non-member functions //
+
+       template <class CHILD>
+       constexpr bool isValid(const Aspect<CHILD> aspect)
+       {
+               return isNotEmpty(aspect);
+       }
+
+       template <class CHILD>
+       constexpr bool operator==(Aspect<CHILD> lhs, Aspect<CHILD> rhs)
+       {
+               return (strCmpSafe(lhs.name, rhs.name) == 0);
+       }
+
+       template <class CHILD>
+       constexpr bool operator!=(Aspect<CHILD> lhs, Aspect<CHILD> rhs)
+       {
+               return (strCmpSafe(lhs.name, rhs.name) != 0);
+       }
+}
diff --git a/ucl/include/ucl/misc/AutoHandle.h b/ucl/include/ucl/misc/AutoHandle.h
new file mode 100644 (file)
index 0000000..27c19f4
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_MISC_AUTO_HANDLE_H__
+#define __UCL_MISC_AUTO_HANDLE_H__
+
+#include "ucl/util/types.h"
+
+namespace ucl {
+
+       template <class HANDLE, class DEL_RET, DEL_RET(*DEL_FUNC)(HANDLE)>
+       struct AutoHandle final : ucl::NonCopyable {
+               using Handle = HANDLE;
+
+               HANDLE value;
+
+               AutoHandle() :
+                       value()
+               {
+               }
+
+               AutoHandle(std::nullptr_t) :
+                       AutoHandle()
+               {
+               }
+
+               AutoHandle(HANDLE value) :
+                       value(value)
+               {
+               }
+
+               ~AutoHandle()
+               {
+                       if (value) {
+                               DEL_FUNC(value);
+                       }
+               }
+
+               AutoHandle(AutoHandle &&src) :
+                       value(src.value)
+               {
+                       src.value = nullptr;
+               }
+
+               AutoHandle &operator=(AutoHandle src)
+               {
+                       swap(*this, src);
+                       return *this;
+               }
+
+               AutoHandle &operator=(HANDLE value)
+               {
+                       AutoHandle src{value};
+                       swap(*this, src);
+                       return *this;
+               }
+
+               HANDLE *operator&()
+               {
+                       return &value;
+               }
+
+               operator HANDLE()
+               {
+                       return value;
+               }
+       };
+
+       // Non-member functions //
+
+       template <class HANDLE, class DEL_RET, DEL_RET(*DEL_FUNC)(HANDLE)>
+       inline void swap(AutoHandle<HANDLE, DEL_RET, DEL_FUNC> &x,
+                       AutoHandle<HANDLE, DEL_RET, DEL_FUNC> &y) noexcept
+       {
+               std::swap(x.value, y.value);
+       }
+}
+
+#endif // __UCL_MISC_AUTO_HANDLE_H__
diff --git a/ucl/include/ucl/misc/CString.h b/ucl/include/ucl/misc/CString.h
new file mode 100644 (file)
index 0000000..396f37d
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_MISC_CSTRING_H__
+#define __UCL_MISC_CSTRING_H__
+
+#include "ucl/util/types.h"
+
+namespace ucl {
+
+       class CString final : public NonCopyable {
+       public:
+               friend void swap(CString &x, CString &y) noexcept;
+
+               static CString dup(const char *ptr);
+               static CString takeover(char *ptr) noexcept;
+
+               CString() noexcept;
+               CString(std::nullptr_t) noexcept;
+               CString(CString &&s) noexcept;
+               CString(const std::string &s);
+               ~CString() noexcept;
+
+               CString &operator=(CString s) noexcept;
+
+               bool isEmpty() const;
+
+               char *release() noexcept;
+
+               char *get() const noexcept;
+
+       private:
+               explicit CString(char *ptr) noexcept;
+
+       private:
+               char *m_ptr;
+       };
+}
+
+#include "CString.hpp"
+
+#endif // __UCL_MISC_CSTRING_H__
diff --git a/ucl/include/ucl/misc/CString.hpp b/ucl/include/ucl/misc/CString.hpp
new file mode 100644 (file)
index 0000000..086b3c2
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 "ucl/util/helpers.h"
+
+namespace ucl {
+
+       // CString //
+
+       inline CString CString::dup(const char *const ptr)
+       {
+               return CString(strDupSafe(ptr));
+       }
+
+       inline CString CString::takeover(char *const ptr) noexcept
+       {
+               return CString(ptr);
+       }
+
+       inline CString::CString(char *const ptr) noexcept :
+               m_ptr(ptr)
+       {
+       }
+
+       inline CString::CString() noexcept :
+               m_ptr(nullptr)
+       {
+       }
+
+       inline CString::CString(std::nullptr_t) noexcept :
+               CString()
+       {
+       }
+
+       inline CString::CString(CString &&s) noexcept :
+               m_ptr(s.m_ptr)
+       {
+               s.m_ptr = nullptr;
+       }
+
+       inline CString::CString(const std::string &s) :
+               m_ptr(s.empty() ? nullptr : strdup(s.c_str()))
+       {
+       }
+
+       inline CString::~CString() noexcept
+       {
+               free(m_ptr);
+       }
+
+       inline CString &CString::operator=(CString s) noexcept
+       {
+               swap(*this, s);
+               return *this;
+       }
+
+       inline bool CString::isEmpty() const
+       {
+               return !m_ptr;
+       }
+
+       inline char *CString::release() noexcept
+       {
+               char *const result = m_ptr;
+               m_ptr = nullptr;
+               return result;
+       }
+
+       inline char *CString::get() const noexcept
+       {
+               return m_ptr;
+       }
+
+       // Non-member functions //
+
+       inline void swap(CString &x, CString &y) noexcept
+       {
+               std::swap(x.m_ptr, y.m_ptr);
+       }
+}
diff --git a/ucl/include/ucl/misc/ConstCString.h b/ucl/include/ucl/misc/ConstCString.h
new file mode 100644 (file)
index 0000000..7f600f0
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_MISC_CONST_CSTRING_H__
+#define __UCL_MISC_CONST_CSTRING_H__
+
+#include "CString.h"
+
+namespace ucl {
+
+       class ConstCString final : public NonCopyable {
+       public:
+               friend void swap(ConstCString &x, ConstCString &y) noexcept;
+
+               static ConstCString wrap(const char *ptr) noexcept;
+
+               ConstCString() noexcept;
+               ConstCString(std::nullptr_t) noexcept;
+               ConstCString(ConstCString &&s) noexcept;
+               ConstCString(CString &&s) noexcept;
+               ~ConstCString() noexcept;
+
+               ConstCString &operator=(ConstCString s) noexcept;
+
+               bool isEmpty() const;
+
+               const char *get() const noexcept;
+
+       private:
+               explicit ConstCString(const char *ptr) noexcept;
+
+       private:
+               const char *m_ptr;
+               bool m_isOwner;
+       };
+}
+
+#include "ConstCString.hpp"
+
+#endif // __UCL_MISC_CONST_CSTRING_H__
diff --git a/ucl/include/ucl/misc/ConstCString.hpp b/ucl/include/ucl/misc/ConstCString.hpp
new file mode 100644 (file)
index 0000000..50df605
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+namespace ucl {
+
+       // ConstCString //
+
+       inline ConstCString ConstCString::wrap(const char *ptr) noexcept
+       {
+               return ConstCString(ptr);
+       }
+
+       inline ConstCString::ConstCString(const char *ptr) noexcept :
+               m_ptr(ptr),
+               m_isOwner(false)
+       {
+       }
+
+       inline ConstCString::ConstCString() noexcept :
+               m_ptr(nullptr),
+               m_isOwner(false)
+       {
+       }
+
+       inline ConstCString::ConstCString(std::nullptr_t) noexcept :
+               ConstCString()
+       {
+       }
+
+       inline ConstCString::ConstCString(ConstCString &&s) noexcept :
+               m_ptr(s.m_ptr),
+               m_isOwner(s.m_isOwner)
+       {
+               s.m_isOwner = false;
+       }
+
+       inline ConstCString::ConstCString(CString &&s) noexcept :
+               m_ptr(s.release()),
+               m_isOwner(true)
+       {
+       }
+
+       inline ConstCString::~ConstCString() noexcept
+       {
+               if (m_isOwner) {
+                       free(const_cast<char *>(m_ptr));
+               }
+       }
+
+       inline ConstCString &ConstCString::operator=(ConstCString s) noexcept
+       {
+               swap(*this, s);
+               return *this;
+       }
+
+       inline bool ConstCString::isEmpty() const
+       {
+               return !m_ptr;
+       }
+
+       inline const char *ConstCString::get() const noexcept
+       {
+               return m_ptr;
+       }
+
+       // Non-member functions //
+
+       inline void swap(ConstCString &x, ConstCString &y) noexcept
+       {
+               std::swap(x.m_ptr, y.m_ptr);
+               std::swap(x.m_isOwner, y.m_isOwner);
+       }
+}
diff --git a/ucl/include/ucl/misc/Event.h b/ucl/include/ucl/misc/Event.h
new file mode 100644 (file)
index 0000000..cd27f29
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_MISC_EVENT_H__
+#define __UCL_MISC_EVENT_H__
+
+#include <vector>
+
+#include "ucl/util/types.h"
+
+namespace ucl {
+
+       template <class DELEGATE>
+       class Event final {
+       public:
+               Event();
+
+               template <class DELEGATE2>
+               void operator+=(DELEGATE2 &&delegate);
+               template <class DELEGATE2>
+               void operator-=(const DELEGATE2 &delegate);
+
+               bool isEmpty() const;
+
+               template <class ...ARGS>
+               void dispatch(ARGS &&...args);
+               template <class PREDICATE, class ...ARGS>
+               void dispatchPred(PREDICATE &&pred, ARGS &&...args);
+
+       private:
+               template <class DO_INVOKE, class ...ARGS>
+               void dispatchImpl(const DO_INVOKE &doInvoke, ARGS &&...args);
+
+               void lock();
+               void unlock();
+               bool isLocked() const;
+
+               void defrag();
+
+       private:
+               std::vector<DELEGATE> m_delegates;
+               int m_lockCount;
+               bool m_isFragmented;
+       };
+}
+
+#include "Event.hpp"
+
+#endif // __UCL_MISC_EVENT_H__
diff --git a/ucl/include/ucl/misc/Event.hpp b/ucl/include/ucl/misc/Event.hpp
new file mode 100644 (file)
index 0000000..ed4e402
--- /dev/null
@@ -0,0 +1,154 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 <algorithm>
+
+namespace ucl { namespace { namespace impl {
+
+       template <class PREDICATE, class DELEGATE, class ...ARGS>
+       auto doInvokePred(PREDICATE &&pred,
+                       const DELEGATE &delegate, ARGS &&...args) ->
+                               decltype(pred(delegate(std::forward<ARGS>(args)...)))
+       {
+               return pred(delegate(std::forward<ARGS>(args)...));
+       }
+
+       template <class DELEGATE, class PREDICATE, class ...ARGS>
+       auto doInvokePred(PREDICATE &&pred,
+                       const DELEGATE &delegate, ARGS &&...args) -> decltype(pred())
+       {
+               delegate(std::forward<ARGS>(args)...);
+               return pred();
+       }
+}}}
+
+namespace ucl {
+
+       template <class DELEGATE>
+       Event<DELEGATE>::Event() :
+               m_lockCount(0),
+               m_isFragmented(false)
+       {
+       }
+
+       template <class DELEGATE>
+       template <class DELEGATE2>
+       void Event<DELEGATE>::operator+=(DELEGATE2 &&delegate)
+       {
+               m_delegates.emplace_back(std::forward<DELEGATE2>(delegate));
+       }
+
+       template <class DELEGATE>
+       template <class DELEGATE2>
+       void Event<DELEGATE>::operator-=(const DELEGATE2 &delegate)
+       {
+               const auto it = std::find(
+                               m_delegates.begin(), m_delegates.end(), delegate);
+               if (it != m_delegates.end()) {
+                       if (isLocked()) {
+                               *it = {};
+                               m_isFragmented = true;
+                       } else {
+                               m_delegates.erase(it);
+                       }
+               }
+       }
+
+       template <class DELEGATE>
+       bool Event<DELEGATE>::isEmpty() const
+       {
+               return m_delegates.empty();
+       }
+
+       template <class DELEGATE>
+       template <class ...ARGS>
+       void Event<DELEGATE>::dispatch(ARGS &&...args)
+       {
+               dispatchImpl(
+                       [](const DELEGATE &delegate, ARGS &&...args)
+                       {
+                               delegate(std::forward<ARGS>(args)...);
+                               return true;
+                       },
+                       std::forward<ARGS>(args)...);
+       }
+
+       template <class DELEGATE>
+       template <class PREDICATE, class ...ARGS>
+       void Event<DELEGATE>::dispatchPred(PREDICATE &&pred, ARGS &&...args)
+       {
+               dispatchImpl(
+                       [&pred](const DELEGATE &delegate, ARGS &&...args)
+                       {
+                               return impl::doInvokePred(std::forward<PREDICATE>(pred),
+                                               delegate, std::forward<ARGS>(args)...);
+                       },
+                       std::forward<ARGS>(args)...);
+       }
+
+       template <class DELEGATE>
+       template <class DO_INVOKE, class ...ARGS>
+       void Event<DELEGATE>::dispatchImpl(const DO_INVOKE &doInvoke, ARGS &&...args)
+       {
+               lock();
+               const auto size = m_delegates.size();
+               for (size_t i = 0; i < size; ++i) {
+                       const auto &delegate = m_delegates[i];
+                       if (delegate) {
+                               if (!doInvoke(delegate, std::forward<ARGS>(args)...)) {
+                                       break;
+                               }
+                       } else {
+                               m_isFragmented = true;
+                       }
+               }
+               unlock();
+               defrag();
+       }
+
+       template <class DELEGATE>
+       void Event<DELEGATE>::lock()
+       {
+               ++m_lockCount;
+       }
+
+       template <class DELEGATE>
+       void Event<DELEGATE>::unlock()
+       {
+               --m_lockCount;
+       }
+
+       template <class DELEGATE>
+       bool Event<DELEGATE>::isLocked() const
+       {
+               return (m_lockCount > 0);
+       }
+
+       template <class DELEGATE>
+       void Event<DELEGATE>::defrag()
+       {
+               if (m_isFragmented) {
+                       m_isFragmented = false;
+                       m_delegates.erase(
+                               std::remove_if(m_delegates.begin(), m_delegates.end(),
+                                       [](const DELEGATE &delegate) -> bool
+                                       {
+                                               return !delegate;
+                                       }),
+                               m_delegates.end());
+               }
+       }
+}
diff --git a/ucl/include/ucl/misc/HashMap.h b/ucl/include/ucl/misc/HashMap.h
new file mode 100644 (file)
index 0000000..8470fed
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_MISC_HASH_MAP_H__
+#define __UCL_MISC_HASH_MAP_H__
+
+#include <unordered_map>
+
+#include "Variant.h"
+
+namespace ucl {
+
+       template <class KEY, class VALUE>
+       class HashMap;
+
+       template <class VALUE>
+       using Dict = HashMap<std::string, VALUE>;
+
+       using VarDict = Dict<Variant>;
+
+       template <class KEY, class VALUE>
+       class HashMap final {
+       public:
+               template <class VALUE2>
+               HashMap &set(const KEY &key, VALUE2 &&value);
+               HashMap &unset(const KEY &key);
+
+               template <class VALUE2>
+               bool get(const KEY &key, VALUE2 &value) const;
+               VALUE get(const KEY &key) const;
+
+               void clear();
+
+       private:
+               template <class ENUM_CLASS>
+               struct EnumClassHash final {
+                       size_t operator()(ENUM_CLASS key) const {
+                               return static_cast<size_t>(key);
+                       }
+               };
+
+               template <class KEY2, class = void>
+               struct GetHash final {
+                       using Type = std::hash<KEY2>;
+               };
+
+               template <class KEY2>
+               struct GetHash<KEY2, typename std::enable_if<
+                               std::is_enum<KEY2>::value>::type> {
+                       using Type = EnumClassHash<KEY2>;
+               };
+
+               template <class KEY2>
+               struct GetHash<KEY2, typename std::enable_if<
+                               std::is_class<typename KEY2::Hash>::value>::type> {
+                       using Type = typename KEY2::Hash;
+               };
+
+               using Hash = typename GetHash<KEY>::Type;
+
+       private:
+               std::unordered_map<KEY, VALUE, Hash> m_map;
+       };
+}
+
+#include "HashMap.hpp"
+
+#endif // __UCL_MISC_HASH_MAP_H__
diff --git a/ucl/include/ucl/misc/HashMap.hpp b/ucl/include/ucl/misc/HashMap.hpp
new file mode 100644 (file)
index 0000000..2ba4ffd
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+namespace ucl {
+
+       template <class KEY, class VALUE>
+       template <class VALUE2>
+       inline HashMap<KEY, VALUE> &HashMap<KEY, VALUE>::
+                       set(const KEY &key, VALUE2 &&value)
+       {
+               m_map.emplace(key, std::forward<VALUE2>(value));
+               return *this;
+       }
+
+       template <class KEY, class VALUE>
+       inline HashMap<KEY, VALUE> &HashMap<KEY, VALUE>::
+                       unset(const KEY &key)
+       {
+               m_map.erase(key);
+               return *this;
+       }
+
+       template <class KEY, class VALUE>
+       template <class VALUE2>
+       inline bool HashMap<KEY, VALUE>::
+                       get(const KEY &key, VALUE2 &value) const
+       {
+               const auto it = m_map.find(key);
+               if (it == m_map.end()) {
+                       return false;
+               }
+               value = it->second;
+               return true;
+       }
+
+       template <class KEY, class VALUE>
+       inline VALUE HashMap<KEY, VALUE>::
+                       get(const KEY &key) const
+       {
+               const auto it = m_map.find(key);
+               if (it == m_map.end()) {
+                       return {};
+               }
+               return it->second;
+       }
+
+       template <class KEY, class VALUE>
+       inline void HashMap<KEY, VALUE>::clear()
+       {
+               m_map.clear();
+       }
+}
diff --git a/ucl/include/ucl/misc/RefCountAware.h b/ucl/include/ucl/misc/RefCountAware.h
new file mode 100644 (file)
index 0000000..6ea5ee9
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_MISC_REF_COUNT_AWARE_H__
+#define __UCL_MISC_REF_COUNT_AWARE_H__
+
+#include "ucl/util/types.h"
+#include "ucl/util/memory.h"
+
+namespace ucl {
+
+       UCL_DECLARE_REF_ALIASES(RefCountAware);
+
+       class RefCountAware : public Polymorphic {
+       public:
+               bool isShared() const;
+               UInt getUseCount() const;
+               const void *getObjPtr() const;
+
+               template <class T>
+               SharedRef<T> asSharedThis(T *thisAlias) const;
+
+               template <class T>
+               WeakRef<T> asWeakThis(T *thisAlias) const;
+
+       protected:
+               RefCountAware(IRefCountObj *rc);
+               virtual ~RefCountAware() = default;
+
+       public:
+               // This section MUST be public!
+               // Signal to RefCountObj<T, C> to pass IRefCountObj to constructor
+               enum { _IS_REF_COUNT_AWARE };
+
+       private:
+               IRefCountObj *const m_rc;
+       };
+
+       // Non-member functions //
+
+       template <class T>
+       SharedRef<T> asShared(T &obj);
+       template <class T>
+       SharedRef<T> asShared(T *obj);
+
+       template <class T>
+       WeakRef<T> asWeak(T &obj);
+       template <class T>
+       WeakRef<T> asWeak(T *obj);
+
+       template <class T, class U, class = typename
+                       std::enable_if<!std::is_same<T, U>::value>::type>
+       SharedRef<T> asShared(U &obj);
+       template <class T, class U, class = typename
+                       std::enable_if<!std::is_same<T, U>::value>::type>
+       SharedRef<T> asShared(U *obj);
+
+       template <class T, class U, class = typename
+                       std::enable_if<!std::is_same<T, U>::value>::type>
+       WeakRef<T> asWeak(U &obj);
+       template <class T, class U, class = typename
+                       std::enable_if<!std::is_same<T, U>::value>::type>
+       WeakRef<T> asWeak(U *obj);
+
+       template <class T, class U, class = typename
+                       std::enable_if<!std::is_same<T, const U>::value>::type>
+       SharedRef<const T> asShared(const U &obj);
+       template <class T, class U, class = typename
+                       std::enable_if<!std::is_same<T, const U>::value>::type>
+       SharedRef<const T> asShared(const U *obj);
+
+       template <class T, class U, class = typename
+                       std::enable_if<!std::is_same<T, const U>::value>::type>
+       WeakRef<const T> asWeak(const U &obj);
+       template <class T, class U, class = typename
+                       std::enable_if<!std::is_same<T, const U>::value>::type>
+       WeakRef<const T> asWeak(const U *obj);
+}
+
+#include "RefCountAware.hpp"
+
+#endif // __UCL_MISC_REF_COUNT_AWARE_H__
diff --git a/ucl/include/ucl/misc/RefCountAware.hpp b/ucl/include/ucl/misc/RefCountAware.hpp
new file mode 100644 (file)
index 0000000..8fb3812
--- /dev/null
@@ -0,0 +1,148 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 "ucl/util/logging.h"
+
+namespace ucl {
+
+       inline RefCountAware::RefCountAware(IRefCountObj *const rc) :
+               m_rc(rc)
+       {
+       }
+
+       inline bool RefCountAware::isShared() const
+       {
+               return !!m_rc;
+       }
+
+       inline UInt RefCountAware::getUseCount() const
+       {
+               if (!isShared()) {
+                       UCL_ELOG("NOT SHARED: %s", typeid(*this).name());
+                       return 0;
+               }
+               return m_rc->getUseCount();
+       }
+
+       inline const void *RefCountAware::getObjPtr() const
+       {
+               if (!isShared()) {
+                       UCL_ELOG("NOT SHARED: %s", typeid(*this).name());
+                       return nullptr;
+               }
+               return m_rc->getObjPtr();
+       }
+
+       template <class T>
+       inline SharedRef<T> RefCountAware::asSharedThis(T *const thisAlias) const
+       {
+               if (!isShared()) {
+                       UCL_ELOG("NOT SHARED: %s", typeid(*this).name());
+                       return {};
+               }
+               return {m_rc, thisAlias};
+       }
+
+       template <class T>
+       inline WeakRef<T> RefCountAware::asWeakThis(T *const thisAlias) const
+       {
+               if (!isShared()) {
+                       UCL_ELOG("NOT SHARED: %s", typeid(*this).name());
+                       return {};
+               }
+               return {m_rc, thisAlias};
+       }
+
+       // Non-member functions //
+
+       template <class T>
+       inline SharedRef<T> asShared(T &obj)
+       {
+               return obj.template asSharedThis<T>(&obj);
+       }
+
+       template <class T>
+       inline SharedRef<T> asShared(T *obj)
+       {
+               if (!obj) return {};
+               return obj->template asSharedThis<T>(obj);
+       }
+
+       template <class T>
+       inline WeakRef<T> asWeak(T &obj)
+       {
+               return obj.template asWeakThis<T>(&obj);
+       }
+
+       template <class T>
+       inline WeakRef<T> asWeak(T *obj)
+       {
+               if (!obj) return {};
+               return obj->template asWeakThis<T>(obj);
+       }
+
+       template <class T, class U, class>
+       inline SharedRef<T> asShared(U &obj)
+       {
+               return obj.template asSharedThis<T>(&obj);
+       }
+
+       template <class T, class U, class>
+       inline SharedRef<T> asShared(U *obj)
+       {
+               if (!obj) return {};
+               return obj->template asSharedThis<T>(obj);
+       }
+
+       template <class T, class U, class>
+       inline WeakRef<T> asWeak(U &obj)
+       {
+               return obj.template asWeakThis<T>(&obj);
+       }
+
+       template <class T, class U, class>
+       inline WeakRef<T> asWeak(U *obj)
+       {
+               if (!obj) return {};
+               return obj->template asWeakThis<T>(obj);
+       }
+
+       template <class T, class U, class>
+       inline SharedRef<const T> asShared(const U &obj)
+       {
+               return obj.template asSharedThis<const T>(&obj);
+       }
+
+       template <class T, class U, class>
+       inline SharedRef<const T> asShared(const U *obj)
+       {
+               if (!obj) return {};
+               return obj->template asSharedThis<const T>(obj);
+       }
+
+       template <class T, class U, class>
+       inline WeakRef<const T> asWeak(const U &obj)
+       {
+               return obj.template asWeakThis<const T>(&obj);
+       }
+
+       template <class T, class U, class>
+       inline WeakRef<const T> asWeak(const U *obj)
+       {
+               if (!obj) return {};
+               return obj->template asWeakThis<const T>(obj);
+       }
+}
diff --git a/ucl/include/ucl/misc/TString.h b/ucl/include/ucl/misc/TString.h
new file mode 100644 (file)
index 0000000..71ca2d9
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_MISC_T_STRING_H__
+#define __UCL_MISC_T_STRING_H__
+
+#include "ucl/util/types.h"
+
+namespace ucl {
+
+       class TString final {
+       public:
+               TString();
+
+               /**
+                * Constructs TString from std::string and domain
+                *
+                * @param str     Text string or string id if translatable.
+                * @param domain  Valid domain name or "" for default domain,
+                *                nullptr - if string is not translatable
+                */
+               TString(const std::string &str, const char *domain);
+               TString(const std::string &str, bool translatable = false);
+
+               TString(std::string &&str, const char *domain);
+               TString(std::string &&str, bool translatable = false);
+
+               TString(const char *str, const char *domain);
+               TString(const char *str, bool translatable = false);
+
+               bool isEmpty() const;
+
+               bool isTranslatable() const;
+               bool hasDomain() const;
+               const char *getDomain() const;
+
+               const std::string &getStr() const;
+               operator const std::string &() const;
+
+               const char *getCStr() const;
+               operator const char *() const;
+
+               const char *translate() const;
+
+               template <typename ...ARGS>
+               std::string format(ARGS ...args) const;
+
+       private:
+               const char *doTranslate(const char *strId) const;
+
+       private:
+               std::string m_str;
+               const char *m_domain;
+       };
+}
+
+#include "TString.hpp"
+
+#endif // __UCL_MISC_T_STRING_H__
diff --git a/ucl/include/ucl/misc/TString.hpp b/ucl/include/ucl/misc/TString.hpp
new file mode 100644 (file)
index 0000000..01c1327
--- /dev/null
@@ -0,0 +1,146 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 <libintl.h>
+#include <app_i18n.h>
+
+#include "ucl/util/helpers.h"
+
+namespace ucl {
+
+       inline TString::TString() :
+               m_domain(nullptr)
+       {
+       }
+
+       inline TString::TString(const std::string &str, const char *const domain) :
+               m_str(str),
+               m_domain(m_str.empty() ? nullptr : domain)
+       {
+       }
+
+       inline TString::TString(const std::string &str, const bool translatable) :
+               TString(str, (translatable ? "" : nullptr))
+       {
+       }
+
+       inline TString::TString(std::string &&str, const char *const domain) :
+               m_str(std::move(str)),
+               m_domain(m_str.empty() ? nullptr : domain)
+       {
+       }
+
+       inline TString::TString(std::string &&str, const bool translatable) :
+               TString(std::move(str), (translatable ? "" : nullptr))
+       {
+       }
+
+       inline TString::TString(const char *const str, const char *const domain) :
+               TString(std::string(nz(str)), domain)
+       {
+       }
+
+       inline TString::TString(const char *const str, const bool translatable) :
+               TString(std::string(nz(str)), (translatable ? "" : nullptr))
+       {
+       }
+
+       inline bool TString::isEmpty() const
+       {
+               return m_str.empty();
+       }
+
+       inline const std::string &TString::getStr() const
+       {
+               return m_str;
+       }
+
+       inline TString::operator const std::string &() const
+       {
+               return m_str;
+       }
+
+       inline const char *TString::getCStr() const
+       {
+               return m_str.c_str();
+       }
+
+       inline TString::operator const char *() const
+       {
+               return m_str.c_str();
+       }
+
+       inline bool TString::isTranslatable() const
+       {
+               return (m_domain != nullptr);
+       }
+
+       inline bool TString::hasDomain() const
+       {
+               return isNotEmpty(m_domain);
+       }
+
+       inline const char *TString::getDomain() const
+       {
+               return m_domain;
+       }
+
+       inline const char *TString::translate() const
+       {
+               if (!m_domain) {
+                       return getCStr();
+               }
+               return doTranslate(getCStr());
+       }
+
+       inline const char *TString::doTranslate(const char *const strId) const
+       {
+               if (m_domain[0] == '\0') {
+                       return i18n_get_text(strId);
+               }
+               return dgettext(m_domain, strId);
+       }
+
+       template <typename ...ARGS>
+       inline std::string TString::format(ARGS ...args) const
+       {
+               constexpr auto STR_LEN_ADJUST = 1.7f;
+
+               const char *fmt = m_str.c_str();
+               size_t fmtLen = m_str.length();
+
+               if (m_domain) {
+                       fmt = doTranslate(fmt);
+                       fmtLen = strlen(fmt);
+               }
+
+               size_t strLen = static_cast<size_t>(fmtLen * STR_LEN_ADJUST);
+
+               std::string result;
+
+               while (1) {
+                       result.resize(strLen);
+                       const size_t n = snprintf(&result[0], strLen, fmt, args...);
+                       if (n < strLen) {
+                               result.resize(n);
+                               break;
+                       }
+                       strLen = n + 1;
+               }
+
+               return result;
+       }
+}
diff --git a/ucl/include/ucl/misc/Timeout.h b/ucl/include/ucl/misc/Timeout.h
new file mode 100644 (file)
index 0000000..165265c
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_MISC_TIMEOUT_H__
+#define __UCL_MISC_TIMEOUT_H__
+
+#include <Ecore.h>
+
+#include "ucl/util/types.h"
+#include "ucl/util/smartDelegation.h"
+
+namespace ucl {
+
+       UCL_DECLARE_REF_ALIASES(Timeout);
+
+       class Timeout final : public NonCopyable {
+       public:
+               using TimeoutHandler = WeakDelegate<void(Timeout *sender)>;
+
+       public:
+               static TimeoutSRef create(double timeoutSec,
+                               const TimeoutHandler &handler);
+
+               bool isExpired() const;
+
+       private:
+               friend class ReffedObj<Timeout>;
+               Timeout(const TimeoutHandler &handler);
+               ~Timeout();
+
+               Result prepare(double timeoutSec);
+
+               Eina_Bool onTimer();
+
+       private:
+               Ecore_Timer *m_timer;
+               TimeoutHandler m_handler;
+       };
+}
+
+#endif // __UCL_MISC_TIMEOUT_H__
diff --git a/ucl/include/ucl/misc/Variant.h b/ucl/include/ucl/misc/Variant.h
new file mode 100644 (file)
index 0000000..6542358
--- /dev/null
@@ -0,0 +1,149 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_MISC_VARIANT_H__
+#define __UCL_MISC_VARIANT_H__
+
+#include <array>
+#include <vector>
+#include <initializer_list>
+
+#include "ConstCString.h"
+
+namespace ucl {
+
+       class Variant;
+
+       using VarVector = std::vector<Variant>;
+
+       template <size_t N>
+       using VarArray = std::array<Variant, N>;
+
+       struct VarInitList final {
+               VarInitList(const std::initializer_list<Variant> &il) : il(il) {}
+               const std::initializer_list<Variant> &il;
+       };
+
+       class Variant final {
+       public:
+               enum Type {
+                       TYPE_NIL,
+                       TYPE_BOOLEAN,
+                       TYPE_INTEGER,
+                       TYPE_FLOAT,
+                       TYPE_DOUBLE,
+                       TYPE_STRING,
+                       TYPE_ARRAY
+               };
+
+       public:
+               friend void swap(Variant &x, Variant &y) noexcept;
+
+               friend bool operator==(const Variant &lhs, const Variant &rhs) noexcept;
+               friend bool operator!=(const Variant &lhs, const Variant &rhs) noexcept;
+
+       public:
+               Variant() noexcept;
+               Variant(std::nullptr_t) noexcept;
+
+               Variant(bool aBool) noexcept;
+               Variant(int anInt) noexcept;
+               Variant(float aFloat) noexcept;
+               Variant(double aDouble) noexcept;
+
+               Variant(const char *aString);
+               Variant(const char *aString, int length);
+               Variant(const std::string &aString);
+
+               Variant(std::nullptr_t, int arrayLength);
+               Variant(const Variant *anArray, int length);
+               Variant(const VarVector &anArray);
+               template <size_t N>
+               Variant(const VarArray<N> &anArray);
+               Variant(const VarInitList &anArray);
+
+               ~Variant();
+
+               Variant(const Variant &v);
+               Variant(Variant &&v) noexcept;
+
+               Variant &operator=(Variant v);
+
+               Type getType() const noexcept;
+               int getLength() const noexcept;
+               bool isEmpty() const noexcept;
+
+               bool asBool() const noexcept;
+               int asInt() const noexcept;
+               float asFloat() const noexcept;
+               double asDouble() const noexcept;
+
+               ConstCString asString() const noexcept;
+
+               Variant *asArray() noexcept;
+               const Variant *asArray() const noexcept;
+
+               Variant *begin() noexcept;
+               Variant *end() noexcept;
+               const Variant *begin() const noexcept;
+               const Variant *end() const noexcept;
+
+               Variant &operator[](int index) noexcept;
+               const Variant &operator[](int index) const noexcept;
+
+               explicit operator bool() const noexcept;
+               explicit operator int() const noexcept;
+               explicit operator float() const noexcept;
+               explicit operator double() const noexcept;
+
+               bool operator==(Variant::Type rhs) const noexcept;
+               bool operator!=(Variant::Type rhs) const noexcept;
+
+       private:
+               const char *getStr() const noexcept;
+
+       public:
+               union {
+                       uint8_t m_type;
+                       struct {
+                               uint64_t qw1;
+                               uint64_t qw2;
+                       } m_raw;
+                       struct { uint8_t type; bool value; } m_aBool;
+                       struct { uint8_t type; int value; } m_anInt;
+                       struct { uint8_t type; float value; } m_aFloat;
+                       struct { uint8_t type; double value; } m_aDouble;
+                       struct {
+                               uint8_t type;
+                               char buffer[sizeof(m_raw) - 1];
+                       } m_aSmallStr;
+                       struct {
+                               uint8_t type;
+                               int length;
+                               char *data;
+                       } m_aString;
+                       struct {
+                               uint8_t type;
+                               int length;
+                               Variant *data;
+                       } m_anArray;
+               };
+       };
+}
+
+#include "Variant.hpp"
+
+#endif // __UCL_MISC_VARIANT_H__
diff --git a/ucl/include/ucl/misc/Variant.hpp b/ucl/include/ucl/misc/Variant.hpp
new file mode 100644 (file)
index 0000000..fe6d977
--- /dev/null
@@ -0,0 +1,249 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 <cstring>
+
+namespace ucl { namespace { namespace impl {
+
+       constexpr auto TYPE_MASK = 0x0F;
+
+       constexpr auto FLAG_SMALL_STR = 0x80;
+       constexpr auto TYPE_SMALL_STR = (Variant::TYPE_STRING | FLAG_SMALL_STR);
+
+       constexpr auto TMP_STR_BUFF_SIZE = 32;
+}}}
+
+namespace ucl {
+
+       // Variant //
+
+       inline Variant::Variant() noexcept :
+               m_type(TYPE_NIL)
+       {
+       }
+
+       inline Variant::Variant(std::nullptr_t) noexcept :
+               Variant()
+       {
+       }
+
+       inline Variant::Variant(const bool aBool) noexcept :
+               m_type(TYPE_BOOLEAN)
+       {
+               m_aBool.value = aBool;
+       }
+
+       inline Variant::Variant(const int anInt) noexcept :
+               m_type(TYPE_INTEGER)
+       {
+               m_anInt.value = anInt;
+       }
+
+       inline Variant::Variant(const float aFloat) noexcept :
+               m_type(TYPE_FLOAT)
+       {
+               m_aFloat.value = aFloat;
+       }
+
+       inline Variant::Variant(const double aDouble) noexcept :
+               m_type(TYPE_DOUBLE)
+       {
+               m_aDouble.value = aDouble;
+       }
+
+       inline Variant::Variant(const char *const aString) :
+               Variant(aString, -1)
+       {
+       }
+
+       inline Variant::Variant(const std::string &aString) :
+               Variant(aString.c_str(), aString.size())
+       {
+       }
+
+       inline Variant::Variant(const VarVector &anArray) :
+               Variant(anArray.data(), anArray.size())
+       {
+       }
+
+       template <size_t N>
+       inline Variant::Variant(const VarArray<N> &anArray) :
+               Variant(anArray.data(), anArray.size())
+       {
+       }
+
+       inline Variant::Variant(const VarInitList &anArray) :
+               Variant(anArray.il.begin(), anArray.il.size())
+       {
+       }
+
+       inline Variant::~Variant()
+       {
+               switch (m_type) {
+               case TYPE_STRING:
+                       free(m_aString.data);
+                       break;
+               case TYPE_ARRAY:
+                       delete[] m_anArray.data;
+                       break;
+               }
+       }
+
+       inline Variant::Variant(Variant &&v) noexcept :
+               m_type(v.m_type)
+       {
+               switch (m_type) {
+               case TYPE_NIL:
+                       break;
+               case TYPE_STRING:
+                       m_aString.data = v.m_aString.data;
+                       m_aString.length = v.m_aString.length;
+                       v.m_type = TYPE_NIL;
+                       break;
+               case TYPE_ARRAY:
+                       m_anArray.data = v.m_anArray.data;
+                       m_anArray.length = v.m_anArray.length;
+                       v.m_type = TYPE_NIL;
+                       break;
+               default:
+                       m_raw = v.m_raw;
+                       break;
+               }
+       }
+
+       inline Variant &Variant::operator=(Variant v)
+       {
+               swap(*this, v);
+               return *this;
+       }
+
+       inline Variant::Type Variant::getType() const noexcept
+       {
+               return Type(m_type & impl::TYPE_MASK);
+       }
+
+       inline int Variant::getLength() const noexcept
+       {
+               switch (m_type) {
+               case TYPE_NIL:
+                       return 0;
+               case TYPE_STRING:
+                       return m_aString.length;
+               case TYPE_ARRAY:
+                       return m_anArray.length;
+               case impl::TYPE_SMALL_STR:
+                       return strlen(m_aSmallStr.buffer);
+               }
+               return 1;
+       }
+
+       inline bool Variant::isEmpty() const noexcept
+       {
+               return (getLength() == 0);
+       }
+
+       inline const char *Variant::getStr() const noexcept
+       {
+               return ((m_type == TYPE_STRING) ? m_aString.data : m_aSmallStr.buffer);
+       }
+
+       inline Variant *Variant::asArray() noexcept
+       {
+               return begin();
+       }
+
+       inline const Variant *Variant::asArray() const noexcept
+       {
+               return begin();
+       }
+
+       inline Variant *Variant::begin() noexcept
+       {
+               return ((m_type == TYPE_ARRAY) ? m_anArray.data : this);
+       }
+
+       inline Variant *Variant::end() noexcept
+       {
+               return ((m_type == TYPE_ARRAY) ?
+                               (m_anArray.data + m_anArray.length) : (this + 1));
+       }
+
+       inline const Variant *Variant::begin() const noexcept
+       {
+               return const_cast<Variant *>(this)->begin();
+       }
+
+       inline const Variant *Variant::end() const noexcept
+       {
+               return const_cast<Variant *>(this)->end();
+       }
+
+       inline Variant &Variant::operator[](int index) noexcept
+       {
+               return asArray()[index];
+       }
+
+       inline const Variant &Variant::operator[](int index) const noexcept
+       {
+               return asArray()[index];
+       }
+
+       inline Variant::operator bool() const noexcept
+       {
+               return asBool();
+       }
+
+       inline Variant::operator int() const noexcept
+       {
+               return asInt();
+       }
+
+       inline Variant::operator float() const noexcept
+       {
+               return asFloat();
+       }
+
+       inline Variant::operator double() const noexcept
+       {
+               return asDouble();
+       }
+
+       inline bool Variant::operator==(const Variant::Type rhs) const noexcept
+       {
+               return (m_type == rhs);
+       }
+
+       inline bool Variant::operator!=(const Variant::Type rhs) const noexcept
+       {
+               return (m_type != rhs);
+       }
+
+       // Non-member functions //
+
+       inline void swap(Variant &x, Variant &y) noexcept
+       {
+               static_assert(sizeof(Variant) == sizeof(Variant::m_raw),
+                               "Invalid Variant data structure!");
+               static_assert(std::is_standard_layout<Variant>::value,
+                               "Variant has not standard layout!");
+               std::swap(x.m_raw, y.m_raw);
+       }
+
+       inline bool operator!=(const Variant &lhs, const Variant &rhs) noexcept
+       {
+               return !(lhs == rhs);
+       }
+}
diff --git a/ucl/include/ucl/mvp/GuiPresenter.h b/ucl/include/ucl/mvp/GuiPresenter.h
new file mode 100644 (file)
index 0000000..5a94af4
--- /dev/null
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_MVP_GUI_PRESENTER_H__
+#define __UCL_MVP_GUI_PRESENTER_H__
+
+#include <unordered_set>
+
+#include "ucl/gui/Window.h"
+
+#include "types.h"
+
+namespace ucl {
+
+       UCL_DECLARE_REF_ALIASES(GuiPresenter);
+
+       class GuiPresenter : public RefCountAware {
+       public:
+               struct DeactivatorInfo final {
+                       const void *deactivator;
+                       bool isBroadcast;
+               };
+
+       public:
+               bool isActive() const;
+               bool isDeactivatedBy(const void *deactivator) const;
+
+               void activateBy(const void *deactivator);
+               void deactivateBy(const void *deactivator);
+
+               void addDeactivatorSource(Widget &source);
+               void delDeactivatorSource(Widget &source);
+
+       protected:
+               enum {
+                       PF_ADD_DEACTIVATOR_SOURCES = 1,
+                       PF_ADD_SELF_EXCEPT = 2,
+
+                       PF_PASSIVE = 0,
+                       PF_DEACTIVATOR = (PF_ADD_DEACTIVATOR_SOURCES | PF_ADD_SELF_EXCEPT),
+                       PF_DEFAULT = PF_ADD_DEACTIVATOR_SOURCES
+               };
+
+       protected:
+               GuiPresenter(IRefCountObj &rc);
+               virtual ~GuiPresenter();
+
+               Result prepare(ElmWidget &widget, int flags = PF_DEFAULT);
+               Result prepare(GuiPresenter &parent, int flags = PF_DEFAULT);
+
+               Window &getWindow();
+               bool isWindowReady() const;
+
+               void addDeactivatorException(const void *deactivator);
+               void setDeactivatorSink(const WidgetSRef &sink);
+
+               void sendActivate(Widget &sender);
+               void sendDeactivate(Widget &sender);
+
+               void broadcastActivate();
+               void broadcastDeactivate();
+
+               virtual void onActivate();
+               virtual void onDeactivate();
+               virtual void onActivateBy(const DeactivatorInfo &info);
+               virtual void onDeactivateBy(const DeactivatorInfo &info);
+
+       private:
+               void sendDeactivator(Widget &sender,
+                               SmartEvent event, const void *deactivator);
+               void broadcastDeactivator(SmartEvent event,
+                               const void *deactivator);
+
+               void sendDeactivatorInfo(Widget &sender, SmartEvent event,
+                               const DeactivatorInfo &info);
+
+               void activateByImpl(const DeactivatorInfo &info);
+               void deactivateByImpl(const DeactivatorInfo &info);
+
+               void onActivateBySmart(Widget &widget, void *eventInfo);
+               void onDeactivateBySmart(Widget &widget, void *eventInfo);
+
+       private:
+               std::unordered_set<const void *> m_deactivatorExceptions;
+               std::unordered_set<const void *> m_deactivators;
+               WindowSRef m_window;
+               WidgetSRef m_sink;
+               WidgetWRef m_parentSink;
+               bool m_hasBuildInSources;
+               bool m_isChild;
+               bool m_isPrepared;
+       };
+}
+
+#endif // __UCL_MVP_GUI_PRESENTER_H__
diff --git a/ucl/include/ucl/mvp/ListItemPresenter.h b/ucl/include/ucl/mvp/ListItemPresenter.h
new file mode 100644 (file)
index 0000000..46d2fb4
--- /dev/null
@@ -0,0 +1,131 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_MVP_LIST_ITEM_PRESENTER_H__
+#define __UCL_MVP_LIST_ITEM_PRESENTER_H__
+
+#include "ucl/gui/GenlistItem.h"
+#include "ucl/gui/ElmWidget.h"
+
+#include "ucl/misc/HashMap.h"
+
+#include "types.h"
+
+namespace ucl {
+
+       UCL_DECLARE_REF_ALIASES(ListItemPresenter);
+
+       class ListItemPresenter : public RefCountAware,
+                       public IDisposable {
+       public:
+               // IDisposable //
+
+               virtual void dispose() final override;
+               virtual bool isDisposed() const final override;
+
+       protected:
+               friend class ListPresenter;
+
+               UCL_DECLARE_REF_ALIASES(ItemClass);
+               UCL_DECLARE_REF_ALIASES(ItemClassCache);
+
+               // Flags
+               enum {
+                       PF_AUTO_UNSELECT = 1
+               };
+
+               struct ItemInsertionParams {
+                       ElmStyle itemStyle;
+                       GenlistItem::Type itemType;
+
+                       ItemInsertionParams(ElmStyle itemStyle,
+                                       GenlistItem::Type itemType = GenlistItem::Type::SIMPLE) :
+                               itemStyle(itemStyle), itemType(itemType) {}
+               };
+
+               class ItemClass final : public NonCopyable {
+               public:
+                       static ItemClassSRef newInstance(ElmStyle itemStyle);
+               public:
+                       Elm_Genlist_Item_Class *get();
+               private:
+                       friend class ReffedObj<ItemClass>;
+                       ItemClass(ElmStyle itemStyle);
+                       ~ItemClass();
+               private:
+                       Elm_Genlist_Item_Class *const m_itc;
+               };
+
+               class ItemClassCache final : public NonCopyable {
+               public:
+                       ItemClassSRef getItemClass(ElmStyle itemStyle);
+                       void purge();
+               private:
+                       HashMap<ElmStyle, ItemClassSRef> m_itcMap;
+               };
+
+       protected:
+               ListItemPresenter(IRefCountObj &rc);
+               virtual ~ListItemPresenter();
+
+               void setFlags(int flags);
+               int getFlags() const;
+
+               bool isActive() const;
+
+               GenlistItem getItem();
+               ItemClassCache *getItemClassCache();
+
+               Result updateItemStyle(ElmStyle newItemStyle);
+
+               virtual ItemInsertionParams getItemInsertionParams() = 0;
+
+               virtual void onItemAttached();
+               virtual void onItemDetached();
+
+               virtual CString getItemPartText(EdjePart part);
+               virtual WidgetSRef getItemPartContent(EdjePart part, ElmWidget &parent);
+               virtual bool getItemPartState(EdjePart part);
+
+               virtual void onItemSelected();
+               virtual void onItemRealized();
+               virtual void onItemUnrealized();
+               virtual void onItemHighlighted();
+               virtual void onItemUnhighlighted();
+
+       private:
+               void attachItem(GenlistItem item,
+                               ElmWidgetSRef &&parent,
+                               const ItemClassCacheSRef &itcCache,
+                               const SharedRef<bool> &isActiveRef);
+
+               void deleteDetachedItem(bool silent = false);
+               void detachItem(bool silent = false);
+
+               void onItemSelectedHook();
+               void onItemDel(Evas_Object *obj, void *eventInfo);
+
+       private:
+               ListItemPresenterSRef m_selfRef;
+               GenlistItem m_item;
+               ItemClassCacheSRef m_itcCache;
+               SharedRef<bool> m_isActiveRef;
+               ElmWidgetSRef m_parent;
+               int m_flags;
+       };
+}
+
+#endif // __UCL_MVP_LIST_ITEM_PRESENTER_H__
diff --git a/ucl/include/ucl/mvp/ListPresenter.h b/ucl/include/ucl/mvp/ListPresenter.h
new file mode 100644 (file)
index 0000000..1d62e41
--- /dev/null
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_MVP_LIST_PRESENTER_H__
+#define __UCL_MVP_LIST_PRESENTER_H__
+
+#include "ucl/gui/Genlist.h"
+
+#include "GuiPresenter.h"
+#include "ListItemPresenter.h"
+
+namespace ucl {
+
+       UCL_DECLARE_REF_ALIASES(ListPresenter);
+
+       class ListPresenter final : public GuiPresenter {
+       public:
+               enum {
+                       FLAG_HOMOGENEOUS = (1 << 0),
+                       FLAG_CALC_X_MIN = (1 << 1),
+                       FLAG_CALC_Y_MIN = (1 << 2),
+
+                       FLAG_NOTIFY_REALIZED = (1 << 8),
+                       FLAG_NOTIFY_UNREALIZED = (1 << 9),
+                       FLAG_NOTIFY_HIGHLIGHTED = (1 << 10),
+                       FLAG_NOTIFY_UNHIGHLIGHTED = (1 << 11),
+               };
+
+               class Builder final {
+               public:
+                       Builder();
+                       Builder &setStyle(ElmStyle style);
+                       Builder &setFlags(int flags);
+                       Builder &setParentWidget(const ElmWidgetSRef &parentWidget);
+                       ListPresenterSRef build(GuiPresenter &parent) const;
+               private:
+                       ucl::ElmWidgetSRef m_parentWidget;
+                       ElmStyle m_style;
+                       int m_flags;
+               };
+
+       public:
+               Genlist &getWidget();
+
+               void clear();
+
+               Result append(ListItemPresenter &itemPresenter,
+                               ListItemPresenter *parent = nullptr);
+
+               Result prepend(ListItemPresenter &itemPresenter,
+                               ListItemPresenter *parent = nullptr);
+
+               Result insertAfter(const ListItemPresenter &after,
+                               ListItemPresenter &itemPresenter,
+                               ListItemPresenter *parent = nullptr);
+
+               Result insertBefore(const ListItemPresenter &before,
+                               ListItemPresenter &itemPresenter,
+                               ListItemPresenter *parent = nullptr);
+
+       private:
+               friend class ReffedObj<ListPresenter>;
+               ListPresenter(IRefCountObj &rc);
+               virtual ~ListPresenter();
+
+               Result prepare(GuiPresenter &parent, ElmWidget &parentWidget,
+                               ElmStyle style, int flags);
+
+               template <class INSERT_FUNC>
+               Result insert(ListItemPresenter &itemPresenter,
+                               ListItemPresenter *parent,
+                               INSERT_FUNC &&insertFunc);
+
+               template <class INSERT_FUNC>
+               Result insertRelative(const ListItemPresenter &relative,
+                               ListItemPresenter &itemPresenter,
+                               ListItemPresenter *parent, INSERT_FUNC &&insertFunc);
+
+               void setIsActiveRef(bool value);
+
+               void onItemSelected(Widget &widget, void *eventInfo);
+
+               void onItemRealized(Widget &widget, void *eventInfo);
+               void onItemUnrealized(Widget &widget, void *eventInfo);
+               void onItemHighlighted(Widget &widget, void *eventInfo);
+               void onItemUnhighlighted(Widget &widget, void *eventInfo);
+
+               // GuiPresenter //
+
+               virtual void onActivate() final override;
+               virtual void onDeactivate() final override;
+
+       private:
+               GenlistSRef m_genlist;
+               ListItemPresenter::ItemClassCacheSRef m_itcCache;
+               SharedRef<bool> m_isActiveRef;
+       };
+}
+
+#endif // __UCL_MVP_LIST_PRESENTER_H__
diff --git a/ucl/include/ucl/mvp/types.h b/ucl/include/ucl/mvp/types.h
new file mode 100644 (file)
index 0000000..6c263e2
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_MVP_TYPES_H__
+#define __UCL_MVP_TYPES_H__
+
+#include "ucl/gui/types.h"
+
+#endif // __UCL_MVP_TYPES_H__
diff --git a/ucl/include/ucl/util/delegation.h b/ucl/include/ucl/util/delegation.h
new file mode 100644 (file)
index 0000000..a624c08
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_UTIL_DELEGATION_H__
+#define __UCL_UTIL_DELEGATION_H__
+
+#include "delegation/Callback.h"
+
+#include "delegation/BaseDelegate.h"
+#include "delegation/BaseDelegate2.h"
+
+#include "delegation/Delegate.h"
+#include "delegation/Delegate2.h"
+
+#include "delegation/helpers.h"
+#include "delegation/macro.h"
+
+#if (UCL_INCLUDE_DELEGATION_SHORT_MACRO_H)
+#include "delegation/shortMacro.h"
+#endif
+
+#endif // __UCL_UTIL_DELEGATION_H__
diff --git a/ucl/include/ucl/util/delegation/BaseDelegate.h b/ucl/include/ucl/util/delegation/BaseDelegate.h
new file mode 100644 (file)
index 0000000..62b92ff
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_UTIL_DELEGATION_BASE_DELEGATE_H__
+#define __UCL_UTIL_DELEGATION_BASE_DELEGATE_H__
+
+#include "Callback.h"
+
+namespace ucl {
+
+       template <class FUNC_SIG, class DATA>
+       class BaseDelegate;
+
+       template <class FUNC_SIG, class DATA>
+       class BaseDelegate2;
+
+       template <class R, class ...ARGS, class DATA>
+       class BaseDelegate<R(ARGS...), DATA> {
+       public:
+               using Cb = Callback<R(ARGS...)>;
+               using StubA = typename Cb::StubA;
+
+       public:
+               constexpr BaseDelegate() noexcept;
+               constexpr BaseDelegate(std::nullptr_t) noexcept;
+
+               template <class FUNC_SIG>
+               BaseDelegate(const BaseDelegate2<FUNC_SIG, DATA> &d) noexcept;
+               template <class FUNC_SIG>
+               BaseDelegate(BaseDelegate2<FUNC_SIG, DATA> &&d) noexcept;
+
+               void reset() noexcept;
+
+               const DATA &getData() const noexcept;
+               StubA getStubA() const noexcept;
+               operator bool() const noexcept;
+
+       protected:
+               BaseDelegate(const DATA &data, StubA stubA) noexcept;
+
+       protected:
+               DATA m_data;
+               StubA m_stubA;
+       };
+}
+
+#include "BaseDelegate.hpp"
+
+#endif // __UCL_UTIL_DELEGATION_BASE_DELEGATE_H__
diff --git a/ucl/include/ucl/util/delegation/BaseDelegate.hpp b/ucl/include/ucl/util/delegation/BaseDelegate.hpp
new file mode 100644 (file)
index 0000000..f25c0a7
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+namespace ucl {
+
+       template <class R, class ...ARGS, class DATA>
+       constexpr BaseDelegate<R(ARGS...), DATA>::BaseDelegate() noexcept :
+               m_data(nullptr),
+               m_stubA(nullptr)
+       {
+       }
+
+       template <class R, class ...ARGS, class DATA>
+       constexpr BaseDelegate<R(ARGS...), DATA>::
+                       BaseDelegate(std::nullptr_t) noexcept :
+               BaseDelegate()
+       {
+       }
+
+       template <class R, class ...ARGS, class DATA>
+       inline BaseDelegate<R(ARGS...), DATA>::
+                       BaseDelegate(const DATA &data, StubA stubA) noexcept :
+               m_data(data),
+               m_stubA(stubA)
+       {
+       }
+
+       template <class R, class ...ARGS, class DATA>
+       template <class FUNC_SIG>
+       inline BaseDelegate<R(ARGS...), DATA>::
+                       BaseDelegate(const BaseDelegate2<FUNC_SIG, DATA> &d) noexcept :
+               m_data(d.m_data),
+               m_stubA(d.m_stubA)
+       {
+       }
+
+       template <class R, class ...ARGS, class DATA>
+       template <class FUNC_SIG>
+       inline BaseDelegate<R(ARGS...), DATA>::
+                       BaseDelegate(BaseDelegate2<FUNC_SIG, DATA> &&d) noexcept :
+               m_data(std::move(d.m_data)),
+               m_stubA(d.m_stubA)
+       {
+       }
+
+       template <class R, class ...ARGS, class DATA>
+       inline void BaseDelegate<R(ARGS...), DATA>::reset() noexcept
+       {
+               *this = {};
+       }
+
+       template <class R, class ...ARGS, class DATA>
+       inline const DATA &BaseDelegate<R(ARGS...), DATA>::getData() const noexcept
+       {
+               return m_data;
+       }
+
+       template <class R, class ...ARGS, class DATA>
+       inline typename BaseDelegate<R(ARGS...), DATA>::StubA
+                       BaseDelegate<R(ARGS...), DATA>::getStubA() const noexcept
+       {
+               return m_stubA;
+       }
+
+       template <class R, class ...ARGS, class DATA>
+       inline BaseDelegate<R(ARGS...), DATA>::operator bool() const noexcept
+       {
+               return !!m_data;
+       }
+}
diff --git a/ucl/include/ucl/util/delegation/BaseDelegate2.h b/ucl/include/ucl/util/delegation/BaseDelegate2.h
new file mode 100644 (file)
index 0000000..ff3b635
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_UTIL_DELEGATION_BASE_DELEGATE2_H__
+#define __UCL_UTIL_DELEGATION_BASE_DELEGATE2_H__
+
+#include "BaseDelegate.h"
+
+namespace ucl {
+
+       template <class FUNC_SIG, class DATA>
+       class BaseDelegate2;
+
+       template <class R, class ...ARGS, class DATA>
+       class BaseDelegate2<R(ARGS...), DATA> :
+                       public BaseDelegate<R(ARGS...), DATA> {
+       public:
+               using Cb = typename BaseDelegate2::Cb;
+               using StubA = typename Cb::StubA;
+               using StubB = typename Cb::StubB;
+
+       public:
+               using BaseDelegate<R(ARGS...), DATA>::BaseDelegate;
+
+               StubB getStubB() const noexcept;
+
+       protected:
+               BaseDelegate2(const DATA &data, StubA stubA, StubB stubB) noexcept;
+
+       private:
+               StubB m_stubB;
+       };
+}
+
+#include "BaseDelegate2.hpp"
+
+#endif // __UCL_UTIL_DELEGATION_BASE_DELEGATE2_H__
diff --git a/ucl/include/ucl/util/delegation/BaseDelegate2.hpp b/ucl/include/ucl/util/delegation/BaseDelegate2.hpp
new file mode 100644 (file)
index 0000000..6d8efa7
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+namespace ucl {
+
+       template <class R, class ...ARGS, class DATA>
+       inline BaseDelegate2<R(ARGS...), DATA>::
+                       BaseDelegate2(const DATA &data, StubA stubA, StubB stubB) noexcept :
+               BaseDelegate<R(ARGS...), DATA>(data, stubA),
+               m_stubB(stubB)
+       {
+       }
+
+       template <class R, class ...ARGS, class DATA>
+       inline typename BaseDelegate2<R(ARGS...), DATA>::StubB
+                       BaseDelegate2<R(ARGS...), DATA>::getStubB() const noexcept
+       {
+               return m_stubB;
+       }
+}
diff --git a/ucl/include/ucl/util/delegation/Callback.h b/ucl/include/ucl/util/delegation/Callback.h
new file mode 100644 (file)
index 0000000..69724be
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_UTIL_DELEGATION_CALLBACK_H__
+#define __UCL_UTIL_DELEGATION_CALLBACK_H__
+
+#include "ucl/util/types/baseTypes.h"
+
+namespace ucl {
+
+       template <class FUNC_SIG>
+       class Callback;
+
+       template <class R, class ...ARGS>
+       class Callback<R(ARGS...)> {
+       public:
+               using StubA = R(*)(void *, ARGS...);
+               using StubB = R(*)(ARGS..., void *);
+
+       public:
+               template <class CLASS, R(CLASS::*METHOD)(ARGS...)>
+               static R stubA(void *data, ARGS ...args);
+               template <class CLASS, R(CLASS::*METHOD)(ARGS...)>
+               static R stubB(ARGS ...args, void *data);
+
+               template <class CLASS, R(CLASS::*METHOD)(ARGS...) const>
+               static R stubA(void *data, ARGS ...args);
+               template <class CLASS, R(CLASS::*METHOD)(ARGS...) const>
+               static R stubB(ARGS ...args, void *data);
+
+               template <class CLASS, R(*FUNC)(CLASS &, ARGS...)>
+               static R stubA2A(void *data, ARGS ...args);
+               template <class CLASS, R(*FUNC)(CLASS &, ARGS...)>
+               static R stubB2A(ARGS ...args, void *data);
+
+               template <class CLASS, R(*FUNC)(ARGS..., CLASS &)>
+               static R stubA2B(void *data, ARGS ...args);
+               template <class CLASS, R(*FUNC)(ARGS..., CLASS &)>
+               static R stubB2B(ARGS ...args, void *data);
+
+               template <class HANDLE, R(*FUNC)(HANDLE, ARGS...)>
+               static R stubA2A(void *data, ARGS ...args);
+               template <class HANDLE, R(*FUNC)(HANDLE, ARGS...)>
+               static R stubB2A(ARGS ...args, void *data);
+
+               template <class HANDLE, R(*FUNC)(ARGS..., HANDLE)>
+               static R stubA2B(void *data, ARGS ...args);
+               template <class HANDLE, R(*FUNC)(ARGS..., HANDLE)>
+               static R stubB2B(ARGS ...args, void *data);
+
+               template <R(*FUNC)(ARGS...)>
+               static R stubA2V(void *data, ARGS ...args);
+               template <R(*FUNC)(ARGS...)>
+               static R stubB2V(ARGS ...args, void *data);
+       };
+}
+
+#include "Callback.hpp"
+
+#endif // __UCL_UTIL_DELEGATION_CALLBACK_H__
diff --git a/ucl/include/ucl/util/delegation/Callback.hpp b/ucl/include/ucl/util/delegation/Callback.hpp
new file mode 100644 (file)
index 0000000..28d2145
--- /dev/null
@@ -0,0 +1,120 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+namespace ucl {
+
+       template <class R, class ...ARGS>
+       template <class CLASS, R(CLASS::*METHOD)(ARGS...)>
+       inline R Callback<R(ARGS...)>::stubA(void *data, ARGS ...args)
+       {
+               return (static_cast<CLASS *>(data)->*METHOD)(
+                               std::forward<ARGS>(args)...);
+       }
+
+       template <class R, class ...ARGS>
+       template <class CLASS, R(CLASS::*METHOD)(ARGS...)>
+       inline R Callback<R(ARGS...)>::stubB(ARGS ...args, void *data)
+       {
+               return (static_cast<CLASS *>(data)->*METHOD)(
+                               std::forward<ARGS>(args)...);
+       }
+
+       template <class R, class ...ARGS>
+       template <class CLASS, R(CLASS::*METHOD)(ARGS...) const>
+       inline R Callback<R(ARGS...)>::stubA(void *data, ARGS ...args)
+       {
+               return (static_cast<const CLASS *>(data)->*METHOD)(
+                               std::forward<ARGS>(args)...);
+       }
+
+       template <class R, class ...ARGS>
+       template <class CLASS, R(CLASS::*METHOD)(ARGS...) const>
+       inline R Callback<R(ARGS...)>::stubB(ARGS ...args, void *data)
+       {
+               return (static_cast<const CLASS *>(data)->*METHOD)(
+                               std::forward<ARGS>(args)...);
+       }
+
+       template <class R, class ...ARGS>
+       template <class CLASS, R(*FUNC)(CLASS &, ARGS...)>
+       inline R Callback<R(ARGS...)>::stubA2A(void *data, ARGS ...args)
+       {
+               return FUNC(*static_cast<CLASS *>(data), std::forward<ARGS>(args)...);
+       }
+
+       template <class R, class ...ARGS>
+       template <class CLASS, R(*FUNC)(CLASS &, ARGS...)>
+       inline R Callback<R(ARGS...)>::stubB2A(ARGS ...args, void *data)
+       {
+               return FUNC(*static_cast<CLASS *>(data), std::forward<ARGS>(args)...);
+       }
+
+       template <class R, class ...ARGS>
+       template <class CLASS, R(*FUNC)(ARGS..., CLASS &)>
+       inline R Callback<R(ARGS...)>::stubA2B(void *data, ARGS ...args)
+       {
+               return FUNC(std::forward<ARGS>(args)..., *static_cast<CLASS *>(data));
+       }
+
+       template <class R, class ...ARGS>
+       template <class CLASS, R(*FUNC)(ARGS..., CLASS &)>
+       inline R Callback<R(ARGS...)>::stubB2B(ARGS ...args, void *data)
+       {
+               return FUNC(std::forward<ARGS>(args)..., *static_cast<CLASS *>(data));
+       }
+
+       template <class R, class ...ARGS>
+       template <class HANDLE, R(*FUNC)(HANDLE, ARGS...)>
+       inline R Callback<R(ARGS...)>::stubA2A(void *data, ARGS ...args)
+       {
+               return FUNC(static_cast<HANDLE>(data), std::forward<ARGS>(args)...);
+       }
+
+       template <class R, class ...ARGS>
+       template <class HANDLE, R(*FUNC)(HANDLE, ARGS...)>
+       inline R Callback<R(ARGS...)>::stubB2A(ARGS ...args, void *data)
+       {
+               return FUNC(static_cast<HANDLE>(data), std::forward<ARGS>(args)...);
+       }
+
+       template <class R, class ...ARGS>
+       template <class HANDLE, R(*FUNC)(ARGS..., HANDLE)>
+       inline R Callback<R(ARGS...)>::stubA2B(void *data, ARGS ...args)
+       {
+               return FUNC(std::forward<ARGS>(args)..., static_cast<HANDLE>(data));
+       }
+
+       template <class R, class ...ARGS>
+       template <class HANDLE, R(*FUNC)(ARGS..., HANDLE)>
+       inline R Callback<R(ARGS...)>::stubB2B(ARGS ...args, void *data)
+       {
+               return FUNC(std::forward<ARGS>(args)..., static_cast<HANDLE>(data));
+       }
+
+       template <class R, class ...ARGS>
+       template <R(*FUNC)(ARGS...)>
+       inline R Callback<R(ARGS...)>::stubA2V(void *data, ARGS ...args)
+       {
+               return FUNC(std::forward<ARGS>(args)...);
+       }
+
+       template <class R, class ...ARGS>
+       template <R(*FUNC)(ARGS...)>
+       inline R Callback<R(ARGS...)>::stubB2V(ARGS ...args, void *data)
+       {
+               return FUNC(std::forward<ARGS>(args)...);
+       }
+}
diff --git a/ucl/include/ucl/util/delegation/Delegate.h b/ucl/include/ucl/util/delegation/Delegate.h
new file mode 100644 (file)
index 0000000..e1e7416
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_UTIL_DELEGATION_DELEGATE_H__
+#define __UCL_UTIL_DELEGATION_DELEGATE_H__
+
+#include "BaseDelegate.h"
+
+namespace ucl {
+
+       template <class FUNC_SIG>
+       class Delegate;
+
+       template <class R, class ...ARGS>
+       class Delegate<R(ARGS...)> : public BaseDelegate<R(ARGS...), void *> {
+       public:
+               using BaseDelegate<R(ARGS...), void *>::BaseDelegate;
+
+               R operator()(ARGS ...args) const;
+
+               template <class CLASS, R(CLASS::*METHOD)(ARGS...)>
+               static Delegate make(CLASS *data) noexcept;
+               template <class CLASS, R(CLASS::*METHOD)(ARGS...) const>
+               static Delegate make(const CLASS *data) noexcept;
+
+               template <class CLASS, R(*FUNC)(CLASS &, ARGS...)>
+               static Delegate makeA(CLASS &data) noexcept;
+               template <class CLASS, R(*FUNC)(ARGS..., CLASS &)>
+               static Delegate makeB(CLASS &data) noexcept;
+
+               template <class HANDLE, R(*FUNC)(HANDLE, ARGS...)>
+               static Delegate makeA(HANDLE data) noexcept;
+               template <class HANDLE, R(*FUNC)(ARGS..., HANDLE)>
+               static Delegate makeB(HANDLE data) noexcept;
+
+               template <R(*FUNC)(ARGS...)>
+               static Delegate make() noexcept;
+       };
+}
+
+#include "Delegate.hpp"
+
+#endif // __UCL_UTIL_DELEGATION_DELEGATE_H__
diff --git a/ucl/include/ucl/util/delegation/Delegate.hpp b/ucl/include/ucl/util/delegation/Delegate.hpp
new file mode 100644 (file)
index 0000000..632ec24
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+namespace ucl {
+
+       template <class R, class ...ARGS>
+       inline R Delegate<R(ARGS...)>::operator()(ARGS ...args) const
+       {
+               return this->m_stubA(this->m_data, std::forward<ARGS>(args)...);
+       }
+
+       template <class R, class ...ARGS>
+       template <class CLASS, R(CLASS::*METHOD)(ARGS...)>
+       inline Delegate<R(ARGS...)>
+                       Delegate<R(ARGS...)>::make(CLASS *const data) noexcept
+       {
+               return {static_cast<void *>(data),
+                               Delegate::Cb::template stubA<CLASS, METHOD>};
+       }
+
+       template <class R, class ...ARGS>
+       template <class CLASS, R(CLASS::*METHOD)(ARGS...) const>
+       inline Delegate<R(ARGS...)>
+                       Delegate<R(ARGS...)>::make(const CLASS *const data) noexcept
+       {
+               return {static_cast<void *>(const_cast<CLASS *>(data)),
+                               Delegate::Cb::template stubA<CLASS, METHOD>};
+       }
+
+       template <class R, class ...ARGS>
+       template <class CLASS, R(*FUNC)(CLASS &, ARGS...)>
+       inline Delegate<R(ARGS...)>
+                       Delegate<R(ARGS...)>::makeA(CLASS &data) noexcept
+       {
+               return {const_cast<void *>(static_cast<const void *>(&data)),
+                               Delegate::Cb::template stubA2A<CLASS, FUNC>};
+       }
+
+       template <class R, class ...ARGS>
+       template <class CLASS, R(*FUNC)(ARGS..., CLASS &)>
+       inline Delegate<R(ARGS...)>
+                       Delegate<R(ARGS...)>::makeB(CLASS &data) noexcept
+       {
+               return {const_cast<void *>(static_cast<const void *>(&data)),
+                               Delegate::Cb::template stubA2B<CLASS, FUNC>};
+       }
+
+       template <class R, class ...ARGS>
+       template <class HANDLE, R(*FUNC)(HANDLE, ARGS...)>
+       inline Delegate<R(ARGS...)>
+                       Delegate<R(ARGS...)>::makeA(const HANDLE data) noexcept
+       {
+               return {const_cast<void *>(static_cast<const void *>(data)),
+                               Delegate::Cb::template stubA2A<HANDLE, FUNC>};
+       }
+
+       template <class R, class ...ARGS>
+       template <class HANDLE, R(*FUNC)(ARGS..., HANDLE)>
+       inline Delegate<R(ARGS...)>
+                       Delegate<R(ARGS...)>::makeB(const HANDLE data) noexcept
+       {
+               return {const_cast<void *>(static_cast<const void *>(data)),
+                               Delegate::Cb::template stubA2B<HANDLE, FUNC>};
+       }
+
+       template <class R, class ...ARGS>
+       template <R(*FUNC)(ARGS...)>
+       inline Delegate<R(ARGS...)>
+                       Delegate<R(ARGS...)>::make() noexcept
+       {
+               return {nullptr, Delegate::Cb::template stubA2V<FUNC>};
+       }
+}
diff --git a/ucl/include/ucl/util/delegation/Delegate2.h b/ucl/include/ucl/util/delegation/Delegate2.h
new file mode 100644 (file)
index 0000000..56ff3fb
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_UTIL_DELEGATION_DELEGATE2_H__
+#define __UCL_UTIL_DELEGATION_DELEGATE2_H__
+
+#include "BaseDelegate2.h"
+
+namespace ucl {
+
+       template <class FUNC_SIG>
+       class Delegate2;
+
+       template <class R, class ...ARGS>
+       class Delegate2<R(ARGS...)> : public BaseDelegate2<R(ARGS...), void *> {
+       public:
+               using BaseDelegate2<R(ARGS...), void *>::BaseDelegate2;
+
+               R operator()(ARGS ...args) const;
+
+               template <class CLASS, R(CLASS::*METHOD)(ARGS...)>
+               static Delegate2 make(CLASS *data) noexcept;
+               template <class CLASS, R(CLASS::*METHOD)(ARGS...) const>
+               static Delegate2 make(const CLASS *data) noexcept;
+
+               template <class CLASS, R(*FUNC)(CLASS &, ARGS...)>
+               static Delegate2 makeA(CLASS &data) noexcept;
+               template <class CLASS, R(*FUNC)(ARGS..., CLASS &)>
+               static Delegate2 makeB(CLASS &data) noexcept;
+
+               template <class HANDLE, R(*FUNC)(HANDLE, ARGS...)>
+               static Delegate2 makeA(HANDLE data) noexcept;
+               template <class HANDLE, R(*FUNC)(ARGS..., HANDLE)>
+               static Delegate2 makeB(HANDLE data) noexcept;
+
+               template <R(*FUNC)(ARGS...)>
+               static Delegate2 make() noexcept;
+       };
+}
+
+#include "Delegate2.hpp"
+
+#endif // __UCL_UTIL_DELEGATION_DELEGATE2_H__
diff --git a/ucl/include/ucl/util/delegation/Delegate2.hpp b/ucl/include/ucl/util/delegation/Delegate2.hpp
new file mode 100644 (file)
index 0000000..085ba46
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+namespace ucl {
+
+       template <class R, class ...ARGS>
+       inline R Delegate2<R(ARGS...)>::operator()(ARGS ...args) const
+       {
+               return this->m_stubA(this->m_data, std::forward<ARGS>(args)...);
+       }
+
+       template <class R, class ...ARGS>
+       template <class CLASS, R(CLASS::*METHOD)(ARGS...)>
+       inline Delegate2<R(ARGS...)>
+                       Delegate2<R(ARGS...)>::make(CLASS *const data) noexcept
+       {
+               return {static_cast<void *>(data),
+                               Delegate2::Cb::template stubA<CLASS, METHOD>,
+                               Delegate2::Cb::template stubB<CLASS, METHOD>};
+       }
+
+       template <class R, class ...ARGS>
+       template <class CLASS, R(CLASS::*METHOD)(ARGS...) const>
+       inline Delegate2<R(ARGS...)>
+                       Delegate2<R(ARGS...)>::make(const CLASS *const data) noexcept
+       {
+               return {static_cast<void *>(const_cast<CLASS *>(data)),
+                               Delegate2::Cb::template stubA<CLASS, METHOD>,
+                               Delegate2::Cb::template stubB<CLASS, METHOD>};
+       }
+
+       template <class R, class ...ARGS>
+       template <class CLASS, R(*FUNC)(CLASS &, ARGS...)>
+       inline Delegate2<R(ARGS...)>
+                       Delegate2<R(ARGS...)>::makeA(CLASS &data) noexcept
+       {
+               return {const_cast<void *>(static_cast<const void *>(&data)),
+                               Delegate2::Cb::template stubA2A<CLASS, FUNC>,
+                               Delegate2::Cb::template stubB2A<CLASS, FUNC>};
+       }
+
+       template <class R, class ...ARGS>
+       template <class CLASS, R(*FUNC)(ARGS..., CLASS &)>
+       inline Delegate2<R(ARGS...)>
+                       Delegate2<R(ARGS...)>::makeB(CLASS &data) noexcept
+       {
+               return {const_cast<void *>(static_cast<const void *>(&data)),
+                               Delegate2::Cb::template stubA2B<CLASS, FUNC>,
+                               Delegate2::Cb::template stubB2B<CLASS, FUNC>};
+       }
+
+       template <class R, class ...ARGS>
+       template <class HANDLE, R(*FUNC)(HANDLE, ARGS...)>
+       inline Delegate2<R(ARGS...)>
+                       Delegate2<R(ARGS...)>::makeA(const HANDLE data) noexcept
+       {
+               return {const_cast<void *>(static_cast<const void *>(data)),
+                               Delegate2::Cb::template stubA2A<HANDLE, FUNC>,
+                               Delegate2::Cb::template stubB2A<HANDLE, FUNC>};
+       }
+
+       template <class R, class ...ARGS>
+       template <class HANDLE, R(*FUNC)(ARGS..., HANDLE)>
+       inline Delegate2<R(ARGS...)>
+                       Delegate2<R(ARGS...)>::makeB(const HANDLE data) noexcept
+       {
+               return {const_cast<void *>(static_cast<const void *>(data)),
+                               Delegate2::Cb::template stubA2B<HANDLE, FUNC>,
+                               Delegate2::Cb::template stubB2B<HANDLE, FUNC>};
+       }
+
+       template <class R, class ...ARGS>
+       template <R(*FUNC)(ARGS...)>
+       inline Delegate2<R(ARGS...)>
+                       Delegate2<R(ARGS...)>::make() noexcept
+       {
+               return {nullptr,
+                               Delegate2::Cb::template stubA2V<FUNC>,
+                               Delegate2::Cb::template stubB2V<FUNC>};
+       }
+}
diff --git a/ucl/include/ucl/util/delegation/helpers.h b/ucl/include/ucl/util/delegation/helpers.h
new file mode 100644 (file)
index 0000000..54ebb99
--- /dev/null
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_UTIL_DELEGATION_HELPERS_H__
+#define __UCL_UTIL_DELEGATION_HELPERS_H__
+
+namespace ucl {
+
+       // Automatic function signature detection for a specific type //
+
+       template <template <typename ...> class T, class TAG, class FUNC>
+       struct AutoFuncSig;
+
+       template <template <typename ...> class T,
+                        class R, class CLASS, class ...ARGS>
+       struct AutoFuncSig<T, void *, R(CLASS::*)(ARGS...)> {
+               using Data = CLASS;
+               using Type = T<R(ARGS...)>;
+       };
+
+       template <template <typename ...> class T,
+                       class CLASS, class R, class ...ARGS>
+       struct AutoFuncSig<T, void *, R(CLASS::*)(ARGS...) const> {
+               using Data = CLASS;
+               using Type = T<R(ARGS...)>;
+       };
+
+       template <template <typename ...> class T,
+                       class CLASS, class R, class ...ARGS>
+       struct AutoFuncSig<T, void *, R(*)(CLASS &, ARGS...)> {
+               using Data = CLASS;
+               using Type = T<R(ARGS...)>;
+       };
+
+       template <template <typename ...> class T,
+                       class HANDLE, class R, class ...ARGS>
+       struct AutoFuncSig<T, void *, R(*)(HANDLE, ARGS...)> {
+               using Data = HANDLE;
+               using Type = T<R(ARGS...)>;
+       };
+
+       template <template <typename ...> class T,
+                       class R, class ...ARGS>
+       struct AutoFuncSig<T, void, R(*)(ARGS...)> {
+               using Type = T<R(ARGS...)>;
+       };
+
+       // Relation operators //
+
+       template <class R, class ...ARGS, class DATA1, class DATA2>
+       inline bool operator==(const BaseDelegate<R(ARGS...), DATA1> &lhs,
+                       const BaseDelegate<R(ARGS...), DATA2> &rhs) noexcept
+       {
+               return ((lhs.getStubA() == rhs.getStubA()) && (
+                               lhs.getData() == rhs.getData()));
+       }
+
+       template <class R, class ...ARGS, class DATA1, class DATA2>
+       inline bool operator!=(const BaseDelegate<R(ARGS...), DATA1> &lhs,
+                       const BaseDelegate<R(ARGS...), DATA2> &rhs) noexcept
+       {
+               return ((lhs.getStubA() != rhs.getStubA()) || (
+                               lhs.getData() != rhs.getData()));
+       }
+
+       template <class R, class ...ARGS, class DATA1, class DATA2>
+       inline bool operator<(const BaseDelegate<R(ARGS...), DATA1> &lhs,
+                       const BaseDelegate<R(ARGS...), DATA2> &rhs) noexcept
+       {
+               return ((lhs.getStubA() < rhs.getStubA()) ||
+                               ((lhs.getStubA() == rhs.getStubA()) && (
+                                       lhs.getData() < rhs.getData())));
+       }
+
+       template <class R, class ...ARGS, class DATA1, class DATA2>
+       inline bool operator<=(const BaseDelegate<R(ARGS...), DATA1> &lhs,
+                       const BaseDelegate<R(ARGS...), DATA2> &rhs) noexcept
+       {
+               return ((lhs.getStubA() < rhs.getStubA()) ||
+                               ((lhs.getStubA() == rhs.getStubA()) && (
+                                       lhs.getData() <= rhs.getData())));
+       }
+
+       template <class R, class ...ARGS, class DATA1, class DATA2>
+       inline bool operator>(const BaseDelegate<R(ARGS...), DATA1> &lhs,
+                       const BaseDelegate<R(ARGS...), DATA2> &rhs) noexcept
+       {
+               return ((lhs.getStubA() > rhs.getStubA()) ||
+                               ((lhs.getStubA() == rhs.getStubA()) && (
+                                       lhs.getData() > rhs.getData())));
+       }
+
+       template <class R, class ...ARGS, class DATA1, class DATA2>
+       inline bool operator>=(const BaseDelegate<R(ARGS...), DATA1> &lhs,
+                       const BaseDelegate<R(ARGS...), DATA2> &rhs) noexcept
+       {
+               return ((lhs.getStubA() > rhs.getStubA()) ||
+                               ((lhs.getStubA() == rhs.getStubA()) && (
+                                       lhs.getData() >= rhs.getData())));
+       }
+}
+
+#endif // __UCL_UTIL_DELEGATION_HELPERS_H__
diff --git a/ucl/include/ucl/util/delegation/macro.h b/ucl/include/ucl/util/delegation/macro.h
new file mode 100644 (file)
index 0000000..62bf88f
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_UTIL_DELEGATION_MACRO_H__
+#define __UCL_UTIL_DELEGATION_MACRO_H__
+
+// Helper macro to simplify use of AutoFuncSig template
+
+#define _UCL_AFS(DELEGATE, FUNC) \
+               ::ucl::AutoFuncSig<DELEGATE, void *, decltype(&FUNC)>
+
+// Helper macro to automatically generate different delegate objects //
+
+#define _UCL_DELEGATE(DELEGATE, FUNC, DATA) (_UCL_AFS(DELEGATE, FUNC):: \
+               Type::make<_UCL_AFS(DELEGATE, FUNC)::Data, &FUNC>(DATA))
+
+#define _UCL_DELEGATE_A(DELEGATE, FUNC, DATA) (_UCL_AFS(DELEGATE, FUNC):: \
+               Type::makeA<_UCL_AFS(DELEGATE, FUNC)::Data, &FUNC>(DATA))
+
+#define _UCL_DELEGATE_V(DELEGATE, FUNC) \
+               (::ucl::AutoFuncSig<DELEGATE, void, decltype(&FUNC)>::\
+                       Type::make<&FUNC>())
+
+// Helper macro to automatically generate Delegate objects //
+
+#define UCL_DELEGATE(FUNC, DATA) _UCL_DELEGATE(::ucl::Delegate, FUNC, DATA)
+#define UCL_DELEGATE_A(FUNC, DATA) _UCL_DELEGATE_A(::ucl::Delegate, FUNC, DATA)
+#define UCL_DELEGATE_V(FUNC) _UCL_DELEGATE_V(::ucl::Delegate, FUNC)
+
+// Helper macro to automatically generate Delegate2 objects //
+
+#define UCL_DELEGATE2(FUNC, DATA) _UCL_DELEGATE(::ucl::Delegate2, FUNC, DATA)
+#define UCL_DELEGATE2_A(FUNC, DATA) \
+               _UCL_DELEGATE_A(::ucl::Delegate2, FUNC, DATA)
+#define UCL_DELEGATE2_V(FUNC) _UCL_DELEGATE_V(::ucl::Delegate2, FUNC)
+
+// Helper macro to automatically generate Callback stubs //
+
+#define UCL_CALLBACK_A(FUNC) (&_UCL_AFS(::ucl::Callback, FUNC):: \
+               Type::stubA<_UCL_AFS(::ucl::Callback, FUNC)::Data, &FUNC>)
+#define UCL_CALLBACK_B(FUNC) (&_UCL_AFS(::ucl::Callback, FUNC):: \
+               Type::stubB<_UCL_AFS(::ucl::Callback, FUNC)::Data, &FUNC>)
+
+#define UCL_CALLBACK_A2A(FUNC) (&_UCL_AFS(::ucl::Callback, FUNC)::Type:: \
+               stubA2A<_UCL_AFS(::ucl::Callback, FUNC)::Data, &FUNC>)
+#define UCL_CALLBACK_B2A(FUNC) (&_UCL_AFS(::ucl::Callback, FUNC)::Type:: \
+               stubB2A<_UCL_AFS(::ucl::Callback, FUNC)::Data, &FUNC>)
+
+#define UCL_CALLBACK_A2V(FUNC) (&::ucl::AutoFuncSig<::ucl::Callback, void, \
+               decltype(&FUNC)>::Type::stubA2V<&FUNC>)
+#define UCL_CALLBACK_B2V(FUNC) (&::ucl::AutoFuncSig<::ucl::Callback, void, \
+               decltype(&FUNC)>::Type::stubB2V<&FUNC>)
+
+#endif // __UCL_UTIL_DELEGATION_MACRO_H__
diff --git a/ucl/include/ucl/util/delegation/shortMacro.h b/ucl/include/ucl/util/delegation/shortMacro.h
new file mode 100644 (file)
index 0000000..3837977
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_UTIL_DELEGATION_SHORT_MACRO_H__
+#define __UCL_UTIL_DELEGATION_SHORT_MACRO_H__
+
+// Helper macro to automatically generate Delegate objects //
+
+#define DELEGATE(FUNC, DATA)    UCL_DELEGATE(FUNC, DATA)
+#define DELEGATE_A(FUNC, DATA)  UCL_DELEGATE_A(FUNC, DATA)
+#define DELEGATE_V(FUNC)        UCL_DELEGATE_V(FUNC)
+
+// Helper macro to automatically generate Delegate2 objects //
+
+#define DELEGATE2(FUNC, DATA)    UCL_DELEGATE2(FUNC, DATA)
+#define DELEGATE2_A(FUNC, DATA)  UCL_DELEGATE2_A(FUNC, DATA)
+#define DELEGATE2_V(FUNC)        UCL_DELEGATE2_V(FUNC)
+
+// Helper macro to automatically generate Callback stubs //
+
+#define CALLBACK_A(FUNC)  UCL_CALLBACK_A(FUNC)
+#define CALLBACK_B(FUNC)  UCL_CALLBACK_B(FUNC)
+
+#define CALLBACK_A2A(FUNC)  UCL_CALLBACK_A2A(FUNC)
+#define CALLBACK_B2A(FUNC)  UCL_CALLBACK_B2A(FUNC)
+
+#define CALLBACK_A2V(FUNC)  UCL_CALLBACK_A2V(FUNC)
+#define CALLBACK_B2V(FUNC)  UCL_CALLBACK_B2V(FUNC)
+
+#endif // __UCL_UTIL_DELEGATION_SHORT_MACRO_H__
diff --git a/ucl/include/ucl/util/helpers.h b/ucl/include/ucl/util/helpers.h
new file mode 100644 (file)
index 0000000..117d3de
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_UTIL_HELPERS_H__
+#define __UCL_UTIL_HELPERS_H__
+
+#include "types/baseTypes.h"
+#include "types/classTypes.h"
+
+namespace ucl {
+
+       constexpr Eina_Bool toEina(bool value);
+
+       // "nz()" - "Not Zero" functions
+       // return "zValue" if "!value" is true
+       constexpr const char *nz(const char *value, const char *zValue = "");
+
+       // "ne()" - "Not Empty" functions
+       // return "eValue" if "isEmpty(value)" is true
+       constexpr const char *ne(const char *value, const char *eValue = nullptr);
+
+       constexpr bool isEmpty(const char *value);
+
+       template <class T>
+       constexpr auto isEmpty(const T &value) -> decltype(value.empty())
+       {
+               return value.empty();
+       }
+
+       template <class T>
+       constexpr auto isEmpty(const T &value) -> decltype(value.isEmpty())
+       {
+               return value.isEmpty();
+       }
+
+       template <class T>
+       constexpr auto isEmpty(const T &value) -> decltype(isEmpty(*value))
+       {
+               return (!value || isEmpty(*value));
+       }
+
+       template <class T>
+       constexpr bool isNotEmpty(T &&value);
+
+       template <class T>
+       constexpr bool isNotValid(T &&value);
+
+       char *strDupSafe(const char *value);
+       int strCmpSafe(const char *lhs, const char *rhs);
+
+       template <class T1, class T2>
+       inline auto dynamicCast(T2 &&src) -> decltype(
+                       dynamic_cast<T1>(std::forward<T2>(src)))
+       {
+               return dynamic_cast<T1>(std::forward<T2>(src));
+       }
+
+       template <class T1, class T2>
+       inline auto constCast(T2 &&src) -> decltype(
+                       const_cast<T1>(std::forward<T2>(src)))
+       {
+               return const_cast<T1>(std::forward<T2>(src));
+       }
+
+       template <class T>
+       constexpr const T &min(const T &a, const T &b);
+
+       template <class T>
+       constexpr const T &max(const T &a, const T &b);
+
+       template <class T>
+       constexpr bool isPot(T value)
+       {
+               return (((value - 1) & value) == 0);
+       }
+
+       template <uint MULTIPLE, class T>
+       constexpr T ceilDiv(T value);
+
+       template <uint MULTIPLE, class T>
+       constexpr typename std::enable_if<isPot(MULTIPLE), T>::type
+                       roundUp(T value)
+       {
+               return ((value + (MULTIPLE - 1)) & ~static_cast<T>(MULTIPLE - 1));
+       }
+
+       template <uint MULTIPLE, class T>
+       constexpr typename std::enable_if<!isPot(MULTIPLE), T>::type
+                       roundUp(T value)
+       {
+               return (ceilDiv<MULTIPLE>(value) * MULTIPLE);
+       }
+}
+
+namespace ucl { namespace util {
+
+       template <class T>
+       std::unique_ptr<T> makeUnique(T *p);
+
+       template <class T, class = typename std::enable_if<
+                       std::is_convertible<T *, IDisposable *>::value>::type>
+       inline void dispose(T *&p) noexcept
+       {
+               if (p) {
+                       p->dispose();
+                       p = nullptr;
+               }
+       }
+}}
+
+#include "helpers.hpp"
+
+#endif // __UCL_UTIL_HELPERS_H__
diff --git a/ucl/include/ucl/util/helpers.hpp b/ucl/include/ucl/util/helpers.hpp
new file mode 100644 (file)
index 0000000..a7606f8
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+namespace ucl {
+
+       constexpr Eina_Bool toEina(const bool value)
+       {
+               return (value ? EINA_TRUE : EINA_FALSE);
+       }
+
+       constexpr const char *nz(const char *const value, const char *const zValue)
+       {
+               return (value ? value : zValue);
+       }
+
+       template <class T>
+       constexpr bool isNotEmpty(T &&value)
+       {
+               return !isEmpty(std::forward<T>(value));
+       }
+
+       constexpr const char *ne(const char *const value, const char *const eValue)
+       {
+               return (isNotEmpty(value) ? value : eValue);
+       }
+
+       constexpr bool isEmpty(const char *const value)
+       {
+               return (!value || (value[0] == '\0'));
+       }
+
+       template <class T>
+       constexpr bool isNotValid(T &&value)
+       {
+               return !isValid(std::forward<T>(value));
+       }
+
+       inline char *strDupSafe(const char *const value)
+       {
+               return (value ? strdup(value) : nullptr);
+       }
+
+       inline int strCmpSafe(const char *lhs, const char *rhs)
+       {
+               return strcmp(nz(lhs), nz(rhs));
+       }
+
+       template <class T>
+       constexpr const T &min(const T &a, const T &b)
+       {
+               return ((a < b) ? a : b);
+       }
+
+       template <class T>
+       constexpr const T &max(const T &a, const T &b)
+       {
+               return ((a > b) ? a : b);
+       }
+
+       template <uint MULTIPLE, class T>
+       constexpr T ceilDiv(T value)
+       {
+               return ((value + (MULTIPLE - 1)) / MULTIPLE);
+       }
+}
+
+namespace ucl { namespace util {
+
+       template <class T>
+       inline std::unique_ptr<T> makeUnique(T *const p)
+       {
+               return std::unique_ptr<T>(p);
+       }
+}}
diff --git a/ucl/include/ucl/util/logging.h b/ucl/include/ucl/util/logging.h
new file mode 100644 (file)
index 0000000..804a513
--- /dev/null
@@ -0,0 +1,205 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_UTIL_LOGGING_H__
+#define __UCL_UTIL_LOGGING_H__
+
+#include <assert.h>
+
+#include <dlog.h>
+
+#include "types/Result.h"
+
+::ucl::ResultData getUCLResultData(::ucl::Result result);
+
+#ifndef UCL_LOG_LEVEL
+#define UCL_LOG_LEVEL UCL_MAX_LOG_LEVEL
+#elif UCL_LOG_LEVEL > UCL_MAX_LOG_LEVEL
+#undef UCL_LOG_LEVEL
+#define UCL_LOG_LEVEL UCL_MAX_LOG_LEVEL
+#endif
+
+#ifndef UCL_LOG_TAG
+#define UCL_LOG_TAG UCL_DEFAULT_LOG_TAG
+#endif
+
+#ifndef __MODULE__
+#define __MODULE__ (strrchr(__FILE__, '/') ? \
+               strrchr(__FILE__, '/') + 1 : __FILE__)
+#endif
+
+// Base macros for writing logs without result code
+#define UCL_ULOG(prio, fmt, ...) dlog_print( \
+       (log_priority)prio, UCL_LOG_TAG, "%s: %s(%d) > " fmt, \
+       __MODULE__, __func__, __LINE__, ##__VA_ARGS__)
+
+// Base macros for writing logs WITH result code
+#define UCL_URESDATALOG(prio, resdata, fmt, ...) dlog_print( \
+       (log_priority)prio, UCL_LOG_TAG, "%s: %s(%d) > " fmt " {%s}", \
+       __MODULE__, __func__, __LINE__, ##__VA_ARGS__, resdata.name)
+
+#define UCL_URESLOG(prio, result, fmt, ...) do { \
+       const ::ucl::ResultData &resdata = ::getUCLResultData(result); \
+       UCL_URESDATALOG(prio, resdata, fmt, ##__VA_ARGS__);} while (false)
+
+#if UCL_LOG_LEVEL >= UCL_LOG_LEVEL_VERBOSE
+#define UCL_VLOG(msg, ...) UCL_ULOG(DLOG_VERBOSE, msg, ##__VA_ARGS__)
+#define UCL_VRESLOG(result, msg, ...) \
+               UCL_URESLOG(DLOG_VERBOSE, result, msg, ##__VA_ARGS__)
+#else
+#define UCL_VLOG(msg, ...) do {} while (false)
+#define UCL_VRESLOG(result, msg, ...) do {} while (false)
+#endif
+
+#if UCL_LOG_LEVEL >= UCL_LOG_LEVEL_DEBUG
+#define UCL_DLOG(msg, ...) UCL_ULOG(DLOG_DEBUG, msg, ##__VA_ARGS__)
+#define UCL_DRESLOG(result, msg, ...) \
+               UCL_URESLOG(DLOG_DEBUG, result, msg, ##__VA_ARGS__)
+#else
+#define UCL_DLOG(msg, ...) do {} while (false)
+#define UCL_DRESLOG(result, msg, ...) do {} while (false)
+#endif
+
+#if UCL_LOG_LEVEL >= UCL_LOG_LEVEL_INFO
+#define UCL_ILOG(msg, ...) UCL_ULOG(DLOG_INFO, msg, ##__VA_ARGS__)
+#define UCL_IRESLOG(result, msg, ...) \
+               UCL_URESLOG(DLOG_INFO, result, msg, ##__VA_ARGS__)
+#else
+#define UCL_ILOG(msg, ...) do {} while (false)
+#define UCL_IRESLOG(result, msg, ...) do {} while (false)
+#endif
+
+#if UCL_LOG_LEVEL >= UCL_LOG_LEVEL_WARNING
+#define UCL_WLOG(msg, ...) UCL_ULOG(DLOG_WARN, msg, ##__VA_ARGS__)
+#define UCL_WRESLOG(result, msg, ...) \
+               UCL_URESLOG(DLOG_WARN, result, msg, ##__VA_ARGS__)
+#else
+#define UCL_WLOG(msg, ...) do {} while (false)
+#define UCL_WRESLOG(result, msg, ...) do {} while (false)
+#endif
+
+#if UCL_LOG_LEVEL >= UCL_LOG_LEVEL_ERROR
+#define UCL_ELOG(msg, ...) UCL_ULOG(DLOG_ERROR, msg, ##__VA_ARGS__)
+#define UCL_ERESLOG(result, msg, ...) \
+               UCL_URESLOG(DLOG_ERROR, result, msg, ##__VA_ARGS__)
+#else
+#define UCL_ELOG(msg, ...) do {} while (false)
+#define UCL_ERESLOG(result, msg, ...) do {} while (false)
+#endif
+
+#if UCL_LOG_LEVEL >= UCL_LOG_LEVEL_FATAL
+#define UCL_FLOG(msg, ...) UCL_ULOG(DLOG_FATAL, msg, ##__VA_ARGS__)
+#define UCL_FRESLOG(result, msg, ...) UCL_URESLOG( \
+       DLOG_FATAL, result, msg, ##__VA_ARGS__)
+#else
+#define UCL_FLOG(msg, ...) do {} while (false)
+#define UCL_FRESLOG(result, msg, ...) do {} while (false)
+#endif
+
+#if UCL_LOG_LEVEL >= UCL_LOG_LEVEL_ERROR
+
+// Simple macros for writing logs WITH result
+// code and automatic log priority determination
+#define UCL_RESLOG(result, msg, ...) { \
+       const ::ucl::ResultData &resdata = ::getUCLResultData(result); \
+       UCL_URESDATALOG(resdata.logPrio, \
+                       resdata, msg, ##__VA_ARGS__);} while (false)
+
+#else
+#define UCL_RESLOG(result, msg, ...) do {} while (false)
+#endif
+
+#define UCL_ASSERT(expr, msg, ...) \
+       do { \
+               if (!(expr)) { \
+                       UCL_FLOG(msg, ##__VA_ARGS__); \
+                       assert(false); \
+               } \
+       } while (false)
+
+#define UCL_FAIL_RETURN(result, msg, ...) \
+       do { \
+               const ::ucl::Result __RESULT__ = (result); \
+               if (isBad(__RESULT__)) { \
+                       UCL_RESLOG(__RESULT__, msg, ##__VA_ARGS__); \
+                       return __RESULT__; \
+               } \
+       } while (false)
+
+#define UCL_FAIL_RETURN_VALUE(result, value, msg, ...) \
+       do { \
+               const ::ucl::Result __RESULT__ = (result); \
+               if (isBad(__RESULT__)) { \
+                       UCL_RESLOG(__RESULT__, msg, ##__VA_ARGS__); \
+                       return value; \
+               } \
+       } while (false)
+
+#define UCL_FAIL_RETURN_VOID(result, msg, ...) \
+       do { \
+               const ::ucl::Result __RESULT__ = (result); \
+               if (isBad(__RESULT__)) { \
+                       UCL_RESLOG(__RESULT__, msg, ##__VA_ARGS__); \
+                       return; \
+               } \
+       } while (false)
+
+#define UCL_LOG_RETURN(result, msg, ...) \
+       do { \
+               const ::ucl::Result __RESULT__ = (result); \
+               UCL_RESLOG(__RESULT__, msg, ##__VA_ARGS__); \
+               return __RESULT__; \
+       } while (false)
+
+#define UCL_LOG_RETURN_VALUE(result, value, msg, ...) \
+       do { \
+               const ::ucl::Result __RESULT__ = (result); \
+               UCL_RESLOG(__RESULT__, msg, ##__VA_ARGS__); \
+               return value; \
+       } while (false)
+
+#define UCL_LOG_RETURN_VOID(result, msg, ...) \
+       do { \
+               const ::ucl::Result __RESULT__ = (result); \
+               UCL_RESLOG(__RESULT__, msg, ##__VA_ARGS__); \
+               return; \
+       } while (false)
+
+#define UCL_FAIL_BREAK(result, msg, ...) \
+       do { \
+               const ::ucl::Result __RESULT__ = (result); \
+               if (isBad(__RESULT__)) { \
+                       UCL_RESLOG(__RESULT__, msg, ##__VA_ARGS__); \
+                       break; \
+               } \
+       } while (false)
+
+#define UCL_LOG_BREAK(result, msg, ...) \
+       do { \
+               const ::ucl::Result __RESULT__ = (result); \
+               UCL_RESLOG(__RESULT__, msg, ##__VA_ARGS__); \
+               break; \
+       } while (false)
+
+#define UCL_FAIL_LOG(result, msg, ...) \
+       do { \
+               const ::ucl::Result __RESULT__ = (result); \
+               if (isBad(__RESULT__)) { \
+                       UCL_RESLOG(__RESULT__, msg, ##__VA_ARGS__); \
+               } \
+       } while (false)
+
+#endif // __UCL_UTIL_LOGGING_H__
diff --git a/ucl/include/ucl/util/memory.h b/ucl/include/ucl/util/memory.h
new file mode 100644 (file)
index 0000000..cc33960
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_UTIL_MEMORY_H__
+#define __UCL_UTIL_MEMORY_H__
+
+#include "memory/RefCountObj.h"
+
+#include "memory/BaseRef.h"
+#include "memory/SharedRef.h"
+#include "memory/WeakRef.h"
+
+#include "memory/helpers.h"
+#include "memory/macro.h"
+
+#endif // __UCL_UTIL_MEMORY_H__
diff --git a/ucl/include/ucl/util/memory/BaseRef.h b/ucl/include/ucl/util/memory/BaseRef.h
new file mode 100644 (file)
index 0000000..8146eae
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_UTIL_MEMORY_BASE_REF_H__
+#define __UCL_UTIL_MEMORY_BASE_REF_H__
+
+#include "IRefCountObj.h"
+
+namespace ucl {
+
+       template <class T>
+       class BaseRef {
+       public:
+               using Type = T;
+
+               template <class U>
+               friend class BaseRef;
+               template <class U>
+               friend class SharedRef;
+               template <class U>
+               friend class WeakRef;
+
+       public:
+               UInt getUseCount() const noexcept;
+
+       protected:
+               constexpr BaseRef() noexcept;
+               BaseRef(IRefCountObj *rc, T *ptr) noexcept;
+               BaseRef(BaseRef<T> &&r) noexcept;
+               template <class U>
+               BaseRef(BaseRef<U> &&r) noexcept;
+
+       protected:
+               IRefCountObj *m_rc;
+               T *m_ptr;
+       };
+}
+
+#include "BaseRef.hpp"
+
+#endif // __UCL_UTIL_MEMORY_BASE_REF_H__
diff --git a/ucl/include/ucl/util/memory/BaseRef.hpp b/ucl/include/ucl/util/memory/BaseRef.hpp
new file mode 100644 (file)
index 0000000..312c38e
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+namespace ucl {
+
+       template <class T>
+       constexpr BaseRef<T>::BaseRef() noexcept :
+               m_rc(nullptr),
+               m_ptr(nullptr)
+       {
+       }
+
+       template <class T>
+       inline BaseRef<T>::BaseRef(
+                       IRefCountObj *const rc, T *const ptr) noexcept :
+               m_rc(rc),
+               m_ptr(ptr)
+       {
+       }
+
+       template <class T>
+       inline BaseRef<T>::BaseRef(BaseRef<T> &&r) noexcept :
+               m_rc(r.m_rc),
+               m_ptr(r.m_ptr)
+       {
+               r.m_rc = nullptr;
+               r.m_ptr = nullptr;
+       }
+
+       template <class T>
+       template <class U>
+       inline BaseRef<T>::BaseRef(BaseRef<U> &&r) noexcept :
+               m_rc(r.m_rc),
+               m_ptr(r.m_ptr)
+       {
+               r.m_rc = nullptr;
+               r.m_ptr = nullptr;
+       }
+
+       template <class T>
+       inline UInt BaseRef<T>::getUseCount() const noexcept
+       {
+               return (m_rc ? m_rc->getUseCount() : 0);
+       }
+}
diff --git a/ucl/include/ucl/util/memory/IRefCountObj.h b/ucl/include/ucl/util/memory/IRefCountObj.h
new file mode 100644 (file)
index 0000000..69d6a1c
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_UTIL_MEMORY_I_REF_COUNT_OBJ_H__
+#define __UCL_UTIL_MEMORY_I_REF_COUNT_OBJ_H__
+
+#include "ucl/util/types/classTypes.h"
+
+namespace ucl {
+
+       class IRefCountObj : public Polymorphic {
+       public:
+               virtual void ref() noexcept = 0;
+               virtual void unref() noexcept = 0;
+               virtual bool refNz() noexcept = 0;
+               virtual void refWeak() noexcept = 0;
+               virtual void unrefWeak() noexcept = 0;
+               virtual UInt getUseCount() const noexcept = 0;
+               virtual const void *getObjPtr() const noexcept = 0;
+       protected:
+               virtual ~IRefCountObj() = default;
+       };
+}
+
+#endif // __UCL_UTIL_MEMORY_I_REF_COUNT_OBJ_H__
diff --git a/ucl/include/ucl/util/memory/RefCountObj.h b/ucl/include/ucl/util/memory/RefCountObj.h
new file mode 100644 (file)
index 0000000..7237aa4
--- /dev/null
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_UTIL_MEMORY_REF_COUNT_OBJ_H__
+#define __UCL_UTIL_MEMORY_REF_COUNT_OBJ_H__
+
+#include "IRefCountObj.h"
+#include "ReffedObj.h"
+
+namespace ucl {
+
+       template <class T, class C>
+       class RefCountObj final : public IRefCountObj {
+       public:
+               template <class ...ARGS>
+               RefCountObj(ARGS &&...args);
+
+               T *getObj() noexcept;
+
+               // IRefCountObj //
+
+               virtual void ref() noexcept final override;
+               virtual void unref() noexcept final override;
+               virtual bool refNz() noexcept final override;
+               virtual void refWeak() noexcept final override;
+               virtual void unrefWeak() noexcept final override;
+               virtual UInt getUseCount() const noexcept final override;
+               virtual const void *getObjPtr() const noexcept final override;
+
+       private:
+               template <class T2, class = char[1]>
+               struct IsRefCountAware : std::false_type {};
+               template <class T2>
+               struct IsRefCountAware<T2, char[T2::_IS_REF_COUNT_AWARE * 0 + 1]> :
+                               std::true_type {};
+
+               template <class T2, class = char[1]>
+               struct IsOnUniqueAware : std::false_type {};
+               template <class T2>
+               struct IsOnUniqueAware<T2,
+                               char[T2::_ENABLE_ON_UNIQUE_CHANGED_DISPATCH * 0 + 1]> :
+                               std::true_type {};
+
+       private:
+               virtual ~RefCountObj() = default;
+
+               template <class T2, class ...ARGS, class =
+                               typename std::enable_if<!IsRefCountAware<T2>::value>::type>
+               void createObj(const P<0> &, ARGS &&...args)
+               {
+                       m_obj.create(std::forward<ARGS>(args)...);
+               }
+
+               template <class T2, class ...ARGS, class =
+                               typename std::enable_if<IsRefCountAware<T2>::value>::type>
+               auto createObj(const P<1> &, ARGS &&...args) -> decltype(
+                               ReffedObj<T>::template check<T2>(
+                                               (IRefCountObj *)0, std::forward<ARGS>(args)...))
+               {
+                       m_obj.create(static_cast<IRefCountObj *>(this),
+                                       std::forward<ARGS>(args)...);
+               }
+
+               template <class T2, class ...ARGS, class =
+                               typename std::enable_if<IsRefCountAware<T2>::value>::type>
+               auto createObj(const P<2> &, ARGS &&...args) -> decltype(
+                               ReffedObj<T>::template check<T2>(
+                                               *(IRefCountObj *)0, std::forward<ARGS>(args)...))
+               {
+                       m_obj.create(*static_cast<IRefCountObj *>(this),
+                                       std::forward<ARGS>(args)...);
+               }
+
+               void dispatchOnUniqueChanged(const bool isUnique)
+               {
+                       dispatchOnUniqueChanged<T>(P<1>(), isUnique);
+               }
+
+               template <class T2>
+               void dispatchOnUniqueChanged(...)
+               {
+               }
+
+               template <class T2, class =
+                               typename std::enable_if<IsOnUniqueAware<T2>::value>::type>
+               void dispatchOnUniqueChanged(const P<1> &, const bool isUnique)
+               {
+                       m_obj.template dispatchOnUniqueChanged<T>(isUnique);
+               }
+
+       private:
+               ReffedObj<T> m_obj;
+               C m_useCounter;
+               C m_weakCounter;
+       };
+}
+
+#include "RefCountObj.hpp"
+
+#endif // __UCL_UTIL_MEMORY_REF_COUNT_OBJ_H__
diff --git a/ucl/include/ucl/util/memory/RefCountObj.hpp b/ucl/include/ucl/util/memory/RefCountObj.hpp
new file mode 100644 (file)
index 0000000..8a2c065
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+namespace ucl {
+
+       template <class T, class C>
+       template <class ...ARGS>
+       inline RefCountObj<T, C>::RefCountObj(ARGS &&...args) :
+               m_useCounter(1),
+               m_weakCounter(1)
+       {
+               createObj<T>(P<2>(), std::forward<ARGS>(args)...);
+       }
+
+       template <class T, class C>
+       inline T *RefCountObj<T, C>::getObj() noexcept
+       {
+               return m_obj.get();
+       }
+
+       template <class T, class C>
+       inline void RefCountObj<T, C>::ref() noexcept
+       {
+               if (m_useCounter.ref() == 2) {
+                       dispatchOnUniqueChanged(false);
+               }
+       }
+
+       template <class T, class C>
+       inline void RefCountObj<T, C>::unref() noexcept
+       {
+               const auto newCount = m_useCounter.unref();
+               if (newCount == 0) {
+                       m_obj.destroy();
+                       unrefWeak();
+               } else if (newCount == 1) {
+                       dispatchOnUniqueChanged(true);
+               }
+       }
+
+       template <class T, class C>
+       inline bool RefCountObj<T, C>::refNz() noexcept
+       {
+               const auto newCount = m_useCounter.refNz();
+               if (newCount == 0) {
+                       return false;
+               }
+               if (newCount == 2) {
+                       dispatchOnUniqueChanged(false);
+               }
+               return true;
+       }
+
+       template <class T, class C>
+       inline void RefCountObj<T, C>::refWeak() noexcept
+       {
+               m_weakCounter.ref();
+       }
+
+       template <class T, class C>
+       inline void RefCountObj<T, C>::unrefWeak() noexcept
+       {
+               if (m_weakCounter.unref() == 0) {
+                       delete this;
+               }
+       }
+
+       template <class T, class C>
+       inline UInt RefCountObj<T, C>::getUseCount() const noexcept
+       {
+               return m_useCounter.get();
+       }
+
+       template <class T, class C>
+       inline const void *RefCountObj<T, C>::getObjPtr() const noexcept
+       {
+               return m_obj.get();
+       }
+}
diff --git a/ucl/include/ucl/util/memory/RefCounterMT.h b/ucl/include/ucl/util/memory/RefCounterMT.h
new file mode 100644 (file)
index 0000000..1d2fb95
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_UTIL_MEMORY_REF_COUNTER_MT_H__
+#define __UCL_UTIL_MEMORY_REF_COUNTER_MT_H__
+
+#include "ucl/util/types/baseTypes.h"
+
+namespace ucl {
+
+       class RefCounterMT final {
+       public:
+               explicit RefCounterMT(const UInt count = 0) noexcept;
+
+               UInt ref() noexcept;
+               UInt unref() noexcept;
+               UInt refNz() noexcept;
+
+               UInt get() const noexcept;
+
+       private:
+               std::atomic<UInt> m_counter;
+       };
+}
+
+#include "RefCounterMT.hpp"
+
+#endif // __UCL_UTIL_MEMORY_REF_COUNTER_MT_H__
diff --git a/ucl/include/ucl/util/memory/RefCounterMT.hpp b/ucl/include/ucl/util/memory/RefCounterMT.hpp
new file mode 100644 (file)
index 0000000..1ff459b
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+namespace ucl {
+
+       inline RefCounterMT::RefCounterMT(const UInt count) noexcept :
+               m_counter(count)
+       {
+       }
+
+       inline UInt RefCounterMT::ref() noexcept
+       {
+               return (m_counter.fetch_add(1, std::memory_order_acq_rel) + 1);
+       }
+
+       inline UInt RefCounterMT::unref() noexcept
+       {
+               return (m_counter.fetch_sub(1, std::memory_order_acq_rel) - 1);
+       }
+
+       inline UInt RefCounterMT::refNz() noexcept
+       {
+               auto curCount = m_counter.load(std::memory_order_relaxed);
+               for (;;) {
+                       if (curCount == 0) {
+                               return 0;
+                       }
+                       const auto newCount = (curCount + 1);
+                       if (m_counter.compare_exchange_weak(curCount, newCount,
+                                       std::memory_order_acq_rel, std::memory_order_relaxed)) {
+                               return newCount;
+                       }
+               }
+       }
+
+       inline UInt RefCounterMT::get() const noexcept
+       {
+               return m_counter.load(std::memory_order_relaxed);
+       }
+}
diff --git a/ucl/include/ucl/util/memory/RefCounterST.h b/ucl/include/ucl/util/memory/RefCounterST.h
new file mode 100644 (file)
index 0000000..30e5e35
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_UTIL_MEMORY_REF_COUNTER_ST_H__
+#define __UCL_UTIL_MEMORY_REF_COUNTER_ST_H__
+
+#include "ucl/util/types/baseTypes.h"
+
+namespace ucl {
+
+       class RefCounterST final {
+       public:
+               explicit RefCounterST(const UInt count = 0) noexcept;
+
+               UInt ref() noexcept;
+               UInt unref() noexcept;
+               UInt refNz() noexcept;
+
+               UInt get() const noexcept;
+
+       private:
+               UInt m_counter;
+       };
+}
+
+#include "RefCounterST.hpp"
+
+#endif // __UCL_UTIL_MEMORY_REF_COUNTER_ST_H__
diff --git a/ucl/include/ucl/util/memory/RefCounterST.hpp b/ucl/include/ucl/util/memory/RefCounterST.hpp
new file mode 100644 (file)
index 0000000..45781c7
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+namespace ucl {
+
+       inline RefCounterST::RefCounterST(const UInt count) noexcept :
+               m_counter(count)
+       {
+       }
+
+       inline UInt RefCounterST::ref() noexcept
+       {
+               return (++m_counter);
+       }
+
+       inline UInt RefCounterST::unref() noexcept
+       {
+               return (--m_counter);
+       }
+
+       inline UInt RefCounterST::refNz() noexcept
+       {
+               if (m_counter == 0) {
+                       return 0;
+               }
+               return ref();
+       }
+
+       inline UInt RefCounterST::get() const noexcept
+       {
+               return m_counter;
+       }
+}
diff --git a/ucl/include/ucl/util/memory/ReffedObj.h b/ucl/include/ucl/util/memory/ReffedObj.h
new file mode 100644 (file)
index 0000000..c521544
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_UTIL_MEMORY_REFFED_OBJ_H__
+#define __UCL_UTIL_MEMORY_REFFED_OBJ_H__
+
+#include "RefCounterST.h"
+#include "RefCounterMT.h"
+
+namespace ucl {
+
+       template <class T, class C>
+       class RefCountObj;
+
+       template <class T>
+       class ReffedObj final {
+       private:
+               friend class RefCountObj<T, RefCounterST>;
+               friend class RefCountObj<T, RefCounterMT>;
+
+               template <class ...ARGS>
+               void create(ARGS &&...args);
+               void destroy() noexcept;
+
+               T *get() noexcept;
+               const T *get() const noexcept;
+
+               template <class T2>
+               void dispatchOnUniqueChanged(bool isUnique);
+
+       private:
+               template <class T2, class ...ARGS>
+               static constexpr auto check(ARGS &&...args) -> decltype(
+                               (void)(new T2(std::forward<ARGS>(args)...)))
+               {
+                       return;
+               }
+
+       private:
+               typename std::aligned_storage<sizeof(T), alignof(T)>::type m_obj;
+       };
+}
+
+#include "ReffedObj.hpp"
+
+#endif // __UCL_UTIL_MEMORY_REFFED_OBJ_H__
diff --git a/ucl/include/ucl/util/memory/ReffedObj.hpp b/ucl/include/ucl/util/memory/ReffedObj.hpp
new file mode 100644 (file)
index 0000000..cfc1e84
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+namespace ucl {
+
+       template <class T>
+       template <class ...ARGS>
+       inline void ReffedObj<T>::create(ARGS &&...args)
+       {
+               new (get()) T(std::forward<ARGS>(args)...);
+       }
+
+       template <class T>
+       inline void ReffedObj<T>::destroy() noexcept
+       {
+               get()->~T();
+       }
+
+       template <class T>
+       inline T *ReffedObj<T>::get() noexcept
+       {
+               return static_cast<T *>(static_cast<void *>(&m_obj));
+       }
+
+       template <class T>
+       inline const T *ReffedObj<T>::get() const noexcept
+       {
+               return static_cast<const T *>(static_cast<const void *>(&m_obj));
+       }
+
+       template <class T>
+       template <class T2>
+       inline void ReffedObj<T>::dispatchOnUniqueChanged(const bool isUnique)
+       {
+               get()->onUniqueChanged(isUnique);
+       }
+}
diff --git a/ucl/include/ucl/util/memory/SharedRef.h b/ucl/include/ucl/util/memory/SharedRef.h
new file mode 100644 (file)
index 0000000..396d176
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_UTIL_MEMORY_SHARED_REF_H__
+#define __UCL_UTIL_MEMORY_SHARED_REF_H__
+
+#include "BaseRef.h"
+
+namespace ucl {
+
+       template <class T>
+       class SharedRef final : public BaseRef<T> {
+       public:
+               template <class U>
+               friend void swap(SharedRef<U> &x, SharedRef<U> &y) noexcept;
+
+               template <class T2, class U>
+               friend SharedRef<T2> staticRefCast(const SharedRef<U> &r) noexcept;
+               template <class T2, class U>
+               friend SharedRef<T2> dynamicRefCast(const SharedRef<U> &r) noexcept;
+
+       public:
+               constexpr SharedRef() noexcept;
+               constexpr SharedRef(std::nullptr_t) noexcept;
+
+               SharedRef(IRefCountObj *rc, T *ptr) noexcept;
+               SharedRef(IRefCountObj *rc, T *ptr, bool noRef) noexcept;
+
+               SharedRef(const SharedRef<T> &r) noexcept;
+               template <class U>
+               SharedRef(const SharedRef<U> &r) noexcept;
+
+               SharedRef(SharedRef<T> &&r) noexcept;
+               template <class U>
+               SharedRef(SharedRef<U> &&r) noexcept;
+
+               ~SharedRef();
+
+               SharedRef<T> &operator=(SharedRef<T> r) noexcept;
+
+               void reset() noexcept;
+
+               T *get() const noexcept;
+               operator bool() const noexcept;
+
+               T *operator->() const noexcept;
+               typename std::add_lvalue_reference<T>::type operator*() const noexcept;
+
+               template <class U, class = typename std::enable_if<
+                       std::is_convertible<T *, U *>::value && (
+                               std::is_same<typename std::remove_cv<U>::type, void>::value ||
+                               std::is_same<typename std::remove_cv<U>::type,
+                                       typename std::remove_cv<T>::type>::value)>::type>
+               operator const SharedRef<U> &() const noexcept
+               {
+                       return reinterpret_cast<const SharedRef<U> &>(*this);
+               }
+       };
+
+       // Non-member functions //
+
+       template <class T, class ...ARGS>
+       SharedRef<T> makeShared(ARGS &&...args);
+       template <class T, class ...ARGS>
+       SharedRef<T> makeSharedMT(ARGS &&...args);
+
+       template <class T, class U>
+       const SharedRef<T> &constRefCast(const SharedRef<U> &r) noexcept;
+       template <class T, class U>
+       SharedRef<T> &&constRefCast(SharedRef<U> &&r) noexcept;
+}
+
+#include "SharedRef.hpp"
+
+#endif // __UCL_UTIL_MEMORY_SHARED_REF_H__
diff --git a/ucl/include/ucl/util/memory/SharedRef.hpp b/ucl/include/ucl/util/memory/SharedRef.hpp
new file mode 100644 (file)
index 0000000..f085b9c
--- /dev/null
@@ -0,0 +1,176 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+namespace ucl {
+
+       template <class T>
+       constexpr SharedRef<T>::SharedRef() noexcept
+       {
+       }
+
+       template <class T>
+       constexpr SharedRef<T>::SharedRef(std::nullptr_t) noexcept
+       {
+       }
+
+       template <class T>
+       inline SharedRef<T>::SharedRef(
+                       IRefCountObj *const rc, T *const ptr) noexcept :
+               BaseRef<T>(rc, ptr)
+       {
+               this->m_rc->ref();
+       }
+
+       template <class T>
+       inline SharedRef<T>::SharedRef(
+                       IRefCountObj *const rc, T *const ptr, bool noRef) noexcept :
+               BaseRef<T>(rc, ptr)
+       {
+       }
+
+       template <class T>
+       inline SharedRef<T>::SharedRef(const SharedRef<T> &r) noexcept :
+               BaseRef<T>(r.m_rc, r.m_ptr)
+       {
+               if (this->m_rc) {
+                       this->m_rc->ref();
+               }
+       }
+
+       template <class T>
+       template <class U>
+       inline SharedRef<T>::SharedRef(const SharedRef<U> &r) noexcept :
+               BaseRef<T>(r.m_rc, r.m_ptr)
+       {
+               if (this->m_rc) {
+                       this->m_rc->ref();
+               }
+       }
+
+       template <class T>
+       inline SharedRef<T>::SharedRef(SharedRef<T> &&r) noexcept :
+               BaseRef<T>(std::move(r))
+       {
+       }
+
+       template <class T>
+       template <class U>
+       inline SharedRef<T>::SharedRef(SharedRef<U> &&r) noexcept :
+               BaseRef<T>(std::move(r))
+       {
+       }
+
+       template <class T>
+       inline SharedRef<T>::~SharedRef()
+       {
+               if (this->m_rc) {
+                       this->m_rc->unref();
+               }
+       }
+
+       template <class T>
+       inline SharedRef<T> &SharedRef<T>::operator=(SharedRef<T> r) noexcept
+       {
+               swap(*this, r);
+               return *this;
+       }
+
+       template <class T>
+       inline void SharedRef<T>::reset() noexcept
+       {
+               *this = {};
+       }
+
+       template <class T>
+       inline T *SharedRef<T>::get() const noexcept
+       {
+               return this->m_ptr;
+       }
+
+       template <class T>
+       inline SharedRef<T>::operator bool() const noexcept
+       {
+               return !!this->m_ptr;
+       }
+
+       template <class T>
+       inline T *SharedRef<T>::operator->() const noexcept
+       {
+               return this->m_ptr;
+       }
+
+       template <class T>
+       inline typename std::add_lvalue_reference<T>::type
+                       SharedRef<T>::operator*() const noexcept
+       {
+               return *this->m_ptr;
+       }
+
+       // Non-member functions //
+
+       template <class T, class ...ARGS>
+       SharedRef<T> makeShared(ARGS &&...args)
+       {
+               const auto rc = new RefCountObj<T, RefCounterST>(
+                               std::forward<ARGS>(args)...);
+               return {rc, rc->getObj(), true};
+       }
+
+       template <class T, class ...ARGS>
+       SharedRef<T> makeSharedMT(ARGS &&...args)
+       {
+               const auto rc = new RefCountObj<T, RefCounterMT>(
+                               std::forward<ARGS>(args)...);
+               return {rc, rc->getObj(), true};
+       }
+
+       template <class T>
+       inline void swap(SharedRef<T> &x, SharedRef<T> &y) noexcept
+       {
+               std::swap(x.m_rc, y.m_rc);
+               std::swap(x.m_ptr, y.m_ptr);
+       }
+
+       template <class T, class U>
+       inline SharedRef<T> staticRefCast(const SharedRef<U> &r) noexcept
+       {
+               return {r.m_rc, static_cast<T *>(r.get())};
+       }
+
+       template <class T, class U>
+       inline SharedRef<T> dynamicRefCast(const SharedRef<U> &r) noexcept
+       {
+               const auto ptr = dynamic_cast<T *>(r.get());
+               if (!ptr) {
+                       return {};
+               }
+               return {r.m_rc, ptr};
+       }
+
+       template <class T, class U>
+       inline const SharedRef<T> &constRefCast(const SharedRef<U> &r) noexcept
+       {
+               (void)const_cast<T *>((U *)nullptr);
+               return reinterpret_cast<const SharedRef<T> &>(r);
+       }
+
+       template <class T, class U>
+       inline SharedRef<T> &&constRefCast(SharedRef<U> &&r) noexcept
+       {
+               (void)const_cast<T *>((U *)nullptr);
+               return reinterpret_cast<SharedRef<T> &&>(r);
+       }
+}
diff --git a/ucl/include/ucl/util/memory/WeakRef.h b/ucl/include/ucl/util/memory/WeakRef.h
new file mode 100644 (file)
index 0000000..4cccbe6
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_UTIL_MEMORY_WEAK_REF_H__
+#define __UCL_UTIL_MEMORY_WEAK_REF_H__
+
+#include "SharedRef.h"
+
+namespace ucl {
+
+       template <class T>
+       class WeakRef final : public BaseRef<T> {
+       public:
+               template <class U>
+               friend void swap(WeakRef<U> &x, WeakRef<U> &y) noexcept;
+
+               template <class T2, class U>
+               friend WeakRef<T2> staticRefCast(const WeakRef<U> &r) noexcept;
+               template <class T2, class U>
+               friend WeakRef<T2> dynamicRefCast(const WeakRef<U> &r) noexcept;
+
+       public:
+               constexpr WeakRef() noexcept;
+               constexpr WeakRef(std::nullptr_t) noexcept;
+
+               WeakRef(IRefCountObj *rc, T *ptr) noexcept;
+
+               WeakRef(const WeakRef<T> &r) noexcept;
+               template <class U>
+               WeakRef(const BaseRef<U> &r) noexcept;
+
+               WeakRef(WeakRef<T> &&r) noexcept;
+               template <class U>
+               WeakRef(WeakRef<U> &&r) noexcept;
+
+               ~WeakRef();
+
+               WeakRef<T> &operator=(WeakRef<T> r) noexcept;
+
+               void reset() noexcept;
+
+               SharedRef<T> lock() const noexcept;
+
+               T *getUnsafePtr() const noexcept;
+               operator bool() const noexcept;
+
+               template <class U, class = typename std::enable_if<
+                       std::is_convertible<T *, U *>::value && (
+                               std::is_same<typename std::remove_cv<U>::type, void>::value ||
+                               std::is_same<typename std::remove_cv<U>::type,
+                                       typename std::remove_cv<T>::type>::value)>::type>
+               operator const WeakRef<U> &() const noexcept
+               {
+                       return reinterpret_cast<const WeakRef<U> &>(*this);
+               }
+       };
+
+       // Non-member functions //
+
+       template <class T>
+       WeakRef<T> makeWeak(const SharedRef<T> &r) noexcept;
+
+       template <class T, class U>
+       const WeakRef<T> &constRefCast(const WeakRef<U> &r) noexcept;
+       template <class T, class U>
+       WeakRef<T> &&constRefCast(WeakRef<U> &&r) noexcept;
+}
+
+#include "WeakRef.hpp"
+
+#endif // __UCL_UTIL_MEMORY_WEAK_REF_H__
diff --git a/ucl/include/ucl/util/memory/WeakRef.hpp b/ucl/include/ucl/util/memory/WeakRef.hpp
new file mode 100644 (file)
index 0000000..6634f3c
--- /dev/null
@@ -0,0 +1,155 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+namespace ucl {
+
+       template <class T>
+       constexpr WeakRef<T>::WeakRef() noexcept
+       {
+       }
+
+       template <class T>
+       constexpr WeakRef<T>::WeakRef(std::nullptr_t) noexcept
+       {
+       }
+
+       template <class T>
+       inline WeakRef<T>::WeakRef(
+                       IRefCountObj *const rc, T *const ptr) noexcept :
+               BaseRef<T>(rc, ptr)
+       {
+               this->m_rc->refWeak();
+       }
+
+       template <class T>
+       inline WeakRef<T>::WeakRef(const WeakRef<T> &r) noexcept :
+               BaseRef<T>(r.m_rc, r.m_ptr)
+       {
+               if (this->m_rc) {
+                       this->m_rc->refWeak();
+               }
+       }
+
+       template <class T>
+       template <class U>
+       inline WeakRef<T>::WeakRef(const BaseRef<U> &r) noexcept :
+               BaseRef<T>(r.m_rc, r.m_ptr)
+       {
+               if (this->m_rc) {
+                       this->m_rc->refWeak();
+               }
+       }
+
+       template <class T>
+       inline WeakRef<T>::WeakRef(WeakRef<T> &&r) noexcept :
+               BaseRef<T>(std::move(r))
+       {
+       }
+
+       template <class T>
+       template <class U>
+       inline WeakRef<T>::WeakRef(WeakRef<U> &&r) noexcept :
+               BaseRef<T>(std::move(r))
+       {
+       }
+
+       template <class T>
+       inline WeakRef<T>::~WeakRef()
+       {
+               if (this->m_rc) {
+                       this->m_rc->unrefWeak();
+               }
+       }
+
+       template <class T>
+       inline WeakRef<T> &WeakRef<T>::operator=(WeakRef<T> r) noexcept
+       {
+               swap(*this, r);
+               return *this;
+       }
+
+       template <class T>
+       inline void WeakRef<T>::reset() noexcept
+       {
+               *this = {};
+       }
+
+       template <class T>
+       inline SharedRef<T> WeakRef<T>::lock() const noexcept
+       {
+               if (this->m_rc && this->m_rc->refNz()) {
+                       return {this->m_rc, this->m_ptr, true};
+               }
+               return {};
+       }
+
+       template <class T>
+       inline T *WeakRef<T>::getUnsafePtr() const noexcept
+       {
+               return (operator bool() ? this->m_ptr : nullptr);
+       }
+
+       template <class T>
+       inline WeakRef<T>::operator bool() const noexcept
+       {
+               return (this->m_rc && (this->m_rc->getUseCount() > 0));
+       }
+
+       // Non-member functions //
+
+       template <class T>
+       inline WeakRef<T> makeWeak(const SharedRef<T> &r) noexcept
+       {
+               return r;
+       }
+
+       template <class T>
+       inline void swap(WeakRef<T> &x, WeakRef<T> &y) noexcept
+       {
+               std::swap(x.m_rc, y.m_rc);
+               std::swap(x.m_ptr, y.m_ptr);
+       }
+
+       template <class T, class U>
+       inline WeakRef<T> staticRefCast(const WeakRef<U> &r) noexcept
+       {
+               return {r.m_rc, static_cast<T *>(r.getUnsafePtr())};
+       }
+
+       template <class T, class U>
+       inline WeakRef<T> dynamicRefCast(const WeakRef<U> &r) noexcept
+       {
+               const auto ptr = dynamic_cast<T *>(r.getUnsafePtr());
+               if (!ptr) {
+                       return {};
+               }
+               return {r.m_rc, ptr};
+       }
+
+       template <class T, class U>
+       inline const WeakRef<T> &constRefCast(const WeakRef<U> &r) noexcept
+       {
+               (void)const_cast<T *>((U *)nullptr);
+               return reinterpret_cast<const WeakRef<T> &>(r);
+       }
+
+       template <class T, class U>
+       inline WeakRef<T> &&constRefCast(WeakRef<U> &&r) noexcept
+       {
+               (void)const_cast<T *>((U *)nullptr);
+               return reinterpret_cast<WeakRef<T> &&>(r);
+       }
+}
diff --git a/ucl/include/ucl/util/memory/helpers.h b/ucl/include/ucl/util/memory/helpers.h
new file mode 100644 (file)
index 0000000..5ce25a3
--- /dev/null
@@ -0,0 +1,164 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_UTIL_MEMORY_HELPERS_H__
+#define __UCL_UTIL_MEMORY_HELPERS_H__
+
+namespace ucl {
+
+       // Misc //
+
+       namespace util {
+
+               template <class T, class = typename std::enable_if<
+                               std::is_convertible<T *, IDisposable *>::value>::type>
+               inline void dispose(SharedRef<T> &r) noexcept
+               {
+                       if (r) {
+                               r->dispose();
+                               r.reset();
+                       }
+               }
+
+               template <class T, class = typename std::enable_if<
+                               std::is_convertible<T *, IDisposable *>::value>::type>
+               inline void dispose(WeakRef<T> &r) noexcept
+               {
+                       if (const auto shared = r.lock()) {
+                               shared->dispose();
+                               r.reset();
+                       }
+               }
+       }
+
+       // Generic casting functions //
+
+       template <class T, class U>
+       inline auto dynamicCast(const U &src) noexcept -> decltype(
+                       dynamicRefCast<typename T::Type>(src))
+       {
+               return dynamicRefCast<typename T::Type>(src);
+       }
+
+       template <class T, class U>
+       inline auto constCast(U &&src) noexcept -> decltype(
+                       constRefCast<typename T::Type>(std::forward<U>(src)))
+       {
+               return constRefCast<typename T::Type>(std::forward<U>(src));
+       }
+
+       // Relation operators //
+
+       namespace himpl {
+
+               template <class T, class = typename std::enable_if<
+                       !std::is_base_of<BaseRef<typename T::Type>, T>::value>::type>
+               inline const T &getCmpPtr(const T &ptr) noexcept
+               {
+                       return ptr;
+               }
+
+               template <class T>
+               inline T *getCmpPtr(const SharedRef<T> &r) noexcept
+               {
+                       return r.get();
+               }
+
+               template <class T>
+               inline T *getCmpPtr(const WeakRef<T> &r) noexcept
+               {
+                       return r.getUnsafePtr();
+               }
+       }
+
+       template <class T, class U, class = typename std::enable_if<
+               std::is_base_of<BaseRef<typename T::Type>, T>::value ||
+               std::is_base_of<BaseRef<typename U::Type>, U>::value>::type>
+       inline bool operator==(const T &lhs, const U &rhs) noexcept
+       {
+               return (himpl::getCmpPtr(lhs) == himpl::getCmpPtr(rhs));
+       }
+
+       template <class T, class U, class = typename std::enable_if<
+               std::is_base_of<BaseRef<typename T::Type>, T>::value ||
+               std::is_base_of<BaseRef<typename U::Type>, U>::value>::type>
+       inline bool operator!=(const T &lhs, const U &rhs) noexcept
+       {
+               return (himpl::getCmpPtr(lhs) != himpl::getCmpPtr(rhs));
+       }
+
+       template <class T, class U, class = typename std::enable_if<
+               std::is_base_of<BaseRef<typename T::Type>, T>::value ||
+               std::is_base_of<BaseRef<typename U::Type>, U>::value>::type>
+       inline bool operator<(const T &lhs, const U &rhs) noexcept
+       {
+               return (himpl::getCmpPtr(lhs) < himpl::getCmpPtr(rhs));
+       }
+
+       template <class T, class U, class = typename std::enable_if<
+               std::is_base_of<BaseRef<typename T::Type>, T>::value ||
+               std::is_base_of<BaseRef<typename U::Type>, U>::value>::type>
+       inline bool operator<=(const T &lhs, const U &rhs) noexcept
+       {
+               return (himpl::getCmpPtr(lhs) <= himpl::getCmpPtr(rhs));
+       }
+
+       template <class T, class U, class = typename std::enable_if<
+               std::is_base_of<BaseRef<typename T::Type>, T>::value ||
+               std::is_base_of<BaseRef<typename U::Type>, U>::value>::type>
+       inline bool operator>(const T &lhs, const U &rhs) noexcept
+       {
+               return (himpl::getCmpPtr(lhs) > himpl::getCmpPtr(rhs));
+       }
+
+       template <class T, class U, class = typename std::enable_if<
+               std::is_base_of<BaseRef<typename T::Type>, T>::value ||
+               std::is_base_of<BaseRef<typename U::Type>, U>::value>::type>
+       inline bool operator>=(const T &lhs, const U &rhs) noexcept
+       {
+               return (himpl::getCmpPtr(lhs) >= himpl::getCmpPtr(rhs));
+       }
+
+       template <class T, class = typename std::enable_if<
+               std::is_base_of<BaseRef<typename T::Type>, T>::value>::type>
+       inline bool operator==(const T &lhs, std::nullptr_t rhs) noexcept
+       {
+               return !lhs;
+       }
+
+       template <class T, class = typename std::enable_if<
+               std::is_base_of<BaseRef<typename T::Type>, T>::value>::type>
+       bool operator==(std::nullptr_t lhs, const T &rhs) noexcept
+       {
+               return !rhs;
+       }
+
+       template <class T, class = typename std::enable_if<
+               std::is_base_of<BaseRef<typename T::Type>, T>::value>::type>
+       bool operator!=(const T &lhs, std::nullptr_t rhs) noexcept
+       {
+               return lhs;
+       }
+
+       template <class T, class = typename std::enable_if<
+               std::is_base_of<BaseRef<typename T::Type>, T>::value>::type>
+       bool operator!=(std::nullptr_t lhs, const T &rhs) noexcept
+       {
+               return rhs;
+       }
+}
+
+#endif // __UCL_UTIL_MEMORY_HELPERS_H__
diff --git a/ucl/include/ucl/util/memory/macro.h b/ucl/include/ucl/util/memory/macro.h
new file mode 100644 (file)
index 0000000..b97175a
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_UTIL_MEMORY_MACRO_H__
+#define __UCL_UTIL_MEMORY_MACRO_H__
+
+#define UCL_DECLARE_REF_ALIASES(CLASS_NAME) \
+               class CLASS_NAME; \
+               using CLASS_NAME##SRef = ::ucl::SharedRef<CLASS_NAME>; \
+               using CLASS_NAME##WRef = ::ucl::WeakRef<CLASS_NAME>; \
+               using CLASS_NAME##SCRef = ::ucl::SharedRef<const CLASS_NAME>; \
+               using CLASS_NAME##WCRef = ::ucl::WeakRef<const CLASS_NAME>
+
+#define UCL_USING_REF_ALIASES(CLASS_NAME) \
+               using CLASS_NAME; \
+               using CLASS_NAME##SRef; \
+               using CLASS_NAME##WRef; \
+               using CLASS_NAME##SCRef; \
+               using CLASS_NAME##WCRef; \
+
+#endif // __UCL_UTIL_MEMORY_MACRO_H__
diff --git a/ucl/include/ucl/util/shortLogs.h b/ucl/include/ucl/util/shortLogs.h
new file mode 100644 (file)
index 0000000..02f8bbf
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_UTIL_SHORT_LOGS_H__
+#define __UCL_UTIL_SHORT_LOGS_H__
+
+#undef ULOG
+#undef URESDATALOG
+#undef URESLOG
+
+#undef VLOG
+#undef DLOG
+#undef ILOG
+#undef WLOG
+#undef ELOG
+#undef FLOG
+
+#undef VRESLOG
+#undef DRESLOG
+#undef IRESLOG
+#undef WRESLOG
+#undef ERESLOG
+#undef FRESLOG
+
+#undef RESLOG
+
+#undef RETVM_IF
+#undef RETM_IF
+
+#undef FAIL_RETURN
+#undef FAIL_RETURN_VALUE
+#undef FAIL_RETURN_VOID
+#undef FAIL_BREAK
+#undef FAIL_LOG
+
+#undef LOG_RETURN
+#undef LOG_RETURN_VALUE
+#undef LOG_RETURN_VOID
+#undef LOG_BREAK
+
+#define ULOG         UCL_ULOG
+#define URESDATALOG  UCL_URESDATALOG
+#define URESLOG      UCL_URESLOG
+
+#define VLOG  UCL_VLOG
+#define DLOG  UCL_DLOG
+#define ILOG  UCL_ILOG
+#define WLOG  UCL_WLOG
+#define ELOG  UCL_ELOG
+#define FLOG  UCL_FLOG
+
+#define VRESLOG  UCL_VRESLOG
+#define DRESLOG  UCL_DRESLOG
+#define IRESLOG  UCL_IRESLOG
+#define WRESLOG  UCL_WRESLOG
+#define ERESLOG  UCL_ERESLOG
+#define FRESLOG  UCL_FRESLOG
+
+#define RESLOG  UCL_RESLOG
+
+#define FAIL_RETURN        UCL_FAIL_RETURN
+#define FAIL_RETURN_VALUE  UCL_FAIL_RETURN_VALUE
+#define FAIL_RETURN_VOID   UCL_FAIL_RETURN_VOID
+#define FAIL_BREAK         UCL_FAIL_BREAK
+#define FAIL_LOG           UCL_FAIL_LOG
+
+#define LOG_RETURN        UCL_LOG_RETURN
+#define LOG_RETURN_VALUE  UCL_LOG_RETURN_VALUE
+#define LOG_RETURN_VOID   UCL_LOG_RETURN_VOID
+#define LOG_BREAK         UCL_LOG_BREAK
+
+#endif // __UCL_UTIL_SHORT_LOGS_H__
diff --git a/ucl/include/ucl/util/smartDelegation.h b/ucl/include/ucl/util/smartDelegation.h
new file mode 100644 (file)
index 0000000..6714411
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_UTIL_SMART_DELEGATION_H__
+#define __UCL_UTIL_SMART_DELEGATION_H__
+
+#include "smartDelegation/WeakDelegate.h"
+
+#include "smartDelegation/macro.h"
+
+#if (UCL_INCLUDE_SMART_DELEGATION_SHORT_MACRO_H)
+#include "smartDelegation/shortMacro.h"
+#endif
+
+#endif // __UCL_UTIL_SMART_DELEGATION_H__
diff --git a/ucl/include/ucl/util/smartDelegation/WeakDelegate.h b/ucl/include/ucl/util/smartDelegation/WeakDelegate.h
new file mode 100644 (file)
index 0000000..97e1ae8
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_UTIL_SMART_DELEGATION_WEAK_DELEGATE_H__
+#define __UCL_UTIL_SMART_DELEGATION_WEAK_DELEGATE_H__
+
+#include "ucl/util/delegation.h"
+#include "ucl/util/memory.h"
+
+namespace ucl {
+
+       template <class FUNC_SIG>
+       class WeakDelegate;
+
+       template <class R, class ...ARGS>
+       class WeakDelegate<R(ARGS...)> :
+                       public BaseDelegate<R(ARGS...), WeakRef<void>> {
+       public:
+               using BaseDelegate<R(ARGS...), WeakRef<void>>::BaseDelegate;
+
+               R operator()(ARGS ...args) const;
+
+               template <class CLASS, R(CLASS::*METHOD)(ARGS...)>
+               static WeakDelegate make(const WeakRef<CLASS> &data) noexcept;
+
+               template <class CLASS, R(CLASS::*METHOD)(ARGS...) const>
+               static WeakDelegate make(const WeakRef<const CLASS> &data) noexcept;
+       };
+}
+
+#include "WeakDelegate.hpp"
+
+#endif // __UCL_UTIL_SMART_DELEGATION_WEAK_DELEGATE_H__
diff --git a/ucl/include/ucl/util/smartDelegation/WeakDelegate.hpp b/ucl/include/ucl/util/smartDelegation/WeakDelegate.hpp
new file mode 100644 (file)
index 0000000..fa7b3f8
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+namespace ucl {
+
+       template <class R, class ...ARGS>
+       inline R WeakDelegate<R(ARGS...)>::operator()(ARGS ...args) const
+       {
+               const auto tmp = this->m_data.lock();
+               if (tmp) {
+                       return this->m_stubA(tmp.get(), std::forward<ARGS>(args)...);
+               }
+               return R();
+       }
+
+       template <class R, class ...ARGS>
+       template <class CLASS, R(CLASS::*METHOD)(ARGS...)>
+       inline WeakDelegate<R(ARGS...)> WeakDelegate<R(ARGS...)>::make(
+                       const WeakRef<CLASS> &data) noexcept
+       {
+               return {data, WeakDelegate::Cb::template stubA<CLASS, METHOD>};
+       }
+
+       template <class R, class ...ARGS>
+       template <class CLASS, R(CLASS::*METHOD)(ARGS...) const>
+       inline WeakDelegate<R(ARGS...)> WeakDelegate<R(ARGS...)>::make(
+                       const WeakRef<const CLASS> &data) noexcept
+       {
+               return {constRefCast<CLASS>(data),
+                               WeakDelegate::Cb::template stubA<CLASS, METHOD>};
+       }
+}
diff --git a/ucl/include/ucl/util/smartDelegation/macro.h b/ucl/include/ucl/util/smartDelegation/macro.h
new file mode 100644 (file)
index 0000000..b117820
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_UTIL_SMART_DELEGATION_MACRO_H__
+#define __UCL_UTIL_SMART_DELEGATION_MACRO_H__
+
+#define UCL_WEAK_DELEGATE(FUNC, DATA) \
+               _UCL_DELEGATE(::ucl::WeakDelegate, FUNC, DATA)
+
+#endif // __UCL_UTIL_SMART_DELEGATION_MACRO_H__
diff --git a/ucl/include/ucl/util/smartDelegation/shortMacro.h b/ucl/include/ucl/util/smartDelegation/shortMacro.h
new file mode 100644 (file)
index 0000000..ddf5e35
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_UTIL_SMART_DELEGATION_SHORT_MACRO_H__
+#define __UCL_UTIL_SMART_DELEGATION_SHORT_MACRO_H__
+
+#define WEAK_DELEGATE(FUNC, DATA) UCL_WEAK_DELEGATE(FUNC, DATA)
+
+#endif // __UCL_UTIL_SMART_DELEGATION_SHORT_MACRO_H__
diff --git a/ucl/include/ucl/util/threading.h b/ucl/include/ucl/util/threading.h
new file mode 100644 (file)
index 0000000..4595b1b
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_UTIL_THREADING_H__
+#define __UCL_UTIL_THREADING_H__
+
+#include "threading/Thread.h"
+#include "threading/Mutex.h"
+#include "threading/MutexLock.h"
+#include "threading/CondVar.h"
+
+#endif // __UCL_UTIL_THREADING_H__
diff --git a/ucl/include/ucl/util/threading/CondVar.h b/ucl/include/ucl/util/threading/CondVar.h
new file mode 100644 (file)
index 0000000..e73a763
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_UTIL_THREADING_COND_VAR_H__
+#define __UCL_UTIL_THREADING_COND_VAR_H__
+
+#include "MutexLock.h"
+
+namespace ucl {
+
+       class CondVar final : public NonCopyable {
+       public:
+               CondVar();
+               ~CondVar();
+               void wait(MutexLock &lock);
+               void notify();
+               void notifyAll();
+               pthread_cond_t *getHandle();
+       private:
+               pthread_cond_t m_cond;
+       };
+}
+
+#include "CondVar.hpp"
+
+#endif // __UCL_UTIL_THREADING_COND_VAR_H__
diff --git a/ucl/include/ucl/util/threading/CondVar.hpp b/ucl/include/ucl/util/threading/CondVar.hpp
new file mode 100644 (file)
index 0000000..09b0ae0
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+namespace ucl {
+
+       inline CondVar::CondVar() :
+               m_cond()
+       {
+               pthread_cond_init(&m_cond, NULL);
+       }
+
+       inline CondVar::~CondVar()
+       {
+               pthread_cond_destroy(&m_cond);
+       }
+
+       inline void CondVar::wait(MutexLock &lock)
+       {
+               pthread_cond_wait(&m_cond, lock.getMutex().getHandle());
+       }
+
+       inline void CondVar::notify()
+       {
+               pthread_cond_signal(&m_cond);
+       }
+
+       inline void CondVar::notifyAll()
+       {
+               pthread_cond_broadcast(&m_cond);
+       }
+
+       inline pthread_cond_t *CondVar::getHandle()
+       {
+               return &m_cond;
+       }
+}
diff --git a/ucl/include/ucl/util/threading/Mutex.h b/ucl/include/ucl/util/threading/Mutex.h
new file mode 100644 (file)
index 0000000..eda90ff
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_UTIL_THREADING_MUTEX_H__
+#define __UCL_UTIL_THREADING_MUTEX_H__
+
+// Use pthread because Tizen 3.0 officially not support C++ 11
+// And there were problems with threading in C++ 11 and Tizen 3.0
+#include <pthread.h>
+
+#include "ucl/util/types/classTypes.h"
+
+namespace ucl {
+
+       class Mutex final : public NonCopyable {
+       public:
+               Mutex(bool recursive = false);
+               ~Mutex();
+               void lock();
+               void unlock();
+               pthread_mutex_t *getHandle();
+       private:
+               pthread_mutex_t m_mutex;
+       };
+}
+
+#include "Mutex.hpp"
+
+#endif // __UCL_UTIL_THREADING_MUTEX_H__
diff --git a/ucl/include/ucl/util/threading/Mutex.hpp b/ucl/include/ucl/util/threading/Mutex.hpp
new file mode 100644 (file)
index 0000000..c3b75be
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+namespace ucl {
+
+       inline Mutex::Mutex(const bool recursive) :
+               m_mutex()
+       {
+               if (recursive) {
+                       pthread_mutexattr_t attr = {};
+                       pthread_mutexattr_init(&attr);
+                       pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+                       pthread_mutex_init(&m_mutex, &attr);
+                       pthread_mutexattr_destroy(&attr);
+               } else {
+                       pthread_mutex_init(&m_mutex, nullptr);
+               }
+       }
+
+       inline Mutex::~Mutex()
+       {
+               pthread_mutex_destroy(&m_mutex);
+       }
+
+       inline void Mutex::lock()
+       {
+               pthread_mutex_lock(&m_mutex);
+       }
+
+       inline void Mutex::unlock()
+       {
+               pthread_mutex_unlock(&m_mutex);
+       }
+
+       inline pthread_mutex_t *Mutex::getHandle()
+       {
+               return &m_mutex;
+       }
+}
diff --git a/ucl/include/ucl/util/threading/MutexLock.h b/ucl/include/ucl/util/threading/MutexLock.h
new file mode 100644 (file)
index 0000000..062837f
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_UTIL_THREADING_MUTEX_LOCK_H__
+#define __UCL_UTIL_THREADING_MUTEX_LOCK_H__
+
+#include "Mutex.h"
+
+namespace ucl {
+
+       class MutexLock final : public NonCopyable {
+       public:
+               MutexLock(Mutex &mutex);
+               ~MutexLock();
+               Mutex &getMutex();
+       private:
+               Mutex &m_mutex;
+       };
+}
+
+#include "MutexLock.hpp"
+
+#endif // __UCL_UTIL_THREADING_MUTEX_LOCK_H__
diff --git a/ucl/include/ucl/util/threading/MutexLock.hpp b/ucl/include/ucl/util/threading/MutexLock.hpp
new file mode 100644 (file)
index 0000000..a30d995
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+namespace ucl {
+
+       inline MutexLock::MutexLock(Mutex &mutex) :
+               m_mutex(mutex)
+       {
+               mutex.lock();
+       }
+
+       inline MutexLock::~MutexLock()
+       {
+               m_mutex.unlock();
+       }
+
+       inline Mutex &MutexLock::getMutex()
+       {
+               return m_mutex;
+       }
+}
diff --git a/ucl/include/ucl/util/threading/Thread.h b/ucl/include/ucl/util/threading/Thread.h
new file mode 100644 (file)
index 0000000..0839921
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_UTIL_THREADING_THREAD_H__
+#define __UCL_UTIL_THREADING_THREAD_H__
+
+// Use pthread because Tizen 3.0 officially not support C++ 11
+// And there were problems with threading in C++ 11 and Tizen 3.0
+#include <pthread.h>
+
+#include "ucl/util/types/classTypes.h"
+
+namespace ucl {
+
+       class Thread final : public NonCopyable {
+       public:
+               Thread();
+               template <class FUNC>
+               explicit Thread(FUNC &&func);
+               ~Thread();
+
+               bool wasStarted() const;
+               bool wasJoinded() const;
+
+               template <class FUNC>
+               bool start(FUNC &&func);
+               void join();
+
+               pthread_t *getHandle();
+
+       private:
+               std::function<void()> m_func;
+               pthread_t m_thread;
+               bool m_wasStarted;
+               bool m_wasJoined;
+       };
+}
+
+#include "Thread.hpp"
+
+#endif // __UCL_UTIL_THREADING_THREAD_H__
diff --git a/ucl/include/ucl/util/threading/Thread.hpp b/ucl/include/ucl/util/threading/Thread.hpp
new file mode 100644 (file)
index 0000000..74259c1
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 "ucl/util/logging.h"
+
+namespace ucl {
+
+       inline Thread::Thread() :
+               m_thread(),
+               m_wasStarted(false),
+               m_wasJoined(false)
+       {
+       }
+
+       template <class FUNC>
+       inline Thread::Thread(FUNC &&func) :
+               Thread()
+       {
+               start(func);
+       }
+
+       inline Thread::~Thread()
+       {
+               if (!m_wasJoined) {
+                       join();
+               }
+       }
+
+       inline bool Thread::wasStarted() const
+       {
+               return m_wasStarted;
+       }
+
+       inline bool Thread::wasJoinded() const
+       {
+               return m_wasJoined;
+       }
+
+       template <class FUNC>
+       inline bool Thread::start(FUNC &&func)
+       {
+               if (m_wasStarted) {
+                       UCL_WLOG("Already started!");
+                       return false;
+               }
+               m_func = std::forward<FUNC>(func);
+               const int res = pthread_create(&m_thread, NULL,
+                       [](void *data) -> void *
+                       {
+                               static_cast<Thread *>(data)->m_func();
+                               return nullptr;
+                       },
+                       this);
+               if (res != 0) {
+                       UCL_ELOG("pthread_create() failed: %d", res);
+                       m_func = {};
+                       return false;
+               }
+               m_wasStarted = true;
+               return true;
+       }
+
+       inline void Thread::join()
+       {
+               if (!m_wasStarted) {
+                       UCL_WLOG("Not stared started!");
+                       return;
+               }
+               if (m_wasJoined) {
+                       UCL_WLOG("Already joined!");
+                       return;
+               }
+               m_wasJoined = true;
+               pthread_join(m_thread, NULL);
+               m_func = {};
+       }
+
+       inline pthread_t *Thread::getHandle()
+       {
+               return ((m_wasStarted && !m_wasJoined) ? &m_thread : NULL);
+       }
+}
diff --git a/ucl/include/ucl/util/types.h b/ucl/include/ucl/util/types.h
new file mode 100644 (file)
index 0000000..70a33d3
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_UTIL_TYPES_H__
+#define __UCL_UTIL_TYPES_H__
+
+#include "types/baseTypes.h"
+#include "types/classTypes.h"
+#include "types/Result.h"
+
+#endif // __UCL_UTIL_TYPES_H__
diff --git a/ucl/include/ucl/util/types/Result.h b/ucl/include/ucl/util/types/Result.h
new file mode 100644 (file)
index 0000000..099223f
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_UTIL_TYPES_RESULT_H__
+#define __UCL_UTIL_TYPES_RESULT_H__
+
+#include "baseTypes.h"
+
+namespace ucl {
+
+       // ResultData declaration //
+
+       struct ResultData final {
+               const char *name;
+               int logPrio;
+       };
+
+       // Result declaration //
+
+       struct Result final {
+               int value;
+
+               Result() = default;
+
+               template <class VALUE, class = char(*)[VALUE::_UCL_RESULT * 0 + 1]>
+               constexpr Result(const VALUE &v) : value(v) {}
+       };
+
+       // Result non-member functions //
+
+       const ResultData &getResultData(Result result);
+
+       constexpr bool isGood(Result result);
+       constexpr bool isBad(Result result);
+
+       constexpr bool operator==(Result lhs, Result rhs);
+       constexpr bool operator!=(Result lhs, Result rhs);
+
+       // Basic Result values //
+
+       enum {
+               _UCL_RESULT,
+
+               RES_OK    = 0,
+               RES_FALSE = 1,
+               _RES_END,
+
+               RES_FAIL              = -1,
+               RES_INVALID_ARGUMENTS = -2,
+               RES_ILLEGAL_STATE     = -3,
+               RES_OUT_OF_MEMORY     = -4,
+               RES_IO_ERROR          = -5,
+               RES_NOT_SUPPORTED     = -6,
+               RES_INVALID_DATA      = -7,
+               RES_FATAL             = -8,
+               // TODO MUST match previous item!
+               _RES_BEGIN            = RES_FATAL
+       };
+}
+
+#include "Result.hpp"
+
+#endif // __UCL_UTIL_TYPES_RESULT_H__
diff --git a/ucl/include/ucl/util/types/Result.hpp b/ucl/include/ucl/util/types/Result.hpp
new file mode 100644 (file)
index 0000000..c83db4c
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+namespace ucl {
+
+       constexpr bool isGood(const Result result)
+       {
+               return (result.value >= RES_OK);
+       }
+
+       constexpr bool isBad(const Result result)
+       {
+               return !isGood(result);
+       }
+
+       constexpr bool operator==(const Result lhs, const Result rhs)
+       {
+               return (lhs.value == rhs.value);
+       }
+
+       constexpr bool operator!=(const Result lhs, const Result rhs)
+       {
+               return (lhs.value != rhs.value);
+       }
+}
diff --git a/ucl/include/ucl/util/types/baseTypes.h b/ucl/include/ucl/util/types/baseTypes.h
new file mode 100644 (file)
index 0000000..c5062db
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_UTIL_TYPES_BASE_TYPES_H__
+#define __UCL_UTIL_TYPES_BASE_TYPES_H__
+
+#include <cstddef>
+#include <cstdlib>
+#include <cstdint>
+
+#include <string>
+#include <memory>
+#include <atomic>
+#include <functional>
+#include <type_traits>
+#include <utility>
+
+#include <Eina.h>
+
+#include "ucl/config.h"
+
+namespace ucl {
+       using UInt = unsigned int;
+}
+
+#endif // __UCL_UTIL_TYPES_BASE_TYPES_H__
diff --git a/ucl/include/ucl/util/types/classTypes.h b/ucl/include/ucl/util/types/classTypes.h
new file mode 100644 (file)
index 0000000..5c708d2
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_UTIL_TYPES_CLASS_TYPES_H__
+#define __UCL_UTIL_TYPES_CLASS_TYPES_H__
+
+#include "baseTypes.h"
+
+namespace ucl {
+
+       class NonCopyable {
+       public:
+               NonCopyable(const NonCopyable &) = delete;
+               NonCopyable &operator=(const NonCopyable &) = delete;
+       protected:
+               NonCopyable() = default;
+               ~NonCopyable() = default;
+       };
+
+       class Polymorphic : public NonCopyable {
+       protected:
+               Polymorphic() = default;
+               virtual ~Polymorphic() = default;
+       };
+
+       class IDisposable : public Polymorphic {
+       public:
+               virtual void dispose() = 0;
+               virtual bool isDisposed() const = 0;
+       protected:
+               virtual ~IDisposable() = default;
+       };
+
+       template <class IPRODUCT>
+       class IFactory : public Polymorphic {
+       public:
+               using IProduct = IPRODUCT;
+       public:
+               virtual IPRODUCT *newInstance() const = 0;
+       protected:
+               virtual ~IFactory() = default;
+       };
+
+       template <class PRODUCT, class IPRODUCT>
+       class Factory final : public IFactory<IPRODUCT> {
+       public:
+               using Product = PRODUCT;
+       public:
+               virtual IPRODUCT *newInstance() const final override
+               {
+                       return new PRODUCT();
+               }
+       };
+
+       // Priority selector for SFINAE functions
+       template <int N>
+       struct P : P<N - 1> {};
+       template <>
+       struct P<0> {};
+}
+
+#endif // __UCL_UTIL_TYPES_CLASS_TYPES_H__
diff --git a/ucl/source/appfw/InstanceManagerBase.cpp b/ucl/source/appfw/InstanceManagerBase.cpp
new file mode 100644 (file)
index 0000000..2e90b24
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 "ucl/appfw/InstanceManagerBase.h"
+
+#include "common.h"
+
+namespace ucl {
+
+       InstanceManagerBase::InstanceManagerBase(AppParams appParams) :
+               m_appParams(std::move(appParams))
+       {
+       }
+
+       InstanceManagerBase::~InstanceManagerBase()
+       {
+       }
+
+       const AppParams &InstanceManagerBase::getAppParams() const
+       {
+               return m_appParams;
+       }
+
+       void InstanceManagerBase::setSysEventProvider(SysEventProviderUPtr provider)
+       {
+               m_sysEventProvider = std::move(provider);
+       }
+
+       SysEventProvider &InstanceManagerBase::getSysEventProvider() const
+       {
+               UCL_ASSERT(m_sysEventProvider, "m_sysEventProvider is NULL!");
+               return *m_sysEventProvider;
+       }
+}
diff --git a/ucl/source/appfw/SysEventProvider.cpp b/ucl/source/appfw/SysEventProvider.cpp
new file mode 100644 (file)
index 0000000..8958aaf
--- /dev/null
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 "ucl/appfw/SysEventProvider.h"
+
+#include "common.h"
+
+namespace ucl {
+
+       // SysEventProvider::EventProxy //
+
+       class SysEventProvider::EventProxy : public NonCopyable {
+       public:
+               EventProxy(SysEventProvider &provider,
+                               const SysEvent sysEvent,
+                               const app_event_type_e appEvent):
+                       m_provider(provider),
+                       m_sysEvent(sysEvent)
+               {
+                       const int res = m_provider.addEventHandler(&m_eventHandler,
+                                       appEvent, CALLBACK_B(EventProxy::onAppEvent), this);
+                       if (res != APP_ERROR_NONE) {
+                               if (res != APP_ERROR_INVALID_PARAMETER) {
+                                       ELOG("addEventHandler() failed! %d", res);
+                               }
+                               m_eventHandler = nullptr;
+                       }
+               }
+
+               ~EventProxy()
+               {
+                       if (m_eventHandler) {
+                               const int res = m_provider.delEventHandler(m_eventHandler);
+                               if (res != APP_ERROR_NONE) {
+                                       WLOG("delEventHandler() failed! %d", res);
+                               }
+                       }
+               }
+
+       private:
+               void onAppEvent(app_event_info_h event)
+               {
+                       m_provider.dispatch(m_sysEvent);
+               }
+
+       private:
+               SysEventProvider &m_provider;
+               app_event_handler_h m_eventHandler;
+               SysEvent m_sysEvent;
+       };
+
+       // SysEventProvider //
+
+       SysEventProvider::SysEventProvider(EventHandlerAddFunc addFunc,
+                       EventHandlerDelFunc delFunc):
+               m_addFunc(addFunc),
+               m_delFunc(delFunc)
+       {
+               m_eventProxies.emplace_back(*this, SysEvent::LANGUAGE_CHANGED,
+                               APP_EVENT_LANGUAGE_CHANGED);
+
+               m_eventProxies.emplace_back(*this, SysEvent::REGION_FMT_CHANGED,
+                               APP_EVENT_REGION_FORMAT_CHANGED);
+
+               m_eventProxies.emplace_back(*this, SysEvent::LOW_MEMORY,
+                               APP_EVENT_LOW_MEMORY);
+
+               m_eventProxies.emplace_back(*this, SysEvent::LOW_BATTERY,
+                               APP_EVENT_LOW_BATTERY);
+
+               m_eventProxies.emplace_back(*this, SysEvent::ORIENTATION_CHANGED,
+                               APP_EVENT_DEVICE_ORIENTATION_CHANGED);
+
+               m_eventProxies.emplace_back(*this, SysEvent::SUSPEND_STATE_CHANGED,
+                               APP_EVENT_SUSPENDED_STATE_CHANGED);
+
+               m_eventProxies.emplace_back(*this, SysEvent::UPDATE_REQUESTED,
+                               APP_EVENT_UPDATE_REQUESTED);
+       }
+
+       SysEventProvider::~SysEventProvider()
+       {
+       }
+
+       int SysEventProvider::addEventHandler(app_event_handler_h *handler,
+                       app_event_type_e appEvent, app_event_cb cb, void *data)
+       {
+               return m_addFunc(handler, appEvent, cb, data);
+       }
+
+       int SysEventProvider::delEventHandler(app_event_handler_h handler)
+       {
+               return m_delFunc(handler);
+       }
+
+       void SysEventProvider::dispatch(SysEvent sysEvent)
+       {
+               m_event.dispatch(sysEvent);
+       }
+}
diff --git a/ucl/source/appfw/UIApp.cpp b/ucl/source/appfw/UIApp.cpp
new file mode 100644 (file)
index 0000000..6f49c2b
--- /dev/null
@@ -0,0 +1,193 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 "ucl/appfw/UIApp.h"
+
+#include <app.h>
+
+#include "ucl/appfw/IInstanceAppControlExt.h"
+#include "common.h"
+
+namespace ucl {
+
+       UIApp::UIApp(InstanceManagerBase &instanceMgr) :
+               m_instanceMgr(instanceMgr)
+       {
+       }
+
+       UIApp::~UIApp()
+       {
+       }
+
+       int UIApp::run(int argc, char *argv[])
+       {
+               ui_app_lifecycle_callback_s alcc = {};
+               alcc.create = CALLBACK_B(UIApp::onCreate);
+               alcc.terminate = CALLBACK_B(UIApp::onTerminate);
+               alcc.pause = CALLBACK_B(UIApp::onPause);
+               alcc.resume = CALLBACK_B(UIApp::onResume);
+               alcc.app_control = CALLBACK_B(UIApp::onAppControl);
+
+               const int ret = ui_app_main(argc, argv, &alcc, this);
+               if (ret != APP_ERROR_NONE) {
+                       LOG_RETURN_VALUE(RES_FAIL, ret, "ui_app_main() failed! %d", ret);
+               }
+
+               return 0;
+       }
+
+       AppType UIApp::getAppType() const
+       {
+               return AppType::UI;
+       }
+
+       WindowSRef UIApp::getWindow()
+       {
+               return m_window;
+       }
+
+       void UIApp::exitApp()
+       {
+               ui_app_exit();
+       }
+
+       bool UIApp::onCreate()
+       {
+               FAIL_RETURN_VALUE(configParams(), false, "configParams() failed!");
+
+               FAIL_RETURN_VALUE(createWindow(), false, "createWindow() failed!");
+
+               initSysEventManager();
+
+               FAIL_RETURN_VALUE(createInstance(), false, "createInstance() failed!");
+
+               return true;
+       }
+
+       void UIApp::onTerminate()
+       {
+               m_instance.reset();
+               m_instanceMgr.setSysEventProvider(nullptr);
+               m_window.reset();
+       }
+
+       void UIApp::onPause()
+       {
+               if (m_instance) {
+                       m_instance->onPause();
+               }
+       }
+
+       void UIApp::onResume()
+       {
+               if (m_instance) {
+                       m_instance->onResume();
+               }
+       }
+
+       void UIApp::onAppControl(app_control_h appControl)
+       {
+               auto instance = dynamic_cast<
+                               IInstanceAppControlExt *>(m_instance.get());
+               if (instance) {
+                       instance->onAppControl(appControl);
+               }
+       }
+
+       Result UIApp::configParams()
+       {
+               auto &&appParams = m_instanceMgr.getAppParams();
+
+               Variant paramValue;
+
+               if (appParams.get(AppParam::BASE_SCALE, paramValue)) {
+                       const double baseScale = paramValue.asDouble();
+                       if (baseScale <= 0.0) {
+                               LOG_RETURN(RES_INVALID_DATA,
+                                               "Invalid parameter BASE_SCALE: %f", baseScale);
+                       }
+                       elm_app_base_scale_set(baseScale);
+               }
+
+               if (appParams.get(AppParam::ACCELERATION_PREFERENECE, paramValue)) {
+                       const auto accelPreference = paramValue.asString();
+                       if (isEmpty(accelPreference)) {
+                               LOG_RETURN(RES_INVALID_DATA,
+                                               "Invalid parameter ACCELERATION_PREFERENECE: %s",
+                                               accelPreference.get());
+                       }
+                       elm_config_accel_preference_set(accelPreference.get());
+               }
+
+               return RES_OK;
+       }
+
+       Result UIApp::createWindow()
+       {
+               auto &&appParams = m_instanceMgr.getAppParams();
+
+               Variant paramValue;
+
+               auto winType = Window::Type::BASIC;
+               if (appParams.get(AppParam::WINDOW_TYPE, paramValue)) {
+                       winType = static_cast<Window::Type>(paramValue.asInt());
+                       if (isNotValid(winType)) {
+                               LOG_RETURN(RES_INVALID_DATA,
+                                               "Invalid parameter WINDOW_TYPE: %d", winType);
+                       }
+               }
+
+               paramValue = appParams.get(AppParam::WINDOW_NAME);
+               if (isEmpty(paramValue)) {
+                       LOG_RETURN(RES_INVALID_DATA, "WINDOW_NAME must not be empty!");
+               }
+
+               m_window = Window::Builder().
+                               setType(winType).
+                               setName(paramValue.asString().get()).
+                               build();
+               if (!m_window) {
+                       LOG_RETURN(RES_FAIL, "Window::Builder().build() Failed!");
+               }
+
+               return RES_OK;
+       }
+
+       void UIApp::initSysEventManager()
+       {
+               m_instanceMgr.setSysEventProvider(
+                               util::makeUnique(new SysEventProvider(
+                                       &ui_app_add_event_handler,
+                                       &ui_app_remove_event_handler)));
+       }
+
+       Result UIApp::createInstance()
+       {
+               auto instance = m_instanceMgr.newInstance();
+               if (!instance) {
+                       LOG_RETURN(RES_FAIL, "m_instanceMgr.newInstance() failed!");
+               }
+
+               const auto res = instance->onCreate(this);
+               if (isBad(res)) {
+                       LOG_RETURN(res, "instance->onCreate() failed!");
+               }
+
+               m_instance = std::move(instance);
+
+               return RES_OK;
+       }
+}
diff --git a/ucl/source/appfw/common.h b/ucl/source/appfw/common.h
new file mode 100644 (file)
index 0000000..402bb6e
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_SOURCE_APPFW_COMMON_H__
+#define __UCL_SOURCE_APPFW_COMMON_H__
+
+#include "ucl/source/common.h"
+
+#endif // __UCL_SOURCE_APPFW_COMMON_H__
diff --git a/ucl/source/appfw/helpers.cpp b/ucl/source/appfw/helpers.cpp
new file mode 100644 (file)
index 0000000..c547dce
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 "ucl/appfw/helpers.h"
+
+#include "common.h"
+
+namespace ucl {
+
+       std::string getResPath(const char *const relativePath)
+       {
+               std::string result;
+               char *const resDir = app_get_resource_path();
+               if (resDir) {
+                       result = resDir;
+                       free(resDir);
+               } else {
+                       ELOG("app_get_resource_path() failed!");
+               }
+               result += relativePath;
+               return result;
+       }
+}
diff --git a/ucl/source/common.h b/ucl/source/common.h
new file mode 100644 (file)
index 0000000..3312380
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_SOURCE_COMMON_H__
+#define __UCL_SOURCE_COMMON_H__
+
+#include <cmath>
+#include <cstring>
+
+#include <algorithm>
+
+#include <Ecore.h>
+
+#include "ucl/util/types.h"
+#include "ucl/util/helpers.h"
+#include "ucl/util/logging.h"
+#include "ucl/util/shortLogs.h"
+
+#include "ucl/util/delegation/shortMacro.h"
+#include "ucl/util/smartDelegation/shortMacro.h"
+
+#endif // __UCL_SOURCE_COMMON_H__
diff --git a/ucl/source/gui/EdjeWidget.cpp b/ucl/source/gui/EdjeWidget.cpp
new file mode 100644 (file)
index 0000000..8d67596
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 "ucl/gui/EdjeWidget.h"
+
+namespace ucl {
+
+       void EdjeWidget::setText(const TString &value)
+       {
+               if (value.isTranslatable()) {
+                       if (value.hasDomain()) {
+                               elm_object_domain_translatable_text_set(
+                                               getEo(), value.getDomain(), value);
+                       } else {
+                               elm_object_translatable_text_set(getEo(), value);
+                       }
+               } else {
+                       elm_object_domain_text_translatable_set(getEo(),
+                                       nullptr, EINA_FALSE);
+                       elm_object_text_set(getEo(), value);
+               }
+       }
+
+       void EdjeWidget::setText(const TString &value, const EdjePart part)
+       {
+               if (value.isTranslatable()) {
+                       if (value.hasDomain()) {
+                               elm_object_domain_translatable_part_text_set(
+                                               getEo(), part.name, value.getDomain(), value);
+                       } else {
+                               elm_object_translatable_part_text_set(
+                                               getEo(), part.name, value);
+                       }
+               } else {
+                       elm_object_part_text_translatable_set(getEo(),
+                                       part.name, EINA_FALSE);
+                       elm_object_part_text_set(getEo(), part.name, value);
+               }
+       }
+}
diff --git a/ucl/source/gui/ElmWidget.cpp b/ucl/source/gui/ElmWidget.cpp
new file mode 100644 (file)
index 0000000..b7d227e
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 "ucl/gui/ElmWidget.h"
+
+#include "ucl/gui/Window.h"
+#include "ucl/gui/helpers.h"
+
+namespace ucl {
+
+       ElmWidget::ElmWidget(IRefCountObj *rc, Evas_Object *eo, bool isOwner) :
+               Widget(rc, eo, isOwner),
+               m_isAtspiGestureCbSet(false)
+       {
+       }
+
+       ElmWidget::~ElmWidget()
+       {
+               if (m_isAtspiGestureCbSet) {
+                       elm_atspi_accessible_gesture_cb_set(getEo(), nullptr, nullptr);
+               }
+       }
+
+       void ElmWidget::setFocusedImpl(const bool value)
+       {
+               elm_object_focus_set(getEo(), toEina(value));
+       }
+
+       bool ElmWidget::isFocusedImpl() const
+       {
+               return elm_object_focus_get(getEo());
+       }
+
+       bool ElmWidget::ensureFwdEvent(const SmartEvent fwdEvent)
+       {
+               if (Widget::ensureFwdEvent(fwdEvent)) {
+                       return true;
+               }
+               if (fwdEvent == ATSPI_ON_GESTURE) {
+                       if (!m_isAtspiGestureCbSet) {
+                               m_isAtspiGestureCbSet = true;
+                               elm_atspi_accessible_gesture_cb_set(getEo(),
+                                               CALLBACK_A(ElmWidget::onAtspiGesture), this);
+                       }
+                       return true;
+               }
+               return false;
+       }
+
+       Eina_Bool ElmWidget::onAtspiGesture(Elm_Atspi_Gesture_Info gestureInfo,
+                                       Evas_Object *obj)
+       {
+               AtspiGestureEventInfo eventInfo{gestureInfo};
+               callEvent(ATSPI_ON_GESTURE, &eventInfo);
+               return toEina(eventInfo.preventDefault);
+       }
+
+       Window *ElmWidget::getWindow() const
+       {
+               return dynamicWidgetCast<Window>(getTopWidget());
+       }
+}
diff --git a/ucl/source/gui/Genlist.cpp b/ucl/source/gui/Genlist.cpp
new file mode 100644 (file)
index 0000000..b0e31a5
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 "ucl/gui/Genlist.h"
+
+#include "common.h"
+
+namespace ucl {
+
+       // Genlist::Builder //
+
+       GenlistSRef Genlist::Builder::build(ElmWidget &parent) const
+       {
+               Evas_Object *const eo = elm_genlist_add(parent);
+               if (!eo) {
+                       LOG_RETURN_VALUE(RES_FAIL, {}, "elm_genlist_add() failed!");
+               }
+
+               auto result = makeShared<Genlist>(eo, m_isOwner);
+
+               if (m_needBindToEo) {
+                       result->bindToEo();
+               }
+
+               if (isValid(m_style)) {
+                       result->setStyle(m_style);
+               }
+
+               result->setMode(m_mode);
+               result->setHomogeneous(m_isHomogeneous);
+
+               show(*result);
+
+               return result;
+       }
+}
diff --git a/ucl/source/gui/Layout.cpp b/ucl/source/gui/Layout.cpp
new file mode 100644 (file)
index 0000000..1509fc5
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 "ucl/gui/Layout.h"
+
+#include "ucl/gui/stdTheme/layout.h"
+
+#include "common.h"
+
+namespace ucl {
+
+       // Layout::Builder //
+
+       LayoutSRef Layout::Builder::build(ElmWidget &parent) const
+       {
+               Evas_Object *const eo = elm_layout_add(parent);
+               if (!eo) {
+                       LOG_RETURN_VALUE(RES_FAIL, {}, "elm_layout_add() failed!");
+               }
+
+               auto result = makeShared<Layout>(eo, m_isOwner);
+
+               if (m_needBindToEo) {
+                       result->bindToEo();
+               }
+
+               bool isOk = true;
+
+               if (isNotEmpty(m_edjeFilePath) && isValid(m_edjeGroup)) {
+                       isOk = result->setEdjeFile(m_edjeFilePath, m_edjeGroup);
+               } else if (isValid(m_theme)) {
+                       isOk = result->setTheme(m_theme);
+               }
+
+               if (!isOk) {
+                       LOG_RETURN_VALUE(RES_FAIL, {}, "Layout init failed!");
+               }
+
+               show(*result);
+
+               return result;
+       }
+}
diff --git a/ucl/source/gui/NaviItem.cpp b/ucl/source/gui/NaviItem.cpp
new file mode 100644 (file)
index 0000000..02f5da2
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 "ucl/gui/NaviItem.h"
+
+#include "ucl/gui/Naviframe.h"
+#include "ucl/gui/helpers.h"
+
+namespace ucl {
+
+       void NaviItem::popTo() const
+       {
+               const auto navi = dynamicWidgetCast<Naviframe>(getWidget());
+               const bool needStartTransition =
+                               (navi && (navi->getTopItem() != *this));
+
+               elm_naviframe_item_pop_to(getIt());
+
+               if (needStartTransition) {
+                       navi->setInTransition(true);
+               }
+       }
+
+       void NaviItem::promote() const
+       {
+               const auto navi = dynamicWidgetCast<Naviframe>(getWidget());
+               const bool needStartTransition =
+                               (navi && (navi->getTopItem() != *this));
+
+               elm_naviframe_item_promote(getIt());
+
+               if (needStartTransition) {
+                       navi->setInTransition(true);
+               }
+       }
+}
diff --git a/ucl/source/gui/Naviframe.cpp b/ucl/source/gui/Naviframe.cpp
new file mode 100644 (file)
index 0000000..717940b
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 "ucl/gui/Naviframe.h"
+
+#include "common.h"
+
+namespace ucl {
+
+       // Naviframe::Builder //
+
+       NaviframeSRef Naviframe::Builder::build(ElmWidget &parent) const
+       {
+               Evas_Object *const eo = elm_naviframe_add(parent);
+               if (!eo) {
+                       ELOG("elm_naviframe_add() failed!");
+                       return {};
+               }
+
+               auto result = makeShared<Naviframe>(eo);
+
+               if (m_needBindToEo) {
+                       result->bindToEo();
+               }
+
+               if (isValid(m_style)) {
+                       result->setStyle(m_style);
+               }
+
+               show(*result);
+
+               return result;
+       }
+
+       // Naviframe //
+
+       Naviframe::Naviframe(IRefCountObj &rc, Evas_Object *eo) :
+               StyledWidget(&rc, eo),
+               m_isInTransition(false)
+       {
+               addEventHandler(NAVI_TRANSITION_FINISHED, WEAK_DELEGATE(
+                               Naviframe::onTransitionFinished, asWeak(*this)));
+       }
+
+       void Naviframe::setInTransition(const bool inTransition)
+       {
+               if (inTransition != m_isInTransition) {
+                       m_isInTransition = inTransition;
+                       if (inTransition) {
+                               callEvent(NAVI_TRANSITION_STARTED);
+                       } else {
+                               callEvent(NAVI_TRANSITION_FINISHED);
+                       }
+               }
+       }
+
+       void Naviframe::onTransitionFinished(Widget &widget, void *eventInfo)
+       {
+               m_isInTransition = false;
+       }
+}
diff --git a/ucl/source/gui/Widget.cpp b/ucl/source/gui/Widget.cpp
new file mode 100644 (file)
index 0000000..096c6e1
--- /dev/null
@@ -0,0 +1,300 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 "ucl/gui/Widget.h"
+
+#include "common.h"
+
+namespace ucl { namespace { namespace impl {
+
+       constexpr auto WIDGET_EVENT_SMART = EVAS_CALLBACK_LAST;
+}}}
+
+namespace ucl {
+
+       // Widget::EventProxy //
+
+       class Widget::EventProxy : public NonCopyable {
+       public:
+               EventProxy(Widget &widget, const WidgetEvent event,
+                               const WidgetEventHandler handler) :
+                       m_widget(widget),
+                       m_handler(handler),
+                       m_type(static_cast<Evas_Callback_Type>(event))
+               {
+                       evas_object_event_callback_add(m_widget.getEo(),
+                                       m_type, event_cb, this);
+               }
+
+               EventProxy(Widget &widget, const SmartEvent event,
+                               const WidgetEventHandler handler) :
+                       m_widget(widget),
+                       m_smartEvent(event),
+                       m_handler(handler),
+                       m_type(impl::WIDGET_EVENT_SMART)
+               {
+                       evas_object_smart_callback_add(m_widget.getEo(),
+                                       m_smartEvent.c_str(), smart_cb, this);
+               }
+
+               ~EventProxy()
+               {
+                       if (m_type == impl::WIDGET_EVENT_SMART) {
+                               evas_object_smart_callback_del_full(m_widget.getEo(),
+                                               m_smartEvent.c_str(), smart_cb, this);
+                       } else {
+                               evas_object_event_callback_del_full(m_widget.getEo(),
+                                               m_type, event_cb, this);
+                       }
+               }
+
+               void setSelfIt(const Widget::EventProxiesIt it)
+               {
+                       m_selfIt = it;
+               }
+
+               bool operator==(const std::pair<WidgetEvent, WidgetEventHandler> &rhs)
+               {
+                       return ((m_type == static_cast<Evas_Callback_Type>(rhs.first)) &&
+                                       (m_handler == rhs.second));
+               }
+
+               bool operator==(const std::pair<SmartEvent, WidgetEventHandler> &rhs)
+               {
+                       return ((m_type == impl::WIDGET_EVENT_SMART) &&
+                                       (m_handler == rhs.second) &&
+                                       (m_smartEvent.compare(rhs.first) == 0));
+               }
+
+       private:
+               static void event_cb(void *data, Evas *e,
+                               Evas_Object *obj, void *event_info)
+               {
+                       static_cast<EventProxy *>(data)->dispatchEvent(event_info);
+               }
+
+               static void smart_cb(void *data, Evas_Object *obj, void *event_info)
+               {
+                       static_cast<EventProxy *>(data)->dispatchEvent(event_info);
+               }
+
+               void dispatchEvent(void *const event_info)
+               {
+                       if (m_handler) {
+                               m_handler(m_widget, event_info);
+                       } else {
+                               m_widget.delEventProxy(m_selfIt);
+                       }
+               }
+
+       private:
+               Widget &m_widget;
+               const std::string m_smartEvent;
+               const WidgetEventHandler m_handler;
+               const Evas_Callback_Type m_type;
+               Widget::EventProxiesIt m_selfIt;
+       };
+
+       // Widget //
+
+       Widget::Widget(IRefCountObj *const rc, Evas_Object *const eo,
+                       const bool isOwner) :
+               RefCountAware(rc),
+               m_eo(eo),
+               m_isOwner(isOwner),
+               m_isBoundToEo(false),
+               m_isEoRefKept(false),
+               m_isSelfRefUnique(false)
+       {
+               UCL_ASSERT(m_eo, "m_eo is NULL!");
+
+               if (isShared()) {
+                       evas_object_event_callback_priority_add(m_eo, EVAS_CALLBACK_DEL,
+                                       EO_CALLBACK_PRIORITY_AFTER,
+                                       CALLBACK_A(Widget::onEoDel), this);
+               }
+
+               updateRefs();
+       }
+
+       Widget::~Widget()
+       {
+               m_eventProxies.clear();
+
+               if (m_isBoundToEo) {
+                       unbindFromEo();
+               }
+
+               if (isShared()) {
+                       evas_object_event_callback_del_full(m_eo, EVAS_CALLBACK_DEL,
+                                       CALLBACK_A(Widget::onEoDel), this);
+               }
+
+               if (m_isOwner) {
+                       evas_object_del(m_eo);
+               }
+
+               if (m_isEoRefKept) {
+                       evas_object_unref(m_eo);
+               }
+       }
+
+       void Widget::bindToEo()
+       {
+               if (!evas_object_data_get(m_eo, impl::WIDGET_DATA_NAME)) {
+                       evas_object_data_set(m_eo, impl::WIDGET_DATA_NAME, this);
+                       m_isBoundToEo = true;
+               } else {
+                       WLOG("Other Widget is already bound to this Eo!");
+               }
+       }
+
+       void Widget::unbindFromEo()
+       {
+               if (evas_object_data_get(m_eo, impl::WIDGET_DATA_NAME) == this) {
+                       evas_object_data_del(m_eo, impl::WIDGET_DATA_NAME);
+                       m_isBoundToEo = false;
+               } else {
+                       WLOG("Widget does not bound to its Eo!");
+               }
+       }
+
+       void Widget::updateRefs()
+       {
+               updateEoRef();
+
+               if (isShared()) {
+                       updateSelfRef();
+               }
+       }
+
+       void Widget::updateEoRef()
+       {
+               if (needKeepEoRef()) {
+                       if (!m_isEoRefKept) {
+                               m_isEoRefKept = true;
+                               evas_object_ref(m_eo);
+                       }
+               } else if (m_isEoRefKept) {
+                       m_isEoRefKept = false;
+                       evas_object_unref(m_eo);
+               }
+       }
+
+       bool Widget::needKeepEoRef() const
+       {
+               return (!m_isSelfRefUnique || !needKeepSelfRef());
+       }
+
+       void Widget::updateSelfRef()
+       {
+               if (!needKeepSelfRef()) {
+                       m_selfRef.reset();
+               } else if (!m_selfRef) {
+                       m_selfRef = asShared(*this);
+               }
+       }
+
+       bool Widget::needKeepSelfRef() const
+       {
+               return (!m_isOwner && m_eo);
+       }
+
+       void Widget::setSelfRefUnique(const bool value)
+       {
+               if (value != m_isSelfRefUnique) {
+                       m_isSelfRefUnique = value;
+                       updateEoRef();
+               }
+       }
+
+       void Widget::onEoDel(Evas *e, Evas_Object *obj, void *event_info)
+       {
+               if (!m_selfRef) {
+                       FLOG("UNEXPECTED! m_selfRef is NULL!");
+                       m_eo = nullptr;
+                       return;
+               }
+               if (m_isOwner || m_isEoRefKept || !m_isSelfRefUnique) {
+                       ELOG("UNEXPECTED! m_isOwner: %d; m_isEoRefKept: %d; "
+                                       "m_isSelfRefUnique: %d;",
+                                       m_isOwner, m_isEoRefKept, m_isSelfRefUnique);
+                       m_eo = nullptr;
+               }
+               m_selfRef.reset();
+       }
+
+       void Widget::onUniqueChanged(bool isUnique)
+       {
+               setSelfRefUnique(isUnique);
+       }
+
+       void Widget::delEventProxy(const EventProxiesIt it)
+       {
+               if (it != m_eventProxies.end()) {
+                       m_eventProxies.erase(it);
+               }
+       }
+
+       void Widget::addEventHandler(const WidgetEvent event,
+                       const WidgetEventHandler handler)
+       {
+               m_eventProxies.emplace_front(*this, event, handler);
+               m_eventProxies.front().setSelfIt(m_eventProxies.begin());
+       }
+
+       void Widget::addEventHandler(const SmartEvent event,
+                       const WidgetEventHandler handler)
+       {
+               if (strncmp(event.name, UCL_SMART_FWD, strlen(UCL_SMART_FWD)) == 0) {
+                       if (!ensureFwdEvent(event)) {
+                               LOG_RETURN_VOID(RES_NOT_SUPPORTED,
+                                               "Event is not supported: %s;", event.name);
+                       }
+               }
+               m_eventProxies.emplace_front(*this, event, handler);
+               m_eventProxies.front().setSelfIt(m_eventProxies.begin());
+       }
+
+       void Widget::delEventHandler(const WidgetEvent event,
+                       const WidgetEventHandler handler)
+       {
+               delEventProxy(std::find(m_eventProxies.begin(), m_eventProxies.end(),
+                               std::make_pair(event, handler)));
+       }
+
+       void Widget::delEventHandler(const SmartEvent event,
+                       const WidgetEventHandler handler)
+       {
+               delEventProxy(std::find(m_eventProxies.begin(), m_eventProxies.end(),
+                               std::make_pair(event, handler)));
+       }
+
+       void Widget::setFocusedImpl(const bool value)
+       {
+               evas_object_focus_set(getEo(), toEina(value));
+       }
+
+       bool Widget::isFocusedImpl() const
+       {
+               return evas_object_focus_get(getEo());
+       }
+
+       bool Widget::ensureFwdEvent(const SmartEvent fwdEvent)
+       {
+               return false;
+       }
+}
diff --git a/ucl/source/gui/WidgetItem.cpp b/ucl/source/gui/WidgetItem.cpp
new file mode 100644 (file)
index 0000000..04d1fca
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 "ucl/gui/WidgetItem.h"
+
+namespace ucl {
+
+       void WidgetItem::setText(const TString &value) const
+       {
+               if (value.isTranslatable()) {
+                       if (value.hasDomain()) {
+                               elm_object_item_domain_translatable_text_set(
+                                               getIt(), value.getDomain(), value);
+                       } else {
+                               elm_object_item_translatable_text_set(getIt(), value);
+                       }
+               } else {
+                       elm_object_item_text_translatable_set(getIt(), EINA_FALSE);
+                       elm_object_item_text_set(getIt(), value);
+               }
+       }
+
+       void WidgetItem::setText(const TString &value,
+                       const EdjePart part) const
+       {
+               if (value.isTranslatable()) {
+                       if (value.hasDomain()) {
+                               elm_object_item_domain_translatable_part_text_set(
+                                               getIt(), part.name, value.getDomain(), value);
+                       } else {
+                               elm_object_item_translatable_part_text_set(
+                                               getIt(), part.name, value);
+                       }
+               } else {
+                       elm_object_item_part_text_translatable_set(getIt(),
+                                       part.name, EINA_FALSE);
+                       elm_object_item_part_text_set(getIt(), part.name, value);
+               }
+       }
+}
diff --git a/ucl/source/gui/Window.cpp b/ucl/source/gui/Window.cpp
new file mode 100644 (file)
index 0000000..3f74e9e
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 "ucl/gui/Window.h"
+
+#include "common.h"
+
+namespace ucl {
+
+       // Window::Builder //
+
+       WindowSRef Window::Builder::build() const
+       {
+               if (!m_winEo && isEmpty(m_name) && isEmpty(m_title)) {
+                       ELOG("Wrong built parameters!");
+                       return {};
+               }
+
+               Evas_Object *winEo = m_winEo;
+               bool isOwner = m_isOwner;
+
+               if (!winEo) {
+                       winEo = elm_win_add(nullptr,
+                                       (m_name.empty() ? m_title : m_name).c_str(),
+                                       static_cast<Elm_Win_Type>(m_type));
+                       if (!winEo) {
+                               ELOG("elm_win_add() failed!");
+                               return {};
+                       }
+                       if (!m_isOwnerWasSet) {
+                               isOwner = true;
+                       }
+               }
+
+               StyledWidget bg(elm_bg_add(winEo));
+               expand(bg);
+               show(bg);
+
+               StyledWidget conform(elm_conformant_add(winEo));
+               expand(conform);
+               show(conform);
+
+               elm_win_resize_object_add(winEo, bg);
+               elm_win_resize_object_add(winEo, conform);
+
+               elm_win_indicator_opacity_set(winEo, ELM_WIN_INDICATOR_OPAQUE);
+               elm_win_conformant_set(winEo, EINA_TRUE);
+
+               auto result = makeShared<Window>(winEo, isOwner, conform);
+
+               if (m_needBindToEo) {
+                       result->bindToEo();
+               }
+
+               result->setTitle(m_title.empty() ? m_name : m_title);
+
+               if (result->isRotationsSupported()) {
+                       result->setRotations(m_rotations);
+               }
+
+               result->setIndicatorVisible(m_isIndicatorVisible);
+
+               return result;
+       }
+}
diff --git a/ucl/source/gui/common.h b/ucl/source/gui/common.h
new file mode 100644 (file)
index 0000000..b8a0028
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_SOURCE_GUI_COMMON_H__
+#define __UCL_SOURCE_GUI_COMMON_H__
+
+#include "ucl/source/common.h"
+
+#endif // __UCL_SOURCE_GUI_COMMON_H__
diff --git a/ucl/source/misc/Timeout.cpp b/ucl/source/misc/Timeout.cpp
new file mode 100644 (file)
index 0000000..41a3d3f
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 "ucl/misc/Timeout.h"
+
+#include "common.h"
+
+namespace ucl {
+
+       TimeoutSRef Timeout::create(double timeoutSec,
+                       const TimeoutHandler &handler)
+       {
+               auto result = makeShared<Timeout>(handler);
+
+               FAIL_RETURN_VALUE(result->prepare(timeoutSec), {},
+                               "result->prepare() failed!");
+
+               return result;
+       }
+
+       Timeout::Timeout(const TimeoutHandler &handler) :
+               m_timer(nullptr),
+               m_handler(handler)
+       {
+       }
+
+       Timeout::~Timeout()
+       {
+               if (m_timer) {
+                       ecore_timer_del(m_timer);
+               }
+       }
+
+       Result Timeout::prepare(const double timeoutSec)
+       {
+               m_timer = ecore_timer_add(timeoutSec,
+                       [](void *data) -> Eina_Bool
+                       {
+                               const auto self = static_cast<Timeout *>(data);
+                               self->m_timer = nullptr;
+                               if (self->m_handler) {
+                                       self->m_handler(self);
+                               }
+                               return ECORE_CALLBACK_CANCEL;
+                       },
+                       this);
+
+               if (!m_timer) {
+                       FAIL_RETURN(RES_FAIL, "ecore_timer_add() failed!");
+               }
+
+               return RES_OK;
+       }
+
+       bool Timeout::isExpired() const
+       {
+               return !m_timer;
+       }
+}
diff --git a/ucl/source/misc/Variant.cpp b/ucl/source/misc/Variant.cpp
new file mode 100644 (file)
index 0000000..8be8708
--- /dev/null
@@ -0,0 +1,228 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 "ucl/misc/Variant.h"
+
+#include "common.h"
+
+namespace ucl {
+
+       // Variant //
+
+       Variant::Variant(const char *const aString, const int length) :
+               m_type(aString ? TYPE_STRING : TYPE_NIL)
+       {
+               if (aString) {
+                       const size_t realLength = ((length < 0) ? strlen(aString) : length);
+                       if (realLength < sizeof(m_aSmallStr.buffer)) {
+                               strncpy(m_aSmallStr.buffer, aString, realLength);
+                               m_aSmallStr.buffer[realLength] = '\0';
+                               m_type |= impl::FLAG_SMALL_STR;
+                       } else {
+                               m_aString.data = strndup(aString, realLength);
+                               m_aString.length = realLength;
+                       }
+               }
+       }
+
+       Variant::Variant(std::nullptr_t, const int arrayLength) :
+               m_type(static_cast<int>((arrayLength > 0) ? TYPE_ARRAY : TYPE_NIL))
+       {
+               if (arrayLength > 0) {
+                       m_anArray.data = new Variant[arrayLength];
+                       m_anArray.length = arrayLength;
+               }
+       }
+
+       Variant::Variant(const Variant *const anArray, const int length) :
+               Variant(nullptr, length)
+       {
+               if (length > 0) {
+                       std::copy(anArray, (anArray + length), m_anArray.data);
+               }
+       }
+
+       Variant::Variant(const Variant &v) :
+               m_type(v.m_type)
+       {
+               switch (m_type) {
+               case TYPE_NIL:
+                       break;
+               case TYPE_STRING:
+                       m_aString.data = strndup(v.m_aString.data, v.m_aString.length);
+                       m_aString.length = v.m_aString.length;
+                       break;
+               case TYPE_ARRAY:
+                       m_anArray.data = new Variant[v.m_anArray.length];
+                       std::copy(v.m_anArray.data, (v.m_anArray.data + v.m_anArray.length),
+                                       m_anArray.data);
+                       m_anArray.length = v.m_anArray.length;
+                       break;
+               default:
+                       m_raw = v.m_raw;
+                       break;
+               }
+       }
+
+       bool Variant::asBool() const noexcept
+       {
+               switch (m_type) {
+               case TYPE_BOOLEAN:
+                       return m_aBool.value;
+               case TYPE_INTEGER:
+                       return (m_anInt.value != 0);
+               case TYPE_FLOAT:
+                       return (m_aFloat.value != 0.0f);
+               case TYPE_DOUBLE:
+                       return (m_aDouble.value != 0.0);
+               case TYPE_STRING:
+               case impl::TYPE_SMALL_STR:
+                       {
+                               const auto str = getStr();
+                               return (strcasecmp(str, "true") == 0)
+                                       || (strcasecmp(str, "yes") == 0)
+                                       || (strcasecmp(str, "ok") == 0)
+                                       || (strcasecmp(str, "on") == 0)
+                                       || (strcasecmp(str, "1") == 0);
+                       }
+               case TYPE_ARRAY:
+                       return (m_anArray.length != 0);
+               }
+               return false;
+       }
+
+       int Variant::asInt() const noexcept
+       {
+               switch (m_type) {
+               case TYPE_BOOLEAN:
+                       return static_cast<int>(m_aBool.value);
+               case TYPE_INTEGER:
+                       return m_anInt.value;
+               case TYPE_FLOAT:
+                       return static_cast<int>(m_aFloat.value);
+               case TYPE_DOUBLE:
+                       return static_cast<int>(m_aDouble.value);
+               case TYPE_STRING:
+               case impl::TYPE_SMALL_STR:
+                       return std::atoi(getStr());
+               case TYPE_ARRAY:
+                       return m_anArray.length;
+               }
+               return 0;
+       }
+
+       float Variant::asFloat() const noexcept
+       {
+               switch (m_type) {
+               case TYPE_BOOLEAN:
+                       return static_cast<float>(m_aBool.value);
+               case TYPE_INTEGER:
+                       return static_cast<float>(m_anInt.value);
+               case TYPE_FLOAT:
+                       return m_aFloat.value;
+               case TYPE_DOUBLE:
+                       return static_cast<float>(m_aDouble.value);
+               case TYPE_STRING:
+               case impl::TYPE_SMALL_STR:
+                       return static_cast<float>(std::atof(getStr()));
+               case TYPE_ARRAY:
+                       return static_cast<float>(m_anArray.length);
+               }
+               return 0.0f;
+       }
+
+       double Variant::asDouble() const noexcept
+       {
+               switch (m_type) {
+               case TYPE_BOOLEAN:
+                       return static_cast<double>(m_aBool.value);
+               case TYPE_INTEGER:
+                       return static_cast<double>(m_anInt.value);
+               case TYPE_FLOAT:
+                       return static_cast<double>(m_aFloat.value);
+               case TYPE_DOUBLE:
+                       return m_aDouble.value;
+               case TYPE_STRING:
+               case impl::TYPE_SMALL_STR:
+                       return std::atof(getStr());
+               case TYPE_ARRAY:
+                       return static_cast<double>(m_anArray.length);
+               }
+               return 0.0;
+       }
+
+       ConstCString Variant::asString() const noexcept
+       {
+               char strBuff[impl::TMP_STR_BUFF_SIZE] = {};
+               switch (m_type) {
+               case TYPE_NIL:
+                       return ConstCString::wrap("");
+               case TYPE_BOOLEAN:
+                       return ConstCString::wrap(m_aBool.value ? "true" : "false");
+               case TYPE_INTEGER:
+                       snprintf(strBuff, sizeof(strBuff), "%d", m_anInt.value);
+                       break;
+               case TYPE_FLOAT:
+                       snprintf(strBuff, sizeof(strBuff), "%f",
+                                       static_cast<double>(m_aFloat.value));
+                       break;
+               case TYPE_DOUBLE:
+                       snprintf(strBuff, sizeof(strBuff), "%f", m_aDouble.value);
+                       break;
+               case impl::TYPE_SMALL_STR:
+                       return ConstCString::wrap(m_aSmallStr.buffer);
+               case TYPE_STRING:
+                       return ConstCString::wrap(m_aString.data);
+               case TYPE_ARRAY:
+                       snprintf(strBuff, sizeof(strBuff), "%d", m_anArray.length);
+                       break;
+               }
+               return CString::dup(strBuff);
+       }
+
+       // Non-member functions //
+
+       bool operator==(const Variant &lhs, const Variant &rhs) noexcept
+       {
+               if (lhs.m_type != rhs.m_type) {
+                       return false;
+               }
+               switch (lhs.m_type) {
+               case Variant::TYPE_BOOLEAN:
+                       return (lhs.m_aBool.value == rhs.m_aBool.value);
+               case Variant::TYPE_INTEGER:
+                       return (lhs.m_anInt.value == rhs.m_anInt.value);
+               case Variant::TYPE_FLOAT:
+                       return (lhs.m_aFloat.value == rhs.m_aFloat.value);
+               case Variant::TYPE_DOUBLE:
+                       return (lhs.m_aDouble.value == rhs.m_aDouble.value);
+               case Variant::TYPE_STRING:
+               case impl::TYPE_SMALL_STR:
+                       return (strcmp(lhs.getStr(), rhs.getStr()) == 0);
+               case Variant::TYPE_ARRAY:
+                       if (lhs.m_anArray.length != rhs.m_anArray.length) {
+                               return false;
+                       }
+                       for (int i = 0; i < lhs.m_anArray.length; ++i) {
+                               if (lhs.m_anArray.data[i] != rhs.m_anArray.data[i]) {
+                                       return false;
+                               }
+                       }
+                       return true;
+               }
+               return true;
+       }
+}
diff --git a/ucl/source/misc/common.h b/ucl/source/misc/common.h
new file mode 100644 (file)
index 0000000..fd9d17e
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_SOURCE_MISC_COMMON_H__
+#define __UCL_SOURCE_MISC_COMMON_H__
+
+#include "ucl/source/common.h"
+
+#endif // __UCL_SOURCE_MISC_COMMON_H__
diff --git a/ucl/source/mvp/GuiPresenter.cpp b/ucl/source/mvp/GuiPresenter.cpp
new file mode 100644 (file)
index 0000000..e23bc02
--- /dev/null
@@ -0,0 +1,257 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 "ucl/mvp/GuiPresenter.h"
+
+#include "common.h"
+
+namespace ucl { namespace { namespace impl {
+
+       constexpr SmartEvent ACTIVATE_BY {"ucl,activate,by"};
+       constexpr SmartEvent DEACTIVATE_BY {"ucl,deactivate,by"};
+}}}
+
+namespace ucl {
+
+       GuiPresenter::GuiPresenter(IRefCountObj &rc) :
+               RefCountAware(&rc),
+               m_hasBuildInSources(false),
+               m_isChild(false),
+               m_isPrepared(false)
+       {
+       }
+
+       GuiPresenter::~GuiPresenter()
+       {
+               if (m_hasBuildInSources) {
+                       if (m_isChild) {
+                               if (const auto parentSink = m_parentSink.lock()) {
+                                       delDeactivatorSource(*parentSink);
+                               }
+                       } else if (m_window) {
+                               delDeactivatorSource(*m_window);
+                       }
+               }
+       }
+
+       Result GuiPresenter::prepare(ElmWidget &widget, const int flags)
+       {
+               m_window = asShared(widget.getWindow());
+               if (!m_window) {
+                       LOG_RETURN(RES_FAIL, "m_window is NULL!");
+               }
+
+               if (flags & PF_ADD_DEACTIVATOR_SOURCES) {
+                       addDeactivatorSource(*m_window);
+                       m_hasBuildInSources = true;
+               }
+
+               if (flags & PF_ADD_SELF_EXCEPT) {
+                       addDeactivatorException(getObjPtr());
+               }
+
+               m_isPrepared = true;
+
+               return RES_OK;
+       }
+
+       Result GuiPresenter::prepare(GuiPresenter &parent, const int flags)
+       {
+               if (flags & PF_ADD_DEACTIVATOR_SOURCES) {
+
+                       if (!parent.m_sink) {
+                               LOG_RETURN(RES_FAIL, "parent.m_sink is NULL!");
+                       }
+
+                       for (auto deactivator: parent.m_deactivators) {
+                               if (m_deactivatorExceptions.find(deactivator) ==
+                                               m_deactivatorExceptions.end()) {
+                                       m_deactivators.insert(deactivator);
+                               }
+                       }
+
+                       addDeactivatorSource(*parent.m_sink);
+                       m_parentSink = parent.m_sink;
+                       m_hasBuildInSources = true;
+               }
+
+               if (flags & PF_ADD_SELF_EXCEPT) {
+                       addDeactivatorException(getObjPtr());
+               }
+
+               m_window = parent.m_window;
+               m_isChild = true;
+               m_isPrepared = true;
+
+               return RES_OK;
+       }
+
+       Window &GuiPresenter::getWindow()
+       {
+               UCL_ASSERT(isWindowReady(), "m_window is NULL!");
+               return *m_window;
+       }
+
+       bool GuiPresenter::isWindowReady() const
+       {
+               return !!m_window;
+       }
+
+       void GuiPresenter::addDeactivatorException(const void *const deactivator)
+       {
+               const auto pair = m_deactivatorExceptions.insert(deactivator);
+               if (pair.second) {
+                       activateBy(deactivator);
+               }
+       }
+
+       void GuiPresenter::setDeactivatorSink(const WidgetSRef &sink)
+       {
+               m_sink = sink;
+       }
+
+       void GuiPresenter::sendActivate(Widget &sender)
+       {
+               sendDeactivator(sender, impl::ACTIVATE_BY, getObjPtr());
+       }
+
+       void GuiPresenter::sendDeactivate(Widget &sender)
+       {
+               sendDeactivator(sender, impl::DEACTIVATE_BY, getObjPtr());
+       }
+
+       void GuiPresenter::broadcastActivate()
+       {
+               broadcastDeactivator(impl::ACTIVATE_BY, getObjPtr());
+       }
+
+       void GuiPresenter::broadcastDeactivate()
+       {
+               broadcastDeactivator(impl::DEACTIVATE_BY, getObjPtr());
+       }
+
+       void GuiPresenter::sendDeactivator(Widget &sender,
+                       SmartEvent event, const void *deactivator)
+       {
+               sendDeactivatorInfo(sender, event, {deactivator, false});
+       }
+
+       void GuiPresenter::broadcastDeactivator(const SmartEvent event,
+                       const void *const deactivator)
+       {
+               sendDeactivatorInfo(*m_window, event, {deactivator, true});
+       }
+
+       void GuiPresenter::sendDeactivatorInfo(Widget &sender,
+                       const SmartEvent event, const DeactivatorInfo &info)
+       {
+               sender.callEvent(event, const_cast<DeactivatorInfo *>(&info));
+       }
+
+       bool GuiPresenter::isActive() const
+       {
+               return isEmpty(m_deactivators);
+       }
+
+       bool GuiPresenter::isDeactivatedBy(const void *const deactivator) const
+       {
+               return (m_deactivators.find(deactivator) != m_deactivators.end());
+       }
+
+       void GuiPresenter::activateBy(const void *const deactivator)
+       {
+               activateByImpl({deactivator, false});
+       }
+
+       void GuiPresenter::deactivateBy(const void *const deactivator)
+       {
+               deactivateByImpl({deactivator, false});
+       }
+
+       void GuiPresenter::addDeactivatorSource(Widget &source)
+       {
+               source.addEventHandler(impl::ACTIVATE_BY, WEAK_DELEGATE(
+                               GuiPresenter::onActivateBySmart, asWeak(*this)));
+               source.addEventHandler(impl::DEACTIVATE_BY, WEAK_DELEGATE(
+                               GuiPresenter::onDeactivateBySmart, asWeak(*this)));
+       }
+
+       void GuiPresenter::delDeactivatorSource(Widget &source)
+       {
+               source.delEventHandler(impl::ACTIVATE_BY, WEAK_DELEGATE(
+                               GuiPresenter::onActivateBySmart, asWeak(*this)));
+               source.delEventHandler(impl::DEACTIVATE_BY, WEAK_DELEGATE(
+                               GuiPresenter::onDeactivateBySmart, asWeak(*this)));
+       }
+
+       void GuiPresenter::activateByImpl(const DeactivatorInfo &info)
+       {
+               const auto count = m_deactivators.erase(info.deactivator);
+               if (m_isPrepared && (count > 0)) {
+                       if (m_sink) {
+                               sendDeactivatorInfo(*m_sink, impl::ACTIVATE_BY, info);
+                       }
+                       onActivateBy(info);
+                       if (m_deactivators.size() == 0) {
+                               onActivate();
+                       }
+               }
+       }
+
+       void GuiPresenter::deactivateByImpl(const DeactivatorInfo &info)
+       {
+               if (m_deactivatorExceptions.find(info.deactivator) !=
+                               m_deactivatorExceptions.end()) {
+                       return;
+               }
+               const auto pair = m_deactivators.insert(info.deactivator);
+               if (m_isPrepared && pair.second) {
+                       if (m_sink) {
+                               sendDeactivatorInfo(*m_sink, impl::DEACTIVATE_BY, info);
+                       }
+                       onDeactivateBy(info);
+                       if (m_deactivators.size() == 1) {
+                               onDeactivate();
+                       }
+               }
+       }
+
+       void GuiPresenter::onActivateBySmart(Widget &widget, void *eventInfo)
+       {
+               activateByImpl(*static_cast<DeactivatorInfo *>(eventInfo));
+       }
+
+       void GuiPresenter::onDeactivateBySmart(Widget &widget, void *eventInfo)
+       {
+               deactivateByImpl(*static_cast<DeactivatorInfo *>(eventInfo));
+       }
+
+       void GuiPresenter::onActivate()
+       {
+       }
+
+       void GuiPresenter::onDeactivate()
+       {
+       }
+
+       void GuiPresenter::onActivateBy(const DeactivatorInfo &info)
+       {
+       }
+
+       void GuiPresenter::onDeactivateBy(const DeactivatorInfo &info)
+       {
+       }
+}
diff --git a/ucl/source/mvp/ListItemPresenter.cpp b/ucl/source/mvp/ListItemPresenter.cpp
new file mode 100644 (file)
index 0000000..d27568b
--- /dev/null
@@ -0,0 +1,294 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 "ucl/mvp/ListItemPresenter.h"
+
+#include "common.h"
+
+namespace ucl {
+
+       // ListItemPresenter::ItemClass //
+
+       ListItemPresenter::ItemClassSRef ListItemPresenter::ItemClass::
+                       newInstance(const ElmStyle itemStyle)
+       {
+               auto result = makeShared<ItemClass>(itemStyle);
+               if (!result->get()) {
+                       LOG_RETURN_VALUE(RES_FAIL, {}, "Failed to create ItemClass()!");
+               }
+               return result;
+       }
+
+       ListItemPresenter::ItemClass::ItemClass(const ElmStyle itemStyle) :
+               m_itc(elm_genlist_item_class_new())
+       {
+               if (!m_itc) {
+                       return;
+               }
+
+               m_itc->item_style = itemStyle.name;
+
+               m_itc->func.text_get =
+                       [](void *data, Evas_Object *obj, const char *part) -> char *
+                       {
+                               if (!data) {
+                                       LOG_RETURN_VALUE(RES_FATAL, nullptr, "data is NULL");
+                               }
+                               return static_cast<ListItemPresenter *>(data)->
+                                               getItemPartText(EdjePart(part)).release();
+                       };
+
+               m_itc->func.content_get =
+                       [](void *data, Evas_Object *obj, const char *part) -> Evas_Object *
+                       {
+                               if (!data) {
+                                       LOG_RETURN_VALUE(RES_FATAL, nullptr, "data is NULL");
+                               }
+                               auto &&item = *static_cast<ListItemPresenter *>(data);
+                               if (const auto widget = item.getItemPartContent(
+                                               EdjePart(part), *item.m_parent)) {
+                                       widget->setIsOwner(false);
+                                       return widget->getEo();
+                               }
+                               return nullptr;
+                       };
+
+               m_itc->func.state_get =
+                       [](void *data, Evas_Object *obj, const char *part) -> Eina_Bool
+                       {
+                               if (!data) {
+                                       LOG_RETURN_VALUE(RES_FATAL, false, "data is NULL");
+                               }
+                               return static_cast<ListItemPresenter *>(data)->
+                                               getItemPartState(EdjePart(part));
+                       };
+       }
+
+       ListItemPresenter::ItemClass::~ItemClass()
+       {
+               if (m_itc) {
+                       elm_genlist_item_class_free(m_itc);
+               }
+       }
+
+       Elm_Genlist_Item_Class *ListItemPresenter::ItemClass::get()
+       {
+               return m_itc;
+       }
+
+       // ListItemPresenter::ItemClassCache //
+
+       ListItemPresenter::ItemClassSRef ListItemPresenter::ItemClassCache::
+                       getItemClass(const ElmStyle itemStyle)
+       {
+               ItemClassSRef result;
+
+               if (!m_itcMap.get(itemStyle, result)) {
+                       result = ItemClass::newInstance(itemStyle);
+                       if (result) {
+                               m_itcMap.set(itemStyle, result);
+                       } else {
+                               ELOG("ItemClass::newInstance() failed!");
+                       }
+               }
+
+               return result;
+       }
+
+       void ListItemPresenter::ItemClassCache::purge()
+       {
+               m_itcMap.clear();
+       }
+
+       // ListItemPresenter //
+
+       ListItemPresenter::ListItemPresenter(IRefCountObj &rc) :
+               RefCountAware(&rc),
+               m_flags(PF_AUTO_UNSELECT)
+       {
+       }
+
+       ListItemPresenter::~ListItemPresenter()
+       {
+               if (m_item) {
+                       FLOG("m_item is still alive!");
+                       deleteDetachedItem(true);
+               }
+       }
+
+       void ListItemPresenter::attachItem(GenlistItem item, ElmWidgetSRef &&parent,
+                       const ItemClassCacheSRef &itcCache,
+                       const SharedRef<bool> &isActiveRef)
+       {
+               if (m_item) {
+                       deleteDetachedItem();
+               }
+
+               m_item = item;
+               m_item.setData(this);
+               m_item.setDelCallback(CALLBACK_A(ListItemPresenter::onItemDel));
+
+               m_parent = std::move(parent);
+
+               m_itcCache = itcCache;
+               m_isActiveRef = isActiveRef;
+
+               if (!m_selfRef) {
+                       m_selfRef = asShared(*this);
+               }
+
+               onItemAttached();
+       }
+
+       void ListItemPresenter::deleteDetachedItem(const bool silent)
+       {
+               auto item = m_item;
+               detachItem(silent);
+               item.del();
+       }
+
+       void ListItemPresenter::detachItem(const bool silent)
+       {
+               m_item.setData(nullptr);
+               m_item.setDelCallback(nullptr);
+               m_item = nullptr;
+
+               m_parent.reset();
+               m_itcCache.reset();
+               m_isActiveRef.reset();
+
+               if (!silent) {
+                       onItemDetached();
+               }
+       }
+
+       void ListItemPresenter::onItemDel(Evas_Object *obj, void *eventInfo)
+       {
+               if (m_item) {
+                       detachItem();
+               }
+               m_selfRef.reset();
+       }
+
+       void ListItemPresenter::setFlags(const int flags)
+       {
+               m_flags = flags;
+       }
+
+       int ListItemPresenter::getFlags() const
+       {
+               return m_flags;
+       }
+
+       bool ListItemPresenter::isActive() const
+       {
+               return (m_isActiveRef ? *m_isActiveRef : false);
+       }
+
+       GenlistItem ListItemPresenter::getItem()
+       {
+               return m_item;
+       }
+
+       ListItemPresenter::ItemClassCache *ListItemPresenter::getItemClassCache()
+       {
+               return m_itcCache.get();
+       }
+
+       Result ListItemPresenter::updateItemStyle(const ElmStyle newItemStyle)
+       {
+               if (!m_item) {
+                       LOG_RETURN(RES_ILLEGAL_STATE, "m_item is NULL!");
+               }
+               if (!m_itcCache) {
+                       LOG_RETURN(RES_FATAL, "m_itcCache is NULL!");
+               }
+
+               const auto itc = m_itcCache->getItemClass(newItemStyle);
+               if (!itc) {
+                       LOG_RETURN(RES_FAIL, "m_itcCache->getItemClass() failed!");
+               }
+
+               m_item.update(itc->get());
+
+               return RES_OK;
+       }
+
+       void ListItemPresenter::dispose()
+       {
+               if (m_item) {
+                       deleteDetachedItem();
+                       m_selfRef.reset();
+               }
+       }
+
+       bool ListItemPresenter::isDisposed() const
+       {
+               return !m_item;
+       }
+
+       void ListItemPresenter::onItemAttached()
+       {
+       }
+
+       void ListItemPresenter::onItemDetached()
+       {
+       }
+
+       WidgetSRef ListItemPresenter::getItemPartContent(const EdjePart part,
+                       ElmWidget &parent)
+       {
+               return nullptr;
+       }
+
+       CString ListItemPresenter::getItemPartText(const EdjePart part)
+       {
+               return nullptr;
+       }
+
+       bool ListItemPresenter::getItemPartState(const EdjePart part)
+       {
+               return false;
+       }
+
+       void ListItemPresenter::onItemSelectedHook()
+       {
+               if (m_flags & PF_AUTO_UNSELECT) {
+                       m_item.setSelected(false);
+               }
+               onItemSelected();
+       }
+
+       void ListItemPresenter::onItemSelected()
+       {
+       }
+
+       void ListItemPresenter::onItemRealized()
+       {
+       }
+
+       void ListItemPresenter::onItemUnrealized()
+       {
+       }
+
+       void ListItemPresenter::onItemHighlighted()
+       {
+       }
+
+       void ListItemPresenter::onItemUnhighlighted()
+       {
+       }
+}
diff --git a/ucl/source/mvp/ListPresenter.cpp b/ucl/source/mvp/ListPresenter.cpp
new file mode 100644 (file)
index 0000000..2835697
--- /dev/null
@@ -0,0 +1,328 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 "ucl/mvp/ListPresenter.h"
+
+#include "common.h"
+
+namespace ucl { namespace { namespace impl {
+
+       constexpr SmartEvent ITEM_SELECTED {"selected"};
+
+       constexpr SmartEvent ITEM_REALIZED {"realized"};
+       constexpr SmartEvent ITEM_UNREALIZED {"unrealized"};
+       constexpr SmartEvent ITEM_HIGHLIGHTED {"highlighted"};
+       constexpr SmartEvent ITEM_UNHIGHLIGHTED {"unhighlighted"};
+
+       ListItemPresenter *toItemPresenter(void *eventInfo)
+       {
+               if (!eventInfo) {
+                       LOG_RETURN_VALUE(RES_FATAL, nullptr, "eventInfo is NULL");
+               }
+
+               const GenlistItem item{static_cast<Elm_Object_Item *>(eventInfo)};
+               const auto data = item.getData();
+               if (!data) {
+                       LOG_RETURN_VALUE(RES_FATAL, nullptr, "data is NULL");
+               }
+
+               return static_cast<ListItemPresenter *>(data);
+       }
+}}}
+
+namespace ucl {
+
+       // ListPresenter::Builder //
+
+       ListPresenter::Builder::Builder() :
+               m_flags(FLAG_HOMOGENEOUS)
+       {
+       }
+
+       ListPresenter::Builder &ListPresenter::Builder::setStyle(
+                       const ElmStyle style)
+       {
+               m_style = style;
+               return *this;
+       }
+
+       ListPresenter::Builder &ListPresenter::Builder::setFlags(const int flags)
+       {
+               m_flags = flags;
+               return *this;
+       }
+
+       ListPresenter::Builder &ListPresenter::Builder::setParentWidget(
+                       const ElmWidgetSRef &parentWidget)
+       {
+               m_parentWidget = parentWidget;
+               return *this;
+       }
+
+       ListPresenterSRef ListPresenter::Builder::build(GuiPresenter &parent) const
+       {
+               if (!m_parentWidget) {
+                       LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {},
+                                       "m_parentWidget is NULL!");
+               }
+
+               auto result = makeShared<ListPresenter>();
+
+               FAIL_RETURN_VALUE(result->prepare(
+                               parent, *m_parentWidget, m_style, m_flags),
+                               {}, "result->prepare() failed!");
+
+               return result;
+       }
+
+       // ListPresenter //
+
+       ListPresenter::ListPresenter(IRefCountObj &rc) :
+                       GuiPresenter(rc)
+       {
+       }
+
+       ListPresenter::~ListPresenter()
+       {
+               if (m_genlist) {
+                       m_genlist->clear();
+               }
+       }
+
+       Result ListPresenter::prepare(
+                       GuiPresenter &parent, ElmWidget &parentWidget,
+                       const ElmStyle style, const int flags)
+       {
+               FAIL_RETURN(GuiPresenter::prepare(parent, PF_DEACTIVATOR),
+                               "GuiPresenter::prepare() failed!");
+
+               m_genlist = Genlist::Builder().
+                               setStyle(style).
+                               setMode(Genlist::Mode::COMPRESS).
+                               setHomogeneous(flags & FLAG_HOMOGENEOUS).
+                               setNeedBindToEo(true).
+                               build(parentWidget);
+               if (!m_genlist) {
+                       LOG_RETURN(RES_FAIL, "Genlist::build() failed!");
+               }
+
+               expandAndFill(*m_genlist);
+
+               // TODO Add Scroller widget.
+               elm_scroller_content_min_limit(*m_genlist,
+                               toEina((flags & FLAG_CALC_X_MIN) != 0),
+                               toEina((flags & FLAG_CALC_Y_MIN) != 0));
+
+               m_itcCache = makeShared<ListItemPresenter::ItemClassCache>();
+
+               m_isActiveRef = makeShared<bool>();
+               *m_isActiveRef = isActive();
+
+               m_genlist->addEventHandler(impl::ITEM_SELECTED, WEAK_DELEGATE(
+                               ListPresenter::onItemSelected, asWeak(*this)));
+
+               if (flags & FLAG_NOTIFY_REALIZED) {
+                       m_genlist->addEventHandler(impl::ITEM_REALIZED, WEAK_DELEGATE(
+                                       ListPresenter::onItemRealized, asWeak(*this)));
+               }
+               if (flags & FLAG_NOTIFY_UNREALIZED) {
+                       m_genlist->addEventHandler(impl::ITEM_UNREALIZED, WEAK_DELEGATE(
+                                       ListPresenter::onItemUnrealized, asWeak(*this)));
+               }
+               if (flags & FLAG_NOTIFY_HIGHLIGHTED) {
+                       m_genlist->addEventHandler(impl::ITEM_HIGHLIGHTED, WEAK_DELEGATE(
+                                       ListPresenter::onItemHighlighted, asWeak(*this)));
+               }
+               if (flags & FLAG_NOTIFY_UNHIGHLIGHTED) {
+                       m_genlist->addEventHandler(impl::ITEM_UNHIGHLIGHTED, WEAK_DELEGATE(
+                                       ListPresenter::onItemUnhighlighted, asWeak(*this)));
+               }
+
+               return RES_OK;
+       }
+
+       Genlist &ListPresenter::getWidget()
+       {
+               return *m_genlist;
+       }
+
+       void ListPresenter::clear()
+       {
+               m_genlist->clear();
+               m_itcCache->purge();
+       }
+
+       Result ListPresenter::append(ListItemPresenter &itemPresenter,
+                               ListItemPresenter *parent)
+       {
+               return insert(itemPresenter, parent,
+                       [this](const Elm_Genlist_Item_Class *itc, const void *data,
+                                       GenlistItem parent, GenlistItem::Type type)
+                       {
+                               return m_genlist->append(itc, data, nullptr, type, parent);
+                       });
+       }
+
+       Result ListPresenter::prepend(ListItemPresenter &itemPresenter,
+                               ListItemPresenter *parent)
+       {
+               return insert(itemPresenter, parent,
+                       [this](const Elm_Genlist_Item_Class *itc, const void *data,
+                                       GenlistItem parent, GenlistItem::Type type)
+                       {
+                               return m_genlist->prepend(itc, data, nullptr, type, parent);
+                       });
+       }
+
+       Result ListPresenter::insertAfter(const ListItemPresenter &after,
+                       ListItemPresenter &itemPresenter,
+                               ListItemPresenter *parent)
+       {
+               return insertRelative(after, itemPresenter, parent,
+                       [this](GenlistItem rel, const Elm_Genlist_Item_Class *itc,
+                               const void *data, GenlistItem parent, GenlistItem::Type type)
+                       {
+                               return m_genlist->insertAfter(
+                                               rel, itc, data, nullptr, type, parent);
+                       });
+       }
+
+       Result ListPresenter::insertBefore(const ListItemPresenter &before,
+                       ListItemPresenter &itemPresenter,
+                               ListItemPresenter *parent)
+       {
+               return insertRelative(before, itemPresenter, parent,
+                       [this](GenlistItem rel, const Elm_Genlist_Item_Class *itc,
+                               const void *data, GenlistItem parent, GenlistItem::Type type)
+                       {
+                               return m_genlist->insertBefore(
+                                               rel, itc, data, nullptr, type, parent);
+                       });
+       }
+
+       template <class INSERT_FUNC>
+       Result ListPresenter::insert(ListItemPresenter &itemPresenter,
+                       ListItemPresenter *parent, INSERT_FUNC &&insertFunc)
+       {
+               const auto params = itemPresenter.getItemInsertionParams();
+
+               const auto itc = m_itcCache->getItemClass(params.itemStyle);
+               if (!itc) {
+                       LOG_RETURN(RES_FAIL, "m_itcCache.getItemClass() failed!");
+               }
+
+               GenlistItem parentItem;
+               if (parent) {
+                       parentItem = parent->m_item;
+                       if (!parentItem) {
+                               ELOG("parentItem is NULL");
+                       }
+               }
+
+               const auto item = insertFunc(itc->get(),
+                               &itemPresenter, parentItem, params.itemType);
+               if (!item) {
+                       LOG_RETURN(RES_FAIL, "insertFunc() failed!");
+               }
+
+               itemPresenter.attachItem(item, m_genlist, m_itcCache, m_isActiveRef);
+
+               return RES_OK;
+       }
+
+       template <class INSERT_FUNC>
+       Result ListPresenter::insertRelative(const ListItemPresenter &relative,
+                       ListItemPresenter &itemPresenter, ListItemPresenter *parent,
+                       INSERT_FUNC &&insertFunc)
+       {
+               const auto relItem = relative.m_item;
+               if (!relItem) {
+                       LOG_RETURN(RES_FAIL, "relItem is NULL!");
+               }
+               if (relItem.getWidget() != m_genlist->getEo()) {
+                       LOG_RETURN(RES_FAIL, "relItem has wrong genlist!");
+               }
+               return insert(itemPresenter, parent,
+                       [relItem, &insertFunc](const Elm_Genlist_Item_Class *itc,
+                               const void *data, GenlistItem parent, GenlistItem::Type type)
+                       {
+                               return insertFunc(relItem, itc, data, parent, type);
+                       });
+       }
+
+       void ListPresenter::setIsActiveRef(const bool value)
+       {
+               if (!m_isActiveRef) {
+                       LOG_RETURN_VOID(RES_FATAL, "m_isActiveRef is NULL");
+               }
+               *m_isActiveRef = value;
+       }
+
+       void ListPresenter::onItemSelected(Widget &widget, void *eventInfo)
+       {
+               const auto itemPresenter = impl::toItemPresenter(eventInfo);
+               if (!itemPresenter) {
+                       LOG_RETURN_VOID(RES_FATAL, "itemPresenter is NULL");
+               }
+               itemPresenter->onItemSelectedHook();
+       }
+
+       void ListPresenter::onItemRealized(Widget &widget, void *eventInfo)
+       {
+               const auto itemPresenter = impl::toItemPresenter(eventInfo);
+               if (!itemPresenter) {
+                       LOG_RETURN_VOID(RES_FATAL, "itemPresenter is NULL");
+               }
+               itemPresenter->onItemRealized();
+       }
+
+       void ListPresenter::onItemUnrealized(Widget &widget, void *eventInfo)
+       {
+               const auto itemPresenter = impl::toItemPresenter(eventInfo);
+               if (!itemPresenter) {
+                       LOG_RETURN_VOID(RES_FATAL, "itemPresenter is NULL");
+               }
+               itemPresenter->onItemUnrealized();
+       }
+
+       void ListPresenter::onItemHighlighted(Widget &widget, void *eventInfo)
+       {
+               const auto itemPresenter = impl::toItemPresenter(eventInfo);
+               if (!itemPresenter) {
+                       LOG_RETURN_VOID(RES_FATAL, "itemPresenter is NULL");
+               }
+               itemPresenter->onItemHighlighted();
+       }
+
+       void ListPresenter::onItemUnhighlighted(Widget &widget, void *eventInfo)
+       {
+               const auto itemPresenter = impl::toItemPresenter(eventInfo);
+               if (!itemPresenter) {
+                       LOG_RETURN_VOID(RES_FATAL, "itemPresenter is NULL");
+               }
+               itemPresenter->onItemUnhighlighted();
+       }
+
+       void ListPresenter::onActivate()
+       {
+               setIsActiveRef(true);
+       }
+
+       void ListPresenter::onDeactivate()
+       {
+               setIsActiveRef(false);
+       }
+}
diff --git a/ucl/source/mvp/common.h b/ucl/source/mvp/common.h
new file mode 100644 (file)
index 0000000..11a4d84
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __UCL_SOURCE_MVP_COMMON_H__
+#define __UCL_SOURCE_MVP_COMMON_H__
+
+#include "ucl/source/common.h"
+
+#endif // __UCL_SOURCE_MVP_COMMON_H__
diff --git a/ucl/source/util/logging.cpp b/ucl/source/util/logging.cpp
new file mode 100644 (file)
index 0000000..311f25b
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 "ucl/util/logging.h"
+
+#if (UCL_DEFINE_GET_UCL_RESULT_DATA)
+#include "ucl/util/types/Result.h"
+
+ucl::ResultData getUCLResultData(const ucl::Result result)
+{
+       return ucl::getResultData(result);
+}
+#endif
diff --git a/ucl/source/util/types/Result.cpp b/ucl/source/util/types/Result.cpp
new file mode 100644 (file)
index 0000000..b42875e
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 "ucl/util/types/Result.h"
+
+#include "ucl/util/logging.h"
+
+namespace ucl { namespace { namespace impl {
+
+       constexpr ResultData RESUT_DATA[] = {
+               {"RES_FATAL",             DLOG_FATAL},
+               {"RES_INVALID_DATA",      DLOG_ERROR},
+               {"RES_NOT_SUPPORTED",     DLOG_ERROR},
+               {"RES_IO_ERROR",          DLOG_ERROR},
+               {"RES_OUT_OF_MEMORY",     DLOG_ERROR},
+               {"RES_ILLEGAL_STATE",     DLOG_ERROR},
+               {"RES_INVALID_ARGUMENTS", DLOG_ERROR},
+               {"RES_FAIL",              DLOG_ERROR},
+               {"RES_OK",                DLOG_INFO},
+               {"RES_FALSE",             DLOG_INFO},
+               {"Unknown result value",  DLOG_ERROR},
+       };
+}}}
+
+namespace ucl {
+
+       const ResultData &getResultData(const Result result)
+       {
+               return impl::RESUT_DATA[
+                       ((result.value < _RES_BEGIN) || (result.value >= _RES_END)) ?
+                               _RES_END : (result.value - _RES_BEGIN)];
+       }
+}
diff --git a/ucl/src/appfw/InstanceManagerBase.cpp b/ucl/src/appfw/InstanceManagerBase.cpp
deleted file mode 100644 (file)
index 2e90b24..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 "ucl/appfw/InstanceManagerBase.h"
-
-#include "common.h"
-
-namespace ucl {
-
-       InstanceManagerBase::InstanceManagerBase(AppParams appParams) :
-               m_appParams(std::move(appParams))
-       {
-       }
-
-       InstanceManagerBase::~InstanceManagerBase()
-       {
-       }
-
-       const AppParams &InstanceManagerBase::getAppParams() const
-       {
-               return m_appParams;
-       }
-
-       void InstanceManagerBase::setSysEventProvider(SysEventProviderUPtr provider)
-       {
-               m_sysEventProvider = std::move(provider);
-       }
-
-       SysEventProvider &InstanceManagerBase::getSysEventProvider() const
-       {
-               UCL_ASSERT(m_sysEventProvider, "m_sysEventProvider is NULL!");
-               return *m_sysEventProvider;
-       }
-}
diff --git a/ucl/src/appfw/SysEventProvider.cpp b/ucl/src/appfw/SysEventProvider.cpp
deleted file mode 100644 (file)
index 8958aaf..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 "ucl/appfw/SysEventProvider.h"
-
-#include "common.h"
-
-namespace ucl {
-
-       // SysEventProvider::EventProxy //
-
-       class SysEventProvider::EventProxy : public NonCopyable {
-       public:
-               EventProxy(SysEventProvider &provider,
-                               const SysEvent sysEvent,
-                               const app_event_type_e appEvent):
-                       m_provider(provider),
-                       m_sysEvent(sysEvent)
-               {
-                       const int res = m_provider.addEventHandler(&m_eventHandler,
-                                       appEvent, CALLBACK_B(EventProxy::onAppEvent), this);
-                       if (res != APP_ERROR_NONE) {
-                               if (res != APP_ERROR_INVALID_PARAMETER) {
-                                       ELOG("addEventHandler() failed! %d", res);
-                               }
-                               m_eventHandler = nullptr;
-                       }
-               }
-
-               ~EventProxy()
-               {
-                       if (m_eventHandler) {
-                               const int res = m_provider.delEventHandler(m_eventHandler);
-                               if (res != APP_ERROR_NONE) {
-                                       WLOG("delEventHandler() failed! %d", res);
-                               }
-                       }
-               }
-
-       private:
-               void onAppEvent(app_event_info_h event)
-               {
-                       m_provider.dispatch(m_sysEvent);
-               }
-
-       private:
-               SysEventProvider &m_provider;
-               app_event_handler_h m_eventHandler;
-               SysEvent m_sysEvent;
-       };
-
-       // SysEventProvider //
-
-       SysEventProvider::SysEventProvider(EventHandlerAddFunc addFunc,
-                       EventHandlerDelFunc delFunc):
-               m_addFunc(addFunc),
-               m_delFunc(delFunc)
-       {
-               m_eventProxies.emplace_back(*this, SysEvent::LANGUAGE_CHANGED,
-                               APP_EVENT_LANGUAGE_CHANGED);
-
-               m_eventProxies.emplace_back(*this, SysEvent::REGION_FMT_CHANGED,
-                               APP_EVENT_REGION_FORMAT_CHANGED);
-
-               m_eventProxies.emplace_back(*this, SysEvent::LOW_MEMORY,
-                               APP_EVENT_LOW_MEMORY);
-
-               m_eventProxies.emplace_back(*this, SysEvent::LOW_BATTERY,
-                               APP_EVENT_LOW_BATTERY);
-
-               m_eventProxies.emplace_back(*this, SysEvent::ORIENTATION_CHANGED,
-                               APP_EVENT_DEVICE_ORIENTATION_CHANGED);
-
-               m_eventProxies.emplace_back(*this, SysEvent::SUSPEND_STATE_CHANGED,
-                               APP_EVENT_SUSPENDED_STATE_CHANGED);
-
-               m_eventProxies.emplace_back(*this, SysEvent::UPDATE_REQUESTED,
-                               APP_EVENT_UPDATE_REQUESTED);
-       }
-
-       SysEventProvider::~SysEventProvider()
-       {
-       }
-
-       int SysEventProvider::addEventHandler(app_event_handler_h *handler,
-                       app_event_type_e appEvent, app_event_cb cb, void *data)
-       {
-               return m_addFunc(handler, appEvent, cb, data);
-       }
-
-       int SysEventProvider::delEventHandler(app_event_handler_h handler)
-       {
-               return m_delFunc(handler);
-       }
-
-       void SysEventProvider::dispatch(SysEvent sysEvent)
-       {
-               m_event.dispatch(sysEvent);
-       }
-}
diff --git a/ucl/src/appfw/UIApp.cpp b/ucl/src/appfw/UIApp.cpp
deleted file mode 100644 (file)
index 4e1a4de..0000000
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 "ucl/appfw/UIApp.h"
-
-#include <app.h>
-
-#include "ucl/appfw/IInstanceAppControlExt.h"
-#include "common.h"
-
-namespace ucl {
-
-       UIApp::UIApp(InstanceManagerBase &instanceMgr) :
-               m_instanceMgr(instanceMgr)
-       {
-       }
-
-       UIApp::~UIApp()
-       {
-       }
-
-       int UIApp::run(int argc, char *argv[])
-       {
-               ui_app_lifecycle_callback_s alcc = {};
-               alcc.create = CALLBACK_B(UIApp::onCreate);
-               alcc.terminate = CALLBACK_B(UIApp::onTerminate);
-               alcc.pause = CALLBACK_B(UIApp::onPause);
-               alcc.resume = CALLBACK_B(UIApp::onResume);
-               alcc.app_control = CALLBACK_B(UIApp::onAppControl);
-
-               const int ret = ui_app_main(argc, argv, &alcc, this);
-               if (ret != APP_ERROR_NONE) {
-                       LOG_RETURN_VALUE(RES_FAIL, ret, "ui_app_main() failed! %d", ret);
-               }
-
-               return 0;
-       }
-
-       AppType UIApp::getAppType() const
-       {
-               return AppType::UI;
-       }
-
-       WindowSRef UIApp::getWindow()
-       {
-               return m_window;
-       }
-
-       void UIApp::exitApp()
-       {
-               ui_app_exit();
-       }
-
-       bool UIApp::onCreate()
-       {
-               FAIL_RETURN_VALUE(configParams(), false, "configParams() failed!");
-
-               FAIL_RETURN_VALUE(createWindow(), false, "createWindow() failed!");
-
-               initSysEventManager();
-
-               FAIL_RETURN_VALUE(createInstance(), false, "createInstance() failed!");
-
-               return true;
-       }
-
-       void UIApp::onTerminate()
-       {
-               m_instance.reset();
-               m_instanceMgr.setSysEventProvider(nullptr);
-               m_window.reset();
-       }
-
-       void UIApp::onPause()
-       {
-               if (m_instance) {
-                       m_instance->onPause();
-               }
-       }
-
-       void UIApp::onResume()
-       {
-               if (m_instance) {
-                       m_instance->onResume();
-               }
-       }
-
-       void UIApp::onAppControl(app_control_h appControl)
-       {
-               auto instance = dynamic_cast<
-                               IInstanceAppControlExt *>(m_instance.get());
-               if (instance) {
-                       instance->onAppControl(appControl);
-               }
-       }
-
-       Result UIApp::configParams()
-       {
-               auto &&appParams = m_instanceMgr.getAppParams();
-
-               Variant paramValue;
-
-               if (appParams.get(AppParam::BASE_SCALE, paramValue)) {
-                       const double baseScale = paramValue.asDouble();
-                       if (baseScale <= 0.0) {
-                               LOG_RETURN(RES_INVALID_DATA,
-                                               "Invalid parameter BASE_SCALE: %f", baseScale);
-                       }
-                       elm_app_base_scale_set(baseScale);
-               }
-
-               if (appParams.get(AppParam::ACCELERATION_PREFERENECE, paramValue)) {
-                       const auto accelPreference = paramValue.asString();
-                       if (isEmpty(accelPreference)) {
-                               LOG_RETURN(RES_INVALID_DATA,
-                                               "Invalid parameter ACCELERATION_PREFERENECE: %s",
-                                               accelPreference.get());
-                       }
-                       elm_config_accel_preference_set(accelPreference.get());
-               }
-
-               return RES_OK;
-       }
-
-       Result UIApp::createWindow()
-       {
-               auto &&appParams = m_instanceMgr.getAppParams();
-
-               Variant paramValue;
-
-               auto winType = Window::Type::BASIC;
-               if (appParams.get(AppParam::WINDOW_TYPE, paramValue)) {
-                       winType = static_cast<Window::Type>(paramValue.asInt());
-                       if (isNotValid(winType)) {
-                               LOG_RETURN(RES_INVALID_DATA,
-                                               "Invalid parameter WINDOW_TYPE: %d", winType);
-                       }
-               }
-
-               paramValue = appParams.get(AppParam::WINDOW_NAME);
-               if (isEmpty(paramValue)) {
-                       LOG_RETURN(RES_INVALID_DATA, "WINDOW_NAME must not be empty!");
-               }
-
-               m_window = Window::Builder().
-                               setType(winType).
-                               setName(paramValue.asString().get()).
-                               setIsOwner(true).
-                               build();
-               if (!m_window) {
-                       LOG_RETURN(RES_FAIL, "Window::Builder().build() Failed!");
-               }
-
-               return RES_OK;
-       }
-
-       void UIApp::initSysEventManager()
-       {
-               m_instanceMgr.setSysEventProvider(
-                               util::makeUnique(new SysEventProvider(
-                                       &ui_app_add_event_handler,
-                                       &ui_app_remove_event_handler)));
-       }
-
-       Result UIApp::createInstance()
-       {
-               auto instance = m_instanceMgr.newInstance();
-               if (!instance) {
-                       LOG_RETURN(RES_FAIL, "m_instanceMgr.newInstance() failed!");
-               }
-
-               const auto res = instance->onCreate(this);
-               if (isBad(res)) {
-                       LOG_RETURN(res, "instance->onCreate() failed!");
-               }
-
-               m_instance = std::move(instance);
-
-               return RES_OK;
-       }
-}
diff --git a/ucl/src/appfw/common.h b/ucl/src/appfw/common.h
deleted file mode 100644 (file)
index b612dfb..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_APPFW_COMMON_H__
-#define __UCL_APPFW_COMMON_H__
-
-#include "../common.h"
-
-#endif // __UCL_APPFW_COMMON_H__
diff --git a/ucl/src/appfw/helpers.cpp b/ucl/src/appfw/helpers.cpp
deleted file mode 100644 (file)
index c547dce..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 "ucl/appfw/helpers.h"
-
-#include "common.h"
-
-namespace ucl {
-
-       std::string getResPath(const char *const relativePath)
-       {
-               std::string result;
-               char *const resDir = app_get_resource_path();
-               if (resDir) {
-                       result = resDir;
-                       free(resDir);
-               } else {
-                       ELOG("app_get_resource_path() failed!");
-               }
-               result += relativePath;
-               return result;
-       }
-}
diff --git a/ucl/src/common.h b/ucl/src/common.h
deleted file mode 100644 (file)
index f358669..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_COMMON_H__
-#define __UCL_COMMON_H__
-
-#include <cmath>
-#include <cstring>
-
-#include <algorithm>
-
-#include <Ecore.h>
-
-#include "ucl/util/types.h"
-#include "ucl/util/helpers.h"
-#include "ucl/util/logging.h"
-#include "ucl/util/shortLogs.h"
-
-#include "ucl/util/delegation/shortMacro.h"
-#include "ucl/util/smartDelegation/shortMacro.h"
-
-#endif // __UCL_COMMON_H__
diff --git a/ucl/src/gui/EdjeWidget.cpp b/ucl/src/gui/EdjeWidget.cpp
deleted file mode 100644 (file)
index 8d67596..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 "ucl/gui/EdjeWidget.h"
-
-namespace ucl {
-
-       void EdjeWidget::setText(const TString &value)
-       {
-               if (value.isTranslatable()) {
-                       if (value.hasDomain()) {
-                               elm_object_domain_translatable_text_set(
-                                               getEo(), value.getDomain(), value);
-                       } else {
-                               elm_object_translatable_text_set(getEo(), value);
-                       }
-               } else {
-                       elm_object_domain_text_translatable_set(getEo(),
-                                       nullptr, EINA_FALSE);
-                       elm_object_text_set(getEo(), value);
-               }
-       }
-
-       void EdjeWidget::setText(const TString &value, const EdjePart part)
-       {
-               if (value.isTranslatable()) {
-                       if (value.hasDomain()) {
-                               elm_object_domain_translatable_part_text_set(
-                                               getEo(), part.name, value.getDomain(), value);
-                       } else {
-                               elm_object_translatable_part_text_set(
-                                               getEo(), part.name, value);
-                       }
-               } else {
-                       elm_object_part_text_translatable_set(getEo(),
-                                       part.name, EINA_FALSE);
-                       elm_object_part_text_set(getEo(), part.name, value);
-               }
-       }
-}
diff --git a/ucl/src/gui/ElmWidget.cpp b/ucl/src/gui/ElmWidget.cpp
deleted file mode 100644 (file)
index b7d227e..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 "ucl/gui/ElmWidget.h"
-
-#include "ucl/gui/Window.h"
-#include "ucl/gui/helpers.h"
-
-namespace ucl {
-
-       ElmWidget::ElmWidget(IRefCountObj *rc, Evas_Object *eo, bool isOwner) :
-               Widget(rc, eo, isOwner),
-               m_isAtspiGestureCbSet(false)
-       {
-       }
-
-       ElmWidget::~ElmWidget()
-       {
-               if (m_isAtspiGestureCbSet) {
-                       elm_atspi_accessible_gesture_cb_set(getEo(), nullptr, nullptr);
-               }
-       }
-
-       void ElmWidget::setFocusedImpl(const bool value)
-       {
-               elm_object_focus_set(getEo(), toEina(value));
-       }
-
-       bool ElmWidget::isFocusedImpl() const
-       {
-               return elm_object_focus_get(getEo());
-       }
-
-       bool ElmWidget::ensureFwdEvent(const SmartEvent fwdEvent)
-       {
-               if (Widget::ensureFwdEvent(fwdEvent)) {
-                       return true;
-               }
-               if (fwdEvent == ATSPI_ON_GESTURE) {
-                       if (!m_isAtspiGestureCbSet) {
-                               m_isAtspiGestureCbSet = true;
-                               elm_atspi_accessible_gesture_cb_set(getEo(),
-                                               CALLBACK_A(ElmWidget::onAtspiGesture), this);
-                       }
-                       return true;
-               }
-               return false;
-       }
-
-       Eina_Bool ElmWidget::onAtspiGesture(Elm_Atspi_Gesture_Info gestureInfo,
-                                       Evas_Object *obj)
-       {
-               AtspiGestureEventInfo eventInfo{gestureInfo};
-               callEvent(ATSPI_ON_GESTURE, &eventInfo);
-               return toEina(eventInfo.preventDefault);
-       }
-
-       Window *ElmWidget::getWindow() const
-       {
-               return dynamicWidgetCast<Window>(getTopWidget());
-       }
-}
diff --git a/ucl/src/gui/Genlist.cpp b/ucl/src/gui/Genlist.cpp
deleted file mode 100644 (file)
index b0e31a5..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 "ucl/gui/Genlist.h"
-
-#include "common.h"
-
-namespace ucl {
-
-       // Genlist::Builder //
-
-       GenlistSRef Genlist::Builder::build(ElmWidget &parent) const
-       {
-               Evas_Object *const eo = elm_genlist_add(parent);
-               if (!eo) {
-                       LOG_RETURN_VALUE(RES_FAIL, {}, "elm_genlist_add() failed!");
-               }
-
-               auto result = makeShared<Genlist>(eo, m_isOwner);
-
-               if (m_needBindToEo) {
-                       result->bindToEo();
-               }
-
-               if (isValid(m_style)) {
-                       result->setStyle(m_style);
-               }
-
-               result->setMode(m_mode);
-               result->setHomogeneous(m_isHomogeneous);
-
-               show(*result);
-
-               return result;
-       }
-}
diff --git a/ucl/src/gui/Layout.cpp b/ucl/src/gui/Layout.cpp
deleted file mode 100644 (file)
index 1509fc5..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 "ucl/gui/Layout.h"
-
-#include "ucl/gui/stdTheme/layout.h"
-
-#include "common.h"
-
-namespace ucl {
-
-       // Layout::Builder //
-
-       LayoutSRef Layout::Builder::build(ElmWidget &parent) const
-       {
-               Evas_Object *const eo = elm_layout_add(parent);
-               if (!eo) {
-                       LOG_RETURN_VALUE(RES_FAIL, {}, "elm_layout_add() failed!");
-               }
-
-               auto result = makeShared<Layout>(eo, m_isOwner);
-
-               if (m_needBindToEo) {
-                       result->bindToEo();
-               }
-
-               bool isOk = true;
-
-               if (isNotEmpty(m_edjeFilePath) && isValid(m_edjeGroup)) {
-                       isOk = result->setEdjeFile(m_edjeFilePath, m_edjeGroup);
-               } else if (isValid(m_theme)) {
-                       isOk = result->setTheme(m_theme);
-               }
-
-               if (!isOk) {
-                       LOG_RETURN_VALUE(RES_FAIL, {}, "Layout init failed!");
-               }
-
-               show(*result);
-
-               return result;
-       }
-}
diff --git a/ucl/src/gui/NaviItem.cpp b/ucl/src/gui/NaviItem.cpp
deleted file mode 100644 (file)
index 02f5da2..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 "ucl/gui/NaviItem.h"
-
-#include "ucl/gui/Naviframe.h"
-#include "ucl/gui/helpers.h"
-
-namespace ucl {
-
-       void NaviItem::popTo() const
-       {
-               const auto navi = dynamicWidgetCast<Naviframe>(getWidget());
-               const bool needStartTransition =
-                               (navi && (navi->getTopItem() != *this));
-
-               elm_naviframe_item_pop_to(getIt());
-
-               if (needStartTransition) {
-                       navi->setInTransition(true);
-               }
-       }
-
-       void NaviItem::promote() const
-       {
-               const auto navi = dynamicWidgetCast<Naviframe>(getWidget());
-               const bool needStartTransition =
-                               (navi && (navi->getTopItem() != *this));
-
-               elm_naviframe_item_promote(getIt());
-
-               if (needStartTransition) {
-                       navi->setInTransition(true);
-               }
-       }
-}
diff --git a/ucl/src/gui/Naviframe.cpp b/ucl/src/gui/Naviframe.cpp
deleted file mode 100644 (file)
index 69d80a5..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 "ucl/gui/Naviframe.h"
-
-#include "common.h"
-
-namespace ucl {
-
-       // Naviframe::Builder //
-
-       NaviframeSRef Naviframe::Builder::build(ElmWidget &parent) const
-       {
-               Evas_Object *const eo = elm_naviframe_add(parent);
-               if (!eo) {
-                       ELOG("elm_naviframe_add() failed!");
-                       return {};
-               }
-
-               auto result = makeShared<Naviframe>(eo);
-
-               if (m_needBindToEo) {
-                       result->bindToEo();
-               }
-
-               if (isValid(m_style)) {
-                       result->setStyle(m_style);
-               }
-
-               show(*result);
-
-               return result;
-       }
-
-       // Naviframe //
-
-       Naviframe::Naviframe(IRefCountObj &rc, Evas_Object *eo) :
-               StyledWidget(&rc, eo, true),
-               m_isInTransition(false)
-       {
-               addEventHandler(NAVI_TRANSITION_FINISHED, WEAK_DELEGATE(
-                               Naviframe::onTransitionFinished, asWeak(*this)));
-       }
-
-       void Naviframe::setInTransition(const bool inTransition)
-       {
-               if (inTransition != m_isInTransition) {
-                       m_isInTransition = inTransition;
-                       if (inTransition) {
-                               callEvent(NAVI_TRANSITION_STARTED);
-                       } else {
-                               callEvent(NAVI_TRANSITION_FINISHED);
-                       }
-               }
-       }
-
-       void Naviframe::onTransitionFinished(Widget &widget, void *eventInfo)
-       {
-               m_isInTransition = false;
-       }
-}
diff --git a/ucl/src/gui/Widget.cpp b/ucl/src/gui/Widget.cpp
deleted file mode 100644 (file)
index 096c6e1..0000000
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 "ucl/gui/Widget.h"
-
-#include "common.h"
-
-namespace ucl { namespace { namespace impl {
-
-       constexpr auto WIDGET_EVENT_SMART = EVAS_CALLBACK_LAST;
-}}}
-
-namespace ucl {
-
-       // Widget::EventProxy //
-
-       class Widget::EventProxy : public NonCopyable {
-       public:
-               EventProxy(Widget &widget, const WidgetEvent event,
-                               const WidgetEventHandler handler) :
-                       m_widget(widget),
-                       m_handler(handler),
-                       m_type(static_cast<Evas_Callback_Type>(event))
-               {
-                       evas_object_event_callback_add(m_widget.getEo(),
-                                       m_type, event_cb, this);
-               }
-
-               EventProxy(Widget &widget, const SmartEvent event,
-                               const WidgetEventHandler handler) :
-                       m_widget(widget),
-                       m_smartEvent(event),
-                       m_handler(handler),
-                       m_type(impl::WIDGET_EVENT_SMART)
-               {
-                       evas_object_smart_callback_add(m_widget.getEo(),
-                                       m_smartEvent.c_str(), smart_cb, this);
-               }
-
-               ~EventProxy()
-               {
-                       if (m_type == impl::WIDGET_EVENT_SMART) {
-                               evas_object_smart_callback_del_full(m_widget.getEo(),
-                                               m_smartEvent.c_str(), smart_cb, this);
-                       } else {
-                               evas_object_event_callback_del_full(m_widget.getEo(),
-                                               m_type, event_cb, this);
-                       }
-               }
-
-               void setSelfIt(const Widget::EventProxiesIt it)
-               {
-                       m_selfIt = it;
-               }
-
-               bool operator==(const std::pair<WidgetEvent, WidgetEventHandler> &rhs)
-               {
-                       return ((m_type == static_cast<Evas_Callback_Type>(rhs.first)) &&
-                                       (m_handler == rhs.second));
-               }
-
-               bool operator==(const std::pair<SmartEvent, WidgetEventHandler> &rhs)
-               {
-                       return ((m_type == impl::WIDGET_EVENT_SMART) &&
-                                       (m_handler == rhs.second) &&
-                                       (m_smartEvent.compare(rhs.first) == 0));
-               }
-
-       private:
-               static void event_cb(void *data, Evas *e,
-                               Evas_Object *obj, void *event_info)
-               {
-                       static_cast<EventProxy *>(data)->dispatchEvent(event_info);
-               }
-
-               static void smart_cb(void *data, Evas_Object *obj, void *event_info)
-               {
-                       static_cast<EventProxy *>(data)->dispatchEvent(event_info);
-               }
-
-               void dispatchEvent(void *const event_info)
-               {
-                       if (m_handler) {
-                               m_handler(m_widget, event_info);
-                       } else {
-                               m_widget.delEventProxy(m_selfIt);
-                       }
-               }
-
-       private:
-               Widget &m_widget;
-               const std::string m_smartEvent;
-               const WidgetEventHandler m_handler;
-               const Evas_Callback_Type m_type;
-               Widget::EventProxiesIt m_selfIt;
-       };
-
-       // Widget //
-
-       Widget::Widget(IRefCountObj *const rc, Evas_Object *const eo,
-                       const bool isOwner) :
-               RefCountAware(rc),
-               m_eo(eo),
-               m_isOwner(isOwner),
-               m_isBoundToEo(false),
-               m_isEoRefKept(false),
-               m_isSelfRefUnique(false)
-       {
-               UCL_ASSERT(m_eo, "m_eo is NULL!");
-
-               if (isShared()) {
-                       evas_object_event_callback_priority_add(m_eo, EVAS_CALLBACK_DEL,
-                                       EO_CALLBACK_PRIORITY_AFTER,
-                                       CALLBACK_A(Widget::onEoDel), this);
-               }
-
-               updateRefs();
-       }
-
-       Widget::~Widget()
-       {
-               m_eventProxies.clear();
-
-               if (m_isBoundToEo) {
-                       unbindFromEo();
-               }
-
-               if (isShared()) {
-                       evas_object_event_callback_del_full(m_eo, EVAS_CALLBACK_DEL,
-                                       CALLBACK_A(Widget::onEoDel), this);
-               }
-
-               if (m_isOwner) {
-                       evas_object_del(m_eo);
-               }
-
-               if (m_isEoRefKept) {
-                       evas_object_unref(m_eo);
-               }
-       }
-
-       void Widget::bindToEo()
-       {
-               if (!evas_object_data_get(m_eo, impl::WIDGET_DATA_NAME)) {
-                       evas_object_data_set(m_eo, impl::WIDGET_DATA_NAME, this);
-                       m_isBoundToEo = true;
-               } else {
-                       WLOG("Other Widget is already bound to this Eo!");
-               }
-       }
-
-       void Widget::unbindFromEo()
-       {
-               if (evas_object_data_get(m_eo, impl::WIDGET_DATA_NAME) == this) {
-                       evas_object_data_del(m_eo, impl::WIDGET_DATA_NAME);
-                       m_isBoundToEo = false;
-               } else {
-                       WLOG("Widget does not bound to its Eo!");
-               }
-       }
-
-       void Widget::updateRefs()
-       {
-               updateEoRef();
-
-               if (isShared()) {
-                       updateSelfRef();
-               }
-       }
-
-       void Widget::updateEoRef()
-       {
-               if (needKeepEoRef()) {
-                       if (!m_isEoRefKept) {
-                               m_isEoRefKept = true;
-                               evas_object_ref(m_eo);
-                       }
-               } else if (m_isEoRefKept) {
-                       m_isEoRefKept = false;
-                       evas_object_unref(m_eo);
-               }
-       }
-
-       bool Widget::needKeepEoRef() const
-       {
-               return (!m_isSelfRefUnique || !needKeepSelfRef());
-       }
-
-       void Widget::updateSelfRef()
-       {
-               if (!needKeepSelfRef()) {
-                       m_selfRef.reset();
-               } else if (!m_selfRef) {
-                       m_selfRef = asShared(*this);
-               }
-       }
-
-       bool Widget::needKeepSelfRef() const
-       {
-               return (!m_isOwner && m_eo);
-       }
-
-       void Widget::setSelfRefUnique(const bool value)
-       {
-               if (value != m_isSelfRefUnique) {
-                       m_isSelfRefUnique = value;
-                       updateEoRef();
-               }
-       }
-
-       void Widget::onEoDel(Evas *e, Evas_Object *obj, void *event_info)
-       {
-               if (!m_selfRef) {
-                       FLOG("UNEXPECTED! m_selfRef is NULL!");
-                       m_eo = nullptr;
-                       return;
-               }
-               if (m_isOwner || m_isEoRefKept || !m_isSelfRefUnique) {
-                       ELOG("UNEXPECTED! m_isOwner: %d; m_isEoRefKept: %d; "
-                                       "m_isSelfRefUnique: %d;",
-                                       m_isOwner, m_isEoRefKept, m_isSelfRefUnique);
-                       m_eo = nullptr;
-               }
-               m_selfRef.reset();
-       }
-
-       void Widget::onUniqueChanged(bool isUnique)
-       {
-               setSelfRefUnique(isUnique);
-       }
-
-       void Widget::delEventProxy(const EventProxiesIt it)
-       {
-               if (it != m_eventProxies.end()) {
-                       m_eventProxies.erase(it);
-               }
-       }
-
-       void Widget::addEventHandler(const WidgetEvent event,
-                       const WidgetEventHandler handler)
-       {
-               m_eventProxies.emplace_front(*this, event, handler);
-               m_eventProxies.front().setSelfIt(m_eventProxies.begin());
-       }
-
-       void Widget::addEventHandler(const SmartEvent event,
-                       const WidgetEventHandler handler)
-       {
-               if (strncmp(event.name, UCL_SMART_FWD, strlen(UCL_SMART_FWD)) == 0) {
-                       if (!ensureFwdEvent(event)) {
-                               LOG_RETURN_VOID(RES_NOT_SUPPORTED,
-                                               "Event is not supported: %s;", event.name);
-                       }
-               }
-               m_eventProxies.emplace_front(*this, event, handler);
-               m_eventProxies.front().setSelfIt(m_eventProxies.begin());
-       }
-
-       void Widget::delEventHandler(const WidgetEvent event,
-                       const WidgetEventHandler handler)
-       {
-               delEventProxy(std::find(m_eventProxies.begin(), m_eventProxies.end(),
-                               std::make_pair(event, handler)));
-       }
-
-       void Widget::delEventHandler(const SmartEvent event,
-                       const WidgetEventHandler handler)
-       {
-               delEventProxy(std::find(m_eventProxies.begin(), m_eventProxies.end(),
-                               std::make_pair(event, handler)));
-       }
-
-       void Widget::setFocusedImpl(const bool value)
-       {
-               evas_object_focus_set(getEo(), toEina(value));
-       }
-
-       bool Widget::isFocusedImpl() const
-       {
-               return evas_object_focus_get(getEo());
-       }
-
-       bool Widget::ensureFwdEvent(const SmartEvent fwdEvent)
-       {
-               return false;
-       }
-}
diff --git a/ucl/src/gui/WidgetItem.cpp b/ucl/src/gui/WidgetItem.cpp
deleted file mode 100644 (file)
index 04d1fca..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 "ucl/gui/WidgetItem.h"
-
-namespace ucl {
-
-       void WidgetItem::setText(const TString &value) const
-       {
-               if (value.isTranslatable()) {
-                       if (value.hasDomain()) {
-                               elm_object_item_domain_translatable_text_set(
-                                               getIt(), value.getDomain(), value);
-                       } else {
-                               elm_object_item_translatable_text_set(getIt(), value);
-                       }
-               } else {
-                       elm_object_item_text_translatable_set(getIt(), EINA_FALSE);
-                       elm_object_item_text_set(getIt(), value);
-               }
-       }
-
-       void WidgetItem::setText(const TString &value,
-                       const EdjePart part) const
-       {
-               if (value.isTranslatable()) {
-                       if (value.hasDomain()) {
-                               elm_object_item_domain_translatable_part_text_set(
-                                               getIt(), part.name, value.getDomain(), value);
-                       } else {
-                               elm_object_item_translatable_part_text_set(
-                                               getIt(), part.name, value);
-                       }
-               } else {
-                       elm_object_item_part_text_translatable_set(getIt(),
-                                       part.name, EINA_FALSE);
-                       elm_object_item_part_text_set(getIt(), part.name, value);
-               }
-       }
-}
diff --git a/ucl/src/gui/Window.cpp b/ucl/src/gui/Window.cpp
deleted file mode 100644 (file)
index 3f74e9e..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 "ucl/gui/Window.h"
-
-#include "common.h"
-
-namespace ucl {
-
-       // Window::Builder //
-
-       WindowSRef Window::Builder::build() const
-       {
-               if (!m_winEo && isEmpty(m_name) && isEmpty(m_title)) {
-                       ELOG("Wrong built parameters!");
-                       return {};
-               }
-
-               Evas_Object *winEo = m_winEo;
-               bool isOwner = m_isOwner;
-
-               if (!winEo) {
-                       winEo = elm_win_add(nullptr,
-                                       (m_name.empty() ? m_title : m_name).c_str(),
-                                       static_cast<Elm_Win_Type>(m_type));
-                       if (!winEo) {
-                               ELOG("elm_win_add() failed!");
-                               return {};
-                       }
-                       if (!m_isOwnerWasSet) {
-                               isOwner = true;
-                       }
-               }
-
-               StyledWidget bg(elm_bg_add(winEo));
-               expand(bg);
-               show(bg);
-
-               StyledWidget conform(elm_conformant_add(winEo));
-               expand(conform);
-               show(conform);
-
-               elm_win_resize_object_add(winEo, bg);
-               elm_win_resize_object_add(winEo, conform);
-
-               elm_win_indicator_opacity_set(winEo, ELM_WIN_INDICATOR_OPAQUE);
-               elm_win_conformant_set(winEo, EINA_TRUE);
-
-               auto result = makeShared<Window>(winEo, isOwner, conform);
-
-               if (m_needBindToEo) {
-                       result->bindToEo();
-               }
-
-               result->setTitle(m_title.empty() ? m_name : m_title);
-
-               if (result->isRotationsSupported()) {
-                       result->setRotations(m_rotations);
-               }
-
-               result->setIndicatorVisible(m_isIndicatorVisible);
-
-               return result;
-       }
-}
diff --git a/ucl/src/gui/common.h b/ucl/src/gui/common.h
deleted file mode 100644 (file)
index 6b543d3..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_GUI_COMMON_H__
-#define __UCL_GUI_COMMON_H__
-
-#include "../common.h"
-
-#endif // __UCL_GUI_COMMON_H__
diff --git a/ucl/src/misc/Timeout.cpp b/ucl/src/misc/Timeout.cpp
deleted file mode 100644 (file)
index 41a3d3f..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 "ucl/misc/Timeout.h"
-
-#include "common.h"
-
-namespace ucl {
-
-       TimeoutSRef Timeout::create(double timeoutSec,
-                       const TimeoutHandler &handler)
-       {
-               auto result = makeShared<Timeout>(handler);
-
-               FAIL_RETURN_VALUE(result->prepare(timeoutSec), {},
-                               "result->prepare() failed!");
-
-               return result;
-       }
-
-       Timeout::Timeout(const TimeoutHandler &handler) :
-               m_timer(nullptr),
-               m_handler(handler)
-       {
-       }
-
-       Timeout::~Timeout()
-       {
-               if (m_timer) {
-                       ecore_timer_del(m_timer);
-               }
-       }
-
-       Result Timeout::prepare(const double timeoutSec)
-       {
-               m_timer = ecore_timer_add(timeoutSec,
-                       [](void *data) -> Eina_Bool
-                       {
-                               const auto self = static_cast<Timeout *>(data);
-                               self->m_timer = nullptr;
-                               if (self->m_handler) {
-                                       self->m_handler(self);
-                               }
-                               return ECORE_CALLBACK_CANCEL;
-                       },
-                       this);
-
-               if (!m_timer) {
-                       FAIL_RETURN(RES_FAIL, "ecore_timer_add() failed!");
-               }
-
-               return RES_OK;
-       }
-
-       bool Timeout::isExpired() const
-       {
-               return !m_timer;
-       }
-}
diff --git a/ucl/src/misc/Variant.cpp b/ucl/src/misc/Variant.cpp
deleted file mode 100644 (file)
index f723f34..0000000
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 "ucl/misc/Variant.h"
-
-#include "common.h"
-
-namespace ucl {
-
-       // Variant //
-
-       Variant::Variant(const char *const aString, const int length) :
-               m_type(aString ? TYPE_STRING : TYPE_NIL)
-       {
-               if (aString) {
-                       const int realLength = ((length < 0) ? strlen(aString) : length);
-                       if (realLength < sizeof(m_aSmallStr.buffer)) {
-                               strncpy(m_aSmallStr.buffer, aString, realLength);
-                               m_aSmallStr.buffer[realLength] = '\0';
-                               m_type |= impl::FLAG_SMALL_STR;
-                       } else {
-                               m_aString.data = strndup(aString, realLength);
-                               m_aString.length = realLength;
-                       }
-               }
-       }
-
-       Variant::Variant(std::nullptr_t, const int arrayLength) :
-               m_type(static_cast<int>((arrayLength > 0) ? TYPE_ARRAY : TYPE_NIL))
-       {
-               if (arrayLength > 0) {
-                       m_anArray.data = new Variant[arrayLength];
-                       m_anArray.length = arrayLength;
-               }
-       }
-
-       Variant::Variant(const Variant *const anArray, const int length) :
-               Variant(nullptr, length)
-       {
-               if (length > 0) {
-                       std::copy(anArray, (anArray + length), m_anArray.data);
-               }
-       }
-
-       Variant::Variant(const Variant &v) :
-               m_type(v.m_type)
-       {
-               switch (m_type) {
-               case TYPE_NIL:
-                       break;
-               case TYPE_STRING:
-                       m_aString.data = strndup(v.m_aString.data, v.m_aString.length);
-                       m_aString.length = v.m_aString.length;
-                       break;
-               case TYPE_ARRAY:
-                       m_anArray.data = new Variant[v.m_anArray.length];
-                       std::copy(v.m_anArray.data, (v.m_anArray.data + v.m_anArray.length),
-                                       m_anArray.data);
-                       m_anArray.length = v.m_anArray.length;
-                       break;
-               default:
-                       m_raw = v.m_raw;
-                       break;
-               }
-       }
-
-       bool Variant::asBool() const noexcept
-       {
-               switch (m_type) {
-               case TYPE_BOOLEAN:
-                       return m_aBool.value;
-               case TYPE_INTEGER:
-                       return (m_anInt.value != 0);
-               case TYPE_FLOAT:
-                       return (m_aFloat.value != 0.0f);
-               case TYPE_DOUBLE:
-                       return (m_aDouble.value != 0.0);
-               case TYPE_STRING:
-               case impl::TYPE_SMALL_STR:
-                       {
-                               const auto str = getStr();
-                               return (strcasecmp(str, "true") == 0)
-                                       || (strcasecmp(str, "yes") == 0)
-                                       || (strcasecmp(str, "ok") == 0)
-                                       || (strcasecmp(str, "on") == 0)
-                                       || (strcasecmp(str, "1") == 0);
-                       }
-               case TYPE_ARRAY:
-                       return (m_anArray.length != 0);
-               }
-               return false;
-       }
-
-       int Variant::asInt() const noexcept
-       {
-               switch (m_type) {
-               case TYPE_BOOLEAN:
-                       return static_cast<int>(m_aBool.value);
-               case TYPE_INTEGER:
-                       return m_anInt.value;
-               case TYPE_FLOAT:
-                       return static_cast<int>(m_aFloat.value);
-               case TYPE_DOUBLE:
-                       return static_cast<int>(m_aDouble.value);
-               case TYPE_STRING:
-               case impl::TYPE_SMALL_STR:
-                       return std::atoi(getStr());
-               case TYPE_ARRAY:
-                       return m_anArray.length;
-               }
-               return 0;
-       }
-
-       float Variant::asFloat() const noexcept
-       {
-               switch (m_type) {
-               case TYPE_BOOLEAN:
-                       return static_cast<float>(m_aBool.value);
-               case TYPE_INTEGER:
-                       return static_cast<float>(m_anInt.value);
-               case TYPE_FLOAT:
-                       return m_aFloat.value;
-               case TYPE_DOUBLE:
-                       return static_cast<float>(m_aDouble.value);
-               case TYPE_STRING:
-               case impl::TYPE_SMALL_STR:
-                       return static_cast<float>(std::atof(getStr()));
-               case TYPE_ARRAY:
-                       return static_cast<float>(m_anArray.length);
-               }
-               return 0.0f;
-       }
-
-       double Variant::asDouble() const noexcept
-       {
-               switch (m_type) {
-               case TYPE_BOOLEAN:
-                       return static_cast<double>(m_aBool.value);
-               case TYPE_INTEGER:
-                       return static_cast<double>(m_anInt.value);
-               case TYPE_FLOAT:
-                       return static_cast<double>(m_aFloat.value);
-               case TYPE_DOUBLE:
-                       return m_aDouble.value;
-               case TYPE_STRING:
-               case impl::TYPE_SMALL_STR:
-                       return std::atof(getStr());
-               case TYPE_ARRAY:
-                       return static_cast<double>(m_anArray.length);
-               }
-               return 0.0;
-       }
-
-       ConstCString Variant::asString() const noexcept
-       {
-               char strBuff[impl::TMP_STR_BUFF_SIZE] = {};
-               switch (m_type) {
-               case TYPE_NIL:
-                       return ConstCString::wrap("");
-               case TYPE_BOOLEAN:
-                       return ConstCString::wrap(m_aBool.value ? "true" : "false");
-               case TYPE_INTEGER:
-                       snprintf(strBuff, sizeof(strBuff), "%d", m_anInt.value);
-                       break;
-               case TYPE_FLOAT:
-                       snprintf(strBuff, sizeof(strBuff), "%f",
-                                       static_cast<double>(m_aFloat.value));
-                       break;
-               case TYPE_DOUBLE:
-                       snprintf(strBuff, sizeof(strBuff), "%f", m_aDouble.value);
-                       break;
-               case impl::TYPE_SMALL_STR:
-                       return ConstCString::wrap(m_aSmallStr.buffer);
-               case TYPE_STRING:
-                       return ConstCString::wrap(m_aString.data);
-               case TYPE_ARRAY:
-                       snprintf(strBuff, sizeof(strBuff), "%d", m_anArray.length);
-                       break;
-               }
-               return CString::dup(strBuff);
-       }
-
-       // Non-member functions //
-
-       bool operator==(const Variant &lhs, const Variant &rhs) noexcept
-       {
-               if (lhs.m_type != rhs.m_type) {
-                       return false;
-               }
-               switch (lhs.m_type) {
-               case Variant::TYPE_BOOLEAN:
-                       return (lhs.m_aBool.value == rhs.m_aBool.value);
-               case Variant::TYPE_INTEGER:
-                       return (lhs.m_anInt.value == rhs.m_anInt.value);
-               case Variant::TYPE_FLOAT:
-                       return (lhs.m_aFloat.value == rhs.m_aFloat.value);
-               case Variant::TYPE_DOUBLE:
-                       return (lhs.m_aDouble.value == rhs.m_aDouble.value);
-               case Variant::TYPE_STRING:
-               case impl::TYPE_SMALL_STR:
-                       return (strcmp(lhs.getStr(), rhs.getStr()) == 0);
-               case Variant::TYPE_ARRAY:
-                       if (lhs.m_anArray.length != rhs.m_anArray.length) {
-                               return false;
-                       }
-                       for (int i = 0; i < lhs.m_anArray.length; ++i) {
-                               if (lhs.m_anArray.data[i] != rhs.m_anArray.data[i]) {
-                                       return false;
-                               }
-                       }
-                       return true;
-               }
-               return true;
-       }
-}
diff --git a/ucl/src/misc/common.h b/ucl/src/misc/common.h
deleted file mode 100644 (file)
index 372ad4d..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_MISC_COMMON_H__
-#define __UCL_MISC_COMMON_H__
-
-#include "../common.h"
-
-#endif // __UCL_MISC_COMMON_H__
diff --git a/ucl/src/mvp/GuiPresenter.cpp b/ucl/src/mvp/GuiPresenter.cpp
deleted file mode 100644 (file)
index e23bc02..0000000
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 "ucl/mvp/GuiPresenter.h"
-
-#include "common.h"
-
-namespace ucl { namespace { namespace impl {
-
-       constexpr SmartEvent ACTIVATE_BY {"ucl,activate,by"};
-       constexpr SmartEvent DEACTIVATE_BY {"ucl,deactivate,by"};
-}}}
-
-namespace ucl {
-
-       GuiPresenter::GuiPresenter(IRefCountObj &rc) :
-               RefCountAware(&rc),
-               m_hasBuildInSources(false),
-               m_isChild(false),
-               m_isPrepared(false)
-       {
-       }
-
-       GuiPresenter::~GuiPresenter()
-       {
-               if (m_hasBuildInSources) {
-                       if (m_isChild) {
-                               if (const auto parentSink = m_parentSink.lock()) {
-                                       delDeactivatorSource(*parentSink);
-                               }
-                       } else if (m_window) {
-                               delDeactivatorSource(*m_window);
-                       }
-               }
-       }
-
-       Result GuiPresenter::prepare(ElmWidget &widget, const int flags)
-       {
-               m_window = asShared(widget.getWindow());
-               if (!m_window) {
-                       LOG_RETURN(RES_FAIL, "m_window is NULL!");
-               }
-
-               if (flags & PF_ADD_DEACTIVATOR_SOURCES) {
-                       addDeactivatorSource(*m_window);
-                       m_hasBuildInSources = true;
-               }
-
-               if (flags & PF_ADD_SELF_EXCEPT) {
-                       addDeactivatorException(getObjPtr());
-               }
-
-               m_isPrepared = true;
-
-               return RES_OK;
-       }
-
-       Result GuiPresenter::prepare(GuiPresenter &parent, const int flags)
-       {
-               if (flags & PF_ADD_DEACTIVATOR_SOURCES) {
-
-                       if (!parent.m_sink) {
-                               LOG_RETURN(RES_FAIL, "parent.m_sink is NULL!");
-                       }
-
-                       for (auto deactivator: parent.m_deactivators) {
-                               if (m_deactivatorExceptions.find(deactivator) ==
-                                               m_deactivatorExceptions.end()) {
-                                       m_deactivators.insert(deactivator);
-                               }
-                       }
-
-                       addDeactivatorSource(*parent.m_sink);
-                       m_parentSink = parent.m_sink;
-                       m_hasBuildInSources = true;
-               }
-
-               if (flags & PF_ADD_SELF_EXCEPT) {
-                       addDeactivatorException(getObjPtr());
-               }
-
-               m_window = parent.m_window;
-               m_isChild = true;
-               m_isPrepared = true;
-
-               return RES_OK;
-       }
-
-       Window &GuiPresenter::getWindow()
-       {
-               UCL_ASSERT(isWindowReady(), "m_window is NULL!");
-               return *m_window;
-       }
-
-       bool GuiPresenter::isWindowReady() const
-       {
-               return !!m_window;
-       }
-
-       void GuiPresenter::addDeactivatorException(const void *const deactivator)
-       {
-               const auto pair = m_deactivatorExceptions.insert(deactivator);
-               if (pair.second) {
-                       activateBy(deactivator);
-               }
-       }
-
-       void GuiPresenter::setDeactivatorSink(const WidgetSRef &sink)
-       {
-               m_sink = sink;
-       }
-
-       void GuiPresenter::sendActivate(Widget &sender)
-       {
-               sendDeactivator(sender, impl::ACTIVATE_BY, getObjPtr());
-       }
-
-       void GuiPresenter::sendDeactivate(Widget &sender)
-       {
-               sendDeactivator(sender, impl::DEACTIVATE_BY, getObjPtr());
-       }
-
-       void GuiPresenter::broadcastActivate()
-       {
-               broadcastDeactivator(impl::ACTIVATE_BY, getObjPtr());
-       }
-
-       void GuiPresenter::broadcastDeactivate()
-       {
-               broadcastDeactivator(impl::DEACTIVATE_BY, getObjPtr());
-       }
-
-       void GuiPresenter::sendDeactivator(Widget &sender,
-                       SmartEvent event, const void *deactivator)
-       {
-               sendDeactivatorInfo(sender, event, {deactivator, false});
-       }
-
-       void GuiPresenter::broadcastDeactivator(const SmartEvent event,
-                       const void *const deactivator)
-       {
-               sendDeactivatorInfo(*m_window, event, {deactivator, true});
-       }
-
-       void GuiPresenter::sendDeactivatorInfo(Widget &sender,
-                       const SmartEvent event, const DeactivatorInfo &info)
-       {
-               sender.callEvent(event, const_cast<DeactivatorInfo *>(&info));
-       }
-
-       bool GuiPresenter::isActive() const
-       {
-               return isEmpty(m_deactivators);
-       }
-
-       bool GuiPresenter::isDeactivatedBy(const void *const deactivator) const
-       {
-               return (m_deactivators.find(deactivator) != m_deactivators.end());
-       }
-
-       void GuiPresenter::activateBy(const void *const deactivator)
-       {
-               activateByImpl({deactivator, false});
-       }
-
-       void GuiPresenter::deactivateBy(const void *const deactivator)
-       {
-               deactivateByImpl({deactivator, false});
-       }
-
-       void GuiPresenter::addDeactivatorSource(Widget &source)
-       {
-               source.addEventHandler(impl::ACTIVATE_BY, WEAK_DELEGATE(
-                               GuiPresenter::onActivateBySmart, asWeak(*this)));
-               source.addEventHandler(impl::DEACTIVATE_BY, WEAK_DELEGATE(
-                               GuiPresenter::onDeactivateBySmart, asWeak(*this)));
-       }
-
-       void GuiPresenter::delDeactivatorSource(Widget &source)
-       {
-               source.delEventHandler(impl::ACTIVATE_BY, WEAK_DELEGATE(
-                               GuiPresenter::onActivateBySmart, asWeak(*this)));
-               source.delEventHandler(impl::DEACTIVATE_BY, WEAK_DELEGATE(
-                               GuiPresenter::onDeactivateBySmart, asWeak(*this)));
-       }
-
-       void GuiPresenter::activateByImpl(const DeactivatorInfo &info)
-       {
-               const auto count = m_deactivators.erase(info.deactivator);
-               if (m_isPrepared && (count > 0)) {
-                       if (m_sink) {
-                               sendDeactivatorInfo(*m_sink, impl::ACTIVATE_BY, info);
-                       }
-                       onActivateBy(info);
-                       if (m_deactivators.size() == 0) {
-                               onActivate();
-                       }
-               }
-       }
-
-       void GuiPresenter::deactivateByImpl(const DeactivatorInfo &info)
-       {
-               if (m_deactivatorExceptions.find(info.deactivator) !=
-                               m_deactivatorExceptions.end()) {
-                       return;
-               }
-               const auto pair = m_deactivators.insert(info.deactivator);
-               if (m_isPrepared && pair.second) {
-                       if (m_sink) {
-                               sendDeactivatorInfo(*m_sink, impl::DEACTIVATE_BY, info);
-                       }
-                       onDeactivateBy(info);
-                       if (m_deactivators.size() == 1) {
-                               onDeactivate();
-                       }
-               }
-       }
-
-       void GuiPresenter::onActivateBySmart(Widget &widget, void *eventInfo)
-       {
-               activateByImpl(*static_cast<DeactivatorInfo *>(eventInfo));
-       }
-
-       void GuiPresenter::onDeactivateBySmart(Widget &widget, void *eventInfo)
-       {
-               deactivateByImpl(*static_cast<DeactivatorInfo *>(eventInfo));
-       }
-
-       void GuiPresenter::onActivate()
-       {
-       }
-
-       void GuiPresenter::onDeactivate()
-       {
-       }
-
-       void GuiPresenter::onActivateBy(const DeactivatorInfo &info)
-       {
-       }
-
-       void GuiPresenter::onDeactivateBy(const DeactivatorInfo &info)
-       {
-       }
-}
diff --git a/ucl/src/mvp/ListItemPresenter.cpp b/ucl/src/mvp/ListItemPresenter.cpp
deleted file mode 100644 (file)
index e2ad69a..0000000
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 "ucl/mvp/ListItemPresenter.h"
-
-#include "common.h"
-
-namespace ucl {
-
-       // ListItemPresenter::ItemClass //
-
-       ListItemPresenter::ItemClassSRef ListItemPresenter::ItemClass::
-                       newInstance(const ElmStyle itemStyle)
-       {
-               auto result = makeShared<ItemClass>(itemStyle);
-               if (!result->get()) {
-                       LOG_RETURN_VALUE(RES_FAIL, {}, "Failed to create ItemClass()!");
-               }
-               return result;
-       }
-
-       ListItemPresenter::ItemClass::ItemClass(const ElmStyle itemStyle) :
-               m_itc(elm_genlist_item_class_new())
-       {
-               if (!m_itc) {
-                       return;
-               }
-
-               m_itc->item_style = itemStyle.name;
-
-               m_itc->func.text_get =
-                       [](void *data, Evas_Object *obj, const char *part) -> char *
-                       {
-                               if (!data) {
-                                       LOG_RETURN_VALUE(RES_FATAL, nullptr, "data is NULL");
-                               }
-                               return static_cast<ListItemPresenter *>(data)->
-                                               getItemPartText(EdjePart(part)).release();
-                       };
-
-               m_itc->func.content_get =
-                       [](void *data, Evas_Object *obj, const char *part) -> Evas_Object *
-                       {
-                               if (!data) {
-                                       LOG_RETURN_VALUE(RES_FATAL, nullptr, "data is NULL");
-                               }
-                               if (const auto widget = static_cast<ListItemPresenter *>(data)->
-                                               getItemPartContent(EdjePart(part))) {
-                                       widget->setIsOwner(false);
-                                       return widget->getEo();
-                               }
-                               return nullptr;
-                       };
-
-               m_itc->func.state_get =
-                       [](void *data, Evas_Object *obj, const char *part) -> Eina_Bool
-                       {
-                               if (!data) {
-                                       LOG_RETURN_VALUE(RES_FATAL, false, "data is NULL");
-                               }
-                               return static_cast<ListItemPresenter *>(data)->
-                                               getItemPartState(EdjePart(part));
-                       };
-       }
-
-       ListItemPresenter::ItemClass::~ItemClass()
-       {
-               if (m_itc) {
-                       elm_genlist_item_class_free(m_itc);
-               }
-       }
-
-       Elm_Genlist_Item_Class *ListItemPresenter::ItemClass::get()
-       {
-               return m_itc;
-       }
-
-       // ListItemPresenter::ItemClassCache //
-
-       ListItemPresenter::ItemClassSRef ListItemPresenter::ItemClassCache::
-                       getItemClass(const ElmStyle itemStyle)
-       {
-               ItemClassSRef result;
-
-               if (!m_itcMap.get(itemStyle, result)) {
-                       result = ItemClass::newInstance(itemStyle);
-                       if (result) {
-                               m_itcMap.set(itemStyle, result);
-                       } else {
-                               ELOG("ItemClass::newInstance() failed!");
-                       }
-               }
-
-               return result;
-       }
-
-       void ListItemPresenter::ItemClassCache::purge()
-       {
-               m_itcMap.clear();
-       }
-
-       // ListItemPresenter //
-
-       ListItemPresenter::ListItemPresenter(IRefCountObj &rc) :
-               RefCountAware(&rc),
-               m_flags(PF_AUTO_UNSELECT)
-       {
-       }
-
-       ListItemPresenter::~ListItemPresenter()
-       {
-               if (m_item) {
-                       FLOG("m_item is still alive!");
-                       deleteDetachedItem(true);
-               }
-       }
-
-       void ListItemPresenter::attachItem(GenlistItem item,
-                       const ItemClassCacheSRef &itcCache,
-                       const SharedRef<bool> &isActiveRef)
-       {
-               if (!item) {
-                       LOG_RETURN_VOID(RES_FAIL, "item is NULL!");
-               }
-
-               if (m_item) {
-                       deleteDetachedItem();
-               }
-
-               m_item = item;
-               m_item.setData(this);
-               m_item.setDelCallback(CALLBACK_A(ListItemPresenter::onItemDel));
-
-               m_itcCache = itcCache;
-               m_isActiveRef = isActiveRef;
-
-               if (!m_selfRef) {
-                       m_selfRef = asShared(*this);
-               }
-
-               onItemAttached();
-       }
-
-       void ListItemPresenter::deleteDetachedItem(const bool silent)
-       {
-               auto item = m_item;
-               detachItem(silent);
-               item.del();
-       }
-
-       void ListItemPresenter::detachItem(const bool silent)
-       {
-               m_item.setData(nullptr);
-               m_item.setDelCallback(nullptr);
-               m_item = nullptr;
-               if (!silent) {
-                       onItemDetached();
-               }
-       }
-
-       void ListItemPresenter::onItemDel(Evas_Object *obj, void *eventInfo)
-       {
-               if (m_item) {
-                       detachItem();
-               }
-               m_selfRef.reset();
-       }
-
-       void ListItemPresenter::setFlags(const int flags)
-       {
-               m_flags = flags;
-       }
-
-       int ListItemPresenter::getFlags() const
-       {
-               return m_flags;
-       }
-
-       bool ListItemPresenter::isActive() const
-       {
-               return (m_isActiveRef ? *m_isActiveRef : false);
-       }
-
-       GenlistItem ListItemPresenter::getItem()
-       {
-               return m_item;
-       }
-
-       ListItemPresenter::ItemClassCacheSRef
-                       ListItemPresenter::getItemClassCache()
-       {
-               return m_itcCache.lock();
-       }
-
-       Result ListItemPresenter::updateItemStyle(const ElmStyle newItemStyle)
-       {
-               if (!m_item) {
-                       LOG_RETURN(RES_ILLEGAL_STATE, "m_item is NULL!");
-               }
-
-               const auto itcCache = getItemClassCache();
-               if (!itcCache) {
-                       LOG_RETURN(RES_FATAL, "itcCache is NULL!");
-               }
-
-               const auto itc = itcCache->getItemClass(newItemStyle);
-               if (!itc) {
-                       LOG_RETURN(RES_FAIL, "itcCache.getItemClass() failed!");
-               }
-
-               m_item.update(itc->get());
-
-               return RES_OK;
-       }
-
-       void ListItemPresenter::dispose()
-       {
-               if (m_item) {
-                       deleteDetachedItem();
-                       m_selfRef.reset();
-               }
-       }
-
-       bool ListItemPresenter::isDisposed() const
-       {
-               return !m_item;
-       }
-
-       void ListItemPresenter::onItemAttached()
-       {
-       }
-
-       void ListItemPresenter::onItemDetached()
-       {
-       }
-
-       WidgetSRef ListItemPresenter::getItemPartContent(const EdjePart part)
-       {
-               return nullptr;
-       }
-
-       CString ListItemPresenter::getItemPartText(const EdjePart part)
-       {
-               return nullptr;
-       }
-
-       bool ListItemPresenter::getItemPartState(const EdjePart part)
-       {
-               return false;
-       }
-
-       void ListItemPresenter::onItemSelectedHook()
-       {
-               if (m_flags & PF_AUTO_UNSELECT) {
-                       m_item.setSelected(false);
-               }
-               onItemSelected();
-       }
-
-       void ListItemPresenter::onItemSelected()
-       {
-       }
-
-       void ListItemPresenter::onItemRealized()
-       {
-       }
-
-       void ListItemPresenter::onItemUnrealized()
-       {
-       }
-
-       void ListItemPresenter::onItemHighlighted()
-       {
-       }
-
-       void ListItemPresenter::onItemUnhighlighted()
-       {
-       }
-}
diff --git a/ucl/src/mvp/ListPresenter.cpp b/ucl/src/mvp/ListPresenter.cpp
deleted file mode 100644 (file)
index 220b10e..0000000
+++ /dev/null
@@ -1,326 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 "ucl/mvp/ListPresenter.h"
-
-#include "common.h"
-
-namespace ucl { namespace { namespace impl {
-
-       constexpr SmartEvent ITEM_SELECTED {"selected"};
-
-       constexpr SmartEvent ITEM_REALIZED {"realized"};
-       constexpr SmartEvent ITEM_UNREALIZED {"unrealized"};
-       constexpr SmartEvent ITEM_HIGHLIGHTED {"highlighted"};
-       constexpr SmartEvent ITEM_UNHIGHLIGHTED {"unhighlighted"};
-
-       ListItemPresenter *toItemPresenter(void *eventInfo)
-       {
-               if (!eventInfo) {
-                       LOG_RETURN_VALUE(RES_FATAL, nullptr, "eventInfo is NULL");
-               }
-
-               const GenlistItem item{static_cast<Elm_Object_Item *>(eventInfo)};
-               const auto data = item.getData();
-               if (!data) {
-                       LOG_RETURN_VALUE(RES_FATAL, nullptr, "data is NULL");
-               }
-
-               return static_cast<ListItemPresenter *>(data);
-       }
-}}}
-
-namespace ucl {
-
-       // ListPresenter::Builder //
-
-       ListPresenter::Builder::Builder() :
-               m_flags(FLAG_HOMOGENEOUS)
-       {
-       }
-
-       ListPresenter::Builder &ListPresenter::Builder::setStyle(
-                       const ElmStyle style)
-       {
-               m_style = style;
-               return *this;
-       }
-
-       ListPresenter::Builder &ListPresenter::Builder::setFlags(const int flags)
-       {
-               m_flags = flags;
-               return *this;
-       }
-
-       ListPresenter::Builder &ListPresenter::Builder::setParentWidget(
-                       const ElmWidgetSRef &parentWidget)
-       {
-               m_parentWidget = parentWidget;
-               return *this;
-       }
-
-       ListPresenterSRef ListPresenter::Builder::build(GuiPresenter &parent) const
-       {
-               if (!m_parentWidget) {
-                       LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {},
-                                       "m_parentWidget is NULL!");
-               }
-
-               auto result = makeShared<ListPresenter>();
-
-               FAIL_RETURN_VALUE(result->prepare(
-                               parent, *m_parentWidget, m_style, m_flags),
-                               {}, "result->prepare() failed!");
-
-               return result;
-       }
-
-       // ListPresenter //
-
-       ListPresenter::ListPresenter(IRefCountObj &rc) :
-                       GuiPresenter(rc)
-       {
-       }
-
-       ListPresenter::~ListPresenter()
-       {
-       }
-
-       Result ListPresenter::prepare(
-                       GuiPresenter &parent, ElmWidget &parentWidget,
-                       const ElmStyle style, const int flags)
-       {
-               FAIL_RETURN(GuiPresenter::prepare(parent, PF_DEACTIVATOR),
-                               "GuiPresenter::prepare() failed!");
-
-               m_genlist = Genlist::Builder().
-                               setStyle(style).
-                               setMode(Genlist::Mode::COMPRESS).
-                               setHomogeneous(flags & FLAG_HOMOGENEOUS).
-                               setIsOwner(true).
-                               setNeedBindToEo(true).
-                               build(parentWidget);
-               if (!m_genlist) {
-                       LOG_RETURN(RES_FAIL, "Genlist::build() failed!");
-               }
-
-               expandAndFill(*m_genlist);
-
-               // TODO Add Scroller widget.
-               elm_scroller_content_min_limit(*m_genlist,
-                               toEina((flags & FLAG_CALC_X_MIN) != 0),
-                               toEina((flags & FLAG_CALC_Y_MIN) != 0));
-
-               m_itcCache = makeShared<ListItemPresenter::ItemClassCache>();
-
-               m_isActiveRef = makeShared<bool>();
-               *m_isActiveRef = isActive();
-
-               m_genlist->addEventHandler(impl::ITEM_SELECTED, WEAK_DELEGATE(
-                               ListPresenter::onItemSelected, asWeak(*this)));
-
-               if (flags & FLAG_NOTIFY_REALIZED) {
-                       m_genlist->addEventHandler(impl::ITEM_REALIZED, WEAK_DELEGATE(
-                                       ListPresenter::onItemRealized, asWeak(*this)));
-               }
-               if (flags & FLAG_NOTIFY_UNREALIZED) {
-                       m_genlist->addEventHandler(impl::ITEM_UNREALIZED, WEAK_DELEGATE(
-                                       ListPresenter::onItemUnrealized, asWeak(*this)));
-               }
-               if (flags & FLAG_NOTIFY_HIGHLIGHTED) {
-                       m_genlist->addEventHandler(impl::ITEM_HIGHLIGHTED, WEAK_DELEGATE(
-                                       ListPresenter::onItemHighlighted, asWeak(*this)));
-               }
-               if (flags & FLAG_NOTIFY_UNHIGHLIGHTED) {
-                       m_genlist->addEventHandler(impl::ITEM_UNHIGHLIGHTED, WEAK_DELEGATE(
-                                       ListPresenter::onItemUnhighlighted, asWeak(*this)));
-               }
-
-               return RES_OK;
-       }
-
-       Genlist &ListPresenter::getWidget()
-       {
-               return *m_genlist;
-       }
-
-       void ListPresenter::clear()
-       {
-               m_genlist->clear();
-               m_itcCache->purge();
-       }
-
-       Result ListPresenter::append(ListItemPresenter &itemPresenter,
-                               ListItemPresenter *parent)
-       {
-               return insert(itemPresenter, parent,
-                       [this](const Elm_Genlist_Item_Class *itc, const void *data,
-                                       GenlistItem parent, GenlistItem::Type type)
-                       {
-                               return m_genlist->append(itc, data, nullptr, type, parent);
-                       });
-       }
-
-       Result ListPresenter::prepend(ListItemPresenter &itemPresenter,
-                               ListItemPresenter *parent)
-       {
-               return insert(itemPresenter, parent,
-                       [this](const Elm_Genlist_Item_Class *itc, const void *data,
-                                       GenlistItem parent, GenlistItem::Type type)
-                       {
-                               return m_genlist->prepend(itc, data, nullptr, type, parent);
-                       });
-       }
-
-       Result ListPresenter::insertAfter(const ListItemPresenter &after,
-                       ListItemPresenter &itemPresenter,
-                               ListItemPresenter *parent)
-       {
-               return insertRelative(after, itemPresenter, parent,
-                       [this](GenlistItem rel, const Elm_Genlist_Item_Class *itc,
-                               const void *data, GenlistItem parent, GenlistItem::Type type)
-                       {
-                               return m_genlist->insertAfter(
-                                               rel, itc, data, nullptr, type, parent);
-                       });
-       }
-
-       Result ListPresenter::insertBefore(const ListItemPresenter &before,
-                       ListItemPresenter &itemPresenter,
-                               ListItemPresenter *parent)
-       {
-               return insertRelative(before, itemPresenter, parent,
-                       [this](GenlistItem rel, const Elm_Genlist_Item_Class *itc,
-                               const void *data, GenlistItem parent, GenlistItem::Type type)
-                       {
-                               return m_genlist->insertBefore(
-                                               rel, itc, data, nullptr, type, parent);
-                       });
-       }
-
-       template <class INSERT_FUNC>
-       Result ListPresenter::insert(ListItemPresenter &itemPresenter,
-                       ListItemPresenter *parent, INSERT_FUNC &&insertFunc)
-       {
-               const auto params = itemPresenter.getItemInsertionParams();
-
-               const auto itc = m_itcCache->getItemClass(params.itemStyle);
-               if (!itc) {
-                       LOG_RETURN(RES_FAIL, "m_itcCache.getItemClass() failed!");
-               }
-
-               GenlistItem parentItem;
-               if (parent) {
-                       parentItem = parent->m_item;
-                       if (!parentItem) {
-                               ELOG("parentItem is NULL");
-                       }
-               }
-
-               const auto item = insertFunc(itc->get(),
-                               &itemPresenter, parentItem, params.itemType);
-               if (!item) {
-                       LOG_RETURN(RES_FAIL, "insertFunc() failed!");
-               }
-
-               itemPresenter.attachItem(item, m_itcCache, m_isActiveRef);
-
-               return RES_OK;
-       }
-
-       template <class INSERT_FUNC>
-       Result ListPresenter::insertRelative(const ListItemPresenter &relative,
-                       ListItemPresenter &itemPresenter, ListItemPresenter *parent,
-                       INSERT_FUNC &&insertFunc)
-       {
-               const auto relItem = relative.m_item;
-               if (!relItem) {
-                       LOG_RETURN(RES_FAIL, "relItem is NULL!");
-               }
-               if (relItem.getWidget() != m_genlist->getEo()) {
-                       LOG_RETURN(RES_FAIL, "relItem has wrong genlist!");
-               }
-               return insert(itemPresenter, parent,
-                       [relItem, &insertFunc](const Elm_Genlist_Item_Class *itc,
-                               const void *data, GenlistItem parent, GenlistItem::Type type)
-                       {
-                               return insertFunc(relItem, itc, data, parent, type);
-                       });
-       }
-
-       void ListPresenter::setIsActiveRef(const bool value)
-       {
-               if (!m_isActiveRef) {
-                       LOG_RETURN_VOID(RES_FATAL, "m_isActiveRef is NULL");
-               }
-               *m_isActiveRef = value;
-       }
-
-       void ListPresenter::onItemSelected(Widget &widget, void *eventInfo)
-       {
-               const auto itemPresenter = impl::toItemPresenter(eventInfo);
-               if (!itemPresenter) {
-                       LOG_RETURN_VOID(RES_FATAL, "itemPresenter is NULL");
-               }
-               itemPresenter->onItemSelectedHook();
-       }
-
-       void ListPresenter::onItemRealized(Widget &widget, void *eventInfo)
-       {
-               const auto itemPresenter = impl::toItemPresenter(eventInfo);
-               if (!itemPresenter) {
-                       LOG_RETURN_VOID(RES_FATAL, "itemPresenter is NULL");
-               }
-               itemPresenter->onItemRealized();
-       }
-
-       void ListPresenter::onItemUnrealized(Widget &widget, void *eventInfo)
-       {
-               const auto itemPresenter = impl::toItemPresenter(eventInfo);
-               if (!itemPresenter) {
-                       LOG_RETURN_VOID(RES_FATAL, "itemPresenter is NULL");
-               }
-               itemPresenter->onItemUnrealized();
-       }
-
-       void ListPresenter::onItemHighlighted(Widget &widget, void *eventInfo)
-       {
-               const auto itemPresenter = impl::toItemPresenter(eventInfo);
-               if (!itemPresenter) {
-                       LOG_RETURN_VOID(RES_FATAL, "itemPresenter is NULL");
-               }
-               itemPresenter->onItemHighlighted();
-       }
-
-       void ListPresenter::onItemUnhighlighted(Widget &widget, void *eventInfo)
-       {
-               const auto itemPresenter = impl::toItemPresenter(eventInfo);
-               if (!itemPresenter) {
-                       LOG_RETURN_VOID(RES_FATAL, "itemPresenter is NULL");
-               }
-               itemPresenter->onItemUnhighlighted();
-       }
-
-       void ListPresenter::onActivate()
-       {
-               setIsActiveRef(true);
-       }
-
-       void ListPresenter::onDeactivate()
-       {
-               setIsActiveRef(false);
-       }
-}
diff --git a/ucl/src/mvp/common.h b/ucl/src/mvp/common.h
deleted file mode 100644 (file)
index 2894a14..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 __UCL_MVP_COMMON_H__
-#define __UCL_MVP_COMMON_H__
-
-#include "../common.h"
-
-#endif // __UCL_MVP_COMMON_H__
diff --git a/ucl/src/util/logging.cpp b/ucl/src/util/logging.cpp
deleted file mode 100644 (file)
index 311f25b..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 "ucl/util/logging.h"
-
-#if (UCL_DEFINE_GET_UCL_RESULT_DATA)
-#include "ucl/util/types/Result.h"
-
-ucl::ResultData getUCLResultData(const ucl::Result result)
-{
-       return ucl::getResultData(result);
-}
-#endif
diff --git a/ucl/src/util/types/Result.cpp b/ucl/src/util/types/Result.cpp
deleted file mode 100644 (file)
index b42875e..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * 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 "ucl/util/types/Result.h"
-
-#include "ucl/util/logging.h"
-
-namespace ucl { namespace { namespace impl {
-
-       constexpr ResultData RESUT_DATA[] = {
-               {"RES_FATAL",             DLOG_FATAL},
-               {"RES_INVALID_DATA",      DLOG_ERROR},
-               {"RES_NOT_SUPPORTED",     DLOG_ERROR},
-               {"RES_IO_ERROR",          DLOG_ERROR},
-               {"RES_OUT_OF_MEMORY",     DLOG_ERROR},
-               {"RES_ILLEGAL_STATE",     DLOG_ERROR},
-               {"RES_INVALID_ARGUMENTS", DLOG_ERROR},
-               {"RES_FAIL",              DLOG_ERROR},
-               {"RES_OK",                DLOG_INFO},
-               {"RES_FALSE",             DLOG_INFO},
-               {"Unknown result value",  DLOG_ERROR},
-       };
-}}}
-
-namespace ucl {
-
-       const ResultData &getResultData(const Result result)
-       {
-               return impl::RESUT_DATA[
-                       ((result.value < _RES_BEGIN) || (result.value >= _RES_END)) ?
-                               _RES_END : (result.value - _RES_BEGIN)];
-       }
-}