MCPcopy Create free account
hub / github.com/MiniZinc/MiniZincIDE / updateFileContents

Method updateFileContents

MiniZincIDE/history.cpp:182–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180}
181
182void History::updateFileContents(const QString& file, const QString& contents)
183{
184 auto it = _history.find(file);
185 if (it == _history.end()) {
186 return;
187 }
188 FileDiff d(it.value().snapshot, contents);
189 auto diff = d.diff();
190 if (diff.empty()) {
191 return;
192 }
193 History::Change c;
194 c.edits = diff;
195 c.timestamp = static_cast<double>(QDateTime::currentMSecsSinceEpoch()) / 1000.0;
196 it.value().changes.append(std::move(c));
197 it.value().snapshot = contents;
198 emit historyChanged();
199}
200
201void History::commit() {
202 for (auto it = _history.begin(); it != _history.end(); it++) {

Callers 3

createEditorMethod · 0.80
saveFileMethod · 0.80
testHistoryMethod · 0.80

Calls 4

findMethod · 0.80
diffMethod · 0.80
endMethod · 0.45
valueMethod · 0.45

Tested by 1

testHistoryMethod · 0.64