Add frozen TikZRefinery demo baseline and build pipeline
vpn-dns-gateway/pipeline/head This commit looks good
vpn-dns-gateway/pipeline/pr-main This commit looks good

This commit is contained in:
2026-11-25 22:46:33 -05:00
parent 6064cce05e
commit 27b82c169e
456 changed files with 66509 additions and 0 deletions
@@ -0,0 +1,34 @@
#include "editing/tkrEditHistory.h"
#include <utility>
namespace TikzRefinery {
namespace { constexpr qsizetype nEntryStep = 1; }
bool tkrEditHistory::canUndo() const { return m_nCursor > 0; }
bool tkrEditHistory::canRedo() const { return m_nCursor < m_vecEntries.size(); }
QString tkrEditHistory::undoDescription() const
{ return canUndo() ? m_vecEntries.at(m_nCursor - nEntryStep).strDescription : QString(); }
QString tkrEditHistory::redoDescription() const
{ return canRedo() ? m_vecEntries.at(m_nCursor).strDescription : QString(); }
void tkrEditHistory::record(const QByteArray &baBefore, const QByteArray &baAfter,
const QString &strDescription)
{
// Prepare detached storage first. Allocation failure cannot discard the redo branch.
QVector<Entry> vecPrepared = m_vecEntries;
vecPrepared.resize(m_nCursor);
vecPrepared.append({baBefore, baAfter, strDescription});
m_vecEntries.swap(vecPrepared);
m_nCursor = m_vecEntries.size();
}
void tkrEditHistory::clear() { QVector<Entry>().swap(m_vecEntries); m_nCursor = 0; }
QByteArray tkrEditHistory::restorationSource(bool bRedo) const
{
return bRedo ? m_vecEntries.at(m_nCursor).baAfter
: m_vecEntries.at(m_nCursor - nEntryStep).baBefore;
}
void tkrEditHistory::advance(bool bRedo) { m_nCursor += bRedo ? nEntryStep : -nEntryStep; }
void tkrEditHistory::swap(tkrEditHistory &historyOther) noexcept
{
m_vecEntries.swap(historyOther.m_vecEntries);
std::swap(m_nCursor, historyOther.m_nCursor);
}
} // namespace TikzRefinery