Release version 0.7.18
[platform/core/api/notification.git] / notification-ex / factory_manager.h
1 /*
2  * Copyright (c) 2019 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef NOTIFICATION_EX_FACTORY_MANAGER_H_
18 #define NOTIFICATION_EX_FACTORY_MANAGER_H_
19
20 #include <string>
21 #include <memory>
22 #include <list>
23
24 #include "notification-ex/iitem_factory.h"
25 #include "notification-ex/iaction_factory.h"
26
27 namespace notification {
28 namespace item {
29
30 /**
31  * @brief The class for FactoryManager.
32  * @details The class to manage creation of action and item.
33  * @since_tizen 5.5
34  */
35 class EXPORT_API FactoryManager {
36  public:
37   /**
38    * @brief Gets the instance of FactoryManager
39    * @since_tizen 5.5
40    * @return The FactoryManager instance
41    */
42   static FactoryManager& GetInst();
43
44   /**
45    * @brief Resgisters the IItemFactory
46    * @since_tizen 5.5
47    * @param[in] factory The IItemFactory for noitfication item
48    */
49   void RegisterFactory(std::unique_ptr<IItemFactory> factory);
50
51   /**
52    * @brief Registers the IActionFactory
53    * @since_tizen 5.5
54    * @param[in] factory The IActionFactory for noitfication action
55    */
56   void RegisterFactory(std::unique_ptr<IActionFactory> factory);
57
58   /**
59    * @brief Creates the notification item from type.
60    * @since_tizen 5.5
61    * @return AbstractItem object
62    */
63   std::unique_ptr<AbstractItem> CreateItem(int type);
64
65   /**
66    * @brief Creates the notification action from type.
67    * @since_tizen 5.5
68    * @return AbstractAction object
69    */
70   std::unique_ptr<AbstractAction> CreateAction(int type);
71
72   /**
73    * @brief Gets NullItem
74    * @since_tizen 5.5
75    * @return NullItem object
76    */
77   AbstractItem& GetNullItem();
78
79  private:
80   FactoryManager() {}
81
82  private:
83   std::unique_ptr<IItemFactory> item_factory_;
84   std::unique_ptr<IActionFactory> action_factory_;
85 };
86
87 }  // namespace item
88 }  // namespace notification
89
90 #endif  // NOTIFICATION_EX_FACTORY_MANAGER_H_