2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 #ifndef TIZENAPIS_TIZEN_FILESYSTEM_CONVERTER_H_
20 #define TIZENAPIS_TIZEN_FILESYSTEM_CONVERTER_H_
25 #include <JavaScriptCore/JavaScript.h>
26 #include <CommonsJavaScript/Converter.h>
30 #include "INodeTypes.h"
31 #include "NodeFilter.h"
32 #include "StorageProperties.h"
36 namespace Filesystem {
37 class Converter : public WrtDeviceApis::CommonsJavaScript::Converter
40 using WrtDeviceApis::CommonsJavaScript::Converter::toJSValueRef;
43 explicit Converter(JSContextRef context);
47 JSValueRef toJSValueRef(
49 const JSFile::PrivateObjectDef::PermissionList &parentPermissions,
50 JSContextRef context, DeviceAPI::Common::SecurityAccessor *securityAccessor);
51 JSValueRef toJSValueRef(unsigned char* data,
53 JSValueRef toJSValueRef(unsigned long long arg);
55 IPathPtr toPath(const JSValueRef& arg);
57 NodeFilterPtr toNodeFilter(const JSValueRef& arg);
59 AccessMode toAccessMode(const JSValueRef& arg);
61 std::string toEncoding(const JSValueRef& arg);
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);
70 JSValueRef toJSValueRef(
71 const std::vector<StoragePropertiesPtr>& arg,
72 JSContextRef context);
75 typedef WrtDeviceApis::CommonsJavaScript::ConverterFactory<Converter> ConverterFactory;
76 typedef ConverterFactory::ConverterType ConverterPtr;