2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef _TIZEN_MEDIACONTENT_CONVERTER_H_
18 #define _TIZEN_MEDIACONTENT_CONVERTER_H_
22 #include <CommonsJavaScript/Converter.h>
23 #include <API/Mediacontent/IMediacontent.h>
24 #include <API/Mediacontent/MediacontentMedia.h>
25 #include <API/Mediacontent/MediacontentFolder.h>
26 #include <API/Mediacontent/MediacontentLyrics.h>
28 using namespace TizenApis::Api::Mediacontent;
29 using namespace WrtDeviceApis::Commons;
30 using namespace WrtDeviceApis::CommonsJavaScript;
35 namespace Mediacontent {
38 class MediaConverter : public Converter
41 using Converter::toJSValueRef;
44 explicit MediaConverter(JSContextRef context);
46 JSValueRef toJSValueRefMediacontent(const IMediacontentPtr& arg);
49 * @throw InvalidArgumentException If not a callback nor JS null.
51 JSValueRef toFunctionOrNull(const JSValueRef& arg);
54 * @throw ConversionException If JS null.
55 * @throw InvalidArgumentException If not a callback nor JS null.
57 JSValueRef toFunction(const JSValueRef& arg);
58 JSValueRef toJSValueRefMedia(const MediacontentMediaPtr& arg);
59 JSValueRef toJSValueRefFolder(const MediacontentFolderPtr& arg);
60 JSValueRef toJSValueRef(const std::vector<MediacontentMediaPtr> &arg);
61 JSValueRef toJSValueRef(const std::vector<MediacontentFolderPtr> &arg);
62 JSValueRef toJSValueRef(const MediacontentLyricsPtr &arg);
65 MediacontentMediaListPtr toVectorOfMediaItem(JSValueRef events);
70 typedef ConverterFactory<MediaConverter> MediaConverterFactory;
77 #endif // _TIZEN_MEDIACONTENT_CONVERTER_H_