blob: fdbf4ec0bd5ff9f7528b0226ae5b261548a946e1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
/*
* Copyright (C) 2006
* Siraj Razick <[email protected]>
* PhobosK <[email protected]>
* see Also AUTHORS
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License version 2 as
* published by the Free Software Foundation
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KBFX_DATA_GROUP_H
#define KBFX_DATA_GROUP_H
#include <tqmap.h>
#include <tqstringlist.h>
#include "kbfxdatasource.h"
class KbfxDataGroup
{
public:
typedef TQMap<TQString,KbfxDataSource*> Data;
typedef TQMap<int,KbfxDataSource*> Index;
/**
* Construts a new data group and initialzes the group
* @return Constructs a new Datagroup
*/
KbfxDataGroup();
/**
* De-allocates and frees the meomery when destroyed
* @return
*/
~KbfxDataGroup();
/**
* Adds a new DataSource to the Group
* null pointers and invalid datasources are handled
* internally no manal checking is needed
* @param item A pointer to a datasource valid or invalid
*/
void addItem ( KbfxDataSource * item );
/**
* Sets a proper Name to the group. The default will be set to
* "Unknown Group" . it is recomended that a name is always set
* @param name The name that should be give to the group
*/
void setName ( TQString name ) {m_name = name;}
/**
* To access a datasource give the name of the datasource
* @param The name othe datasource
* @return pointer to a valid datasource
*/
KbfxDataSource * getItem ( TQString );
/**
* use this to get all the items inside the datagroup
* @return a copy of the data Map (TQMap<TQString,KbfxDataSource*>)
*/
Data getData();
/**
* searches and returns the list of matching datasources
* @param keyword to search for
* @return list of matching datasources
*/
KbfxDataSource::DataSourceList lookup ( TQString );
/**
* The name of the group
* @return Name of the group
*/
TQString name() {return m_name;}
/**
* The number of datasources inside the datagroup
* @return number of datasources
*/
int count() {return m_count;}
/**
*
*
*
*/
KbfxDataSource * itemAt(int index);
private:
Data m_data;
TQString m_name;
int m_count;
Index m_index;
};
#endif
|