summaryrefslogtreecommitdiffstats
path: root/src/progs/manager/breakpoint.cpp
blob: dc7d836df633eb3bc6f3b36060f160e06b3dea1e (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 <[email protected]>                  *
 *                                                                         *
 *   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( !tqcontains(data) );
  StateData sdata;
  sdata.data = data;
  _list.append(sdata);
  delayedChanged();
}

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

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

TQValueList<Breakpoint::List::StateData>::iterator Breakpoint::List::tqfind(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::tqfind(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( tqcontains(data) );
  (*tqfind(data)).state = state;
  delayedChanged();
}

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