summaryrefslogtreecommitdiffstats
path: root/src/progs/manager/breakpoint.cpp
blob: 3cda051e03027c300a0859678b75dba63b5c481b (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
/***************************************************************************
 *   Copyright (C) 2006 Nicolas Hadacek <hadacek@kde.org>                  *
 *                                                                         *
 *   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 "breakpoint.h"

#include "coff/base/coff.h"

//----------------------------------------------------------------------------
namespace Breakpoint
{
  List *_list = 0;
}
Breakpoint::List &Breakpoint::list()
{
  if ( _list==0 ) _list = new List;
  return *_list;
}

void Breakpoint::List::append(const Data &data)
{
  Q_ASSERT( !contains(data) );
  StateData sdata;
  sdata.data = data;
  _list.append(sdata);
  delayedChanged();
}

void Breakpoint::List::remove(const Data &data)
{
  Q_ASSERT( contains(data) );
  _list.remove(find(data));
  delayedChanged();
}

void Breakpoint::List::clear()
{
  _list.clear();
  delayedChanged();
}

TQValueList<Breakpoint::List::StateData>::iterator Breakpoint::List::find(const Data &data)
{
  TQValueList<StateData>::iterator it;
  for (it=_list.begin(); it!=_list.end(); ++it)
    if ( (*it).data==data ) return it;
  return _list.end();
}

TQValueList<Breakpoint::List::StateData>::const_iterator Breakpoint::List::find(const Data &data) const
{
  TQValueList<StateData>::const_iterator it;
  for (it=_list.begin(); it!=_list.end(); ++it)
    if ( (*it).data==data ) return it;
  return _list.end();
}

void Breakpoint::List::setState(const Data &data, State state)
{
  Q_ASSERT( contains(data) );
  (*find(data)).state = state;
  delayedChanged();
}

void Breakpoint::List::setAddress(const Data &data, Address address)
{
  Q_ASSERT( contains(data) );
  (*find(data)).address = address;
  delayedChanged();
}