1
/***************************************************************************
2
knutupsdata.cpp - description
4
begin : Tue Aug 21 2001
5
copyright : (C) 2001 by Daniel Prynych
6
email : Daniel.Prynych@alo.cz
7
***************************************************************************/
9
/***************************************************************************
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
16
***************************************************************************/
18
#include "knutupsdata.h"
19
#include "knutvardata.h"
24
KNutUpsData::KNutUpsData() {
30
KNutUpsData::~KNutUpsData() { listRecords.clear(); }
32
void KNutUpsData::add (const upsRecord upsMember) {
33
// vlozime ups na konec
35
listRecords.append(upsMember);
39
void KNutUpsData::put (const int index, const upsRecord upsMember ) {
40
if ((index > -1 ) && (index < countMembers)) {
41
listRecords[index] = (upsMember);
46
void KNutUpsData::get (const int index, upsRecord& upsMember ) {
47
if ((index > -1 ) && (index < countMembers)) upsMember=listRecords[index];
50
QString KNutUpsData::getName (const int index) {
51
if ((index > -1 ) && (index < countMembers)) return listRecords[index].name;
56
void KNutUpsData::deleteName (const int index) {
57
if ((index > -1 ) && (index < countMembers)) {
58
QValueList<upsRecord>::Iterator it = listRecords.begin();
59
for (int i =0; i < index; i++) it++;
60
listRecords.remove(it);
66
int KNutUpsData::getCount ( void ) { return countMembers; }
69
upsRecord* KNutUpsData::findName (const QString name) {
70
QValueList<upsRecord>::Iterator it;
71
for (it = listRecords.begin(); it != listRecords.end(); it++) {
72
if ((*it).name == name) {
73
return &(*it); // vratime adresu