modify license, permission and remove ^M char
[platform/framework/native/uifw.git] / src / ui / FUi_UiBuilderControlItem.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 /**
19 * @file         FUi_UiBuilderControlItem.cpp
20 * @brief                This is the implementation file for _UiBuilderControlItem class.
21 */
22
23 // includes
24 #include <stdlib.h>
25 #include <string.h>
26 #include "FUi_UiBuilder.h"
27 #include "FUi_UiBuilderControlItem.h"
28
29 using namespace Tizen::Base;
30 using namespace Tizen::Base::Collection;
31 using namespace Tizen::Ui;
32
33 namespace Tizen { namespace Ui
34 {
35 _UiBuilderControlItem::_UiBuilderControlItem(void)
36         : _itemName(L"")
37         ,__pUiBuilderControlElementList(null)
38 {
39         if (__pUiBuilderControlElementList   == null)
40         {
41                 __pUiBuilderControlElementList = new (std::nothrow) ArrayListT<_UiBuilderControlElement*>;
42         }
43 }
44
45 _UiBuilderControlItem::~_UiBuilderControlItem(void)
46 {
47         if (__pUiBuilderControlElementList)
48         {
49                 _UiBuilderControlElement* pUiBuilderControlElement = null;
50                 int controlCount = __pUiBuilderControlElementList->GetCount();
51                 for (int i = 0; i < controlCount; i++)
52                 {
53                         __pUiBuilderControlElementList->GetAt(i, pUiBuilderControlElement);
54                         delete pUiBuilderControlElement;
55                 }
56                 __pUiBuilderControlElementList->RemoveAll();
57                 delete __pUiBuilderControlElementList;
58                 __pUiBuilderControlElementList = null;
59         }
60 }
61
62 void
63 _UiBuilderControlItem::SetItemName(const Tizen::Base::String& name)
64 {
65         _itemName = name;
66 }
67
68 String
69 _UiBuilderControlItem::GetItemName(void) const
70 {
71         return _itemName;
72 }
73
74 void
75 _UiBuilderControlItem::SetItemElement(int index, const Tizen::Base::String& name, const Tizen::Base::String& value)
76 {
77         _UiBuilderControlElement* pUiBuilderControlElement = null;
78         pUiBuilderControlElement = new (std::nothrow) _UiBuilderControlElement;
79         if (pUiBuilderControlElement != null)
80         {
81                 pUiBuilderControlElement->SetName(name);
82                 pUiBuilderControlElement->SetValue(value);
83                 __pUiBuilderControlElementList->Add(pUiBuilderControlElement);
84         }
85
86
87 }
88 ArrayListT<_UiBuilderControlElement*>*
89 _UiBuilderControlItem::GetItemProperty(void)
90 {
91         return __pUiBuilderControlElementList;
92 }
93
94
95 } }  // Tizen::Ui