~ubuntu-branches/ubuntu/intrepid/knutclient/intrepid

« back to all changes in this revision

Viewing changes to knutclient/knutupsdata.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Stephan Hermann
  • Date: 2007-03-08 16:08:31 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070308160831-0kes374x4jhkcea5
Tags: 0.9.3-1ubuntu1
* UVE Exception: New Upstream release
* Fixes BTS #410405 (FTBFS on x86_64)
* debian/rules:
  - commented out dh_iconcache call
* debian/control:
  - Added Ubuntu MOTU Maintainer Field
  - Moved old Maintainer field to Original-Maintainer
* debian/changelog:
  - Merged Ubuntu Changelog entries

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
                          knutupsdata.cpp  -  description
3
 
                             -------------------
4
 
    begin                : Tue Aug 21 2001
5
 
    copyright            : (C) 2001 by Daniel Prynych
6
 
    email                : Daniel.Prynych@alo.cz
7
 
 ***************************************************************************/
8
 
 
9
 
/***************************************************************************
10
 
 *                                                                         *
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.                                   *
15
 
 *                                                                         *
16
 
 ***************************************************************************/
17
 
 
18
 
#include "knutupsdata.h"
19
 
#include "knutvardata.h"
20
 
 
21
 
#include <qstring.h>
22
 
 
23
 
 
24
 
KNutUpsData::KNutUpsData()  {
25
 
// vytvori seznam UPS
26
 
  listRecords.clear();
27
 
  countMembers = 0;
28
 
  }
29
 
 
30
 
KNutUpsData::~KNutUpsData() { listRecords.clear(); }
31
 
 
32
 
void KNutUpsData::add (const upsRecord upsMember) {
33
 
// vlozime ups na konec
34
 
  countMembers++;
35
 
  listRecords.append(upsMember);
36
 
  }
37
 
 
38
 
 
39
 
void KNutUpsData::put (const int index, const upsRecord upsMember ) {
40
 
  if ((index > -1 ) && (index < countMembers)) {
41
 
    listRecords[index] = (upsMember);
42
 
    }
43
 
  }
44
 
 
45
 
 
46
 
void KNutUpsData::get (const int index, upsRecord& upsMember ) {
47
 
  if ((index > -1 ) && (index < countMembers)) upsMember=listRecords[index];
48
 
  }
49
 
 
50
 
QString KNutUpsData::getName (const int index) {
51
 
  if ((index > -1 ) && (index < countMembers)) return listRecords[index].name;
52
 
  else return 0L;
53
 
  }
54
 
 
55
 
 
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);
61
 
  countMembers--;
62
 
  }
63
 
}
64
 
 
65
 
 
66
 
int KNutUpsData::getCount ( void ) { return countMembers; }
67
 
 
68
 
 
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
74
 
      }
75
 
    }
76
 
   return 0l;
77
 
  }
78