Beta merge 2
[profile/ivi/wrt-plugins-tizen.git] / src / standards / Tizen / Filesystem / Converter.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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  
18 #ifndef TIZENAPIS_TIZEN_FILESYSTEM_CONVERTER_H_
19 #define TIZENAPIS_TIZEN_FILESYSTEM_CONVERTER_H_
20
21 #include <vector>
22 #include <string>
23 #include <map>
24 #include <JavaScriptCore/JavaScript.h>
25 #include <CommonsJavaScript/Converter.h>
26 #include <API/Filesystem/Enums.h>
27 #include <API/Filesystem/IPath.h>
28 #include <API/Filesystem/INodeTypes.h>
29 #include <API/Filesystem/NodeFilter.h>
30 #include <API/Filesystem/StorageProperties.h>
31
32 namespace TizenApis {
33 namespace Tizen1_0 {
34 class Converter : public WrtDeviceApis::CommonsJavaScript::Converter
35 {
36 public:
37         using WrtDeviceApis::CommonsJavaScript::Converter::toJSValueRef;
38
39 public:
40         explicit Converter(JSContextRef context);
41
42         JSValueRef toJSValueRef(
43                 const Api::Filesystem::StoragePropertiesPtr &arg,
44                 JSContextRef context);
45
46         JSValueRef toJSValueRef(
47                 const std::vector<Api::Filesystem::StoragePropertiesPtr>& arg,
48                 JSContextRef context);
49
50         JSValueRef toJSValueRef(const Api::Filesystem::NodeList& arg,
51                 JSContextRef context);
52
53         JSValueRef toJSValueRef(unsigned char* data,
54                 std::size_t num);
55
56         Api::Filesystem::IPathPtr toPath(const JSValueRef& arg);
57
58         Api::Filesystem::NodeFilterPtr toNodeFilter(const JSValueRef& arg);
59
60         Api::Filesystem::AccessMode toAccessMode(const JSValueRef& arg);
61
62         std::string toEncoding(const JSValueRef& arg);
63         
64         JSValueRef toStorageType(const short type);
65         JSValueRef toStorageState(const short state);
66 };
67
68 typedef WrtDeviceApis::CommonsJavaScript::ConverterFactory<Converter> ConverterFactory;
69 typedef ConverterFactory::ConverterType ConverterPtr;
70 }
71 }
72
73 #endif