cli-parser-cleanup (#15)
All checks were successful
Build ptprnt / build (push) Successful in 3m50s
All checks were successful
Build ptprnt / build (push) Successful in 3m50s
Reviewed-on: moritz/ptouch-prnt#15
This commit was merged in pull request #15.
This commit is contained in:
68
src/core/PrinterDriverFactory.hpp
Normal file
68
src/core/PrinterDriverFactory.hpp
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
ptrnt - print labels on linux
|
||||
Copyright (C) 2025 Moritz Martinius
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "printers/interface/IPrinterDriver.hpp"
|
||||
#include "libusbwrap/LibUsbTypes.hpp"
|
||||
|
||||
namespace ptprnt {
|
||||
|
||||
class PrinterDriverFactory {
|
||||
public:
|
||||
PrinterDriverFactory() = default;
|
||||
~PrinterDriverFactory() = default;
|
||||
|
||||
PrinterDriverFactory(const PrinterDriverFactory&) = delete;
|
||||
PrinterDriverFactory& operator=(const PrinterDriverFactory&) = delete;
|
||||
PrinterDriverFactory(PrinterDriverFactory&&) = delete;
|
||||
PrinterDriverFactory& operator=(PrinterDriverFactory&&) = delete;
|
||||
|
||||
/**
|
||||
* @brief Create a printer driver based on USB ID
|
||||
* @param id USB vendor and product ID
|
||||
* @return Printer driver instance or nullptr if no match
|
||||
*/
|
||||
std::shared_ptr<IPrinterDriver> create(libusbwrap::usbId id);
|
||||
|
||||
/**
|
||||
* @brief Create a virtual FakePrinter for testing without hardware
|
||||
* @return FakePrinter instance
|
||||
*/
|
||||
std::shared_ptr<IPrinterDriver> createFakePrinter();
|
||||
|
||||
/**
|
||||
* @brief Create a printer driver by name
|
||||
* @param driverName Name of the driver (from PrinterInfo.driverName)
|
||||
* @return Printer driver instance or nullptr if no match
|
||||
*/
|
||||
std::shared_ptr<IPrinterDriver> createByName(const std::string& driverName);
|
||||
|
||||
/**
|
||||
* @brief Get list of all available printer driver names
|
||||
* @return Vector of driver names
|
||||
*/
|
||||
std::vector<std::string> listAllDrivers() const;
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
} // namespace ptprnt
|
||||
Reference in New Issue
Block a user