Beta merge 2
[profile/ivi/wrt-plugins-tizen.git] / src / standards / Tizen / Mediacontent / MediaConverter.h
1 /*
2  /*
3  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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 #ifndef _TIZEN_MEDIACONTENT_CONVERTER_H_
19 #define _TIZEN_MEDIACONTENT_CONVERTER_H_
20
21 #include <vector>
22 #include <string>
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>
28
29 using namespace TizenApis::Api::Mediacontent;
30 using namespace WrtDeviceApis::Commons;
31 using namespace WrtDeviceApis::CommonsJavaScript;
32
33
34 namespace TizenApis {
35 namespace Tizen1_0 {
36 namespace Mediacontent {
37         
38
39 class MediaConverter : public Converter
40 {
41         public:
42         using Converter::toJSValueRef;
43
44         public:
45         explicit MediaConverter(JSContextRef context);
46
47         JSValueRef toJSValueRefMediacontent(const IMediacontentPtr& arg);
48
49         /**
50         * @throw InvalidArgumentException If not a callback nor JS null.
51         */
52         JSValueRef toFunctionOrNull(const JSValueRef& arg);
53
54         /**
55         * @throw ConversionException If JS null.
56         * @throw InvalidArgumentException If not a callback nor JS null.
57         */
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;
67
68     
69 };
70
71 typedef ConverterFactory<MediaConverter> MediaConverterFactory;
72
73
74 }
75 }
76 }
77
78 #endif // _TIZEN_MEDIACONTENT_CONVERTER_H_