MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / contextPasteCSV

Method contextPasteCSV

pcsx2-qt/Debugger/Memory/SavedAddressesView.cpp:119–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117}
118
119void SavedAddressesView::contextPasteCSV()
120{
121 QString csv = QGuiApplication::clipboard()->text();
122 // Skip header
123 csv = csv.mid(csv.indexOf('\n') + 1);
124
125 for (const QString& line : csv.split('\n'))
126 {
127 QStringList fields;
128 // In order to handle text with commas in them we must wrap values in quotes to mark
129 // where a value starts and end so that text commas aren't identified as delimiters.
130 // So matches each quote pair, parse it out, and removes the quotes to get the value.
131 QRegularExpression each_quote_pair(R"("([^"]|\\.)*")");
132 QRegularExpressionMatchIterator it = each_quote_pair.globalMatch(line);
133 while (it.hasNext())
134 {
135 QRegularExpressionMatch match = it.next();
136 QString matched_value = match.captured(0);
137 fields << matched_value.mid(1, matched_value.length() - 2);
138 }
139
140 m_model->loadSavedAddressFromFieldList(fields);
141 }
142}
143
144void SavedAddressesView::contextNew()
145{

Callers

nothing calls this directly

Calls 5

splitMethod · 0.80
hasNextMethod · 0.80
nextMethod · 0.80
lengthMethod · 0.45

Tested by

no test coverage detected