2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 * @author Grzegorz Krawczyk
19 * @brief This file provide factory to create wrapper for api from wrt
22 #ifndef WRT_PLUGINS_WRT_WRAPPERS_MGR_INTERFACE_H_
23 #define WRT_PLUGINS_WRT_WRAPPERS_MGR_INTERFACE_H_
26 #include <dpl/noncopyable.h>
27 #include <Commons/plugin_initializer_def.h>
28 #include <Commons/WrtWrapper/IWrtWrapper.h>
30 namespace WrtDeviceApis {
33 class WrtWrappersMgr : private DPL::Noncopyable
35 typedef std::map<JavaScriptContext, IWrtWrapperPtr> RegisteredWrappers;
36 typedef RegisteredWrappers::iterator RegisteredWrappersIterator;
37 typedef RegisteredWrappers::const_iterator RegisteredWrappersConstIterator;
41 static WrtWrappersMgr& getInstance();
44 * creates wrt wrappers for widgetId
45 * @throw Exception::Exception if creation fail
46 * @throw Exception::InvalidArgumentException if arguments are wrong
49 virtual IWrtWrapperPtr registerWrapper(int widgetId,
50 JavaScriptContext context,
51 const engine_interface_t* interface);
54 * removes previously created wrapper
55 * @throw Exception::InvalidArgumentException if creation fail
56 * if widget is not registered
58 virtual void removeWrapper(int widgetId);
61 * removes previously created wrapper
62 * @throw Exception::InvalidArgumentException if creation fail
63 * if widget is not registered
65 virtual void removeWrapper(JavaScriptContext context);
68 * a get previously created wrapper
69 * @throw Exception::InvalidArgumentException if creation fail
70 * if wrapper is not registered
72 virtual IWrtWrapperPtr getWrtWrapper(const JavaScriptContext context) const;
74 virtual bool isWrapperRegistered(JavaScriptContext context) const;
76 virtual ~WrtWrappersMgr();
81 IWrtWrapperPtr getWrapper(const JavaScriptContext context) const;
83 void addWrapper(JavaScriptContext context,
84 IWrtWrapperPtr wrapper);
86 RegisteredWrappers m_wrappers;
90 } // WrtDeviceApisCommon