Changed SharedPtr to std:shared_ptr.
authorJan Olszak <j.olszak@samsung.com>
Tue, 27 Nov 2012 10:12:31 +0000 (11:12 +0100)
committerGerrit Code Review <gerrit2@kim11>
Mon, 3 Dec 2012 10:03:11 +0000 (19:03 +0900)
[Issue#] Code refactoring.
[Bug] N/A
[Cause] N/A
[Solution] Used std::shared_ptr as SharedPtr
[Verification] Build commons, plugins, installer.

Change-Id: Icf661c0a638cfae0c53e249b6cb36e84ffdb8003

15 files changed:
modules/db/include/dpl/db/orm.h
modules/event/include/dpl/event/inter_context_delegate.h
modules/popup/include/dpl/popup/evas_object.h
modules/popup/include/dpl/popup/popup.h
modules/popup/include/dpl/popup/popup_controller.h
modules/popup/include/dpl/popup/popup_manager.h
modules/popup/include/dpl/popup/popup_renderer.h
modules/popup/src/popup_controller.cpp
modules/popup/src/popup_manager.cpp
modules/popup/src/popup_renderer.cpp
modules/test/include/dpl/test/test_results_collector.h
modules/test/src/test_runner.cpp
modules/widget_dao/include/dpl/wrt-dao-ro/common_dao_types.h
modules/widget_dao/include/dpl/wrt-dao-ro/feature_model.h
modules/widget_dao/include/dpl/wrt-dao-ro/plugin_dao_read_only.h

index 0d851a6..dcc67a5 100644 (file)
 #include <typeinfo>
 #include <utility>
 #include <set>
+#include <memory>
 
 #include <dpl/db/sql_connection.h>
 #include <dpl/db/orm_interface.h>
 #include <dpl/string.h>
 #include <dpl/optional.h>
-#include <dpl/shared_ptr.h>
 #include <dpl/type_list.h>
 #include <dpl/assert.h>
 #include <dpl/foreach.h>
@@ -84,7 +84,7 @@ public:
     virtual ArgumentIndex BindTo(DataCommand *command, ArgumentIndex index) = 0;
 };
 
-typedef DPL::SharedPtr<Expression> ExpressionPtr;
+typedef std::shared_ptr<Expression> ExpressionPtr;
 
 template<const char* Operator, typename LeftExpression, typename RightExpression>
 class __attribute__ ((visibility("hidden"))) BinaryExpression : public Expression {
@@ -586,7 +586,7 @@ public:
                 str.str());
         }
         //TODO maybe don't make a copy here but just generate the string part of the query.
-        m_whereExpression.Reset(new Expression(expression));
+        m_whereExpression.reset(new Expression(expression));
     }
 
 };
index 55af651..745e84a 100644 (file)
@@ -32,7 +32,6 @@
 #include <dpl/event/main_event_dispatcher.h>
 #include <dpl/fast_delegate.h>
 #include <dpl/shared_ptr.h>
-#include <dpl/enable_shared_from_this.h>
 #include <dpl/generic_event.h>
 #include <dpl/foreach.h>
 #include <dpl/recursive_mutex.h>
@@ -43,6 +42,7 @@
 #include <dpl/apply.h>
 #include <tuple>
 #include <list>
+#include <memory>
 
 /*
  * - Created ICDelegate can be passed freely to other threads.
@@ -88,7 +88,7 @@ namespace ICDPrivate {
 class ICDSharedDataBase
 {
   public:
-    typedef DPL::SharedPtr<ICDSharedDataBase> ICDSharedDataBasePtr;
+    typedef std::shared_ptr<ICDSharedDataBase> ICDSharedDataBasePtr;
     typedef std::list<ICDSharedDataBasePtr> ICDSharedDataBaseList;
 
     class ScopedLock : DPL::Noncopyable
@@ -146,7 +146,7 @@ class DeleteICDSharedDataBaseEventCall : public DPL::Event::AbstractEventCall
     }
     virtual void Call()
     {
-        m_helperBase.Reset();
+        m_helperBase.reset();
     }
 
   private:
@@ -227,7 +227,7 @@ class ICDelegate
     template<typename ThisType>
     friend class ICDelegateSupport;
     class ICDSharedData;
-    typedef DPL::SharedPtr<ICDSharedData> ICDSharedDataPtr;
+    typedef std::shared_ptr<ICDSharedData> ICDSharedDataPtr;
 
     struct PrivateEvent
     {
@@ -245,7 +245,7 @@ class ICDelegate
     typedef DPL::FastDelegate<void (const PrivateEvent&)>
     ICDSharedDataDelegateType;
     class ICDSharedData : private DPL::Event::EventSupport<PrivateEvent>,
-        private DPL::EnableSharedFromThis<ICDSharedData>,
+        private std::enable_shared_from_this<ICDSharedData>,
         public ICDPrivate::ICDSharedDataBase
     {
       public:
@@ -290,7 +290,7 @@ class ICDelegate
         }
 
       private:
-        friend class DPL::SharedPtr<ICDSharedData>;
+        friend class std::shared_ptr<ICDSharedData>;
         ICDSharedDataDelegateType m_subDelegate;
         ICDPrivate::ICDelegateSupportInterface* m_base;
         DPL::FastDelegate<void (ArgTypesList ...)> m_outerDelegate;
@@ -364,7 +364,7 @@ class ICDelegateSupport : public ICDPrivate::ICDelegateSupportInterface
             m_ICDSharedDatas;
         FOREACH(helper, list) {
             ICDPrivate::ICDSharedDataBase::ScopedLock lock(
-                DPL::StaticPointerCast<ICDPrivate::ICDSharedDataBase>(*helper));
+                std::static_pointer_cast<ICDPrivate::ICDSharedDataBase>(*helper));
             (*helper)->disable();
         }
         m_ICDSharedDatas.clear();
index ba4ad9b..25d7a66 100644 (file)
 #ifndef WRT_SRC_DOMAIN_EFL_EVAS_OBJECT_H
 #define WRT_SRC_DOMAIN_EFL_EVAS_OBJECT_H
 
+#include <dpl/noncopyable.h>
 #include <dpl/framework_efl.h>
 #include <dpl/assert.h>
-#include <dpl/shared_ptr.h>
 #include <dpl/foreach.h>
 #include <dpl/apply.h>
 #include <set>
 #include <string>
 #include <tuple>
 #include <utility>
-
+#include <memory>
 namespace DPL {
 namespace Popup {
 
 class EvasObject
 {
     class EvasObjectShared;
-    typedef DPL::SharedPtr<EvasObjectShared> EvasObjectSharedPtr;
+    typedef std::shared_ptr<EvasObjectShared> EvasObjectSharedPtr;
 
   public:
     class IConnection
index e5c926c..84c2c4e 100644 (file)
@@ -23,8 +23,7 @@
 #ifndef WRT_SRC_POPUP_POPUP_H_
 #define WRT_SRC_POPUP_POPUP_H_
 
-#include <dpl/enable_shared_from_this.h>
-#include <dpl/shared_ptr.h>
+#include <memory>
 #include <dpl/assert.h>
 #include <dpl/log/log.h>
 #include <string>
@@ -43,9 +42,9 @@ struct AnswerCallbackData
 
 class PopupManager;
 class IPopup;
-typedef DPL::SharedPtr<IPopup> IPopupPtr;
+typedef std::shared_ptr<IPopup> IPopupPtr;
 
-class IPopup : protected DPL::EnableSharedFromThis<IPopup>
+class IPopup : public std::enable_shared_from_this<IPopup>
 {
   public:
     virtual void SetTitle(const std::string &title) = 0;
@@ -63,7 +62,7 @@ class IPopup : protected DPL::EnableSharedFromThis<IPopup>
 
   private:
     friend class PopupManager;
-    friend class DPL::SharedPtr<IPopup>;
+    friend class std::shared_ptr<IPopup>;
 };
 
 } // namespace Popup
index 0b49201..5f2938a 100644 (file)
 #ifndef WRT_SRC_POPUP_CONTROLLER_POPUP_CONTROLLER_H_
 #define WRT_SRC_POPUP_CONTROLLER_POPUP_CONTROLLER_H_
 
+#include <memory>
 #include <dpl/singleton.h>
 #include <dpl/event/controller.h>
 #include <dpl/event/event_listener.h>
 #include <dpl/generic_event.h>
 #include <dpl/mutex.h>
 #include <dpl/exception.h>
-#include <dpl/shared_ptr.h>
-#include <dpl/enable_shared_from_this.h>
 #include <dpl/noncopyable.h>
 #include <dpl/log/log.h>
 #include <dpl/popup/popup_manager.h>
@@ -99,7 +98,7 @@ struct PopupAnswerCallback
 class PopupController;
 class CtrlPopup;
 
-typedef DPL::SharedPtr<CtrlPopup> CtrlPopupPtr;
+typedef std::shared_ptr<CtrlPopup> CtrlPopupPtr;
 
 DECLARE_GENERIC_EVENT_3(PopupAnswerEvent,
                         CtrlPopupPtr,
@@ -111,18 +110,18 @@ DECLARE_GENERIC_EVENT_2(ShowPopupEventShort,
                         PopupAnswerCallback)
 
 class CtrlPopup : public DPL::Event::EventSupport<PopupAnswerEvent>,
-    protected DPL::EnableSharedFromThis<CtrlPopup>
+    public std::enable_shared_from_this<CtrlPopup>
 {
   public:
     void SetTitle(const std::string &title);
     void Append(PopupObject::IPopupObject *object);
 
+    ~CtrlPopup();
   private:
     friend class PopupController;
-    friend class DPL::SharedPtr<CtrlPopup>;
+    friend class std::shared_ptr<CtrlPopup>;
 
     explicit CtrlPopup(IPopupPtr popup);
-    ~CtrlPopup();
     void EmitAnswer(const AnswerCallbackData& answer);
 
     IPopupPtr m_popup;
index 267cd14..42a4de5 100644 (file)
@@ -23,8 +23,8 @@
 #ifndef WRT_SRC_POPUP_POPUP_MANAGER_H_
 #define WRT_SRC_POPUP_POPUP_MANAGER_H_
 
+#include <memory>
 #include <dpl/assert.h>
-#include <dpl/shared_ptr.h>
 #include <dpl/noncopyable.h>
 #include <dpl/singleton.h>
 #include <dpl/optional.h>
index 593c231..18d2aab 100644 (file)
 
 #include <map>
 #include <string>
+#include <memory>
 
-#include <dpl/shared_ptr.h>
 #include <dpl/noncopyable.h>
 #include <dpl/log/log.h>
 #include <dpl/assert.h>
-#include <dpl/enable_shared_from_this.h>
 #include <dpl/foreach.h>
-
 #include <dpl/popup/popup.h>
 
 namespace DPL {
 namespace Popup {
 
-class PopupRenderer : public DPL::EnableSharedFromThis<PopupRenderer>
+class PopupRenderer : public std::enable_shared_from_this<PopupRenderer>
 {
   public:
     PopupRenderer();
@@ -49,7 +47,7 @@ class PopupRenderer : public DPL::EnableSharedFromThis<PopupRenderer>
     virtual void setExternalCanvas(void* externalCanvas);
   protected:
     class Popup;
-    typedef DPL::SharedPtr<Popup> PopupPtr;
+    typedef std::shared_ptr<Popup> PopupPtr;
 
     class Popup : public IPopup
     {
@@ -73,7 +71,7 @@ class PopupRenderer : public DPL::EnableSharedFromThis<PopupRenderer>
             Assert(callback);
             m_data = data;
             m_callback = callback;
-            m_renderer->Render(DPL::StaticPointerCast<Popup>(SharedFromThis()));
+            m_renderer->Render(std::static_pointer_cast<Popup>(shared_from_this()));
         }
 
         const std::string& GetTitle() const
@@ -95,10 +93,10 @@ class PopupRenderer : public DPL::EnableSharedFromThis<PopupRenderer>
 
       private:
         friend class PopupRenderer;
-        friend class DPL::SharedPtr<Popup>;
+        friend class std::shared_ptr<Popup>;
         friend class PopupObjectTheme;
 
-        Popup(DPL::SharedPtr<PopupRenderer> renderer) : m_renderer(renderer)
+        Popup(std::shared_ptr<PopupRenderer> renderer) : m_renderer(renderer)
         {
         }
 
@@ -111,7 +109,7 @@ class PopupRenderer : public DPL::EnableSharedFromThis<PopupRenderer>
         void* m_data;
         IPopup::PopupCallbackType m_callback;
         PopupObject::PopupObjects m_popupObjectList;
-        DPL::SharedPtr<PopupRenderer> m_renderer;
+        std::shared_ptr<PopupRenderer> m_renderer;
     };
 
   private:
@@ -121,7 +119,7 @@ class PopupRenderer : public DPL::EnableSharedFromThis<PopupRenderer>
     Impl* m_impl;
 };
 
-typedef DPL::SharedPtr<PopupRenderer> PopupRendererPtr;
+typedef std::shared_ptr<PopupRenderer> PopupRendererPtr;
 
 } // namespace Popup
 } // namespace DPL
index f67dc16..5bd1cf1 100644 (file)
@@ -56,7 +56,7 @@ CtrlPopup::~CtrlPopup()
 void CtrlPopup::EmitAnswer(const AnswerCallbackData & answer)
 {
     AnswerCallbackData l_answer = answer;
-    PopupAnswerEvent event(SharedFromThis(), m_callback, l_answer);
+    PopupAnswerEvent event(shared_from_this(), m_callback, l_answer);
     DPL::Event::EventSupport<PopupAnswerEvent>::EmitEvent(event);
 }
 
index be1b680..a6fa465 100644 (file)
@@ -22,9 +22,7 @@
 #include <stddef.h>
 #include <dpl/popup/popup_manager.h>
 #include <dpl/popup/popup.h>
-
 #include <dpl/log/log.h>
-#include <dpl/shared_ptr.h>
 #include <dpl/assert.h>
 #include <dpl/singleton_impl.h>
 
@@ -45,7 +43,7 @@ void PopupManager::Deinitialize()
 {
     m_popupRenderer->Deinitialize();
     Assert(m_initialized);
-    m_popupRenderer.Reset();
+    m_popupRenderer.reset();
     m_initialized = false;
 }
 
index aa5b214..411c709 100644 (file)
@@ -24,7 +24,6 @@
 #include <dpl/popup/popup_renderer.h>
 #include <dpl/popup/popup_manager.h>
 #include <dpl/popup/evas_object.h>
-#include <dpl/shared_ptr.h>
 #include <dpl/scoped_array.h>
 #include <dpl/assert.h>
 #include <dpl/log/log.h>
@@ -93,7 +92,7 @@ class PopupRenderer::Impl
     void Deinitialize()
     {
         Assert(m_initialized);
-        m_current.Reset(NULL);
+        m_current.reset();
         while (!m_popupsToRender.empty()) {
             m_popupsToRender.pop();
         }
@@ -112,7 +111,7 @@ class PopupRenderer::Impl
         answerData.chackState = m_checkState;
         answerData.password = m_password;
         m_current->ForwardAnswer(answerData);
-        m_current.Reset();
+        m_current.reset();
 
         FOREACH(it, m_createdObjects)
         {
@@ -398,8 +397,8 @@ void PopupRenderer::Deinitialize()
 
 IPopupPtr PopupRenderer::CreatePopup()
 {
-    return DPL::StaticPointerCast<IPopup>(IPopupPtr
-                                              (new Popup(SharedFromThis())));
+    return std::static_pointer_cast<IPopup>(IPopupPtr
+                                              (new Popup(shared_from_this())));
 }
 
 void PopupRenderer::Render(PopupPtr popup)
index cf8fa4e..d3f44bb 100644 (file)
 #ifndef DPL_TEST_RESULTS_COLLECTOR_H
 #define DPL_TEST_RESULTS_COLLECTOR_H
 
-#include <dpl/shared_ptr.h>
 #include <dpl/noncopyable.h>
 #include <vector>
 #include <list>
 #include <map>
 #include <string>
+#include <memory>
 
 namespace DPL
 {
@@ -36,7 +36,7 @@ namespace Test
 {
 
 class TestResultsCollectorBase;
-typedef DPL::SharedPtr<TestResultsCollectorBase>
+typedef std::shared_ptr<TestResultsCollectorBase>
     TestResultsCollectorBasePtr;
 
 class TestResultsCollectorBase
index 8ad093a..506dd10 100644 (file)
@@ -417,7 +417,7 @@ int TestRunner::ExecTestRunner(const ArgsList& value)
                 Usage();
                 return -1;
             }
-            currentCollector.Reset(TestResultsCollectorBase::Create(arg));
+            currentCollector.reset(TestResultsCollectorBase::Create(arg));
             if (!currentCollector) {
                 InvalidArgs("Unsupported output type!");
                 Usage();
@@ -469,7 +469,7 @@ int TestRunner::ExecTestRunner(const ArgsList& value)
         }
     }
 
-    currentCollector.Reset();
+    currentCollector.reset();
 
     // Show help
     if (showHelp)
index c40e396..57659ad 100644 (file)
@@ -29,9 +29,9 @@
 #include <map>
 #include <vector>
 #include <list>
-#include <dpl/optional_typedefs.h>
-#include <dpl/shared_ptr.h>
 #include <memory>
+#include <dpl/optional_typedefs.h>
+
 
 namespace WrtDB {
 class PluginMetafileData
@@ -63,7 +63,7 @@ class PluginObjectsDAO
 {
   public:
     typedef std::set<std::string> Objects;
-    typedef DPL::SharedPtr<Objects> ObjectsPtr;
+    typedef std::shared_ptr<Objects> ObjectsPtr;
 
   public:
     explicit PluginObjectsDAO() {}
index d9440da..fc9754d 100644 (file)
@@ -24,7 +24,7 @@
 
 #include <dpl/event/model.h>
 #include <dpl/event/property.h>
-#include <dpl/shared_ptr.h>
+#include <memory>
 #include <string>
 #include <list>
 #include <set>
@@ -34,7 +34,7 @@ namespace WrtDB {
 
 typedef int FeatureHandle;
 typedef std::list<FeatureHandle> FeatureHandleList;
-typedef DPL::SharedPtr<FeatureHandleList> FeatureHandleListPtr;
+typedef std::shared_ptr<FeatureHandleList> FeatureHandleListPtr;
 
 typedef int FeatureSetHandle;
 typedef std::list<FeatureSetHandle> FeatureSetHandleList;
@@ -69,7 +69,7 @@ class FeatureModel : public DPL::Event::Model
     }
 };
 
-typedef DPL::SharedPtr<FeatureModel> FeatureModelPtr;
+typedef std::shared_ptr<FeatureModel> FeatureModelPtr;
 
 } // namespace WrtDB
 
index 33c83b1..044d3d0 100644 (file)
@@ -26,8 +26,8 @@
 
 #include <string>
 #include <list>
+#include <memory>
 #include <dpl/exception.h>
-#include <dpl/shared_ptr.h>
 #include <dpl/wrt-dao-ro/common_dao_types.h>
 
 namespace WrtDB {
@@ -35,7 +35,7 @@ namespace WrtDB {
 typedef std::list<DbPluginHandle> PluginHandleList;
 typedef std::set<DbPluginHandle> PluginHandleSet;
 typedef std::list<std::string> ImplementedObjectsList;
-typedef DPL::SharedPtr<PluginHandleSet> PluginHandleSetPtr;
+typedef std::shared_ptr<PluginHandleSet> PluginHandleSetPtr;
 
 //TODO make it friend to FeatureDAO or inherit
 class PluginDAOReadOnly