3 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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.
18 #ifndef _TIZEN_MEDIACONTENT_CONVERTER_H_
19 #define _TIZEN_MEDIACONTENT_CONVERTER_H_
23 #include <CommonsJavaScript/Converter.h>
24 #include <API/Mediacontent/IMediacontent.h>
25 #include <API/Mediacontent/MediacontentMedia.h>
26 #include <API/Mediacontent/MediacontentFolder.h>
27 #include <API/Mediacontent/MediacontentLyrics.h>
29 using namespace TizenApis::Api::Mediacontent;
30 using namespace WrtDeviceApis::Commons;
31 using namespace WrtDeviceApis::CommonsJavaScript;
36 namespace Mediacontent {
39 class MediaConverter : public Converter
42 using Converter::toJSValueRef;
45 explicit MediaConverter(JSContextRef context);
47 JSValueRef toJSValueRefMediacontent(const IMediacontentPtr& arg);
50 * @throw InvalidArgumentException If not a callback nor JS null.
52 JSValueRef toFunctionOrNull(const JSValueRef& arg);
55 * @throw ConversionException If JS null.
56 * @throw InvalidArgumentException If not a callback nor JS null.
58 JSValueRef toFunction(const JSValueRef& arg);
59 JSValueRef toJSValueRefMedia(const MediacontentMediaPtr& arg);
60 JSValueRef toJSValueRefFolder(const MediacontentFolderPtr& arg);
61 JSValueRef toJSValueRef(const std::vector<MediacontentMediaPtr> &arg);
62 JSValueRef toJSValueRef(const std::vector<MediacontentFolderPtr> &arg);
63 JSValueRef toJSValueRef(const MediacontentLyricsPtr &arg);
64 //MediacontentLyricsPtr
65 static std::vector<std::string> m_allowedMediaAttributes;
66 static std::vector<std::string> m_allowedFolderAttributes;
71 typedef ConverterFactory<MediaConverter> MediaConverterFactory;
78 #endif // _TIZEN_MEDIACONTENT_CONVERTER_H_