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.
18 #ifndef TIZENAPIS_TIZEN_APPLICATION_CONVERTER_H_
19 #define TIZENAPIS_TIZEN_APPLICATION_CONVERTER_H_
21 #include <JavaScriptCore/JavaScript.h>
22 #include <CommonsJavaScript/Converter.h>
23 #include <API/Application/IApplication.h>
24 #include <API/Application/ApplicationInformation.h>
25 #include <API/Application/ApplicationContext.h>
26 #include <API/Application/ApplicationServiceData.h>
27 #include <API/Application/ApplicationService.h>
31 namespace Application {
32 class ApplicationConverter : public WrtDeviceApis::CommonsJavaScript::Converter
35 using WrtDeviceApis::CommonsJavaScript::Converter::toJSValueRef;
37 explicit ApplicationConverter(JSContextRef context);
38 virtual ~ApplicationConverter();
39 JSValueRef toJSValueRef(const Api::Application::ApplicationInformationPtr &arg);
40 Api::Application::ApplicationInformationPtr toApplicationInformation(const JSValueRef &jsValue);
41 JSValueRef toJSValueRef(const Api::Application::ApplicationInformationArrayPtr &arg);
42 Api::Application::ApplicationInformationArrayPtr toApplicationInformationArray(const JSValueRef &jsValue);
43 JSValueRef toJSValueRef(const Api::Application::ApplicationContextPtr &arg);
44 Api::Application::ApplicationContextPtr toApplicationContext(const JSValueRef &jsValue);
45 JSValueRef toJSValueRef(const Api::Application::ApplicationContextArrayPtr &arg);
46 Api::Application::ApplicationContextArrayPtr toApplicationContextArray(const JSValueRef &jsValue);
47 JSValueRef toJSValueRef(const Api::Application::ApplicationServicePtr &arg);
48 Api::Application::ApplicationServicePtr toApplicationService(const JSValueRef &jsValue);
49 JSValueRef toJSValueRef(const Api::Application::ApplicationServiceDataPtr &arg);
50 Api::Application::ApplicationServiceDataPtr toApplicationServiceData(const JSValueRef &jsValue);
51 JSValueRef toJSValueRef(const std::vector<Api::Application::ApplicationServiceDataPtr> &arg);
52 std::vector<Api::Application::ApplicationServiceDataPtr> toApplicationServiceDataArray(const JSValueRef &jsValue);
55 bool initializeAllowedProperties();
56 static std::vector<std::string> m_allowedApplicationInformation;
57 static std::vector<std::string> m_allowedApplicationContext;
58 static std::vector<std::string> m_allowedApplicationService;
59 static std::vector<std::string> m_allowedApplicationServiceData;
63 typedef WrtDeviceApis::CommonsJavaScript::ConverterFactory<ApplicationConverter> ApplicationConverterFactory;