blob: b5868fb6b9f6fef4c68e648cc72356ca948a1921 (
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
|
/***************************************************************************
knutupsdata.cpp - description
-------------------
begin : Tue Aug 21 2001
copyright : (C) 2001 by Daniel Prynych
email : Daniel.Prynych@alo.cz
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "knutupsdata.h"
#include "knutvardata.h"
#include <tqstring.h>
KNutUpsData::KNutUpsData() {
// vytvori seznam UPS
m_listRecords.clear();
m_countUpsRecords = 0;
}
KNutUpsData::~KNutUpsData() { m_listRecords.clear(); }
void KNutUpsData::add (const upsRecordDef upsRecord) {
// vlozime ups na konec
m_countUpsRecords++;
m_listRecords.append(upsRecord);
}
void KNutUpsData::put (const int index, const upsRecordDef upsRecord ) {
if ((index > -1 ) && (index < m_countUpsRecords)) {
m_listRecords[index] = (upsRecord);
}
}
void KNutUpsData::get (const int index, upsRecordDef& upsRecord ) {
if ((index > -1 ) && (index < m_countUpsRecords)) upsRecord=m_listRecords[index];
}
TQString KNutUpsData::getName (const int index) {
if ((index > -1 ) && (index < m_countUpsRecords)) return m_listRecords[index].name;
else return 0L;
}
void KNutUpsData::deleteName (const int index) {
if ((index > -1 ) && (index < m_countUpsRecords)) {
TQValueList<upsRecordDef>::Iterator it = m_listRecords.begin();
for (int i =0; i < index; i++) it++;
m_listRecords.remove(it);
m_countUpsRecords--;
}
}
int KNutUpsData::getCount ( void ) { return m_countUpsRecords; }
KNutUpsData::upsRecordDef* KNutUpsData::findName (const TQString name) {
TQValueList<upsRecordDef>::Iterator it;
for (it = m_listRecords.begin(); it != m_listRecords.end(); it++) {
if ((*it).name == name) {
return &(*it); // vratime adresu
}
}
return 0l;
}
|