68 lines
2.2 KiB
C++
68 lines
2.2 KiB
C++
/*
|
|
ptrnt - print labels on linux
|
|
Copyright (C) 2024-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
|