Tizen 2.1 base
[platform/framework/native/telephony.git] / src / FTelCallInfo.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 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  * @file        FTelCallInfo.cpp
19  * @brief       This is the implementation file for CallInfo class.
20  */
21
22
23 #include <FTelCallInfo.h>
24 #include <FBaseSysLog.h>
25 #include "FTel_CallInfoImpl.h"
26
27
28 using namespace Tizen::Base;
29
30 namespace Tizen { namespace Telephony
31 {
32 CallInfo::CallInfo(void)
33         : __pCallInfoImpl(null)
34 {
35         __pCallInfoImpl = new (std::nothrow) _CallInfoImpl();
36         SysTryReturnVoidResult(NID_TEL, __pCallInfoImpl != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
37 }
38
39 CallInfo::CallInfo(const CallInfo& callInfo)
40         : __pCallInfoImpl(null)
41 {
42         __pCallInfoImpl = new (std::nothrow) _CallInfoImpl(*callInfo.__pCallInfoImpl);
43         SysTryReturnVoidResult(NID_TEL, __pCallInfoImpl != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
44 }
45
46 CallInfo::~CallInfo(void)
47 {
48         delete __pCallInfoImpl;
49 }
50
51 CallInfo&
52 CallInfo::operator=(const CallInfo& rhs)
53 {
54         if (this != &rhs)
55         {
56         *__pCallInfoImpl = *(rhs.__pCallInfoImpl);
57         }
58
59         return *this;
60 }
61
62 CallType
63 CallInfo::GetCallType(void) const
64 {
65         return __pCallInfoImpl->GetCallType();
66 }
67
68 String
69 CallInfo::GetNumber(void) const
70 {
71         return __pCallInfoImpl->GetNumber();
72 }
73
74 bool
75 CallInfo::Equals(const Object& obj) const
76 {
77         const CallInfo* pOther = dynamic_cast<const CallInfo*>(&obj);
78
79         if (pOther == null)
80         {
81         return false;
82         }
83
84         if (pOther == this)
85         {
86         return true;
87         }
88
89         return __pCallInfoImpl->Equals(*pOther->__pCallInfoImpl);
90 }
91
92 int
93 CallInfo::GetHashCode(void) const
94 {
95         return __pCallInfoImpl->GetHashCode();
96 }
97
98 CallInfo::CallInfo(CallType type, const String& number)
99 {
100         SysLog(NID_TEL,"The CallType is %d and the number is %ls", type, number.GetPointer());
101
102         __pCallInfoImpl = new (std::nothrow) _CallInfoImpl(type, number);
103         SysTryReturnVoidResult(NID_TEL, __pCallInfoImpl != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
104 }
105
106 }} // Tizen::Telephony