diff options
| author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2017-03-18 21:41:46 +0100 |
|---|---|---|
| committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2017-03-18 21:52:22 +0100 |
| commit | 5069c3b800a5806ef132d187c4ec93d037d55ad2 (patch) | |
| tree | 1553a24addda46301792148d1b7fa8303cf7d26a /src/qregisters.h | |
| parent | 8b00fa817e24224245df1ae8776f139d807ce87a (diff) | |
fixed Q-Reg autocompletion for `Q` command
* StateQueryQReg is now derived from StateExpectQReg
whose semantics have been changed slightly.
* The alternative would have been another common base class for both
StateQueryQReg and StateExpectQReg.
Diffstat (limited to 'src/qregisters.h')
| -rw-r--r-- | src/qregisters.h | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/qregisters.h b/src/qregisters.h index d57323a..a08bafe 100644 --- a/src/qregisters.h +++ b/src/qregisters.h @@ -485,10 +485,11 @@ public: * Command states */ -/* +/** * Super class for states accepting Q-Register specifications */ class StateExpectQReg : public State { +protected: QRegSpecMachine machine; public: @@ -498,6 +499,16 @@ private: State *custom(gchar chr); protected: + /** + * Called when a register specification has been + * successfully parsed. + * The QRegSpecMachine is not reset automatically. + * + * @param reg Register of the parsed Q-Reg + * specification. May be NULL in + * parse-only mode or with QREG_OPTIONAL. + * @returns Next parser state. + */ virtual State *got_register(QRegister *reg) = 0; /* in cmdline.cpp */ @@ -540,14 +551,12 @@ private: State *got_file(const gchar *filename); }; -class StateQueryQReg : public State { - QRegSpecMachine machine; - +class StateQueryQReg : public StateExpectQReg { public: - StateQueryQReg(); + StateQueryQReg() : StateExpectQReg(QREG_OPTIONAL) {} private: - State *custom(gchar chr); + State *got_register(QRegister *reg); }; class StateCtlUCommand : public StateExpectQReg { |
