| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | // Copyright 2019 Juan Palacios <[email protected]> |
| 3 | |
| 4 | #pragma once |
| 5 | |
| 6 | #include <string> |
| 7 | #include <utility> |
| 8 | |
| 9 | class QByteArray; |
| 10 | |
| 11 | class ICommandQueue |
| 12 | { |
| 13 | public: |
| 14 | /// Whether a command has been queued for the specified file. |
| 15 | /// @param file queued command file to check |
| 16 | virtual bool hasCommandQueuedFor(std::string const &file) = 0; |
| 17 | |
| 18 | /// Adds a command to the end of the queue. |
| 19 | /// If the command was already queued, there is no effect in the queue. |
| 20 | /// @param cmd command to queue |
| 21 | virtual void add(std::pair<std::string, std::string> &&cmd) = 0; |
| 22 | |
| 23 | /// Transform all commands into raw data, cleaning the command queue. |
| 24 | virtual QByteArray toRawData() = 0; |
| 25 | |
| 26 | /// Write the queued commands to the log. |
| 27 | virtual void logCommands() const = 0; |
| 28 | |
| 29 | virtual ~ICommandQueue() = default; |
| 30 | }; |