2 * Funambol is a mobile platform developed by Funambol, Inc.
3 * Copyright (C) 2003 - 2007 Funambol, Inc.
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU Affero General Public License version 3 as published by
7 * the Free Software Foundation with the addition of the following permission
8 * added to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED
9 * WORK IN WHICH THE COPYRIGHT IS OWNED BY FUNAMBOL, FUNAMBOL DISCLAIMS THE
10 * WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program; if not, see http://www.gnu.org/licenses or write to
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22 * You can contact Funambol, Inc. headquarters at 643 Bair Island Road, Suite
23 * 305, Redwood City, CA 94063, USA, or at email address info@funambol.com.
25 * The interactive user interfaces in modified source and object code versions
26 * of this program must display Appropriate Legal Notices, as required under
27 * Section 5 of the GNU Affero General Public License version 3.
29 * In accordance with Section 7(b) of the GNU Affero General Public License
30 * version 3, these Appropriate Legal Notices must retain the display of the
31 * "Powered by Funambol" logo. If the display of the logo is not reasonably
32 * feasible for technical reasons, the Appropriate Legal Notices must display
33 * the words "Powered by Funambol".
37 #include "syncml/core/Item.h"
38 #include "base/globalsdef.h"
48 if (target) { delete target; target = NULL; }
49 if (source) { delete source; source = NULL; }
50 if (meta ) { delete meta ; meta = NULL; }
51 if (data ) { delete data ; data = NULL; }
52 if (targetParent) { delete [] targetParent; targetParent = NULL; }
53 if (sourceParent) { delete [] sourceParent; sourceParent = NULL; }
59 void Item::initialize() {
70 * Creates a new Item object.
72 * @param target item target - NULL ALLOWED
73 * @param source item source - NULL ALLOWED
74 * @param targetParent item target parent - NULL ALLOWED (DEFAULT)
75 * @param sourceParent item source parent - NULL ALLOWED (DEFAULT)
76 * @param meta item meta data - NULL ALLOWED
77 * @param data item data - NULL ALLOWED
80 Item::Item( Target* target,
91 setTargetParent(tParent);
92 setSourceParent(sParent);
95 setMoreData(moreData);
103 * Creates a new Item object.
105 * @param target item target - NULL ALLOWED
106 * @param source item source - NULL ALLOWED
107 * @param meta item meta data - NULL ALLOWED
108 * @param data item data - NULL ALLOWED
111 Item::Item( Target* target,
119 setTargetParent(NULL);
120 setSourceParent(NULL);
123 setMoreData(moreData);
128 * Returns the item target
130 * @return the item target
132 Target* Item::getTarget() {
137 * Sets the item target
139 * @param target the target
142 void Item::setTarget(Target* target) {
144 delete this->target; this->target = NULL;
147 this->target = target->clone();
152 * Returns the item source
154 * @return the item source
156 Source* Item::getSource() {
161 * Sets the item source
163 * @param source the source
166 void Item::setSource(Source* source) {
168 delete this->source; this->source = NULL;
171 this->source = source->clone();
176 * Returns the item meta element
178 * @return the item meta element
180 Meta* Item::getMeta() {
187 * @param meta the item meta element
190 void Item::setMeta(Meta* meta) {
192 delete this->meta; this->meta = NULL;
195 this->meta = meta->clone();
200 * Returns the item data
202 * @return the item data
205 ComplexData* Item::getData() {
212 * @param data the item data
215 void Item::setData(ComplexData* data) {
217 delete this->data; this->data = NULL;
220 this->data = data->clone();
225 * Gets moreData property
227 * @return true if the data item is incomplete and has further chunks
228 * to come, false otherwise
230 bool Item::isMoreData() {
231 return (moreData != NULL);
235 * Gets the Boolean value of moreData
237 * @return true if the data item is incomplete and has further chunks
238 * to come, false otherwise
240 bool Item::getMoreData() {
245 * Sets the moreData property
247 * @param moreData the moreData property
249 void Item::setMoreData(bool moreData) {
250 this->moreData = moreData;
254 * Gets the taregtParent property
256 * @return the taregtParent property value
258 const char* Item::getTargetParent() {
263 * Sets the taregtParent property
265 * @param parent the taregtParent property
267 void Item::setTargetParent(const char*parent) {
269 delete [] targetParent; targetParent = NULL;
271 targetParent = stringdup(parent);
275 * Gets the sourceParent property
277 * @return the sourceParent property value
279 const char* Item::getSourceParent() {
284 * Sets the sourceParent property
286 * @param parent the sourceParent property
288 void Item::setSourceParent(const char*parent) {
290 delete [] sourceParent; sourceParent = NULL;
292 sourceParent = stringdup(parent);
296 * Item can be an element of an Array object
298 ArrayElement* Item::clone() {
299 //Item* ret = new Item(target, source, targetParent, sourceParent, meta, data, moreData);
300 Item* ret = new Item(target, source, meta, data, moreData);