(SVACE Issues Fix) Initialise uninitialised member variables
[platform/core/uifw/dali-adaptor.git] / dali / internal / system / common / widget-application-impl.h
1 #ifndef DALI_INTERNAL_WIDGET_APPLICATION_IMPL_H
2 #define DALI_INTERNAL_WIDGET_APPLICATION_IMPL_H
3
4 /*
5  * Copyright (c) 2018 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // INTERNAL INCLUDES
22 #include <dali/internal/adaptor/common/application-impl.h>
23 #include <dali/public-api/adaptor-framework/widget-application.h>
24
25 #include <memory>
26
27 namespace Dali
28 {
29 class Widget;
30
31 namespace Internal
32 {
33 namespace Adaptor
34 {
35
36 typedef IntrusivePtr<WidgetApplication> WidgetApplicationPtr;
37
38 /**
39  * Implementation of the WidgetApplication class.
40  */
41 class WidgetApplication : public Application
42 {
43 public:
44
45   typedef std::pair<const std::string, Dali::WidgetApplication::CreateWidgetFunction >  CreateWidgetFunctionPair;
46   typedef std::vector< CreateWidgetFunctionPair >   CreateWidgetFunctionContainer;
47
48   /**
49    * Create a new widget application
50    * @param[in]  argc         A pointer to the number of arguments
51    * @param[in]  argv         A pointer to the argument list
52    * @param[in]  stylesheet   The path to user defined theme file
53    */
54   static WidgetApplicationPtr New( int* argc, char **argv[], const std::string& stylesheet );
55
56 public:
57
58   /**
59    * @copydoc Dali::WidgetApplication::RegisterWidgetCreator()
60    */
61   virtual void RegisterWidgetCreatingFunction( const std::string& widgetName, Dali::WidgetApplication::CreateWidgetFunction createFunction );
62
63 protected:
64
65   /**
66    * Private Constructor
67    * @param[in]  argc         A pointer to the number of arguments
68    * @param[in]  argv         A pointer to the argument list
69    * @param[in]  stylesheet   The path to user defined theme file
70    */
71   WidgetApplication( int* argc, char **argv[], const std::string& stylesheet );
72
73   /**
74    * Destructor
75    */
76   virtual ~WidgetApplication();
77
78   // Undefined
79   WidgetApplication(const Application&) = delete;
80   WidgetApplication& operator=(Application&) = delete;
81 };
82
83 inline WidgetApplication& GetImplementation(Dali::WidgetApplication& widgetApplication)
84 {
85   DALI_ASSERT_ALWAYS(widgetApplication && "widget application handle is empty");
86
87   BaseObject& handle = widgetApplication.GetBaseObject();
88
89   return static_cast<Internal::Adaptor::WidgetApplication&>(handle);
90 }
91
92 inline const WidgetApplication& GetImplementation(const Dali::WidgetApplication& widgetApplication)
93 {
94   DALI_ASSERT_ALWAYS(widgetApplication && "widget application handle is empty");
95
96   const BaseObject& handle = widgetApplication.GetBaseObject();
97
98   return static_cast<const Internal::Adaptor::WidgetApplication&>(handle);
99 }
100
101 } // namespace Adaptor
102
103 } // namespace Internal
104
105 } // namespace Dali
106
107 #endif // DALI_INTERNAL_WIDGET_APPLICATION_IMPL_H