Code Sync with Private GIT
[apps/web/download-manager.git] / src / download-manager-items.cpp
1 /*
2  * Copyright 2012  Samsung Electronics Co., Ltd
3  *
4  * Licensed under the Flora License, Version 1.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *    http://www.tizenopensource.org/license
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 /**
18  * @file        download-manager-items.cpp
19  * @author      Jungki Kwak (jungki.kwak@samsung.com)
20  * @brief       Interface API with item list
21  */
22 #include "download-manager-items.h"
23
24 void Items::attachItem(Item *item)
25 {
26         m_items.push_back(item);
27 }
28
29 void Items::detachItem(Item *item)
30 {
31         vector<Item *>::iterator it;
32         for (it = m_items.begin(); it < m_items.end(); it++) {
33                 if (*it == item) {
34                         delete item;
35                         m_items.erase(it);
36                 }
37         }
38 }
39
40 bool Items::isExistedHistoryId(unsigned int id)
41 {
42         vector <Item *>::iterator it;
43         for (it = m_items.begin(); it < m_items.end(); it++) {
44                 if ((*it)->historyId() == id ) {
45                         DP_LOGD("historyId[%ld],title[%s]",
46                                 (*it)->historyId(), (*it)->title().c_str());
47                         return true;
48                 }
49         }
50         return false;
51 }
52