Tizen 2.0 Release
[framework/osp/media.git] / src / FMedia_CapabilityCommon.cpp
1 //
2 // Open Service Platform
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  * @file        FMedia_CapabilityCommon.cpp
20  * @brief           This file contains the implementation of recorder capability header file FMedia_CapabilityTypes.h
21  */
22
23 #include <FBaseSysLog.h>
24 #include "FMedia_CapabilityTypes.h"
25
26 using namespace Tizen::Base;
27 using namespace Tizen::Base::Collection;
28
29 namespace Tizen { namespace Media
30 {
31
32 _MediaSafeArrayList::_MediaSafeArrayList(void)
33 {
34 }
35
36 _MediaSafeArrayList::~_MediaSafeArrayList(void)
37 {
38         RemoveItems();
39 }
40
41 void
42 _MediaSafeArrayList::RemoveItems(void)
43 {
44         RemoveAll(true);
45 }
46
47 result
48 _MediaSafeArrayList::AddPtr (std::unique_ptr<Tizen::Base::Object> pPtr)
49 {
50         result r = E_SUCCESS;
51         SysTryReturn(NID_MEDIA, pPtr != null, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
52
53         Object* pObj = pPtr.release();
54         SysTryReturn(NID_MEDIA, pObj != null, E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The object is not found.");
55
56         r = Add(*pObj);
57         SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating", GetErrorMessage(r));
58
59         return r;
60
61 CATCH:
62         if (pObj != null)
63         {
64                 delete pObj;
65         }
66         return r;
67 }
68
69
70 }}