Update change log and spec for wrt-plugins-tizen_0.4.21
[framework/web/wrt-plugins-tizen.git] / src / Filesystem / Converter.h
1 //
2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18  
19 #ifndef TIZENAPIS_TIZEN_FILESYSTEM_CONVERTER_H_
20 #define TIZENAPIS_TIZEN_FILESYSTEM_CONVERTER_H_
21
22 #include <vector>
23 #include <string>
24 #include <map>
25 #include <JavaScriptCore/JavaScript.h>
26 #include <CommonsJavaScript/Converter.h>
27 #include "Enums.h"
28 #include "IPath.h"
29 #include "INodeTypes.h"
30 #include "NodeFilter.h"
31 #include "StorageProperties.h"
32 #include "JSFile.h"
33
34 namespace DeviceAPI {
35 namespace Filesystem {
36 class Converter : public WrtDeviceApis::CommonsJavaScript::Converter
37 {
38 public:
39         using WrtDeviceApis::CommonsJavaScript::Converter::toJSValueRef;
40
41 public:
42         explicit Converter(JSContextRef context);
43
44
45
46     JSValueRef toJSValueRef(
47             const NodeList& arg,
48             const JSFile::PrivateObjectDef::PermissionList &parentPermissions,
49             JSContextRef context);      
50         JSValueRef toJSValueRef(unsigned char* data,
51                 std::size_t num);
52         JSValueRef toJSValueRef(unsigned long long arg);
53
54         IPathPtr toPath(const JSValueRef& arg);
55
56         NodeFilterPtr toNodeFilter(const JSValueRef& arg);
57
58         AccessMode toAccessMode(const JSValueRef& arg);
59
60         std::string toEncoding(const JSValueRef& arg);
61         
62         JSValueRef toStorageType(const short type);
63         JSValueRef toStorageState(const short state);
64         JSValueRef toJSValueRef(
65                 const StoragePropertiesPtr &arg,
66                 JSContextRef context);
67
68         JSValueRef toJSValueRef(
69                 const std::vector<StoragePropertiesPtr>& arg,
70                 JSContextRef context);
71 };
72
73 typedef WrtDeviceApis::CommonsJavaScript::ConverterFactory<Converter> ConverterFactory;
74 typedef ConverterFactory::ConverterType ConverterPtr;
75 }
76 }
77
78 #endif