Update change log and spec for wrt-plugins-tizen_0.4.70
[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 <Security.h>
28 #include "Enums.h"
29 #include "IPath.h"
30 #include "INodeTypes.h"
31 #include "NodeFilter.h"
32 #include "StorageProperties.h"
33 #include "JSFile.h"
34
35 namespace DeviceAPI {
36 namespace Filesystem {
37 class Converter : public WrtDeviceApis::CommonsJavaScript::Converter
38 {
39 public:
40         using WrtDeviceApis::CommonsJavaScript::Converter::toJSValueRef;
41
42 public:
43         explicit Converter(JSContextRef context);
44
45
46
47     JSValueRef toJSValueRef(
48             const NodeList& arg,
49             const JSFile::PrivateObjectDef::PermissionList &parentPermissions,
50             JSContextRef context, DeviceAPI::Common::SecurityAccessor *securityAccessor);       
51         JSValueRef toJSValueRef(unsigned char* data,
52                 std::size_t num);
53         JSValueRef toJSValueRef(unsigned long long arg);
54
55         IPathPtr toPath(const JSValueRef& arg);
56
57         NodeFilterPtr toNodeFilter(const JSValueRef& arg);
58
59         AccessMode toAccessMode(const JSValueRef& arg);
60
61         std::string toEncoding(const JSValueRef& arg);
62         
63         JSValueRef toStorageType(const short type);
64         JSValueRef toStorageState(const short state);
65         std::string checkPercentSign(std::string& arg);
66         JSValueRef toJSValueRef(
67                 const StoragePropertiesPtr &arg,
68                 JSContextRef context);
69
70         JSValueRef toJSValueRef(
71                 const std::vector<StoragePropertiesPtr>& arg,
72                 JSContextRef context);
73 };
74
75 typedef WrtDeviceApis::CommonsJavaScript::ConverterFactory<Converter> ConverterFactory;
76 typedef ConverterFactory::ConverterType ConverterPtr;
77 }
78 }
79
80 #endif