32#ifndef EVALUATIONQUEUE_H
33#define EVALUATIONQUEUE_H
47 Command(
const wxString &strng,
int index) : m_indexStart(index), m_command(strng) {}
48 Command(Command &&o) noexcept : m_indexStart(o.m_indexStart), m_command(std::move(o.m_command)) {}
49 Command(
const Command &o) : m_indexStart(o.m_indexStart), m_command(o.m_command) {}
50 Command &operator=(Command &&o)
noexcept
52 m_indexStart = o.m_indexStart;
53 m_command = std::move(o.m_command);
56 Command &operator=(
const Command &o)
58 m_indexStart = o.m_indexStart;
59 m_command = o.m_command;
63 const wxString &GetString()
const {
return m_command; }
66 wxString trimmed = m_command;
68 if (!trimmed.EndsWith(wxS(
";")) && !trimmed.EndsWith(wxS(
"$")))
71 int GetIndex()
const {
return m_indexStart; }
73 long m_indexStart = -1;
87 std::vector<EvaluationQueue::Command> m_commands;
89 wxString m_pendingText;
94 long m_cellConsumedChars = 0;
103 wxString textAtEnqueue;
106 std::vector<QueuedCell> m_queue;
117 bool m_integrityFailure =
false;
118 wxString m_integrityFailureEnqueuedText;
119 wxString m_integrityFailureCurrentText;
127 void ProduceNextCommand();
137 {
return m_userLabel; }
141 if (!m_commands.empty())
142 return m_commands.front().GetIndex();
147 bool m_workingGroupChanged =
false;
153 if (!m_commands.empty())
154 m_commands.back().AddEnding();
163 return !m_queue.empty() && (gr == m_queue.front().cell);
204 {
return m_integrityFailureEnqueuedText; }
208 {
return m_integrityFailureCurrentText; }
211 int Size()
const {
return m_size; }
This file defines the class GroupCell that bundles input and output in the worksheet.
A weak non-owning pointer that becomes null whenever the observed object is destroyed.
Definition: CellPtr.h:539
The configuration storage for the current worksheet.
Definition: Configuration.h:98
A simple FIFO queue with manual removal of elements.
Definition: EvaluationQueue.h:43
void Remove(GroupCell *gr)
Remove a GroupCell from the evaluation queue.
Definition: EvaluationQueue.cpp:62
wxString GetUserLabel() const
Query for the label the user has assigned to the current command.
Definition: EvaluationQueue.h:136
bool IsLastInQueue(GroupCell const *gr)
Is GroupCell gr part of the evaluation queue?
Definition: EvaluationQueue.h:161
bool IsInQueue(GroupCell *gr) const
Is GroupCell gr part of the evaluation queue?
Definition: EvaluationQueue.cpp:56
void Clear()
Clear the queue.
Definition: EvaluationQueue.cpp:43
bool Empty() const
Is the queue empty?
Definition: EvaluationQueue.cpp:34
void AddHiddenTreeToQueue(const GroupCell *gr)
Adds all hidden cells attached to the GroupCell gr to the evaluation queue.
Definition: EvaluationQueue.cpp:103
void AddToQueue(GroupCell *gr)
Adds a GroupCell to the evaluation queue.
Definition: EvaluationQueue.cpp:79
wxString GetCommand()
Return the next command that needs to be evaluated.
Definition: EvaluationQueue.cpp:350
void RemoveFirst()
Removes the first command in the queue.
Definition: EvaluationQueue.cpp:113
GroupCell * GetCell()
Gets the cell the next command in the queue belongs to.
Definition: EvaluationQueue.cpp:343
bool HasIntegrityFailure() const
Did the cell that just became current (see GetCell()) have different text than what was captured when...
Definition: EvaluationQueue.h:200
int CommandsLeftInCell() const
Roughly how many commands are still to be run in the current cell. Because commands are tokenized laz...
Definition: EvaluationQueue.cpp:321
const wxString & GetIntegrityFailureCurrentText() const
The cell's text as AddTokens() actually read it, valid only while HasIntegrityFailure() is true for t...
Definition: EvaluationQueue.h:207
const wxString & GetIntegrityFailureEnqueuedText() const
The cell's text as it was when AddToQueue() was called, valid only while HasIntegrityFailure() is tru...
Definition: EvaluationQueue.h:203
int Size() const
Get the size of the queue [in cells].
Definition: EvaluationQueue.h:211
A cell grouping input (and, if there is one, also the output) cell to a foldable item.
Definition: GroupCell.h:88