summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar archshift2014-08-11 17:44:59 -0700
committerGravatar archshift2014-08-11 17:53:23 -0700
commit5a7c3ad1945c2829d03642b4526b9a066c73f06c (patch)
tree6f9f7e4d63549c68f1eff00587e4b97617b1326d
parentMerge pull request #40 from bentley/master (diff)
downloadyuzu-5a7c3ad1945c2829d03642b4526b9a066c73f06c.tar.gz
yuzu-5a7c3ad1945c2829d03642b4526b9a066c73f06c.tar.xz
yuzu-5a7c3ad1945c2829d03642b4526b9a066c73f06c.zip
Changed iterators to use auto, some of which using range-based loops
Diffstat (limited to '')
-rw-r--r--src/citra_qt/hotkeys.cpp30
-rw-r--r--src/common/break_points.cpp55
2 files changed, 43 insertions, 42 deletions
diff --git a/src/citra_qt/hotkeys.cpp b/src/citra_qt/hotkeys.cpp
index 1aa1e8b96..bbaa4a8dc 100644
--- a/src/citra_qt/hotkeys.cpp
+++ b/src/citra_qt/hotkeys.cpp
@@ -21,14 +21,14 @@ void SaveHotkeys(QSettings& settings)
21{ 21{
22 settings.beginGroup("Shortcuts"); 22 settings.beginGroup("Shortcuts");
23 23
24 for (HotkeyGroupMap::iterator group = hotkey_groups.begin(); group != hotkey_groups.end(); ++group) 24 for (auto group : hotkey_groups)
25 { 25 {
26 settings.beginGroup(group->first); 26 settings.beginGroup(group.first);
27 for (HotkeyMap::iterator hotkey = group->second.begin(); hotkey != group->second.end(); ++hotkey) 27 for (auto hotkey : group.second)
28 { 28 {
29 settings.beginGroup(hotkey->first); 29 settings.beginGroup(hotkey.first);
30 settings.setValue(QString("KeySeq"), hotkey->second.keyseq.toString()); 30 settings.setValue(QString("KeySeq"), hotkey.second.keyseq.toString());
31 settings.setValue(QString("Context"), hotkey->second.context); 31 settings.setValue(QString("Context"), hotkey.second.context);
32 settings.endGroup(); 32 settings.endGroup();
33 } 33 }
34 settings.endGroup(); 34 settings.endGroup();
@@ -42,17 +42,17 @@ void LoadHotkeys(QSettings& settings)
42 42
43 // Make sure NOT to use a reference here because it would become invalid once we call beginGroup() 43 // Make sure NOT to use a reference here because it would become invalid once we call beginGroup()
44 QStringList groups = settings.childGroups(); 44 QStringList groups = settings.childGroups();
45 for (QList<QString>::iterator group = groups.begin(); group != groups.end(); ++group) 45 for (auto group : groups)
46 { 46 {
47 settings.beginGroup(*group); 47 settings.beginGroup(group);
48 48
49 QStringList hotkeys = settings.childGroups(); 49 QStringList hotkeys = settings.childGroups();
50 for (QList<QString>::iterator hotkey = hotkeys.begin(); hotkey != hotkeys.end(); ++hotkey) 50 for (auto hotkey : hotkeys)
51 { 51 {
52 settings.beginGroup(*hotkey); 52 settings.beginGroup(hotkey);
53 53
54 // RegisterHotkey assigns default keybindings, so use old values as default parameters 54 // RegisterHotkey assigns default keybindings, so use old values as default parameters
55 Hotkey& hk = hotkey_groups[*group][*hotkey]; 55 Hotkey& hk = hotkey_groups[group][hotkey];
56 hk.keyseq = QKeySequence::fromString(settings.value("KeySeq", hk.keyseq.toString()).toString()); 56 hk.keyseq = QKeySequence::fromString(settings.value("KeySeq", hk.keyseq.toString()).toString());
57 hk.context = (Qt::ShortcutContext)settings.value("Context", hk.context).toInt(); 57 hk.context = (Qt::ShortcutContext)settings.value("Context", hk.context).toInt();
58 if (hk.shortcut) 58 if (hk.shortcut)
@@ -91,13 +91,13 @@ GHotkeysDialog::GHotkeysDialog(QWidget* parent): QDialog(parent)
91{ 91{
92 ui.setupUi(this); 92 ui.setupUi(this);
93 93
94 for (HotkeyGroupMap::iterator group = hotkey_groups.begin(); group != hotkey_groups.end(); ++group) 94 for (auto group : hotkey_groups)
95 { 95 {
96 QTreeWidgetItem* toplevel_item = new QTreeWidgetItem(QStringList(group->first)); 96 QTreeWidgetItem* toplevel_item = new QTreeWidgetItem(QStringList(group.first));
97 for (HotkeyMap::iterator hotkey = group->second.begin(); hotkey != group->second.end(); ++hotkey) 97 for (auto hotkey : group.second)
98 { 98 {
99 QStringList columns; 99 QStringList columns;
100 columns << hotkey->first << hotkey->second.keyseq.toString(); 100 columns << hotkey.first << hotkey.second.keyseq.toString();
101 QTreeWidgetItem* item = new QTreeWidgetItem(columns); 101 QTreeWidgetItem* item = new QTreeWidgetItem(columns);
102 toplevel_item->addChild(item); 102 toplevel_item->addChild(item);
103 } 103 }
diff --git a/src/common/break_points.cpp b/src/common/break_points.cpp
index 25d34a21a..4e04a06ff 100644
--- a/src/common/break_points.cpp
+++ b/src/common/break_points.cpp
@@ -11,16 +11,16 @@
11 11
12bool BreakPoints::IsAddressBreakPoint(u32 _iAddress) 12bool BreakPoints::IsAddressBreakPoint(u32 _iAddress)
13{ 13{
14 for (TBreakPoints::iterator i = m_BreakPoints.begin(); i != m_BreakPoints.end(); ++i) 14 for (auto breakpoint : m_BreakPoints)
15 if (i->iAddress == _iAddress) 15 if (breakpoint.iAddress == _iAddress)
16 return true; 16 return true;
17 return false; 17 return false;
18} 18}
19 19
20bool BreakPoints::IsTempBreakPoint(u32 _iAddress) 20bool BreakPoints::IsTempBreakPoint(u32 _iAddress)
21{ 21{
22 for (TBreakPoints::iterator i = m_BreakPoints.begin(); i != m_BreakPoints.end(); ++i) 22 for (auto breakpoint : m_BreakPoints)
23 if (i->iAddress == _iAddress && i->bTemporary) 23 if (breakpoint.iAddress == _iAddress && breakpoint.bTemporary)
24 return true; 24 return true;
25 return false; 25 return false;
26} 26}
@@ -28,13 +28,12 @@ bool BreakPoints::IsTempBreakPoint(u32 _iAddress)
28BreakPoints::TBreakPointsStr BreakPoints::GetStrings() const 28BreakPoints::TBreakPointsStr BreakPoints::GetStrings() const
29{ 29{
30 TBreakPointsStr bps; 30 TBreakPointsStr bps;
31 for (TBreakPoints::const_iterator i = m_BreakPoints.begin(); 31 for (auto breakpoint : m_BreakPoints)
32 i != m_BreakPoints.end(); ++i)
33 { 32 {
34 if (!i->bTemporary) 33 if (!breakpoint.bTemporary)
35 { 34 {
36 std::stringstream bp; 35 std::stringstream bp;
37 bp << std::hex << i->iAddress << " " << (i->bOn ? "n" : ""); 36 bp << std::hex << breakpoint.iAddress << " " << (breakpoint.bOn ? "n" : "");
38 bps.push_back(bp.str()); 37 bps.push_back(bp.str());
39 } 38 }
40 } 39 }
@@ -44,13 +43,13 @@ BreakPoints::TBreakPointsStr BreakPoints::GetStrings() const
44 43
45void BreakPoints::AddFromStrings(const TBreakPointsStr& bps) 44void BreakPoints::AddFromStrings(const TBreakPointsStr& bps)
46{ 45{
47 for (TBreakPointsStr::const_iterator i = bps.begin(); i != bps.end(); ++i) 46 for (auto bps_item : bps)
48 { 47 {
49 TBreakPoint bp; 48 TBreakPoint bp;
50 std::stringstream bpstr; 49 std::stringstream bpstr;
51 bpstr << std::hex << *i; 50 bpstr << std::hex << bps_item;
52 bpstr >> bp.iAddress; 51 bpstr >> bp.iAddress;
53 bp.bOn = i->find("n") != i->npos; 52 bp.bOn = bps_item.find("n") != bps_item.npos;
54 bp.bTemporary = false; 53 bp.bTemporary = false;
55 Add(bp); 54 Add(bp);
56 } 55 }
@@ -84,7 +83,7 @@ void BreakPoints::Add(u32 em_address, bool temp)
84 83
85void BreakPoints::Remove(u32 em_address) 84void BreakPoints::Remove(u32 em_address)
86{ 85{
87 for (TBreakPoints::iterator i = m_BreakPoints.begin(); i != m_BreakPoints.end(); ++i) 86 for (auto i = m_BreakPoints.begin(); i != m_BreakPoints.end(); ++i)
88 { 87 {
89 if (i->iAddress == em_address) 88 if (i->iAddress == em_address)
90 { 89 {
@@ -114,14 +113,16 @@ void BreakPoints::Clear()
114MemChecks::TMemChecksStr MemChecks::GetStrings() const 113MemChecks::TMemChecksStr MemChecks::GetStrings() const
115{ 114{
116 TMemChecksStr mcs; 115 TMemChecksStr mcs;
117 for (TMemChecks::const_iterator i = m_MemChecks.begin(); 116 for (auto memcheck : m_MemChecks)
118 i != m_MemChecks.end(); ++i)
119 { 117 {
120 std::stringstream mc; 118 std::stringstream mc;
121 mc << std::hex << i->StartAddress; 119 mc << std::hex << memcheck.StartAddress;
122 mc << " " << (i->bRange ? i->EndAddress : i->StartAddress) << " " << 120 mc << " " << (memcheck.bRange ? memcheck.EndAddress : memcheck.StartAddress) << " "
123 (i->bRange ? "n" : "") << (i->OnRead ? "r" : "") << 121 << (memcheck.bRange ? "n" : "")
124 (i->OnWrite ? "w" : "") << (i->Log ? "l" : "") << (i->Break ? "p" : ""); 122 << (memcheck.OnRead ? "r" : "")
123 << (memcheck.OnWrite ? "w" : "")
124 << (memcheck.Log ? "l" : "")
125 << (memcheck.Break ? "p" : "");
125 mcs.push_back(mc.str()); 126 mcs.push_back(mc.str());
126 } 127 }
127 128
@@ -130,17 +131,17 @@ MemChecks::TMemChecksStr MemChecks::GetStrings() const
130 131
131void MemChecks::AddFromStrings(const TMemChecksStr& mcs) 132void MemChecks::AddFromStrings(const TMemChecksStr& mcs)
132{ 133{
133 for (TMemChecksStr::const_iterator i = mcs.begin(); i != mcs.end(); ++i) 134 for (auto mcs_item : mcs)
134 { 135 {
135 TMemCheck mc; 136 TMemCheck mc;
136 std::stringstream mcstr; 137 std::stringstream mcstr;
137 mcstr << std::hex << *i; 138 mcstr << std::hex << mcs_item;
138 mcstr >> mc.StartAddress; 139 mcstr >> mc.StartAddress;
139 mc.bRange = i->find("n") != i->npos; 140 mc.bRange = mcs_item.find("n") != mcs_item.npos;
140 mc.OnRead = i->find("r") != i->npos; 141 mc.OnRead = mcs_item.find("r") != mcs_item.npos;
141 mc.OnWrite = i->find("w") != i->npos; 142 mc.OnWrite = mcs_item.find("w") != mcs_item.npos;
142 mc.Log = i->find("l") != i->npos; 143 mc.Log = mcs_item.find("l") != mcs_item.npos;
143 mc.Break = i->find("p") != i->npos; 144 mc.Break = mcs_item.find("p") != mcs_item.npos;
144 if (mc.bRange) 145 if (mc.bRange)
145 mcstr >> mc.EndAddress; 146 mcstr >> mc.EndAddress;
146 else 147 else
@@ -157,7 +158,7 @@ void MemChecks::Add(const TMemCheck& _rMemoryCheck)
157 158
158void MemChecks::Remove(u32 _Address) 159void MemChecks::Remove(u32 _Address)
159{ 160{
160 for (TMemChecks::iterator i = m_MemChecks.begin(); i != m_MemChecks.end(); ++i) 161 for (auto i = m_MemChecks.begin(); i != m_MemChecks.end(); ++i)
161 { 162 {
162 if (i->StartAddress == _Address) 163 if (i->StartAddress == _Address)
163 { 164 {
@@ -169,7 +170,7 @@ void MemChecks::Remove(u32 _Address)
169 170
170TMemCheck *MemChecks::GetMemCheck(u32 address) 171TMemCheck *MemChecks::GetMemCheck(u32 address)
171{ 172{
172 for (TMemChecks::iterator i = m_MemChecks.begin(); i != m_MemChecks.end(); ++i) 173 for (auto i = m_MemChecks.begin(); i != m_MemChecks.end(); ++i)
173 { 174 {
174 if (i->bRange) 175 if (i->bRange)
175 { 176 {