Back

iterator.cpp coverage

overall coverage: 100.0%

line# code(run#)
1 #ifndef NO_MEMTRACE
2 #include "memtrace.h"
3 #endif
4
5 #include "myString.h"
6
7 String::Iterator::Iterator(size_t i, String &s) : idx(i), cache(s) {}(4)
8
9 String::Iterator::Iterator(const Iterator &it) : idx(it.idx), cache(it.cache) {}(1)
10
11 String::Iterator &String::Iterator::operator++()(11)
12 {
13 ++idx;(11)
14 return *this;(11)
15 }
16
17 String::Iterator &String::Iterator::operator--()(3)
18 {
19 --idx;(3)
20 return *this;(3)
21 }
22
23 char &String::Iterator::operator*() const(12)
24 {
25 return cache.getChar(idx);(12)
26 }
27
28 bool String::Iterator::operator==(const Iterator &it) const(1)
29 {
30 return idx == it.idx;(1)
31 }
32
33 bool String::Iterator::operator==(const ConstIterator &it) const(1)
34 {
35 return idx == it.idx;(1)
36 }
37
38 bool String::Iterator::operator!=(const Iterator &it) const(1)
39 {
40 return idx != it.idx;(1)
41 }
42
43 bool String::Iterator::operator!=(const ConstIterator &it) const(1)
44 {
45 return idx != it.idx;(1)
46 }
47
48 String::Iterator::~Iterator() = default;
49
50 String::ConstIterator::ConstIterator(size_t i, String &s) : idx(i), cache(s) {}(4)
51
52 String::ConstIterator::ConstIterator(const ConstIterator &it) : idx(it.idx), cache(it.cache) {}(1)
53
54 String::ConstIterator::ConstIterator(const Iterator &it) : idx(it.idx), cache(it.cache) {}(1)
55
56 String::ConstIterator &String::ConstIterator::operator++()(11)
57 {
58 ++idx;(11)
59 return *this;(11)
60 }
61
62 String::ConstIterator &String::ConstIterator::operator--()(3)
63 {
64 --idx;(3)
65 return *this;(3)
66 }
67
68 char String::ConstIterator::operator*() const(8)
69 {
70 return cache.getChar(idx);(8)
71 }
72
73 bool String::ConstIterator::operator==(const Iterator &it) const(1)
74 {
75 return idx == it.idx;(1)
76 }
77
78 bool String::ConstIterator::operator==(const ConstIterator &it) const(1)
79 {
80 return idx == it.idx;(1)
81 }
82
83 bool String::ConstIterator::operator!=(const Iterator &it) const(1)
84 {
85 return idx != it.idx;(1)
86 }
87
88 bool String::ConstIterator::operator!=(const ConstIterator &it) const(1)
89 {
90 return idx != it.idx;(1)
91 }
92
93 String::ConstIterator::~ConstIterator() = default;