TizenRefApp-8724 [Call UI] Update UCL 48/135148/1
authorIgor Olshevskyi <i.olshevskyi@samsung.com>
Tue, 20 Jun 2017 05:16:43 +0000 (08:16 +0300)
committerIgor Olshevskyi <i.olshevskyi@samsung.com>
Wed, 21 Jun 2017 05:38:11 +0000 (08:38 +0300)
Change-Id: I1eb63b28a6203b3ce6b19724fa8e71903d645eec

129 files changed:
.cproject
inc/model/IBaseCallInfo.h
inc/presenters/AcceptDialog.h
inc/presenters/AcceptRejectPresenter.h
inc/presenters/AccessoryPresenter.h
inc/presenters/CallInfoPresenter.h
inc/presenters/CallStatus.h
inc/presenters/DeviceStatePresenter.h
inc/presenters/Indicator.h
inc/presenters/Instance.h
inc/presenters/KeypadPage.h
inc/presenters/MainPage.h
inc/presenters/MoreOptionsPresenter.h
inc/presenters/Page.h
inc/presenters/Presenter.h
inc/presenters/RejectMsgPresenter.h
inc/view/Slider.h
inc/view/VolumeControl.h
src/model/ActiveCall.cpp
src/model/ActiveCall.h
src/model/BatteryStateSource.h
src/model/BluetoothVolume.h
src/model/Call.cpp
src/model/Call.h
src/model/CallClient.h
src/model/CallInfo.cpp
src/model/CallInfo.h
src/model/CallManager.cpp
src/model/CallManager.h
src/model/ConferenceCallInfo.cpp
src/model/ConferenceCallInfo.h
src/model/ConnectionStateSource.h
src/model/ContactInfo.h
src/model/ContactInfoProvider.h
src/model/EndCall.cpp
src/model/EndCall.h
src/model/HeldCall.cpp
src/model/HeldCall.h
src/model/IncomingCall.cpp
src/model/IncomingCall.h
src/model/IndicatorStateProvider.cpp
src/model/IndicatorStateProvider.h
src/model/MsgClient.h
src/model/RejectMsg.cpp
src/model/RejectMsg.h
src/model/RejectMsgProvider.h
src/model/RssiStateSource.h
src/model/SoundManager.cpp
src/model/SoundManager.h
src/model/implTypes.h
src/presenters/AcceptDialog.cpp
src/presenters/AcceptRejectPresenter.cpp
src/presenters/AccessoryPresenter.cpp
src/presenters/CallInfoPresenter.cpp
src/presenters/CallStatus.cpp
src/presenters/DeviceStatePresenter.cpp
src/presenters/Indicator.cpp
src/presenters/Instance.cpp
src/presenters/KeypadPage.cpp
src/presenters/MainPage.cpp
src/presenters/MoreOptionsPresenter.cpp
src/presenters/Page.cpp
src/presenters/Presenter.cpp
src/presenters/RejectMsgPresenter.cpp
src/view/Slider.cpp
src/view/VolumeControl.cpp
ucl/inc/ucl/appfw/SysEventProvider.h
ucl/inc/ucl/appfw/SysEventProvider.hpp
ucl/inc/ucl/appfw/types.h
ucl/inc/ucl/gui/EdjeWidget.h
ucl/inc/ucl/gui/EdjeWidget.hpp
ucl/inc/ucl/gui/ElmWidget.h
ucl/inc/ucl/gui/ElmWidget.hpp
ucl/inc/ucl/gui/Layout.h
ucl/inc/ucl/gui/Naviframe.h
ucl/inc/ucl/gui/StyledWidget.h
ucl/inc/ucl/gui/Widget.h
ucl/inc/ucl/gui/Window.h
ucl/inc/ucl/gui/Window.hpp
ucl/inc/ucl/gui/types.h
ucl/inc/ucl/misc/AutoHandle.h [new file with mode: 0644]
ucl/inc/ucl/misc/Event.hpp
ucl/inc/ucl/misc/RefCountAware.h
ucl/inc/ucl/misc/RefCountAware.hpp
ucl/inc/ucl/misc/Timeout.h [new file with mode: 0644]
ucl/inc/ucl/misc/smartDelegation.h [deleted file]
ucl/inc/ucl/misc/smartDelegation/WeakDelegate.h [deleted file]
ucl/inc/ucl/misc/smartDelegation/WeakDelegate.hpp [deleted file]
ucl/inc/ucl/misc/smartDelegation/macro.h [deleted file]
ucl/inc/ucl/misc/smartDelegation/shortMacro.h [deleted file]
ucl/inc/ucl/util/delegation/BaseDelegate.h
ucl/inc/ucl/util/delegation/BaseDelegate.hpp
ucl/inc/ucl/util/delegation/Delegate.h
ucl/inc/ucl/util/delegation/Delegate.hpp
ucl/inc/ucl/util/delegation/Delegate2.h
ucl/inc/ucl/util/delegation/Delegate2.hpp
ucl/inc/ucl/util/delegation/helpers.h
ucl/inc/ucl/util/memory.h
ucl/inc/ucl/util/memory/BaseRef.h
ucl/inc/ucl/util/memory/BaseRef.hpp
ucl/inc/ucl/util/memory/IRefCountObj.h [new file with mode: 0644]
ucl/inc/ucl/util/memory/RefCountObj.h
ucl/inc/ucl/util/memory/RefCountObj.hpp
ucl/inc/ucl/util/memory/RefCountObjBase.h [deleted file]
ucl/inc/ucl/util/memory/RefCountObjBase.hpp [deleted file]
ucl/inc/ucl/util/memory/RefCounterMT.h [new file with mode: 0644]
ucl/inc/ucl/util/memory/RefCounterMT.hpp [new file with mode: 0644]
ucl/inc/ucl/util/memory/RefCounterST.h [new file with mode: 0644]
ucl/inc/ucl/util/memory/RefCounterST.hpp [new file with mode: 0644]
ucl/inc/ucl/util/memory/ReffedObj.h [new file with mode: 0644]
ucl/inc/ucl/util/memory/ReffedObj.hpp [new file with mode: 0644]
ucl/inc/ucl/util/memory/SharedRef.h
ucl/inc/ucl/util/memory/SharedRef.hpp
ucl/inc/ucl/util/memory/WeakRef.h
ucl/inc/ucl/util/memory/WeakRef.hpp
ucl/inc/ucl/util/memory/helpers.h
ucl/inc/ucl/util/memory/macro.h
ucl/inc/ucl/util/smartDelegation.h [new file with mode: 0644]
ucl/inc/ucl/util/smartDelegation/WeakDelegate.h [new file with mode: 0644]
ucl/inc/ucl/util/smartDelegation/WeakDelegate.hpp [new file with mode: 0644]
ucl/inc/ucl/util/smartDelegation/macro.h [new file with mode: 0644]
ucl/inc/ucl/util/smartDelegation/shortMacro.h [new file with mode: 0644]
ucl/inc/ucl/util/types/baseTypes.h
ucl/inc/ucl/util/types/classTypes.h
ucl/src/common.h
ucl/src/gui/ElmWidget.cpp
ucl/src/gui/Naviframe.cpp
ucl/src/gui/Widget.cpp
ucl/src/misc/Timeout.cpp [new file with mode: 0644]

index c3ed9e8e42a9d723a6dfbe910daaa1abc9bb2755..c8bc4cf69153776f2fd68237f7531e397c19ebd0 100644 (file)
--- a/.cproject
+++ b/.cproject
                                                        <targetPlatform binaryParser="org.eclipse.cdt.core.ELF" id="org.tizen.nativeide.target.sbi.gnu.platform.base.299151930" osList="linux,win32" superClass="org.tizen.nativeide.target.sbi.gnu.platform.base"/>
                                                        <builder autoBuildTarget="all" buildPath="${workspace_loc:/call-ui}/Debug" enableAutoBuild="true" id="org.tizen.nativecore.target.sbi.gnu.builder.287909858" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Tizen Application Builder" superClass="org.tizen.nativecore.target.sbi.gnu.builder"/>
                                                        <tool id="org.tizen.nativecore.tool.sbi.gnu.archiver.850939844" name="Archiver" superClass="org.tizen.nativecore.tool.sbi.gnu.archiver"/>
-                                                       <tool command="i386-linux-gnueabi-g++" id="org.tizen.nativecore.tool.sbi.gnu.cpp.compiler.66050065" name="C++ Compiler" superClass="org.tizen.nativecore.tool.sbi.gnu.cpp.compiler">
+                                                       <tool command="clang++" id="org.tizen.nativecore.tool.sbi.gnu.cpp.compiler.66050065" name="C++ Compiler" superClass="org.tizen.nativecore.tool.sbi.gnu.cpp.compiler">
                                                                <option id="gnu.cpp.compiler.option.optimization.level.1977572256" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
                                                                <option defaultValue="gnu.cpp.compiler.debugging.level.max" id="sbi.gnu.cpp.compiler.option.debugging.level.core.1003532466" name="Debug level" superClass="sbi.gnu.cpp.compiler.option.debugging.level.core" valueType="enumerated"/>
                                                                <option defaultValue="false" id="sbi.gnu.cpp.compiler.option.misc.pic.core.58197076" name="-fPIC option" superClass="sbi.gnu.cpp.compiler.option.misc.pic.core" valueType="boolean"/>
                                                                <option id="sbi.gnu.cpp.compiler.option.1780411914" name="Tizen-Target" superClass="sbi.gnu.cpp.compiler.option" valueType="userObjs">
-                                                                       <listOptionValue builtIn="false" value="wearable-4.0-emulator.core.private_gcc49.i386.core.app"/>
+                                                                       <listOptionValue builtIn="false" value="wearable-4.0-emulator.core.private_llvm40.i386.core.app"/>
                                                                </option>
                                                                <option id="sbi.gnu.cpp.compiler.option.frameworks_inc.core.2060575755" name="Tizen-Frameworks-Include-Path" superClass="sbi.gnu.cpp.compiler.option.frameworks_inc.core" valueType="includePath">
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/libxml2&quot;"/>
                                                                </option>
                                                                <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.27127097" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
                                                        </tool>
-                                                       <tool command="i386-linux-gnueabi-gcc" id="org.tizen.nativecore.tool.sbi.gnu.c.compiler.1049599195" name="C Compiler" superClass="org.tizen.nativecore.tool.sbi.gnu.c.compiler">
+                                                       <tool command="clang" id="org.tizen.nativecore.tool.sbi.gnu.c.compiler.1049599195" name="C Compiler" superClass="org.tizen.nativecore.tool.sbi.gnu.c.compiler">
                                                                <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.option.optimization.level.1400861396" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" valueType="enumerated"/>
                                                                <option defaultValue="gnu.c.debugging.level.max" id="sbi.gnu.c.compiler.option.debugging.level.core.1157370620" name="Debug level" superClass="sbi.gnu.c.compiler.option.debugging.level.core" valueType="enumerated"/>
                                                                <option defaultValue="false" id="sbi.gnu.c.compiler.option.misc.pic.core.1654013693" name="-fPIC option" superClass="sbi.gnu.c.compiler.option.misc.pic.core" valueType="boolean"/>
                                                                <option id="sbi.gnu.c.compiler.option.551225658" name="Tizen-Target" superClass="sbi.gnu.c.compiler.option" valueType="userObjs">
-                                                                       <listOptionValue builtIn="false" value="wearable-4.0-emulator.core.private_gcc49.i386.core.app"/>
+                                                                       <listOptionValue builtIn="false" value="wearable-4.0-emulator.core.private_llvm40.i386.core.app"/>
                                                                </option>
                                                                <option id="sbi.gnu.c.compiler.option.frameworks_inc.core.1481628386" name="Tizen-Frameworks-Include-Path" superClass="sbi.gnu.c.compiler.option.frameworks_inc.core" valueType="includePath">
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/libxml2&quot;"/>
                                                                <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.890993403" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
                                                        </tool>
                                                        <tool id="org.tizen.nativeide.tool.sbi.gnu.c.linker.base.1743186514" name="C Linker" superClass="org.tizen.nativeide.tool.sbi.gnu.c.linker.base"/>
-                                                       <tool command="i386-linux-gnueabi-g++" id="org.tizen.nativecore.tool.sbi.gnu.cpp.linker.1743878166" name="C++ Linker" superClass="org.tizen.nativecore.tool.sbi.gnu.cpp.linker">
+                                                       <tool command="clang++" id="org.tizen.nativecore.tool.sbi.gnu.cpp.linker.1743878166" name="C++ Linker" superClass="org.tizen.nativecore.tool.sbi.gnu.cpp.linker">
                                                                <option defaultValue="false" id="sbi.gnu.cpp.linker.option.shared_flag.core.1017885244" name="Linker.Shared" superClass="sbi.gnu.cpp.linker.option.shared_flag.core" valueType="boolean"/>
                                                                <option defaultValue="false" id="sbi.gnu.cpp.linker.option.noundefined.core.219138009" name="Report unresolved symbol references (-Wl,--no-undefined)" superClass="sbi.gnu.cpp.linker.option.noundefined.core" valueType="boolean"/>
                                                                <option id="sbi.gnu.cpp.linker.option.frameworks_lflags.core.588492684" name="Tizen-Frameworks-Other-Lflags" superClass="sbi.gnu.cpp.linker.option.frameworks_lflags.core" valueType="stringList">
index f369898ad5f00d1da38a31d4f1de409603c16eed..3d1dd6a03f38baa33c38b90bd6c4537627941fa2 100644 (file)
@@ -25,7 +25,7 @@ namespace callui {
        public:
                virtual unsigned int getCallId() const = 0;
                virtual const std::string &getPhoneNumber() const = 0;
-               virtual IContactInfoWCRef getContactInfo() const = 0;
+               virtual IContactInfoSCRef getContactInfo() const = 0;
        };
 
 }
index 1e33326302d057f6c809de13f2c1c733fb1b24ae..cdbd4d1f413a666eefc598d1a338188f4b653d8d 100644 (file)
@@ -51,8 +51,8 @@ namespace callui {
                virtual bool isDisposed() const final override;
 
        private:
-               friend class ucl::RefCountObj<AcceptDialog>;
-               AcceptDialog(ucl::RefCountObjBase &rc,
+               friend class ucl::ReffedObj<AcceptDialog>;
+               AcceptDialog(ucl::IRefCountObj &rc,
                                const AcceptDialogHandler &handler);
 
                ucl::Result prepare(ucl::ElmWidget &parent);
index 31eae7fa06ae5a230afec6912a69092d24f38ca4..4adf6c654061b004de1dd89bdf82e1fbe16307a8 100644 (file)
@@ -49,8 +49,8 @@ namespace callui {
                void update(CallMask calls);
 
        private:
-               friend class ucl::RefCountObj<AcceptRejectPresenter>;
-               AcceptRejectPresenter(ucl::RefCountObjBase &rc,
+               friend class ucl::ReffedObj<AcceptRejectPresenter>;
+               AcceptRejectPresenter(ucl::IRefCountObj &rc,
                                const IIncomingCallSRef &call,
                                CallMask calls);
 
index 92f0f8eb7e6e9b002cbb439fa2ab3ec5768df32f..4810532d8eac76e6e9a085a0675d8a680bd0fd1b 100644 (file)
@@ -48,8 +48,8 @@ namespace callui {
                void setMuteControlDisabled(bool isDisabled);
 
        private:
-               friend class ucl::RefCountObj<AccessoryPresenter>;
-               AccessoryPresenter(ucl::RefCountObjBase &rc,
+               friend class ucl::ReffedObj<AccessoryPresenter>;
+               AccessoryPresenter(ucl::IRefCountObj &rc,
                                const ISoundManagerSRef &sm);
 
                ucl::Result prepare(ucl::ElmWidget &parent, bool isMuteControlDisabled = false);
index 9bdacc93a486c52a119947936e6f293a30ca703b..2c203d32f46c28095769f5c269d0d9b0c989ffc7 100644 (file)
@@ -48,8 +48,8 @@ namespace callui {
                ucl::Result update(CallMode mode, const ICallManagerSRef &cm);
 
        private:
-               friend class ucl::RefCountObj<CallInfoPresenter>;
-               CallInfoPresenter(ucl::RefCountObjBase &rc,
+               friend class ucl::ReffedObj<CallInfoPresenter>;
+               CallInfoPresenter(ucl::IRefCountObj &rc,
                                const ICallManagerSRef &cm,
                                CallMode mode);
 
index bd008815fcc4052140cad534883a3612f5228f23..b3158a4cf21b84009431443bc218745befe7064a 100644 (file)
@@ -48,8 +48,8 @@ namespace callui {
                virtual ~CallStatus();
 
        private:
-               friend class ucl::RefCountObj<CallStatus>;
-               CallStatus(ucl::RefCountObjBase &rc,
+               friend class ucl::ReffedObj<CallStatus>;
+               CallStatus(ucl::IRefCountObj &rc,
                                const ucl::LayoutSRef &layout,
                                CallMode mode,
                                const ICallInfoWCRef &info,
index 2cabe9cbddeeda3c8988928e4678a833598be854..217ddb20aa0d228c285a673f61c4883b30e0f12f 100644 (file)
@@ -46,9 +46,8 @@ namespace callui {
                ucl::Result setCpuLockState(bool lockState);
 
        private:
-               friend class ucl::RefCountObj<DeviceStatePresenter>;
-               DeviceStatePresenter(ucl::RefCountObjBase &rc,
-                               const ucl::WindowSRef &window);
+               friend class ucl::ReffedObj<DeviceStatePresenter>;
+               DeviceStatePresenter(const ucl::WindowSRef &window);
                ~DeviceStatePresenter() = default;
 
                ucl::Result prepare(DisplayState state,
index ed9843237c53806b111d09622ebab70516cb7a4f..232ed0c3e648c6b8715b00d2c442bec2f5267a64 100644 (file)
@@ -47,8 +47,8 @@ namespace callui {
                ucl::Widget &getWidget();
 
        private:
-               friend class ucl::RefCountObj<Indicator>;
-               Indicator(ucl::RefCountObjBase &rc,
+               friend class ucl::ReffedObj<Indicator>;
+               Indicator(ucl::IRefCountObj &rc,
                                const IIndicatorStateProviderSRef &provider);
 
                ucl::Result prepare(ucl::ElmWidget &parent);
index 66c2ecf1960a61dbe70c35aa92b9cd7199370348..ea8afab0a1dbfebd67cb386044495a2b25c1d47a 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "ucl/appfw/IInstance.h"
 #include "ucl/appfw/IInstanceAppControlExt.h"
+#include "ucl/appfw/SysEventProvider.h"
 
 #include "ucl/gui/Theme.h"
 #include "ucl/gui/Naviframe.h"
 
 namespace callui {
 
-       class Instance :
+       class Instance final : public ucl::RefCountAware,
                        public ucl::IInstance,
                        public ucl::IInstanceAppControlExt {
        public:
-               Instance(ucl::SysEventProvider &sysEventProvider);
+               Instance(ucl::IRefCountObj &rc,
+                               ucl::SysEventProvider &sysEventProvider);
                virtual ~Instance();
 
                // IInstance //
index 50e859ad5eb49a68fc659dd5e784a6f8b088120b..187fa8ed1055fdad7907196184c23101823fedb9 100644 (file)
@@ -38,8 +38,8 @@ namespace callui {
                };
 
        private:
-               friend class ucl::RefCountObj<KeypadPage>;
-               KeypadPage(ucl::RefCountObjBase &rc,
+               friend class ucl::ReffedObj<KeypadPage>;
+               KeypadPage(ucl::IRefCountObj &rc,
                                const ucl::NaviframeSRef &navi,
                                const ExitRequestHandler onExitRequest);
                virtual ~KeypadPage();
index 66b3f39907beffe37cf9c1b82c56609ef0a6203a..0ac969ecca9fc01abba9085b4cb25d768c5257d4 100644 (file)
@@ -43,8 +43,8 @@ namespace callui {
                };
 
        private:
-               friend class ucl::RefCountObj<MainPage>;
-               MainPage(ucl::RefCountObjBase &rc,
+               friend class ucl::ReffedObj<MainPage>;
+               MainPage(ucl::IRefCountObj &rc,
                                const ucl::NaviframeSRef &navi,
                                const ExitRequestHandler handler,
                                const ICallSRef &call);
index b574a312460d6a8180270a1d82cdce94bc1b2584..62d3bd2d7d407fe0878557c4aa2374fc19847421 100644 (file)
@@ -49,8 +49,8 @@ namespace callui {
                void update();
 
        private:
-               friend class ucl::RefCountObj<MoreOptionsPresenter>;
-               MoreOptionsPresenter(ucl::RefCountObjBase &rc,
+               friend class ucl::ReffedObj<MoreOptionsPresenter>;
+               MoreOptionsPresenter(ucl::IRefCountObj &rc,
                                const ICallManagerSRef &cm,
                                const ISoundManagerSRef &sm,
                                const ucl::NaviframeSRef &navi);
@@ -119,7 +119,7 @@ namespace callui {
 
                ICallManagerSRef m_cm;
                ISoundManagerSRef m_sm;
-               ucl::NaviframeWRef m_navi;
+               ucl::NaviframeSRef m_navi;
 
                ICallInfoWCRef m_info;
 
index 1d6b37ec634707b523b7cfe7853b0142fe39060f..8dfdc770b7594413f72e6bbe37eda7d188c962b0 100644 (file)
@@ -47,7 +47,7 @@ namespace callui {
                ucl::NaviItem insertBefore(ARGS &&...args);
 
        protected:
-               Page(ucl::RefCountObjBase &rc, const ucl::NaviframeSRef &navi,
+               Page(ucl::IRefCountObj &rc, const ucl::NaviframeSRef &navi,
                                ExitRequestHandler onExitRequest);
                virtual ~Page();
 
index d67e25da15fbf90c170953a41d7a279396490120..c3db2f4e3f16ab1b6bdc310aa9e37680fdae0986 100644 (file)
@@ -40,7 +40,7 @@ namespace callui {
                void deactivateBy(void *deactivator);
 
        protected:
-               Presenter(ucl::RefCountObjBase &rc);
+               Presenter(ucl::IRefCountObj &rc);
                virtual ~Presenter();
 
                ucl::Result prepare(ucl::ElmWidget &widget);
index 4a454ee1396e44fda5df5894aae7de429736f1f4..03eacbd1e81e7fe9357e5d20b5a8a9a2bf212cb3 100644 (file)
@@ -59,8 +59,8 @@ namespace callui {
                class RejectMsgItem;
 
        private:
-               friend class ucl::RefCountObj<RejectMsgPresenter>;
-               RejectMsgPresenter(ucl::RefCountObjBase &rc,
+               friend class ucl::ReffedObj<RejectMsgPresenter>;
+               RejectMsgPresenter(ucl::IRefCountObj &rc,
                                const IRejectMsgProviderSRef &provider,
                                const RejectMsgStateHandler &stateHandler,
                                const RejectMsgSelectHandler &selectHandler);
index ce63711ff0cc7944a966c7dd951c0b735305d1d3..58ef7cc2450aa6a445d84adbb6fb2f862001ca5f 100644 (file)
@@ -42,8 +42,8 @@ namespace callui {
                virtual void setMaxValue(int maxValue);
 
        protected:
-               friend class ucl::RefCountObj<Slider>;
-               Slider(ucl::RefCountObjBase &rc,
+               friend class ucl::ReffedObj<Slider>;
+               Slider(ucl::IRefCountObj &rc,
                                const ucl::LayoutSRef &layout,
                                int maxValue,
                                int curValue);
@@ -53,7 +53,7 @@ namespace callui {
                void prepare(int maxValue, int curValue);
 
        protected:
-               ucl::LayoutWRef m_layout;
+               ucl::Layout *m_layout;
                ucl::Layout m_circleLy;
                Eext_Circle_Surface *m_circleSurf;
                ucl::ElmWidget m_slider;
index 52dd3502eb46b6a98fc2a6aa0d4d4e8ebc8f3d1b..d8299d403b1aadd711257fbda03fc489be141537 100644 (file)
@@ -17,7 +17,8 @@
 #ifndef __CALLUI_VIEW_VOLUME_CONTROL_H__
 #define __CALLUI_VIEW_VOLUME_CONTROL_H__
 
-#include <view/Slider.h>
+#include "view/Slider.h"
+
 #include "ucl/gui/StyledWidget.h"
 #include "ucl/gui/Layout.h"
 
@@ -54,8 +55,8 @@ namespace callui {
                virtual void setValue(int value) override final;
 
        private:
-               friend class ucl::RefCountObj<VolumeControl>;
-               VolumeControl(ucl::RefCountObjBase &rc,
+               friend class ucl::ReffedObj<VolumeControl>;
+               VolumeControl(ucl::IRefCountObj &rc,
                                const ucl::LayoutSRef &layout,
                                const ucl::TString &info,
                                int maxValue,
index ba4bbdf8c17875f0720ac9d6ac5ffdb5d9514d25..7e19f9447a125da146649775b3375e0a4820cf5e 100644 (file)
@@ -55,9 +55,14 @@ namespace callui {
 
        Result ActiveCall::prepare(cm_call_data_h callData)
        {
-               m_callInfo = CallInfo::newInstance(m_cm->getCallClient(),
+               const auto cm = m_cm.lock();
+               if (!cm) {
+                       LOG_RETURN(RES_FAIL, "Call Manager is NULL");
+               }
+
+               m_callInfo = CallInfo::newInstance(cm->getCallClient(),
                                callData,
-                               m_cm->getContactInfoProvider());
+                               cm->getContactInfoProvider());
                if (!m_callInfo) {
                        LOG_RETURN_VALUE(RES_FAIL, RES_FAIL, "CallInfo::newInstance() failed!");
                }
@@ -83,31 +88,35 @@ namespace callui {
 
        Result ActiveCall::hold()
        {
-               if (!m_cm) {
+               const auto cm = m_cm.lock();
+               if (!cm) {
                        LOG_RETURN(RES_FAIL, "Call Manager is NULL");
                }
-               return convertCMResult(cm_hold_call(m_cm->getCallClient()));
+
+               return convertCMResult(cm_hold_call(cm->getCallClient()));
        }
 
        Result ActiveCall::end()
        {
-               if (!m_cm) {
+               const auto cm = m_cm.lock();
+               if (!cm) {
                        LOG_RETURN(RES_FAIL, "Call Manager is NULL");
                }
 
                if (m_isDialing) {
-                       return m_cm->endCall(m_callInfo->getCallId(),
+                       return cm->endCall(m_callInfo->getCallId(),
                                        CallReleaseType::BY_CALL_HANDLE);
                }
-               return m_cm->endCall(0, CallReleaseType::ALL_ACTIVE);
+               return cm->endCall(0, CallReleaseType::ALL_ACTIVE);
        }
 
        Result ActiveCall::split(const IConferenceCallInfoSCRef &confCallInfo)
        {
-               if (!m_cm) {
+               const auto cm = m_cm.lock();
+               if (!cm) {
                        LOG_RETURN(RES_FAIL, "Call Manager is NULL");
                }
-               return m_cm->splitCalls(m_callInfo, confCallInfo);
+               return cm->splitCalls(m_callInfo, confCallInfo);
        }
 
 }
index bbdd3f42cf862095f8dcbe5b6ab5b97c9098a5d3..ee2e22e2066066bc8ad890101e377f8796c808e9 100644 (file)
@@ -39,7 +39,7 @@ namespace callui {
                virtual ucl::Result split(const IConferenceCallInfoSCRef &confCallInfo) override final;
 
        private:
-               friend class ucl::RefCountObj<ActiveCall>;
+               friend class ucl::ReffedObj<ActiveCall>;
                ActiveCall(CallManagerWRef cm, cm_call_data_h callData);
 
                ucl::Result prepare(cm_call_data_h callData);
index 7e252aea2de3999065d10298b3170e1a76073ad6..4506e566dd3fe33573b393ebb252eedcf53d3258 100644 (file)
@@ -36,7 +36,7 @@ namespace callui {
                virtual void setStateChangeHandler(StateChangeHandler handler) override final;
 
        private:
-               friend class ucl::RefCountObj<BatteryStateSource>;
+               friend class ucl::ReffedObj<BatteryStateSource>;
                BatteryStateSource();
 
                ucl::Result prepare();
index 95e6d7a5ed208ce60048e7e893cf2361dbc28d4a..6be854fb6e62f53c173fd20b67faace5bdd54de6 100644 (file)
@@ -32,7 +32,7 @@ namespace callui {
                void setVolumeStateHandler(const BluetoothVolumeHandler &handler);
 
        private:
-               friend class ucl::RefCountObj<BluetoothVolume>;
+               friend class ucl::ReffedObj<BluetoothVolume>;
                BluetoothVolume();
                ~BluetoothVolume();
 
index a54f03aa13854f128b040157ff3e8d0f55a9bc24..dce95a00494787087a46e97e68884f481fac80ab 100644 (file)
@@ -41,7 +41,7 @@ namespace callui {
 
        using namespace ucl;
 
-       Call::Call(RefCountObjBase &rc):
+       Call::Call(IRefCountObj &rc):
                        RefCountAware(&rc)
        {
        }
@@ -263,8 +263,8 @@ namespace callui {
                updateSimSlotStateSource();
                updateHdVoiceStateSource();
 
-               if (m_listener) {
-                       m_listener->onCallEvent(type);
+               if (const auto listener = m_listener.lock()) {
+                       listener->onCallEvent(type);
                }
        }
 
@@ -283,8 +283,8 @@ namespace callui {
                        break;
                }
 
-               if (m_listener) {
-                       m_listener->onError(callErr);
+               if (const auto listener = m_listener.lock()) {
+                       listener->onError(callErr);
                }
        }
 
index ff5a4061e6613b2d0958927c364825eb17ea1065..4459f54312bbce0917b07375c0bc91a29f40a683 100644 (file)
@@ -51,8 +51,8 @@ namespace callui {
 
        private:
                friend class CallBuilder;
-               friend class ucl::RefCountObj<Call>;
-               Call(ucl::RefCountObjBase &rc);
+               friend class ucl::ReffedObj<Call>;
+               Call(ucl::IRefCountObj &rc);
 
                ucl::Result prepare();
 
index 2e83d87fd5e956299d31ac60e8de58ff326105ff..6a375ae7a2e7d06394027dea95d755f14f563b01 100644 (file)
@@ -31,7 +31,7 @@ namespace callui {
                operator cm_client_h() const;
 
        private:
-               friend class ucl::RefCountObj<CallClient>;
+               friend class ucl::ReffedObj<CallClient>;
                CallClient();
                ucl::Result prepare();
 
index 3a52533604ed39e282219b1727d6d81fb69aec5c..2f7a1d33d4804e0a1b4da098a27ea2bc530f8f67 100644 (file)
@@ -201,7 +201,7 @@ namespace callui {
                return m_phoneNum;
        }
 
-       IContactInfoWCRef CallInfo::getContactInfo() const
+       IContactInfoSCRef CallInfo::getContactInfo() const
        {
                return m_contactInfo;
        }
index 835f8e1cc54e9699c2c70764c353edab77086c7d..345a6f732582c57657cd0cdbc5a503b1896e3992 100644 (file)
@@ -36,7 +36,7 @@ namespace callui {
 
                virtual unsigned int getCallId() const override final;
                virtual const std::string &getPhoneNumber() const override final;
-               virtual IContactInfoWCRef getContactInfo() const override final;
+               virtual IContactInfoSCRef getContactInfo() const override final;
                virtual struct tm getDuration() const override final;
                virtual bool isEmergency() const override final;
                virtual bool isHDVoice() const override final;
@@ -46,7 +46,7 @@ namespace callui {
                virtual const ConfMemberList &getConferenceMemberList() const override final;
 
        private:
-               friend class ucl::RefCountObj<CallInfo>;
+               friend class ucl::ReffedObj<CallInfo>;
                CallInfo();
 
                ucl::Result prepare(CallClient &client,
index c3de082347af2011300b66f75fa1f95a31ff44b9..069162a45de2323cf033165973b1809021d88ae8 100644 (file)
@@ -42,7 +42,7 @@ namespace callui {
 
        using namespace ucl;
 
-       CallManager::CallManager(RefCountObjBase &rc,
+       CallManager::CallManager(IRefCountObj &rc,
                const CallClientSRef &callClient,
                ICallManagerListenerWRef listener):
                        RefCountAware(&rc),
@@ -371,8 +371,8 @@ namespace callui {
                        return;
                }
 
-               if (m_listener) {
-                       m_listener->onCallEvent(type);
+               if (const auto listener = m_listener.lock()) {
+                       listener->onCallEvent(type);
                }
        }
 
@@ -404,8 +404,8 @@ namespace callui {
                        break;
                }
 
-               if (m_listener) {
-                       m_listener->onError(err);
+               if (const auto listener = m_listener.lock()) {
+                       listener->onError(err);
                }
        }
 
@@ -424,8 +424,8 @@ namespace callui {
                        if (m_slot == SimSlot::UNDEFINED) {
                                m_slot = slot;
                        }
-                       if (m_listener) {
-                               m_listener->onCallEvent(CallEventType::INCOMING);
+                       if (const auto listener = m_listener.lock()) {
+                               listener->onCallEvent(CallEventType::INCOMING);
                        }
                        return RES_OK;
                }
index b4412ba9beca81ee865f58a332c7e2fa4969f0a6..985a7b833db855575fbddb12cd739d8a8dc47227 100644 (file)
@@ -54,8 +54,8 @@ namespace callui {
                virtual CallMask getAvailableCalls() const override final;
 
        private:
-               friend class ucl::RefCountObj<CallManager>;
-               CallManager(ucl::RefCountObjBase &rc, const CallClientSRef &callClient,
+               friend class ucl::ReffedObj<CallManager>;
+               CallManager(ucl::IRefCountObj &rc, const CallClientSRef &callClient,
                                ICallManagerListenerWRef listener);
 
                ucl::Result prepare();
index 3d3ebf2adbb6d81c474de6e9f2b68fa9f4c49dbb..fcc88efe0fa5b65b83371341bc8a58962e95e94a 100644 (file)
@@ -89,7 +89,7 @@ namespace callui {
                return m_phoneNum;
        }
 
-       IContactInfoWCRef ConferenceCallInfo::getContactInfo() const
+       IContactInfoSCRef ConferenceCallInfo::getContactInfo() const
        {
                return m_contactInfo;
        }
index b3b0fd9f63ea2cd56ab454d0e2f238736365c7c8..84046021bce502ff216635f0e5e4936bb0486de1 100644 (file)
@@ -36,10 +36,10 @@ namespace callui {
 
                virtual unsigned int getCallId() const override final;
                virtual const std::string &getPhoneNumber() const override final;
-               virtual IContactInfoWCRef getContactInfo() const override final;
+               virtual IContactInfoSCRef getContactInfo() const override final;
 
        private:
-               friend class ucl::RefCountObj<ConferenceCallInfo>;
+               friend class ucl::ReffedObj<ConferenceCallInfo>;
                ConferenceCallInfo();
 
                ucl::Result prepare(cm_conf_call_data_t *confCallData,
index 45981218124c79a70d2d2bf0259147edb065918e..f8dad33f0c68e58815cb2b9440a2539b543068bf 100644 (file)
@@ -36,7 +36,7 @@ namespace callui {
                virtual void setStateChangeHandler(StateChangeHandler handler) override final;
 
        private:
-               friend class ucl::RefCountObj<ConnectionStateSource>;
+               friend class ucl::ReffedObj<ConnectionStateSource>;
                ConnectionStateSource();
 
                ucl::Result prepare();
index b899a8aa4058299afc930eb6b15895e637c3c06c..48cfad934d1971f4bcf4b7788193011929a68a4f 100644 (file)
@@ -40,7 +40,7 @@ namespace callui {
                virtual ContactNameSourceType getNameSourceType() const override final;
 
        private:
-               friend class ucl::RefCountObj<ContactInfo>;
+               friend class ucl::ReffedObj<ContactInfo>;
                ContactInfo(int personId,
                                const std::string &name,
                                const std::string &imagePath,
index 627d6806d0fd80d4b726c862a14f6dbd0d1b0bea..9add61dc414f9b9d47e8c2f1ad63f8234cb41a25 100644 (file)
@@ -29,7 +29,7 @@ namespace callui {
                ContactInfoSRef createContactInfo(int contactId);
 
        private:
-               friend class ucl::RefCountObj<ContactInfoProvider>;
+               friend class ucl::ReffedObj<ContactInfoProvider>;
                ContactInfoProvider();
 
                ucl::Result prepare();
index 2a9c92fd625d2899dc7d2f12c575678c0ff03962..1442ccf47c107e686ef5b151e7d8ae7f1cb07a47 100644 (file)
@@ -60,11 +60,12 @@ namespace callui {
                        LOG_RETURN(RES_OK, "Callback already in progress");
                }
 
-               if (!m_cm) {
+               const auto cm = m_cm.lock();
+               if (!cm) {
                        LOG_RETURN(RES_FAIL, "Call Manager is NULL");
                }
 
-               auto res = m_cm->dialVoiceCall(m_callInfo->getPhoneNumber());
+               auto res = cm->dialVoiceCall(m_callInfo->getPhoneNumber());
                if (res == RES_OK) {
                        m_callbackInProgress = true;
                }
index 8a3095752c75b4ba932769a39d097b09d8b0e9cf..190d056790a19dacc196a9b8abd1219b3b38fc41 100644 (file)
@@ -40,7 +40,7 @@ namespace callui {
                virtual ucl::Result writeMessage() override final;
 
        private:
-               friend class ucl::RefCountObj<EndCall>;
+               friend class ucl::ReffedObj<EndCall>;
                EndCall(CallManagerWRef cm, ICallInfoSCRef callInfo);
 
                ucl::Result prepare();
index 839bd62b2a7d0b1824c3a08da5a185040917c50a..10648998adeec0a6576dad786163c3180277d64e 100644 (file)
@@ -53,9 +53,13 @@ namespace callui {
 
        Result HeldCall::prepare(cm_call_data_h callData)
        {
-               m_callInfo = CallInfo::newInstance(m_cm->getCallClient(),
+               const auto cm = m_cm.lock();
+               if (!cm) {
+                       LOG_RETURN(RES_FAIL, "Call Manager is NULL");
+               }
+               m_callInfo = CallInfo::newInstance(cm->getCallClient(),
                                callData,
-                               m_cm->getContactInfoProvider());
+                               cm->getContactInfoProvider());
                if (!m_callInfo) {
                        LOG_RETURN_VALUE(RES_FAIL, RES_FAIL, "CallInfo::newInstance() failed!");
                }
@@ -69,42 +73,47 @@ namespace callui {
 
        Result HeldCall::unhold()
        {
-               if (!m_cm) {
+               const auto cm = m_cm.lock();
+               if (!cm) {
                        LOG_RETURN(RES_FAIL, "Call Manager is NULL");
                }
-               return convertCMResult(cm_unhold_call(m_cm->getCallClient()));
+               return convertCMResult(cm_unhold_call(cm->getCallClient()));
        }
 
        Result HeldCall::joinWithActive()
        {
-               if (!m_cm) {
+               const auto cm = m_cm.lock();
+               if (!cm) {
                        LOG_RETURN(RES_FAIL, "Call Manager is NULL");
                }
-               return convertCMResult(cm_join_call(m_cm->getCallClient()));
+               return convertCMResult(cm_join_call(cm->getCallClient()));
        }
 
        Result HeldCall::swapWithActive()
        {
-               if (!m_cm) {
+               const auto cm = m_cm.lock();
+               if (!cm) {
                        LOG_RETURN(RES_FAIL, "Call Manager is NULL");
                }
-               return convertCMResult(cm_swap_call(m_cm->getCallClient()));
+               return convertCMResult(cm_swap_call(cm->getCallClient()));
        }
 
        Result HeldCall::end()
        {
-               if (!m_cm) {
+               const auto cm = m_cm.lock();
+               if (!cm) {
                        LOG_RETURN(RES_FAIL, "Call Manager is NULL");
                }
-               return m_cm->endCall(0, CallReleaseType::ALL_HOLD);
+               return cm->endCall(0, CallReleaseType::ALL_HOLD);
        }
 
        Result HeldCall::split(const IConferenceCallInfoSCRef &confCallInfo)
        {
-               if (!m_cm) {
+               const auto cm = m_cm.lock();
+               if (!cm) {
                        LOG_RETURN(RES_FAIL, "Call Manager is NULL");
                }
-               return m_cm->splitCalls(m_callInfo, confCallInfo);
+               return cm->splitCalls(m_callInfo, confCallInfo);
        }
 
 }
index b7ed8d7911f4c396c497abe46e5b4eb2d72277ce..bbb786658d708d9a760f7b4ba684eb094cbb941d 100644 (file)
@@ -40,7 +40,7 @@ namespace callui {
                virtual ucl::Result split(const IConferenceCallInfoSCRef &confCallInfo) override final;
 
        private:
-               friend class ucl::RefCountObj<HeldCall>;
+               friend class ucl::ReffedObj<HeldCall>;
                HeldCall(CallManagerWRef cm, cm_call_data_h callData);
 
                ucl::Result prepare(cm_call_data_h callData);
index 9e1720aa1329d193dc56aece262850c2f8d5e8ab..c3e784eee3cfb34297db8b8a1cf09230b0175b08 100644 (file)
@@ -55,9 +55,13 @@ namespace callui {
 
        Result IncomingCall::prepare(cm_call_data_h callData)
        {
-               m_callInfo = CallInfo::newInstance(m_cm->getCallClient(),
+               const auto cm = m_cm.lock();
+               if (!cm) {
+                       LOG_RETURN(RES_FAIL, "Call Manager is NULL");
+               }
+               m_callInfo = CallInfo::newInstance(cm->getCallClient(),
                                callData,
-                               m_cm->getContactInfoProvider());
+                               cm->getContactInfoProvider());
                if (!m_callInfo) {
                        LOG_RETURN_VALUE(RES_FAIL, RES_FAIL, "CallInfo::newInstance() failed!");
                }
@@ -72,26 +76,29 @@ namespace callui {
 
        IRejectMsgProviderSRef IncomingCall::getRejectMsgProvider() const
        {
-               if (!m_cm) {
+               const auto cm = m_cm.lock();
+               if (!cm) {
                        LOG_RETURN_VALUE(RES_FAIL, {}, "Call Manager is NULL");
                }
-               return m_cm->getRejectMsgProvider();
+               return cm->getRejectMsgProvider();
        }
 
        Result IncomingCall::answer(CallAnswerType type)
        {
-               if (!m_cm) {
+               const auto cm = m_cm.lock();
+               if (!cm) {
                        LOG_RETURN(RES_FAIL, "Call Manager is NULL");
                }
-               return convertCMResult(cm_answer_call(m_cm->getCallClient(), convertCUICallAnswerType(type)));
+               return convertCMResult(cm_answer_call(cm->getCallClient(), convertCUICallAnswerType(type)));
        }
 
        Result IncomingCall::reject()
        {
-               if (!m_cm) {
+               const auto cm = m_cm.lock();
+               if (!cm) {
                        LOG_RETURN(RES_FAIL, "Call Manager is NULL");
                }
-               return convertCMResult(cm_reject_call(m_cm->getCallClient()));
+               return convertCMResult(cm_reject_call(cm->getCallClient()));
        }
 
        Result IncomingCall::rejectWithMessage(IRejectMsgSRef message)
@@ -103,18 +110,20 @@ namespace callui {
                        LOG_RETURN(RES_FAIL, "message is not RejectMsg type!");
                }
 
-               if (!m_cm) {
+               const auto cm = m_cm.lock();
+               if (!cm) {
                        LOG_RETURN(RES_FAIL, "Call Manager is NULL");
                }
-               return msg->send(m_callInfo->getPhoneNumber(), m_cm->getSimSlot());
+               return msg->send(m_callInfo->getPhoneNumber(), cm->getSimSlot());
        }
 
        Result IncomingCall::stopAlert()
        {
-               if (!m_cm) {
+               const auto cm = m_cm.lock();
+               if (!cm) {
                        LOG_RETURN(RES_FAIL, "Call Manager is NULL");
                }
-               return convertCMResult(cm_stop_alert(m_cm->getCallClient()));
+               return convertCMResult(cm_stop_alert(cm->getCallClient()));
        }
 
 }
index cfd02916ec9a166c8c63cd4fb7b22fcefa6721e3..db7c1b61eb5346853176aad74ad23d02baa5c718 100644 (file)
@@ -41,7 +41,7 @@ namespace callui {
                virtual ucl::Result stopAlert() override final;
 
        private:
-               friend class ucl::RefCountObj<IncomingCall>;
+               friend class ucl::ReffedObj<IncomingCall>;
                IncomingCall(CallManagerWRef cm, cm_call_data_h callData);
 
                ucl::Result prepare(cm_call_data_h callData);
index 0be9e5b339ce1b71d054604ceba0d4d873685ee8..6175f7110bebde7b4bc997cb69cc46ae7a038049 100644 (file)
@@ -28,7 +28,7 @@ namespace callui {
        class IndicatorStateProvider::SourceHandler :
                        public RefCountAware {
        public:
-               SourceHandler(RefCountObjBase &rc,
+               SourceHandler(IRefCountObj &rc,
                                IndicatorStateProvider &provider,
                                IndicatorProperty property,
                                IIndicatorStateSourceSRef source):
@@ -97,8 +97,8 @@ namespace callui {
 
        void IndicatorStateProvider::dispatchStateChanged(IndicatorProperty property) const
        {
-               if (m_listener) {
-                       m_listener->onStateChanged(property);
+               if (const auto listener = m_listener.lock()) {
+                       listener->onStateChanged(property);
                }
        }
 
index 0f9f2e6c0e705f4fbcb2e12d51b029d4a8c4ced7..3c3a6ab50714d8eb7cf0e5c3839b87340c2e5063 100644 (file)
@@ -40,7 +40,7 @@ namespace callui {
                virtual void setListener(IIndicatorStateListenerWRef listener) override final;
 
        private:
-               friend class ucl::RefCountObj<IndicatorStateProvider>;
+               friend class ucl::ReffedObj<IndicatorStateProvider>;
                IndicatorStateProvider();
 
                void dispatchStateChanged(IndicatorProperty property) const;
index 3ce3e3e6b60aef26cbb689675e1ddb561306ef53..1fdd2e0d0883e9df32e6d15bf2a333b1dd1ff7ed 100644 (file)
@@ -31,7 +31,7 @@ namespace callui {
                operator msg_handle_t() const;
 
        private:
-               friend class ucl::RefCountObj<MsgClient>;
+               friend class ucl::ReffedObj<MsgClient>;
                MsgClient();
 
                ucl::Result prepare();
index 93f79f6adbe15b59d8a77a3ba988f4978e1c3b82..6c3165bafd559d187c39493452b7e03e0af4624e 100644 (file)
@@ -53,7 +53,8 @@ namespace callui {
                        LOG_RETURN(RES_FAIL, "Phone Number is NULL");
                }
 
-               if (!m_msgClient) {
+               const auto msgClient = m_msgClient.lock();
+               if (!msgClient) {
                        LOG_RETURN(RES_FAIL, "Client is NULL");
                }
 
@@ -96,7 +97,7 @@ namespace callui {
                        msg_set_struct_handle(reqInfo, MSG_REQUEST_SENDOPT_HND, sendOpt);
 
                        // Send message
-                       int err = msg_sms_send_message(*m_msgClient, reqInfo);
+                       int err = msg_sms_send_message(*msgClient, reqInfo);
                        if (err != MSG_SUCCESS) {
                                ELOG("msg_sms_send_message() failed. err[%d]", err);
                        } else {
index e2dbed0772c15ed555d76db352479edaae2a3db2..acc4a9b61a30520804bf52ef841293385cc0a553 100644 (file)
@@ -36,7 +36,7 @@ namespace callui {
                std::string getText() const override final;
 
        private:
-               friend class ucl::RefCountObj<RejectMsg>;
+               friend class ucl::ReffedObj<RejectMsg>;
                RejectMsg(MsgClientWRef client, const ucl::TString &string);
 
                ucl::Result prepare();
index ed13cf6ae1c3ad2ffccc3c3190326d938a886d2c..b1cc8b1769a30c66812d656219b0ced859667dd2 100644 (file)
@@ -34,7 +34,7 @@ namespace callui {
                virtual int getMsgCount() const override final;
 
        private:
-               friend class ucl::RefCountObj<RejectMsgProvider>;
+               friend class ucl::ReffedObj<RejectMsgProvider>;
                RejectMsgProvider();
 
                ucl::Result prepare();
index 862e9320c17397b01e33442e7d3ff07620f0a2a4..70747d16416cff8a984febedbe6779b97a75e060 100644 (file)
@@ -36,7 +36,7 @@ namespace callui {
                virtual void setStateChangeHandler(StateChangeHandler handler) override final;
 
        private:
-               friend class ucl::RefCountObj<RssiStateSource>;
+               friend class ucl::ReffedObj<RssiStateSource>;
                RssiStateSource();
 
                ucl::Result prepare();
index e3de217ba7c705ed7b6f19bed216b54ecb77e145..0c451209b9c00517139ec7ce95ee42f0ec0db109 100644 (file)
@@ -71,11 +71,10 @@ namespace callui {
 
        using namespace ucl;
 
-       SoundManager::SoundManager(RefCountObjBase &rc,
-                       const CallClientSRef &client):
-                                       RefCountAware(&rc),
-                               m_client(client),
-                               m_deviceVolumeCbID(-1)
+       SoundManager::SoundManager(IRefCountObj &rc, const CallClientSRef &client):
+                       RefCountAware(&rc),
+                       m_client(client),
+                       m_deviceVolumeCbID(-1)
        {
        }
 
index c8f6901edf2cba38d6bf92951011df8c3d4d85f3..ac52c8954a4606e0dee7bec28bb982f2ae0a8fe1 100644 (file)
@@ -54,9 +54,8 @@ namespace callui {
                virtual bool isBluetoothSupported() const override final;
 
        private:
-               friend class ucl::RefCountObj<SoundManager>;
-               SoundManager(ucl::RefCountObjBase &rc,
-                               const CallClientSRef &client);
+               friend class ucl::ReffedObj<SoundManager>;
+               SoundManager(ucl::IRefCountObj &rc, const CallClientSRef &client);
 
                ucl::Result prepare();
                ucl::Result registerVolumeCallbacks();
index 9b0ec173e5cca8dd59a666aa40810d8f16616cb3..e025c84ac4a51a28162f49e240677ee63a1e7a41 100644 (file)
@@ -19,7 +19,7 @@
 
 #include "model/types.h"
 #include "ucl/misc/Event.h"
-#include "ucl/misc/smartDelegation.h"
+#include "ucl/util/smartDelegation.h"
 
 namespace callui {
 
index ab9731ff8795da272fb3110c04e94202fb5ef1d7..668b5c043cbd8a675f9669d8c999ad63e76bf797 100644 (file)
@@ -73,7 +73,7 @@ namespace callui {
                return result;
        }
 
-       AcceptDialog::AcceptDialog(RefCountObjBase &rc,
+       AcceptDialog::AcceptDialog(IRefCountObj &rc,
                        const AcceptDialogHandler &handler):
                                        Presenter(rc),
                                        m_handler(handler),
index 318b8976766d915ffafa81a6e7c84e53e79681a5..5a23249640a53acf0bb3a4251aa3f369bfb07161 100644 (file)
@@ -86,7 +86,7 @@ namespace callui {
 
        // IncomingCallPresenter
 
-       AcceptRejectPresenter::AcceptRejectPresenter(RefCountObjBase &rc,
+       AcceptRejectPresenter::AcceptRejectPresenter(IRefCountObj &rc,
                        const IIncomingCallSRef &call,
                        CallMask calls):
                        Presenter(rc),
@@ -97,8 +97,8 @@ namespace callui {
 
        AcceptRejectPresenter::~AcceptRejectPresenter()
        {
-               if (m_popup) {
-                       m_popup->dispose();
+               if (const auto popup = m_popup.lock()) {
+                       popup->dispose();
                }
 
                delRotaryEventHandler(
@@ -134,10 +134,10 @@ namespace callui {
        {
                if (m_callMask != calls) {
                        m_callMask = calls;
-                       if (m_popup) {
+                       if (const auto popup = m_popup.lock()) {
                                m_accept->emit(impl::SIGNAL_RESET);
                                m_widget->emit(impl::SIGNAL_RESET);
-                               m_popup->dismiss();
+                               popup->dismiss();
                        }
                }
        }
index 0d004cfbdccc86bd2aef2f4204c0b7996b5e2fb5..0e3387266e37c961f23fbc21884cfe345f4a61a8 100644 (file)
@@ -76,7 +76,7 @@ namespace callui {
                return result;
        }
 
-       AccessoryPresenter::AccessoryPresenter(RefCountObjBase &rc,
+       AccessoryPresenter::AccessoryPresenter(IRefCountObj &rc,
                        const ISoundManagerSRef &sm):
                        Presenter(rc),
                        m_sm(sm),
index ca5632cabb7986225b0415c7cb68b57d2b4e3d02..a4bbe98f10d546267e8d0ac75378ca992eceac47 100644 (file)
@@ -124,7 +124,7 @@ namespace callui {
                return result;
        }
 
-       CallInfoPresenter::CallInfoPresenter(RefCountObjBase &rc,
+       CallInfoPresenter::CallInfoPresenter(IRefCountObj &rc,
                        const ICallManagerSRef &cm,
                        CallMode mode):
                        Presenter(rc),
index d1c16c57a9e7842c31b23eee1bbf078f3c787500..73d807b52912695cc4822d99dd242b2fdce1ff5f 100644 (file)
@@ -92,7 +92,7 @@ namespace callui {
        }
 
 
-       CallStatus::CallStatus(RefCountObjBase &rc,
+       CallStatus::CallStatus(IRefCountObj &rc,
                        const LayoutSRef &layout,
                        CallMode mode,
                        const ICallInfoWCRef &info,
@@ -147,8 +147,6 @@ namespace callui {
 
        Result CallStatus::processOutgoingMode()
        {
-               m_duration = m_info->getDuration();
-
                m_ly->setText(STR_DIALING_CALL, impl::PART_TXT_TEXT_INFO);
 
                // TODO: need add logic for RTL mode in the future
@@ -159,12 +157,13 @@ namespace callui {
 
        Eina_Bool CallStatus::onCallDurationTimerCb()
        {
-               if (!m_info) {
+               const auto info = m_info.lock();
+               if (!info) {
                        m_timer = nullptr;
                        LOG_RETURN_VALUE(RES_FAIL, ECORE_CALLBACK_CANCEL, "m_info is NULL");
                }
 
-               struct tm tmp = m_info->getDuration();
+               struct tm tmp = info->getDuration();
                tryUpdateCallDurationTime(
                                m_duration,
                                tmp,
@@ -180,7 +179,9 @@ namespace callui {
                if (m_isOnHold) {
                        m_ly->setText(STR_ON_HOLD, impl::PART_TXT_TEXT_INFO);
                } else {
-                       m_duration = m_info->getDuration();
+                       if (const auto info = m_info.lock()) {
+                               m_duration = info->getDuration();
+                       }
                        setCallDuration(m_duration, *m_ly, impl::PART_TXT_TEXT_INFO);
 
                        if (m_timer) {
@@ -224,7 +225,9 @@ namespace callui {
                        m_timer = nullptr;
                }
 
-               m_duration = m_info->getDuration();
+               if (const auto info = m_info.lock()) {
+                       m_duration = info->getDuration();
+               }
 
                m_timer = ecore_timer_add(impl::END_CALL_BLINKING_TIMER_INTERVAL,
                                CALLBACK_B(CallStatus::onBlinkingTimerCb), this);
index c59bd1b305dd6ce5c3ddf9456198ceb6cb93a7cb..b651107827385b2b518a54ec5a639daedc22adad 100644 (file)
@@ -68,11 +68,10 @@ namespace callui {
 
        // DeviceStatePresenter
 
-       DeviceStatePresenter::DeviceStatePresenter(RefCountObjBase &rc,
-                       const ucl::WindowSRef &window):
-                                       m_window(window),
-                                       m_mode(DisplayMode::UNDEFINED),
-                                       m_lockState(false)
+       DeviceStatePresenter::DeviceStatePresenter(const ucl::WindowSRef &window):
+               m_window(window),
+               m_mode(DisplayMode::UNDEFINED),
+               m_lockState(false)
        {
        }
 
index d26083c3315530e9035c7a1ec38022fa96beff9a..cda01fc20f940e1d20b21dc0c25c7bbd8df79006 100644 (file)
@@ -188,7 +188,7 @@ namespace callui {
                return result;
        }
 
-       Indicator::Indicator(RefCountObjBase &rc,
+       Indicator::Indicator(IRefCountObj &rc,
                        const IIndicatorStateProviderSRef &provider):
                                        Presenter(rc),
                                        m_provider(provider)
index 51e2a3482c0a3ac8cabf6bd40a6be4a319b99677..b3f815aef5f04c8aed16e8122c72429bd0c874a2 100644 (file)
@@ -42,7 +42,9 @@ namespace callui {
 
        using namespace ucl;
 
-       Instance::Instance(SysEventProvider &sysEventProvider) :
+       Instance::Instance(IRefCountObj &rc,
+                       SysEventProvider &sysEventProvider) :
+               RefCountAware(&rc),
                m_sysEventProvider(sysEventProvider),
                m_context(nullptr),
                m_keyUpEventHandler(nullptr)
@@ -57,8 +59,8 @@ namespace callui {
                        ecore_event_handler_del(m_keyUpEventHandler);
                }
 
-               if (m_page) {
-                       m_page->exitNoTransition();
+               if (const auto page = m_page.lock()) {
+                       page->exitNoTransition();
                }
        }
 
@@ -96,7 +98,7 @@ namespace callui {
                                "createCircleSurface() failed!");
 
                m_sysEventProvider.addEventHandler(
-                               DELEGATE(Instance::onSysEvent, this));
+                               WEAK_DELEGATE(Instance::onSysEvent, asWeak(*this)));
 
                return RES_OK;
        }
index 15cdf8ab8ac64666c6b8bcec388a0530c0249228..791efd49bed210923295b17af824acec673fd371 100644 (file)
@@ -70,7 +70,7 @@ namespace callui {
 
        // KeypadPage
 
-       KeypadPage::KeypadPage(RefCountObjBase &rc,
+       KeypadPage::KeypadPage(IRefCountObj &rc,
                        const NaviframeSRef &navi,
                        const ExitRequestHandler onExitRequest):
                Page(rc, navi, onExitRequest)
index 3504b7e4ca71a0d3229324814e09624fe6ac0cda..d63715eba142e18105b550c760aef27886716f53 100644 (file)
@@ -122,7 +122,7 @@ namespace callui {
 
        // MainPage
 
-       MainPage::MainPage(RefCountObjBase &rc,
+       MainPage::MainPage(IRefCountObj &rc,
                        const NaviframeSRef &navi,
                        const ExitRequestHandler handler,
                        const ICallSRef &call) :
index 00ac1110ab1888638fdeb61948b631def811ea9e..e1d4e651497834838d717de41723b655b22a5297 100644 (file)
@@ -111,7 +111,7 @@ namespace callui {
 
        // MoreOptionsPresenter
 
-       MoreOptionsPresenter::MoreOptionsPresenter(RefCountObjBase &rc,
+       MoreOptionsPresenter::MoreOptionsPresenter(IRefCountObj &rc,
                        const ICallManagerSRef &cm,
                        const ISoundManagerSRef &sm,
                        const NaviframeSRef &navi):
@@ -137,8 +137,8 @@ namespace callui {
                m_sm->removeAudioStateHandler(DELEGATE(
                                MoreOptionsPresenter::onAudioStateChanged, this));
 
-               if (m_keypad) {
-                       m_keypad->exitNoTransition();
+               if (const auto keypad = m_keypad.lock()) {
+                       keypad->exitNoTransition();
                }
        }
 
@@ -466,11 +466,12 @@ namespace callui {
                                m_panelLy->emit(impl::SIGNAL_STATUS_TXT_BIG);
                                return;
                        }
-                       m_info = active->getInfo();
-                       if (!m_info) {
+                       auto info = active->getInfo();
+                       if (!info) {
                                LOG_RETURN_VOID(RES_FAIL, "Call Info is NULL");
                        }
-                       m_duration = m_info->getDuration();
+                       m_info = info;
+                       m_duration = info->getDuration();
                        setCallDuration(m_duration, *m_panelLy, impl::PART_TXT_STATUS);
                        updateStatusFontSize();
 
@@ -492,12 +493,13 @@ namespace callui {
 
        Eina_Bool MoreOptionsPresenter::onCallDurationTimerCb()
        {
-               if (!m_info) {
+               const auto info = m_info.lock();
+               if (!info) {
                        m_timer = nullptr;
                        LOG_RETURN_VALUE(RES_FAIL, ECORE_CALLBACK_CANCEL, "m_info is NULL");
                }
 
-               struct tm tmp = m_info->getDuration();
+               struct tm tmp = info->getDuration();
                tryUpdateCallDurationTime(
                                m_duration,
                                tmp,
index 48afd5f0bb9098014318ea2c9bc70f6a0fe3f900..b36d41ef6d1ca6d5070617e5d8d50e6dceb1e122 100644 (file)
@@ -29,7 +29,7 @@ namespace callui {
 
        using namespace ucl;
 
-       Page::Page(RefCountObjBase &rc, const NaviframeSRef &navi,
+       Page::Page(IRefCountObj &rc, const NaviframeSRef &navi,
                        const ExitRequestHandler onExitRequest) :
                Presenter(rc),
                m_navi(navi),
index c0435aacb5256f0e6b5a76f8334044186656977a..6b9503c62bfd1ae62132e40388f0c18849df0df3 100644 (file)
@@ -30,7 +30,7 @@ namespace callui {
 
        using namespace ucl;
 
-       Presenter::Presenter(RefCountObjBase &rc) :
+       Presenter::Presenter(IRefCountObj &rc) :
                RefCountAware(&rc),
                m_isPrepared(false)
        {
index 637b4eee85ae3c5ad1ad7ee195f5b8ce3e8cf709..400e1be92dc0e54a05f4042fc6fc8200f65977b2 100644 (file)
@@ -128,7 +128,7 @@ namespace callui {
                return result;
        }
 
-       RejectMsgPresenter::RejectMsgPresenter(RefCountObjBase &rc,
+       RejectMsgPresenter::RejectMsgPresenter(IRefCountObj &rc,
                        const IRejectMsgProviderSRef &provider,
                        const RejectMsgStateHandler &stateHandler,
                        const RejectMsgSelectHandler &selectHandler):
index 5fb0f8ecd98478782ea08c165c5020b8dc33e5de..9e22cd6413305dcc7e0b23d571f9f0020bc722e4 100644 (file)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include <view/Slider.h>
+#include "view/Slider.h"
 
 #include "common.h"
 
@@ -67,12 +67,12 @@ namespace callui {
                return result;
        }
 
-       Slider::Slider(RefCountObjBase &rc,
+       Slider::Slider(IRefCountObj &rc,
                        const LayoutSRef &layout,
                        int maxValue,
                        int curValue):
                                ElmWidget(&rc, *layout, true),
-                               m_layout(layout),
+                               m_layout(layout.get()),
                                m_circleLy(elm_layout_add(*m_layout)),
                                m_circleSurf(eext_circle_surface_layout_add(m_circleLy)),
                                m_slider(eext_circle_object_slider_add(*m_layout, m_circleSurf))
index e4e2c769503536c45f8de9635cfc6f9132fe3246..3cba34dff17ba560714c488afbcb8c47538dc8ec 100644 (file)
@@ -92,7 +92,7 @@ namespace callui {
                return result;
        }
 
-       VolumeControl::VolumeControl(RefCountObjBase &rc,
+       VolumeControl::VolumeControl(IRefCountObj &rc,
                        const LayoutSRef &layout,
                        const TString &info,
                        int maxValue,
index 68539b3f3fa2cac341583f3931200d69028ce918..64c6f5ff66cc5e6693bd4247f26799822f0b4e18 100644 (file)
@@ -23,6 +23,9 @@
 
 namespace ucl {
 
+       class SysEventProvider;
+       using SysEventProviderUPtr = std::unique_ptr<SysEventProvider>;
+
        class SysEventProvider : public NonCopyable {
        public:
                using EventHandlerAddFunc = int (*)(app_event_handler_h *,
@@ -34,8 +37,8 @@ namespace ucl {
                                EventHandlerDelFunc delFunc);
                ~SysEventProvider();
 
-               void addEventHandler(SysEventHandler handler);
-               void delEventHandler(SysEventHandler handler);
+               void addEventHandler(const SysEventHandler &handler);
+               void delEventHandler(const SysEventHandler &handler);
 
        private:
                int addEventHandler(app_event_handler_h *handler,
index 867e62f9226b5c257a8594a7ee949723b9fa1e6e..1d523949eb437a50aa9c4572ba683dbd913c5565 100644 (file)
 
 namespace ucl {
 
-       inline void SysEventProvider::addEventHandler(SysEventHandler handler)
+       inline void SysEventProvider::addEventHandler(
+                       const SysEventHandler &handler)
        {
                m_event += handler;
        }
 
-       inline void SysEventProvider::delEventHandler(SysEventHandler handler)
+       inline void SysEventProvider::delEventHandler(
+                       const SysEventHandler &handler)
        {
                m_event -= handler;
        }
index bb7c740af19aa1c6d82f14762fceedb5fb257d15..48f8adc0233ee4e8138d3ce6d696c8301acda3e9 100644 (file)
 
 #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 {
 
@@ -43,9 +45,6 @@ namespace ucl {
 
        using AppParams = HashMap<AppParam, Variant>;
 
-       class SysEventProvider;
-       using SysEventProviderUPtr = std::unique_ptr<SysEventProvider>;
-
        enum class SysEvent {
                LANGUAGE_CHANGED,
                REGION_FMT_CHANGED,
@@ -56,7 +55,9 @@ namespace ucl {
                UPDATE_REQUESTED
        };
 
-       using SysEventHandler = Delegate<void(SysEvent)>;
+       using SysEventHandler = WeakDelegate<void(SysEvent)>;
+
+       using AutoAppCtrl = AutoHandle<app_control_h, int, app_control_destroy>;
 }
 
 #endif // __UCL_APPFW_TYPES_H__
index 8d20b50ab17e3f54e70f97e84452785d2ee210b3..0ee57f0ba50914b2ebead238248654b373328942 100644 (file)
@@ -43,7 +43,7 @@ namespace ucl {
                                EdjeSignalSrc(""));
 
        protected:
-               EdjeWidget(RefCountObjBase *rc, Evas_Object *eo, bool isOwner = false);
+               EdjeWidget(IRefCountObj *rc, Evas_Object *eo, bool isOwner = false);
        };
 }
 
index 5197f592f690d080f8d695f2f1ddb0ea99294cdd..3f989c75972175ff49f92afc6e566d3fa4381310 100644 (file)
@@ -16,7 +16,7 @@
 
 namespace ucl {
 
-       inline EdjeWidget::EdjeWidget(RefCountObjBase *const rc,
+       inline EdjeWidget::EdjeWidget(IRefCountObj *const rc,
                        Evas_Object *const eo, const bool isOwner) :
                ElmWidget(rc, eo, isOwner)
        {
index 9c03011a06bfa723b8b636d240000bbdfff07115..3856b497852fc41fc2b9d087e534fd589672b86b 100644 (file)
 
 #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:
-               friend class RefCountObj<ElmWidget>;
-               using Widget::Widget;
+               explicit ElmWidget(Evas_Object *eo, bool isOwner = false);
+               virtual ~ElmWidget();
 
                void setEnabled(bool value);
                bool isEnabled() const;
@@ -43,8 +47,19 @@ namespace ucl {
                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 //
index 8d0e1abb4161d06f554926dcaa762e937045a4b1..0673a57276897104ddba6f84d4efda17f0bfa18d 100644 (file)
 
 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));
index ec21f450e118b2d1c56e0d52d1b85aece9600fdd..37732ce7ef3991b8a8135ed436dbe337e2f7de40 100644 (file)
@@ -42,7 +42,7 @@ namespace ucl {
                };
 
        public:
-               friend class RefCountObj<Layout>;
+               friend class ReffedObj<Layout>;
                using EdjeWidget::EdjeWidget;
                explicit Layout(Evas_Object *eo, bool isOwner = false);
 
index 0cf36f61531edfab3039c424ea1efb15cca13999..4e4336c792c3cb628d86b98c46ed37c6444559a5 100644 (file)
@@ -85,8 +85,8 @@ namespace ucl {
                std::vector<NaviItem> getItems() const;
 
        private:
-               friend class RefCountObj<Naviframe>;
-               Naviframe(RefCountObjBase &rc, Evas_Object *eo);
+               friend class ReffedObj<Naviframe>;
+               Naviframe(IRefCountObj &rc, Evas_Object *eo);
 
                void onTransitionFinished(Widget &widget, void *eventInfo);
 
index ad995c1f93d439070513b4f273197e183ca6359f..2a0280ca4ef937d1f523afc999d21f3e44516212 100644 (file)
@@ -25,7 +25,7 @@ namespace ucl {
 
        class StyledWidget : public EdjeWidget {
        public:
-               friend class RefCountObj<StyledWidget>;
+               friend class ReffedObj<StyledWidget>;
                using EdjeWidget::EdjeWidget;
                explicit StyledWidget(Evas_Object *eo, bool isOwner = false);
 
index 9f74259e2820fdddc7800dc5236d68b20da1cd04..2048a7d6521e5087667d325604808bdf8586205b 100644 (file)
@@ -23,6 +23,8 @@
 
 #include "ucl/misc/RefCountAware.h"
 
+#define UCL_SMART_FWD "ucl,fwd,"
+
 namespace ucl {
 
        UCL_DECLARE_REF_ALIASES(Widget);
@@ -95,11 +97,12 @@ namespace ucl {
                bool isFocused() const;
 
        protected:
-               friend class RefCountObj<Widget>;
-               Widget(RefCountObjBase *rc, Evas_Object *eo, bool isOwner = false);
+               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;
@@ -120,20 +123,23 @@ namespace ucl {
 
                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 MUST be protected!
-               // Signal to RefCountObj<T> to call onUniqueChanged()
-               enum { ENABLE_ON_UNIQUE_CHANGED_DISPATCH };
+               // This section MAY be protected
                void onUniqueChanged(bool isUnique);
 
        private:
                Evas_Object *m_eo;
                EventProxies m_eventProxies;
-               bool m_isOwner;
-               bool m_isBoundToEo;
-               bool m_isEoRefKept;
-               bool m_isSelfRefKept;
-               bool m_isSelfRefUnique;
+               bool m_isOwner: 1;
+               bool m_isBoundToEo: 1;
+               bool m_isEoRefKept: 1;
+               bool m_isSelfRefKept: 1;
+               bool m_isSelfRefUnique: 1;
        };
 
        // Non-member functions //
index 8e526b4d49c85fddc95bfdbf84dc3350bdc746c2..b611b2569ebc411cdd1e5d43cd02812b628c0c6c 100644 (file)
@@ -80,8 +80,8 @@ namespace ucl {
                void lower();
 
        private:
-               friend class RefCountObj<Window>;
-               Window(RefCountObjBase *rc, Evas_Object *eo,
+               friend class ReffedObj<Window>;
+               Window(IRefCountObj *rc, Evas_Object *eo,
                                bool isOwner, Evas_Object *conform);
 
        private:
index 3d4c959a4c20870c8dcdd8a24ef2ccd749153350..d5b18286a1456a830d10987008ecb67fb8ff9e5b 100644 (file)
@@ -84,7 +84,7 @@ namespace ucl {
 
        // Window //
 
-       inline Window::Window(RefCountObjBase *const rc, Evas_Object *const eo,
+       inline Window::Window(IRefCountObj *const rc, Evas_Object *const eo,
                        const bool isOwner, Evas_Object *const conform) :
                ElmWidget(rc, eo, isOwner),
                m_conform(conform)
index f4deb132e40ff8f3a2d79aae22ce79857ed3077d..454b6bc8cfbd7d96838399a49959f41e36eee569 100644 (file)
@@ -22,8 +22,8 @@
 #include "ucl/util/types.h"
 #include "ucl/util/memory.h"
 #include "ucl/util/delegation.h"
+#include "ucl/util/smartDelegation.h"
 
-#include "ucl/misc/smartDelegation.h"
 #include "ucl/misc/Aspect.h"
 #include "ucl/misc/TString.h"
 #include "ucl/misc/Variant.h"
@@ -87,6 +87,14 @@ namespace ucl {
                IMAGE_PRELOADED = EVAS_CALLBACK_IMAGE_PRELOADED
        };
 
+       // AtspiGestureEventInfo //
+
+       struct AtspiGestureEventInfo {
+               Elm_Atspi_Gesture_Info gestureInfo;
+               bool preventDefault;
+               bool stopPropagation;
+       };
+
        // WidgetARHint //
 
        enum class WidgetARHint
diff --git a/ucl/inc/ucl/misc/AutoHandle.h b/ucl/inc/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__
index f0caec0837e4700e2abb95c0d01905307dbfd87d..ed4e4025412815452fefe74c1c7d1797ed6ea25c 100644 (file)
@@ -48,10 +48,7 @@ namespace ucl {
        template <class DELEGATE2>
        void Event<DELEGATE>::operator+=(DELEGATE2 &&delegate)
        {
-               if (delegate && std::find(m_delegates.begin(), m_delegates.end(),
-                               delegate) == m_delegates.end()) {
-                       m_delegates.emplace_back(std::forward<DELEGATE2>(delegate));
-               }
+               m_delegates.emplace_back(std::forward<DELEGATE2>(delegate));
        }
 
        template <class DELEGATE>
@@ -73,7 +70,7 @@ namespace ucl {
        template <class DELEGATE>
        bool Event<DELEGATE>::isEmpty() const
        {
-               return (isLocked() ? false : m_delegates.empty());
+               return m_delegates.empty();
        }
 
        template <class DELEGATE>
index 7ec13cce993a4b1fe2417871b130f0976053be70..e75ecb9e384978bd39dbdef27687fbf8f773b72c 100644 (file)
@@ -35,11 +35,16 @@ namespace ucl {
                WeakRef<T> asWeakThis(T *thisAlias) const;
 
        protected:
-               RefCountAware(RefCountObjBase *rc);
+               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 };
+
        protected:
-               RefCountObjBase *const m_rc;
+               IRefCountObj *const m_rc;
        };
 
        // Non-member functions //
index ae51c0d977b3330b05d5f92c2e6857604492fe4f..3906d0eba6e42a5d4922dc80917d7fce477a76bc 100644 (file)
@@ -18,7 +18,7 @@
 
 namespace ucl {
 
-       inline RefCountAware::RefCountAware(RefCountObjBase *const rc) :
+       inline RefCountAware::RefCountAware(IRefCountObj *const rc) :
                m_rc(rc)
        {
        }
diff --git a/ucl/inc/ucl/misc/Timeout.h b/ucl/inc/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/inc/ucl/misc/smartDelegation.h b/ucl/inc/ucl/misc/smartDelegation.h
deleted file mode 100644 (file)
index f921743..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_MISC_SMART_DELEGATION_H__
-#define __UCL_MISC_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_MISC_SMART_DELEGATION_H__
diff --git a/ucl/inc/ucl/misc/smartDelegation/WeakDelegate.h b/ucl/inc/ucl/misc/smartDelegation/WeakDelegate.h
deleted file mode 100644 (file)
index 0a5e976..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_MISC_SMART_DELEGATION_WEAK_DELEGATE_H__
-#define __UCL_MISC_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;
-
-               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_MISC_SMART_DELEGATION_WEAK_DELEGATE_H__
diff --git a/ucl/inc/ucl/misc/smartDelegation/WeakDelegate.hpp b/ucl/inc/ucl/misc/smartDelegation/WeakDelegate.hpp
deleted file mode 100644 (file)
index e4b4b5d..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.
- */
-
-namespace ucl {
-
-       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/misc/smartDelegation/macro.h b/ucl/inc/ucl/misc/smartDelegation/macro.h
deleted file mode 100644 (file)
index 5368eda..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_MISC_SMART_DELEGATION_MACRO_H__
-#define __UCL_MISC_SMART_DELEGATION_MACRO_H__
-
-#define UCL_WEAK_DELEGATE(FUNC, DATA) \
-               _UCL_DELEGATE(::ucl::WeakDelegate, FUNC, DATA)
-
-#endif // __UCL_MISC_SMART_DELEGATION_MACRO_H__
diff --git a/ucl/inc/ucl/misc/smartDelegation/shortMacro.h b/ucl/inc/ucl/misc/smartDelegation/shortMacro.h
deleted file mode 100644 (file)
index 43c1ec3..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_SMART_DELEGATION_SHORT_MACRO_H__
-#define __UCL_MISC_SMART_DELEGATION_SHORT_MACRO_H__
-
-#define WEAK_DELEGATE(FUNC, DATA) UCL_WEAK_DELEGATE(FUNC, DATA)
-
-#endif // __UCL_MISC_SMART_DELEGATION_SHORT_MACRO_H__
index d5c518c530b4549eed623419424e8e8f98ea122a..62b92ffbcbfe4b015926ea57f3704a27e0bba1d2 100644 (file)
@@ -42,8 +42,6 @@ namespace ucl {
                template <class FUNC_SIG>
                BaseDelegate(BaseDelegate2<FUNC_SIG, DATA> &&d) noexcept;
 
-               R operator()(ARGS ...args) const;
-
                void reset() noexcept;
 
                const DATA &getData() const noexcept;
@@ -53,7 +51,7 @@ namespace ucl {
        protected:
                BaseDelegate(const DATA &data, StubA stubA) noexcept;
 
-       private:
+       protected:
                DATA m_data;
                StubA m_stubA;
        };
index 4cb9741ffefd70116bc2f70f015fce77e6ee564a..f25c0a7beac08375b1547c73a4e7b102050ed7a1 100644 (file)
@@ -56,13 +56,6 @@ namespace ucl {
        {
        }
 
-       template <class R, class ...ARGS, class DATA>
-       inline R BaseDelegate<R(ARGS...), DATA>::operator()(ARGS ...args) const
-       {
-               return m_stubA(
-                               static_cast<void *>(m_data), std::forward<ARGS>(args)...);
-       }
-
        template <class R, class ...ARGS, class DATA>
        inline void BaseDelegate<R(ARGS...), DATA>::reset() noexcept
        {
index fd53a0ad4f0ac503946f659a3d732676dfbd01f5..e1e74162e9c1c40f8787eabb74f968cf411ee3d6 100644 (file)
@@ -29,6 +29,8 @@ namespace ucl {
        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>
index 5f7be3d49cc8e6d2365b60b7ffdb3f11f27a8c4f..632ec248d799b66014d2337ec081a64ddeed3f72 100644 (file)
 
 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...)>
index c49d31c9fc6b2d293cbe68bd73cd99c128d40d79..56ff3fbeec0623a7e15ebc608d2a770ea26d6129 100644 (file)
@@ -29,6 +29,8 @@ namespace ucl {
        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>
index 4d7786031857a4c5f1c1fea504d1eaa1ac25bb1d..085ba4649583a39420e9bba5b3eff3d2bb9d1a54 100644 (file)
 
 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...)>
index 95e0481b11292c8cdbf0730b15b66faf458e25cf..54ebb993d2f902e8a9bfe539a1d01715c402def8 100644 (file)
@@ -64,16 +64,16 @@ namespace ucl {
        inline bool operator==(const BaseDelegate<R(ARGS...), DATA1> &lhs,
                        const BaseDelegate<R(ARGS...), DATA2> &rhs) noexcept
        {
-               return ((lhs.getStubA() == rhs.getStubA()) && (static_cast<void *>(
-                               lhs.getData()) == static_cast<void *>(rhs.getData())));
+               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()) || (static_cast<void *>(
-                               lhs.getData()) != static_cast<void *>(rhs.getData())));
+               return ((lhs.getStubA() != rhs.getStubA()) || (
+                               lhs.getData() != rhs.getData()));
        }
 
        template <class R, class ...ARGS, class DATA1, class DATA2>
@@ -81,8 +81,8 @@ namespace ucl {
                        const BaseDelegate<R(ARGS...), DATA2> &rhs) noexcept
        {
                return ((lhs.getStubA() < rhs.getStubA()) ||
-                               ((lhs.getStubA() == rhs.getStubA()) && (static_cast<void *>(
-                                       lhs.getData()) < static_cast<void *>(rhs.getData()))));
+                               ((lhs.getStubA() == rhs.getStubA()) && (
+                                       lhs.getData() < rhs.getData())));
        }
 
        template <class R, class ...ARGS, class DATA1, class DATA2>
@@ -90,8 +90,8 @@ namespace ucl {
                        const BaseDelegate<R(ARGS...), DATA2> &rhs) noexcept
        {
                return ((lhs.getStubA() < rhs.getStubA()) ||
-                               ((lhs.getStubA() == rhs.getStubA()) && (static_cast<void *>(
-                                       lhs.getData()) <= static_cast<void *>(rhs.getData()))));
+                               ((lhs.getStubA() == rhs.getStubA()) && (
+                                       lhs.getData() <= rhs.getData())));
        }
 
        template <class R, class ...ARGS, class DATA1, class DATA2>
@@ -99,8 +99,8 @@ namespace ucl {
                        const BaseDelegate<R(ARGS...), DATA2> &rhs) noexcept
        {
                return ((lhs.getStubA() > rhs.getStubA()) ||
-                               ((lhs.getStubA() == rhs.getStubA()) && (static_cast<void *>(
-                                       lhs.getData()) > static_cast<void *>(rhs.getData()))));
+                               ((lhs.getStubA() == rhs.getStubA()) && (
+                                       lhs.getData() > rhs.getData())));
        }
 
        template <class R, class ...ARGS, class DATA1, class DATA2>
@@ -108,8 +108,8 @@ namespace ucl {
                        const BaseDelegate<R(ARGS...), DATA2> &rhs) noexcept
        {
                return ((lhs.getStubA() > rhs.getStubA()) ||
-                               ((lhs.getStubA() == rhs.getStubA()) && (static_cast<void *>(
-                                       lhs.getData()) >= static_cast<void *>(rhs.getData()))));
+                               ((lhs.getStubA() == rhs.getStubA()) && (
+                                       lhs.getData() >= rhs.getData())));
        }
 }
 
index 1fd85237709c7c7dd3966fb32a30c1620f642093..cc3396051af8ef767ed4b1eed6af0b05ec9055cc 100644 (file)
@@ -17,7 +17,6 @@
 #ifndef __UCL_UTIL_MEMORY_H__
 #define __UCL_UTIL_MEMORY_H__
 
-#include "memory/RefCountObjBase.h"
 #include "memory/RefCountObj.h"
 
 #include "memory/BaseRef.h"
index 0aa1b593cc07a61fafcb61a95efd88656b77f7b8..f82a2c918dc7ef9c730b8c789a6e432c0bcaf2d8 100644 (file)
@@ -17,7 +17,7 @@
 #ifndef __UCL_UTIL_MEMORY_BASE_REF_H__
 #define __UCL_UTIL_MEMORY_BASE_REF_H__
 
-#include "RefCountObjBase.h"
+#include "IRefCountObj.h"
 
 namespace ucl {
 
@@ -34,23 +34,17 @@ namespace ucl {
                friend class WeakRef;
 
        public:
-               int getUseCount() const;
-
-               T *operator->() const noexcept;
-               typename std::add_lvalue_reference<T>::type operator*() const noexcept;
-
-               template <class U>
-               explicit operator U() const noexcept;
+               int getUseCount() const noexcept;
 
        protected:
                constexpr BaseRef() noexcept;
-               BaseRef(RefCountObjBase *rc, T *ptr) noexcept;
+               BaseRef(IRefCountObj *rc, T *ptr) noexcept;
                BaseRef(BaseRef<T> &&r) noexcept;
                template <class U>
                BaseRef(BaseRef<U> &&r) noexcept;
 
        protected:
-               RefCountObjBase *m_rc;
+               IRefCountObj *m_rc;
                T *m_ptr;
        };
 }
index d587bc141ec661167b722e322797913f44c0533a..adde1c9a8afc2306be405b013d85e3d05c2d6b72 100644 (file)
@@ -25,7 +25,7 @@ namespace ucl {
 
        template <class T>
        inline BaseRef<T>::BaseRef(
-                       RefCountObjBase *const rc, T *const ptr) noexcept :
+                       IRefCountObj *const rc, T *const ptr) noexcept :
                m_rc(rc),
                m_ptr(ptr)
        {
@@ -51,28 +51,8 @@ namespace ucl {
        }
 
        template <class T>
-       inline int BaseRef<T>::getUseCount() const
+       inline int BaseRef<T>::getUseCount() const noexcept
        {
                return (m_rc ? m_rc->getUseCount() : 0);
        }
-
-       template <class T>
-       inline T *BaseRef<T>::operator->() const noexcept
-       {
-               return m_ptr;
-       }
-
-       template <class T>
-       inline typename std::add_lvalue_reference<T>::type
-                       BaseRef<T>::operator*() const noexcept
-       {
-               return *m_ptr;
-       }
-
-       template <class T>
-       template <class U>
-       inline BaseRef<T>::operator U() const noexcept
-       {
-               return static_cast<U>(m_ptr);
-       }
 }
diff --git a/ucl/inc/ucl/util/memory/IRefCountObj.h b/ucl/inc/ucl/util/memory/IRefCountObj.h
new file mode 100644 (file)
index 0000000..c2397d4
--- /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 unsigned getUseCount() const noexcept = 0;
+               virtual const void *getObjPtr() const noexcept = 0;
+       protected:
+               virtual ~IRefCountObj() = default;
+       };
+}
+
+#endif // __UCL_UTIL_MEMORY_I_REF_COUNT_OBJ_H__
index 777f07e9a5b663206cf49b356dd6c91154b1f027..9832ff6797419ffc363468ff18ea6911b9a3b7bb 100644 (file)
 #ifndef __UCL_UTIL_MEMORY_REF_COUNT_OBJ_H__
 #define __UCL_UTIL_MEMORY_REF_COUNT_OBJ_H__
 
-#include "RefCountObjBase.h"
+#include "IRefCountObj.h"
+#include "ReffedObj.h"
 
 namespace ucl {
 
-       template <class T>
-       class RefCountObj : public RefCountObjBase {
+       template <class T, class C>
+       class RefCountObj final : public IRefCountObj {
        public:
                template <class ...ARGS>
                RefCountObj(ARGS &&...args);
 
                T *getObj() noexcept;
 
-       protected:
-               // RefCountObjBase //
-               virtual void dispose() noexcept final override;
-               virtual void onUniqueChanged(bool isUnique) noexcept final override;
+               // 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 unsigned getUseCount() const noexcept final override;
+               virtual const void *getObjPtr() const noexcept final override;
 
        private:
-               // Consume-all SFINAE functions
-               template <class T2, class ...ARGS>
-               void createObj(const P<0> &, ARGS &&...args);
+               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>
-               void dispatchOnUniqueChanged(
-                               const P<0> &, const bool isUnique) noexcept;
+               struct IsOnUniqueAware<T2,
+                               char[T2::_ENABLE_ON_UNIQUE_CHANGED_DISPATCH * 0 + 1]> :
+                               std::true_type {};
 
-               // Specialized SFINAE functions
+       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>
+               template <class T2, class ...ARGS, class =
+                               typename std::enable_if<IsRefCountAware<T2>::value>::type>
                auto createObj(const P<1> &, ARGS &&...args) -> decltype(
-                               (void)(new T2(this, std::forward<ARGS>(args)...)))
+                               ReffedObj<T>::template check<T2>(
+                                               (IRefCountObj *)0, std::forward<ARGS>(args)...))
                {
-                       new (getObj()) T(this, std::forward<ARGS>(args)...);
+                       m_obj.create(static_cast<IRefCountObj *>(this),
+                                       std::forward<ARGS>(args)...);
                }
 
-               template <class T2, class ...ARGS>
+               template <class T2, class ...ARGS, class =
+                               typename std::enable_if<IsRefCountAware<T2>::value>::type>
                auto createObj(const P<2> &, ARGS &&...args) -> decltype(
-                               (void)(new T2(*this, std::forward<ARGS>(args)...)))
+                               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(...)
                {
-                       new (getObj()) T(*this, std::forward<ARGS>(args)...);
                }
 
-               template <class T2,
-                               class = char(*)[T2::ENABLE_ON_UNIQUE_CHANGED_DISPATCH * 0 + 1]>
-               void dispatchOnUniqueChanged(
-                               const P<1> &, const bool isUnique) noexcept
+               template <class T2, class =
+                               typename std::enable_if<IsOnUniqueAware<T2>::value>::type>
+               void dispatchOnUniqueChanged(const P<1> &, const bool isUnique)
                {
-                       getObj()->onUniqueChanged(isUnique);
+                       m_obj.template dispatchOnUniqueChanged<T>(isUnique);
                }
 
        private:
-               // Proper-aligned storage for T
-               typename std::aligned_storage<sizeof(T), alignof(T)>::type m_obj;
+               ReffedObj<T> m_obj;
+               C m_useCounter;
+               C m_weakCounter;
        };
 }
 
index 3807bd33ce9c0effc9010da8d3864466048d80b3..d3b4e97eb2253ddee01668c268904f144037f2b2 100644 (file)
 
 namespace ucl {
 
-       template <class T>
+       template <class T, class C>
        template <class ...ARGS>
-       inline RefCountObj<T>::RefCountObj(ARGS &&...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>
-       inline T *RefCountObj<T>::getObj() noexcept
+       template <class T, class C>
+       inline T *RefCountObj<T, C>::getObj() noexcept
        {
-               return static_cast<T *>(static_cast<void *>(&m_obj));
+               return m_obj.get();
        }
 
-       template <class T>
-       inline void RefCountObj<T>::dispose() noexcept
+       template <class T, class C>
+       inline void RefCountObj<T, C>::ref() noexcept
        {
-               if (!isDisposed()) {
-                       RefCountObjBase::dispose();
-                       getObj()->~T();
+               if (m_useCounter.ref() == 2) {
+                       dispatchOnUniqueChanged(false);
                }
        }
 
-       template <class T>
-       inline void RefCountObj<T>::onUniqueChanged(const bool isUnique) noexcept
+       template <class T, class C>
+       inline void RefCountObj<T, C>::unref() noexcept
        {
-               dispatchOnUniqueChanged<T>(P<1>(), isUnique);
+               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>
-       template <class T2, class ...ARGS>
-       inline void RefCountObj<T>::createObj(const P<0> &, ARGS &&...args)
+       template <class T, class C>
+       inline unsigned RefCountObj<T, C>::getUseCount() const noexcept
        {
-               new (getObj()) T(std::forward<ARGS>(args)...);
+               return m_useCounter.get();
        }
 
-       template <class T>
-       template <class T2>
-       inline void RefCountObj<T>::dispatchOnUniqueChanged(
-                       const P<0> &, const bool isUnique) noexcept
+       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/RefCountObjBase.h b/ucl/inc/ucl/util/memory/RefCountObjBase.h
deleted file mode 100644 (file)
index 4e6edf0..0000000
+++ /dev/null
@@ -1,51 +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_BASE_H__
-#define __UCL_UTIL_MEMORY_REF_COUNT_OBJ_BASE_H__
-
-#include "ucl/util/types/classTypes.h"
-
-namespace ucl {
-
-       class RefCountObjBase : public Polymorphic {
-       public:
-               void ref() noexcept;
-               void unref() noexcept;
-
-               void refWeak() noexcept;
-               void unrefWeak() noexcept;
-
-               int getUseCount() const noexcept;
-               bool isDisposed() const noexcept;
-
-       protected:
-               RefCountObjBase();
-               virtual ~RefCountObjBase() = default;
-
-               virtual void dispose() noexcept;
-               virtual void onUniqueChanged(bool isUnique) noexcept = 0;
-
-       private:
-               int m_useRefs;
-               int m_weakRefs;
-               bool m_isDisposed;
-       };
-}
-
-#include "RefCountObjBase.hpp"
-
-#endif // __UCL_UTIL_MEMORY_REF_COUNT_OBJ_BASE_H__
diff --git a/ucl/inc/ucl/util/memory/RefCountObjBase.hpp b/ucl/inc/ucl/util/memory/RefCountObjBase.hpp
deleted file mode 100644 (file)
index c4b5d42..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.
- */
-
-namespace ucl {
-
-       inline RefCountObjBase::RefCountObjBase() :
-               m_useRefs(0),
-               m_weakRefs(1),
-               m_isDisposed(false)
-       {
-       }
-
-       inline void RefCountObjBase::ref() noexcept
-       {
-               ++m_useRefs;
-               if (m_useRefs == 2) {
-                       onUniqueChanged(false);
-               }
-       }
-
-       inline void RefCountObjBase::unref() noexcept
-       {
-               --m_useRefs;
-               if (m_useRefs <= 1) {
-                       if (m_useRefs == 1) {
-                               onUniqueChanged(true);
-                       } else {
-                               dispose();
-                               unrefWeak();
-                       }
-               }
-       }
-
-       inline void RefCountObjBase::refWeak() noexcept
-       {
-               ++m_weakRefs;
-       }
-
-       inline void RefCountObjBase::unrefWeak() noexcept
-       {
-               --m_weakRefs;
-               if (m_weakRefs == 0) {
-                       delete this;
-               }
-       }
-
-       inline int RefCountObjBase::getUseCount() const noexcept
-       {
-               return m_useRefs;
-       }
-
-       inline bool RefCountObjBase::isDisposed() const noexcept
-       {
-               return m_isDisposed;
-       }
-
-       inline void RefCountObjBase::dispose() noexcept
-       {
-               m_isDisposed = true;
-       }
-}
diff --git a/ucl/inc/ucl/util/memory/RefCounterMT.h b/ucl/inc/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/inc/ucl/util/memory/RefCounterMT.hpp b/ucl/inc/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/inc/ucl/util/memory/RefCounterST.h b/ucl/inc/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/inc/ucl/util/memory/RefCounterST.hpp b/ucl/inc/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/inc/ucl/util/memory/ReffedObj.h b/ucl/inc/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/inc/ucl/util/memory/ReffedObj.hpp b/ucl/inc/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);
+       }
+}
index 4bd7ca0bc3db70f9b1240b7975085c3e02533510..396d176b67dd0b8dc4fa8b43d24bd8d74d6dee8a 100644 (file)
@@ -22,7 +22,7 @@
 namespace ucl {
 
        template <class T>
-       class SharedRef : public BaseRef<T> {
+       class SharedRef final : public BaseRef<T> {
        public:
                template <class U>
                friend void swap(SharedRef<U> &x, SharedRef<U> &y) noexcept;
@@ -36,11 +36,12 @@ namespace ucl {
                constexpr SharedRef() noexcept;
                constexpr SharedRef(std::nullptr_t) noexcept;
 
-               SharedRef(RefCountObjBase *rc, T *ptr) 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 BaseRef<U> &r) noexcept;
+               SharedRef(const SharedRef<U> &r) noexcept;
 
                SharedRef(SharedRef<T> &&r) noexcept;
                template <class U>
@@ -55,6 +56,9 @@ namespace ucl {
                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 ||
@@ -70,6 +74,8 @@ namespace ucl {
 
        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;
index 5b5ad55c64c9b055322f3838857288ec488f3f76..f085b9c19818ed880799542b041bae7a4784ba86 100644 (file)
@@ -14,8 +14,6 @@
  * limitations under the License.
  */
 
-#include "RefCountObj.h"
-
 namespace ucl {
 
        template <class T>
@@ -30,12 +28,19 @@ namespace ucl {
 
        template <class T>
        inline SharedRef<T>::SharedRef(
-                       RefCountObjBase *const rc, T *const ptr) noexcept :
+                       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)
@@ -47,7 +52,7 @@ namespace ucl {
 
        template <class T>
        template <class U>
-       inline SharedRef<T>::SharedRef(const BaseRef<U> &r) noexcept :
+       inline SharedRef<T>::SharedRef(const SharedRef<U> &r) noexcept :
                BaseRef<T>(r.m_rc, r.m_ptr)
        {
                if (this->m_rc) {
@@ -101,13 +106,35 @@ namespace ucl {
                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>(std::forward<ARGS>(args)...);
-               return {rc, rc->getObj()};
+               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>
index 78450a51f2ab78cebe7a0ffe764046b019ce362e..4cccbe6e8aa2564f7f6a311139f7fa860b781e0a 100644 (file)
@@ -22,7 +22,7 @@
 namespace ucl {
 
        template <class T>
-       class WeakRef : public BaseRef<T> {
+       class WeakRef final : public BaseRef<T> {
        public:
                template <class U>
                friend void swap(WeakRef<U> &x, WeakRef<U> &y) noexcept;
@@ -36,7 +36,7 @@ namespace ucl {
                constexpr WeakRef() noexcept;
                constexpr WeakRef(std::nullptr_t) noexcept;
 
-               WeakRef(RefCountObjBase *rc, T *ptr) noexcept;
+               WeakRef(IRefCountObj *rc, T *ptr) noexcept;
 
                WeakRef(const WeakRef<T> &r) noexcept;
                template <class U>
@@ -52,7 +52,9 @@ namespace ucl {
 
                void reset() noexcept;
 
-               T *get() const noexcept;
+               SharedRef<T> lock() const noexcept;
+
+               T *getUnsafePtr() const noexcept;
                operator bool() const noexcept;
 
                template <class U, class = typename std::enable_if<
index b1681ed662ffbb93b6a3b4504e1755816e7db60a..6634f3c0ccde622d957d32e9a846f6080bcf0f03 100644 (file)
@@ -28,7 +28,7 @@ namespace ucl {
 
        template <class T>
        inline WeakRef<T>::WeakRef(
-                       RefCountObjBase *const rc, T *const ptr) noexcept :
+                       IRefCountObj *const rc, T *const ptr) noexcept :
                BaseRef<T>(rc, ptr)
        {
                this->m_rc->refWeak();
@@ -88,7 +88,16 @@ namespace ucl {
        }
 
        template <class T>
-       inline T *WeakRef<T>::get() const noexcept
+       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);
        }
@@ -96,7 +105,7 @@ namespace ucl {
        template <class T>
        inline WeakRef<T>::operator bool() const noexcept
        {
-               return (this->m_ptr && !this->m_rc->isDisposed());
+               return (this->m_rc && (this->m_rc->getUseCount() > 0));
        }
 
        // Non-member functions //
@@ -117,13 +126,13 @@ namespace ucl {
        template <class T, class U>
        inline WeakRef<T> staticRefCast(const WeakRef<U> &r) noexcept
        {
-               return {r.m_rc, static_cast<T *>(r.get())};
+               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.get());
+               const auto ptr = dynamic_cast<T *>(r.getUnsafePtr());
                if (!ptr) {
                        return {};
                }
index 4e6c0e0ee7a6ebc77299d7860199e839ecce6754..bef907b2b9172b184a96fc875f5fa6b9cb2d9eb7 100644 (file)
@@ -37,52 +37,74 @@ namespace ucl {
 
        // 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 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 (lhs.get() == rhs.get());
+               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 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 (lhs.get() != rhs.get());
+               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 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 (lhs.get() < rhs.get());
+               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 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 (lhs.get() <= rhs.get());
+               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 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 (lhs.get() > rhs.get());
+               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 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 (lhs.get() >= rhs.get());
+               return (himpl::getCmpPtr(lhs) >= himpl::getCmpPtr(rhs));
        }
 
        template <class T, class = typename std::enable_if<
index 6818ef965b53cce1efd8ff7eb2f156211e6e37a5..b97175a1886e6eba3903c05162608f3ffa63d8ae 100644 (file)
                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/smartDelegation.h b/ucl/inc/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/inc/ucl/util/smartDelegation/WeakDelegate.h b/ucl/inc/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/inc/ucl/util/smartDelegation/WeakDelegate.hpp b/ucl/inc/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/inc/ucl/util/smartDelegation/macro.h b/ucl/inc/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/inc/ucl/util/smartDelegation/shortMacro.h b/ucl/inc/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__
index 5b280de6819a865081366583f89909566184d5f9..c5062db0cccb412cfe5f109d3dd0be0f8a6fbf44 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <string>
 #include <memory>
+#include <atomic>
 #include <functional>
 #include <type_traits>
 #include <utility>
index 89d33dd41bb6cf9f15aa3c9bed6182f24edb3f23..1b1402da4b33a842f83d62104780e8ef6d14cf71 100644 (file)
@@ -51,7 +51,7 @@ namespace ucl {
        public:
                virtual IPRODUCT *newInstance() const = 0;
        protected:
-               ~IFactory() = default;
+               virtual ~IFactory() = default;
        };
 
        template <class PRODUCT, class IPRODUCT>
index f03d1947ba2ffc3cdf2b92e5ba3cd18c60f71127..f358669773cd78e85fe2f79913f45ccf3ab19c94 100644 (file)
@@ -30,6 +30,6 @@
 #include "ucl/util/shortLogs.h"
 
 #include "ucl/util/delegation/shortMacro.h"
-#include "ucl/misc/smartDelegation/shortMacro.h"
+#include "ucl/util/smartDelegation/shortMacro.h"
 
 #endif // __UCL_COMMON_H__
index cf99eb7c7f835b5ac30d248668ca62b856134ce5..7c39f813db65f58685e6300b5edf95e376a7f146 100644 (file)
 
 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));
@@ -31,6 +44,30 @@ namespace ucl {
                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 dynamicCast<Window>(getTopWidget());
index 881390c859983ab1d9bef404f94bcc06c9bfafa8..69d80a5419bebdbee2adafe4cb33e934a3c3035a 100644 (file)
@@ -47,7 +47,7 @@ namespace ucl {
 
        // Naviframe //
 
-       Naviframe::Naviframe(RefCountObjBase &rc, Evas_Object *eo) :
+       Naviframe::Naviframe(IRefCountObj &rc, Evas_Object *eo) :
                StyledWidget(&rc, eo, true),
                m_isInTransition(false)
        {
index 5129f18be13d71212d6a650504103512f7406c4e..d2c0dd65a3e9eeb4ade1d7a2294dc018fb49ebf0 100644 (file)
@@ -110,7 +110,7 @@ namespace ucl {
 
        // Widget //
 
-       Widget::Widget(RefCountObjBase *const rc, Evas_Object *const eo,
+       Widget::Widget(IRefCountObj *const rc, Evas_Object *const eo,
                        const bool isOwner) :
                RefCountAware(rc),
                m_eo(eo),
@@ -175,11 +175,9 @@ namespace ucl {
 
        void Widget::updateRefs()
        {
-               const auto rc = m_rc;
-
                updateEoRef();
 
-               if (rc && !rc->isDisposed()) {
+               if (m_rc) {
                        updateSelfRef();
                }
        }
@@ -267,6 +265,12 @@ namespace ucl {
        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());
        }
@@ -294,4 +298,9 @@ namespace ucl {
        {
                return evas_object_focus_get(getEo());
        }
+
+       bool Widget::ensureFwdEvent(const SmartEvent fwdEvent)
+       {
+               return false;
+       }
 }
diff --git a/ucl/src/misc/Timeout.cpp b/ucl/src/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;
+       }
+}