fix bug for geolocation and contents download
[framework/osp/web.git] / src / controls / FWebCtrl_HitElementResultImpl.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                FWebCtrl_HitElementResultImpl.cpp
20  * @brief               The file contains the definition of _HitElementResultImpl class.
21  *
22  * The file contains the definition of _HitElementResultImpl class.
23  */
24 #include <FGrpBitmap.h>
25 #include <FWebCtrlHitElementResult.h>
26 #include <FBaseSysLog.h>
27 #include "FWebCtrl_HitElementResultImpl.h"
28
29
30 using namespace Tizen::Base;
31 using namespace Tizen::Base::Collection;
32 using namespace Tizen::Graphics;
33
34
35 namespace Tizen { namespace Web { namespace Controls
36 {
37
38
39 _HitElementResultImpl::_HitElementResultImpl(void)
40         : __pAttributeMap(null)
41         , __pImage(null)
42         , __content(L"")
43         , __tagName(L"")
44         , __url(L"")
45 {
46 }
47
48
49 _HitElementResultImpl::~_HitElementResultImpl(void)
50 {
51 }
52
53
54 void
55 _HitElementResultImpl::SetHitElementResult(IMap* pAttributeMap, Bitmap* pImage, const String& tagName, const String& content, const String& url)
56 {
57         __pAttributeMap = std::unique_ptr<IMap, AllElementsDeleter>(pAttributeMap);
58         __pImage = std::unique_ptr<Bitmap>(pImage);
59         __tagName = tagName;
60         __content = content;
61         __url = url;
62 }
63
64
65 String
66 _HitElementResultImpl::GetTagName(void) const
67 {
68         return __tagName;
69 }
70
71
72 String
73 _HitElementResultImpl::GetAttributeValue(const String& attributeName) const
74 {
75         String attribute(L"");
76
77         if (__pAttributeMap.get())
78         {
79                 const String* pValue = dynamic_cast< const String* >(__pAttributeMap->GetValue(attributeName));
80
81                 if (pValue)
82                 {
83                         attribute = *pValue;
84                 }
85         }
86
87         return attribute;
88 }
89
90
91 String
92 _HitElementResultImpl::GetContent(void) const
93 {
94         return __content;
95 }
96
97
98 String
99 _HitElementResultImpl::GetUrl(void) const
100 {
101         return __url;
102 }
103
104
105 const Bitmap*
106 _HitElementResultImpl::GetImage(void) const
107 {
108         return __pImage.get();
109 }
110
111
112 bool
113 _HitElementResultImpl::HasImage(void) const
114 {
115         if (__pImage.get())
116         {
117                 return true;
118         }
119         else
120         {
121                 return false;
122         }
123 }
124
125
126 bool
127 _HitElementResultImpl::HasUrl(void) const
128 {
129         if (__url.GetLength())
130         {
131                 return true;
132         }
133         else
134         {
135                 return false;
136         }
137 }
138
139
140 _HitElementResultImpl*
141 _HitElementResultImpl::GetInstance(HitElementResult* pHitElementResult)
142 {
143         return pHitElementResult->__pHitElementResultImpl;
144 }
145
146
147 const _HitElementResultImpl*
148 _HitElementResultImpl::GetInstance(const HitElementResult* pHitElementResult)
149 {
150         return pHitElementResult->__pHitElementResultImpl;
151 }
152
153
154 }}} // Tizen::Web::Controls