add patch
[framework/osp/web.git] / src / controls / FWebCtrlHitElementResult.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                FWebCtrlHitElementResult.cpp
20  * @brief               The file contains the definition of HitElementResult class.
21  *
22  * The file contains the definition of HitElementResult class.
23  */
24 #include <new>
25 #include <FBaseResult.h>
26 #include <FBaseSysLog.h>
27 #include <FGrpBitmap.h>
28 #include <FWebCtrlHitElementResult.h>
29 #include "FWebCtrl_HitElementResultImpl.h"
30
31
32 using namespace Tizen::Base;
33 using namespace Tizen::Base::Collection;
34 using namespace Tizen::Graphics;
35
36
37 namespace Tizen { namespace Web { namespace Controls
38 {
39
40
41 HitElementResult::HitElementResult(void)
42         : __pHitElementResultImpl(new (std::nothrow) _HitElementResultImpl())
43 {
44         SysTryReturnVoidResult(NID_WEB_CTRL, __pHitElementResultImpl, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
45 }
46
47
48 HitElementResult::~HitElementResult(void)
49 {
50         delete __pHitElementResultImpl;
51         __pHitElementResultImpl = null;
52 }
53
54
55 String
56 HitElementResult::GetTagName(void) const
57 {
58         SysAssertf(__pHitElementResultImpl != null, "Not yet constructed. Construct() should be called before use.");
59
60         return __pHitElementResultImpl->GetTagName();
61 }
62
63
64 String
65 HitElementResult::GetAttributeValue(const String& attributeName) const
66 {
67         SysAssertf(__pHitElementResultImpl != null, "Not yet constructed. Construct() should be called before use.");
68
69         SysLog(NID_WEB_CTRL, "The current value of attributeName is %ls", attributeName.GetPointer());
70
71         return __pHitElementResultImpl->GetAttributeValue(attributeName);
72 }
73
74
75 String
76 HitElementResult::GetContent(void) const
77 {
78         SysAssertf(__pHitElementResultImpl != null, "Not yet constructed. Construct() should be called before use.");
79
80         return __pHitElementResultImpl->GetContent();
81 }
82
83
84 String
85 HitElementResult::GetUrl(void) const
86 {
87         SysAssertf(__pHitElementResultImpl != null, "Not yet constructed. Construct() should be called before use.");
88
89         return __pHitElementResultImpl->GetUrl();
90 }
91
92
93 const Bitmap*
94 HitElementResult::GetImage(void) const
95 {
96         SysAssertf(__pHitElementResultImpl != null, "Not yet constructed. Construct() should be called before use.");
97
98         return __pHitElementResultImpl->GetImage();
99 }
100
101
102 bool
103 HitElementResult::HasImage(void) const
104 {
105         SysAssertf(__pHitElementResultImpl != null, "Not yet constructed. Construct() should be called before use.");
106
107         return __pHitElementResultImpl->HasImage();
108 }
109
110
111 bool
112 HitElementResult::HasUrl(void) const
113 {
114         SysAssertf(__pHitElementResultImpl != null, "Not yet constructed. Construct() should be called before use.");
115
116         return __pHitElementResultImpl->HasUrl();
117 }
118
119
120 }}} // Tizen::Web::Controls