File: hex-edit.cpp

package info (click to toggle)
higan 098-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 11,904 kB
  • ctags: 13,286
  • sloc: cpp: 108,285; ansic: 778; makefile: 32; sh: 18
file content (93 lines) | stat: -rw-r--r-- 1,942 bytes parent folder | download | duplicates (2)
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#if defined(Hiro_HexEdit)

auto mHexEdit::allocate() -> pObject* {
  return new pHexEdit(*this);
}

//

auto mHexEdit::address() const -> unsigned {
  return state.address;
}

auto mHexEdit::backgroundColor() const -> Color {
  return state.backgroundColor;
}

auto mHexEdit::columns() const -> unsigned {
  return state.columns;
}

auto mHexEdit::doRead(unsigned offset) const -> uint8_t {
  if(state.onRead) return state.onRead(offset);
  return 0x00;
}

auto mHexEdit::doWrite(unsigned offset, uint8_t data) const -> void {
  if(state.onWrite) return state.onWrite(offset, data);
}

auto mHexEdit::foregroundColor() const -> Color {
  return state.foregroundColor;
}

auto mHexEdit::length() const -> unsigned {
  return state.length;
}

auto mHexEdit::onRead(const function<uint8_t (unsigned)>& callback) -> type& {
  state.onRead = callback;
  return *this;
}

auto mHexEdit::onWrite(const function<void (unsigned, uint8_t)>& callback) -> type& {
  state.onWrite = callback;
  return *this;
}

auto mHexEdit::rows() const -> unsigned {
  return state.rows;
}

auto mHexEdit::setAddress(unsigned address) -> type& {
  state.address = address;
  signal(setAddress, address);
  return *this;
}

auto mHexEdit::setBackgroundColor(Color color) -> type& {
  state.backgroundColor = color;
  signal(setBackgroundColor, color);
  return *this;
}

auto mHexEdit::setColumns(unsigned columns) -> type& {
  state.columns = columns;
  signal(setColumns, columns);
  return *this;
}

auto mHexEdit::setForegroundColor(Color color) -> type& {
  state.foregroundColor = color;
  signal(setForegroundColor, color);
  return *this;
}

auto mHexEdit::setLength(unsigned length) -> type& {
  state.length = length;
  signal(setLength, length);
  return *this;
}

auto mHexEdit::setRows(unsigned rows) -> type& {
  state.rows = rows;
  signal(setRows, rows);
  return *this;
}

auto mHexEdit::update() -> type& {
  signal(update);
  return *this;
}

#endif