add missing files
[raptor.git] / lib / raptordatasourcegroup.cpp
blob5602702a78139dccf502b6ef14b1308a99a937e9
1 /*
2 * Copyright (C) 2006
3 * Siraj Razick <siraj@kdemail.net>
4 * see Also AUTHORS
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Library General Public License version 2 as
8 * published by the Free Software Foundation
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details
15 * You should have received a copy of the GNU Library General Public
16 * License along with this program; if not, write to the
17 * Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #include "raptordatasourcegroup.h"
23 RaptorDataSourceGroup::RaptorDataSourceGroup()
25 m_name = "Uknown Group";
26 m_count = 0;
29 RaptorDataSourceGroup::~RaptorDataSourceGroup()
31 Data::Iterator it;
32 for ( it = m_data.begin();it!=m_data.end();++it )
34 //delete it.data();
35 // m_data.remove ( it );
36 //delete *it;
39 m_data.clear();
42 RaptorDataSourceGroup::Data
43 RaptorDataSourceGroup::lookup ( QString str )
45 //static RaptorDataSourceGroup * _matching = new RaptorDataSourceGroup();
46 RaptorDataSourceGroup::Data _matching;
47 Data::Iterator it;
48 for ( it = m_data.begin();it!=m_data.end();++it )
50 if ( ( *it )->lookup ( str ) == true )
52 // _matching.prepend ( * ( *it ) );
53 _matching[(*it)->name()] = *it;
57 return _matching;
60 void
61 RaptorDataSourceGroup::addItem ( RaptorDataSource * item )
63 if ( item == 0 )
64 return ;
65 m_data[item->name() ] = item;
66 m_index[m_count] = item;
67 m_count++;
69 // qDebug("RaptorDataSourceGroup.cpp::addItem("+item->name()+")");
72 RaptorDataSource*
73 RaptorDataSourceGroup::itemAt(int index)
75 if ( index < 0 || index > m_count)
76 return 0;
77 else
78 return m_index[index];
82 RaptorDataSource *
83 RaptorDataSourceGroup::getItem ( QString name )
85 return m_data[name];
88 RaptorDataSourceGroup::Data
89 RaptorDataSourceGroup::getData()
91 return m_data;