Tizen 2.1 base
[platform/framework/native/content.git] / src / FCnt_DownloadRequestImpl.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        FCnt_DownloadRequestImpl.cpp
20  * @brief       This is the implementation file for the _DownloadRequestImpl class.
21  *
22  */
23
24
25 #include <FBaseLog.h>
26
27 #include "FCnt_DownloadRequestImpl.h"
28
29 using namespace Tizen::Base;
30
31 namespace Tizen { namespace Content
32 {
33
34 _DownloadRequestImpl::_DownloadRequestImpl(void)
35 {
36 }
37
38 _DownloadRequestImpl::_DownloadRequestImpl(const String& url)
39         : __url(url)
40 {
41 }
42
43 _DownloadRequestImpl::_DownloadRequestImpl(const String& url, const String& dirPath)
44         : __url(url)
45         , __dirPath(dirPath)
46 {
47 }
48
49 _DownloadRequestImpl::_DownloadRequestImpl(const _DownloadRequestImpl& rhs)
50         : __url(rhs.__url)
51         , __dirPath(rhs.__dirPath)
52         , __fileName(rhs.__fileName)
53 {
54 }
55
56 _DownloadRequestImpl::~_DownloadRequestImpl(void)
57 {
58 }
59
60
61 _DownloadRequestImpl&
62 _DownloadRequestImpl::operator =(const _DownloadRequestImpl& rhs)
63 {
64         __url = rhs.__url;
65         __dirPath = rhs.__dirPath;
66         __fileName = rhs.__fileName;
67
68         return *this;
69 }
70
71 bool
72 _DownloadRequestImpl::operator ==(const _DownloadRequestImpl& rhs) const
73 {
74         if (&rhs == this)
75         {
76                 return true;
77         }
78
79         if (__url == rhs.__url
80                 && __dirPath == rhs.__dirPath
81                 && __fileName == rhs.__fileName)
82         {
83                 return true;
84         }
85
86         return false;
87 }
88
89 bool
90 _DownloadRequestImpl::Equals(const Object& obj) const
91 {
92         const _DownloadRequestImpl* pOther = dynamic_cast< const _DownloadRequestImpl* >(&obj);
93         if (pOther == null)
94         {
95                 return false;
96         }
97
98         return (*this == *pOther);
99 }
100
101 int
102 _DownloadRequestImpl::GetHashCode(void) const
103 {
104         String hashCode;
105
106         hashCode.Append(__url);
107         hashCode.Append(__dirPath);
108         hashCode.Append(__fileName);
109
110         return hashCode.GetHashCode();
111 }
112
113 void
114 _DownloadRequestImpl::SetDirectoryPath(const String& dirPath)
115 {
116         __dirPath = dirPath;
117 }
118
119 void
120 _DownloadRequestImpl::SetFileName(const String& fileName)
121 {
122         __fileName = fileName;
123 }
124
125 String
126 _DownloadRequestImpl::GetUrl(void) const
127 {
128         return __url;
129 }
130
131 String
132 _DownloadRequestImpl::GetDirectoryPath(void) const
133 {
134         return __dirPath;
135 }
136
137 String
138 _DownloadRequestImpl::GetFileName(void) const
139 {
140         return __fileName;
141 }
142
143 } } // Tizen::Content