Fix indentation back to 4
This commit is contained in:
@@ -51,7 +51,7 @@ FixNamespaceComments: true
|
|||||||
IncludeBlocks: Preserve
|
IncludeBlocks: Preserve
|
||||||
IndentCaseLabels: true
|
IndentCaseLabels: true
|
||||||
IndentPPDirectives: None
|
IndentPPDirectives: None
|
||||||
IndentWidth: 2
|
IndentWidth: 4
|
||||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||||
MaxEmptyLinesToKeep: 1
|
MaxEmptyLinesToKeep: 1
|
||||||
NamespaceIndentation: None
|
NamespaceIndentation: None
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
namespace ptprnt::bitmap {
|
namespace ptprnt::bitmap {
|
||||||
|
|
||||||
struct Bitmap {
|
struct Bitmap {
|
||||||
std::vector<std::vector<int>> map;
|
std::vector<std::vector<int>> map;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ptprnt::bitmap
|
} // namespace ptprnt::bitmap
|
@@ -5,8 +5,8 @@
|
|||||||
namespace ptprnt::driver {
|
namespace ptprnt::driver {
|
||||||
|
|
||||||
struct info {
|
struct info {
|
||||||
std::string name{""};
|
std::string name{""};
|
||||||
std::string version{""};
|
std::string version{""};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ptprnt::driver
|
} // namespace ptprnt::driver
|
@@ -6,39 +6,39 @@
|
|||||||
namespace ptprnt::driver {
|
namespace ptprnt::driver {
|
||||||
|
|
||||||
class IDriver {
|
class IDriver {
|
||||||
public:
|
public:
|
||||||
virtual ~IDriver(){};
|
virtual ~IDriver(){};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get Information struct about this driver
|
* @brief Get Information struct about this driver
|
||||||
*
|
*
|
||||||
* @return driver::info
|
* @return driver::info
|
||||||
*/
|
*/
|
||||||
virtual driver::info getInfo() = 0;
|
virtual driver::info getInfo() = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief opens up the device specified
|
* @brief opens up the device specified
|
||||||
*
|
*
|
||||||
* @return true successfully open up device
|
* @return true successfully open up device
|
||||||
* @return false failed to open device
|
* @return false failed to open device
|
||||||
*/
|
*/
|
||||||
virtual bool open() = 0;
|
virtual bool open() = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief close the device
|
* @brief close the device
|
||||||
*
|
*
|
||||||
* @return true successfully closed device
|
* @return true successfully closed device
|
||||||
* @return false failed to close device
|
* @return false failed to close device
|
||||||
*/
|
*/
|
||||||
virtual bool close() = 0;
|
virtual bool close() = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Send a command to device
|
* @brief Send a command to device
|
||||||
*
|
*
|
||||||
* @return true successfully sent command to device
|
* @return true successfully sent command to device
|
||||||
* @return false error sending command
|
* @return false error sending command
|
||||||
*/
|
*/
|
||||||
virtual bool command() = 0;
|
virtual bool command() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ptprnt::driver
|
} // namespace ptprnt::driver
|
@@ -10,17 +10,17 @@
|
|||||||
namespace ptprnt::printer {
|
namespace ptprnt::printer {
|
||||||
|
|
||||||
class IPrinter {
|
class IPrinter {
|
||||||
public:
|
public:
|
||||||
virtual ~IPrinter(){};
|
virtual ~IPrinter(){};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get Information struct about the printer
|
* @brief Get Information struct about the printer
|
||||||
*
|
*
|
||||||
* @return driver::info
|
* @return driver::info
|
||||||
*/
|
*/
|
||||||
virtual printer::info getInfo() = 0;
|
virtual printer::info getInfo() = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Prints text immediatly
|
* @brief Prints text immediatly
|
||||||
*
|
*
|
||||||
* @param text Text to print
|
* @param text Text to print
|
||||||
@@ -28,16 +28,16 @@ class IPrinter {
|
|||||||
* @return true Printing succeeded
|
* @return true Printing succeeded
|
||||||
* @return false Printing failed
|
* @return false Printing failed
|
||||||
*/
|
*/
|
||||||
virtual bool printText(std::string_view text, uint32_t fontSize) = 0;
|
virtual bool printText(std::string_view text, uint32_t fontSize) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Prints supplied bitmap immediatly
|
* @brief Prints supplied bitmap immediatly
|
||||||
*
|
*
|
||||||
* @param bm Bitmap to print
|
* @param bm Bitmap to print
|
||||||
* @return true Printing succeeded
|
* @return true Printing succeeded
|
||||||
* @return false Printing failed
|
* @return false Printing failed
|
||||||
*/
|
*/
|
||||||
virtual bool printBitmap(std::shared_ptr<bitmap::Bitmap> bm) = 0;
|
virtual bool printBitmap(std::shared_ptr<bitmap::Bitmap> bm) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ptprnt::printer
|
} // namespace ptprnt::printer
|
@@ -9,14 +9,14 @@
|
|||||||
namespace ptprnt::driver {
|
namespace ptprnt::driver {
|
||||||
|
|
||||||
class P700Driver : public IDriver {
|
class P700Driver : public IDriver {
|
||||||
public:
|
public:
|
||||||
P700Driver(uint16_t UsbDevVendor = 0x04f9, uint16_t UsbDevId = 0x2061);
|
P700Driver(uint16_t UsbDevVendor = 0x04f9, uint16_t UsbDevId = 0x2061);
|
||||||
~P700Driver() override;
|
~P700Driver() override;
|
||||||
|
|
||||||
driver::info getInfo() override;
|
driver::info getInfo() override;
|
||||||
bool open() override;
|
bool open() override;
|
||||||
bool close() override;
|
bool close() override;
|
||||||
bool command() override;
|
bool command() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ptprnt::driver
|
} // namespace ptprnt::driver
|
@@ -9,17 +9,17 @@
|
|||||||
namespace ptprnt::printer {
|
namespace ptprnt::printer {
|
||||||
|
|
||||||
class P700Printer : public IPrinter {
|
class P700Printer : public IPrinter {
|
||||||
public:
|
public:
|
||||||
P700Printer(std::unique_ptr<driver::P700Driver> driver);
|
P700Printer(std::unique_ptr<driver::P700Driver> driver);
|
||||||
~P700Printer() override;
|
~P700Printer() override;
|
||||||
|
|
||||||
printer::info getInfo() override;
|
printer::info getInfo() override;
|
||||||
bool printText(std::string_view text, uint32_t fontSize) override;
|
bool printText(std::string_view text, uint32_t fontSize) override;
|
||||||
bool printBitmap(std::shared_ptr<bitmap::Bitmap> bm) override;
|
bool printBitmap(std::shared_ptr<bitmap::Bitmap> bm) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static info mPrinterInfo;
|
static info mPrinterInfo;
|
||||||
std::unique_ptr<driver::P700Driver> mDriver;
|
std::unique_ptr<driver::P700Driver> mDriver;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ptprnt::printer
|
} // namespace ptprnt::printer
|
@@ -5,17 +5,17 @@
|
|||||||
namespace ptprnt::printer {
|
namespace ptprnt::printer {
|
||||||
|
|
||||||
enum class colorMode {
|
enum class colorMode {
|
||||||
monochrome = 0,
|
monochrome = 0,
|
||||||
color = 0,
|
color = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct info {
|
struct info {
|
||||||
std::string name{""};
|
std::string name{""};
|
||||||
std::string revision{""};
|
std::string revision{""};
|
||||||
uint32_t xres = {0};
|
uint32_t xres = {0};
|
||||||
uint32_t yres = {0};
|
uint32_t yres = {0};
|
||||||
colorMode color = {colorMode::monochrome};
|
colorMode color = {colorMode::monochrome};
|
||||||
bool cutter = {false};
|
bool cutter = {false};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ptprnt::printer
|
} // namespace ptprnt::printer
|
@@ -7,22 +7,24 @@ namespace ptprnt::driver {
|
|||||||
|
|
||||||
P700Driver::P700Driver(uint16_t UsbDevVendor, uint16_t UsbDevId) {}
|
P700Driver::P700Driver(uint16_t UsbDevVendor, uint16_t UsbDevId) {}
|
||||||
|
|
||||||
P700Driver::~P700Driver() {}
|
P700Driver::~P700Driver() {
|
||||||
|
libusb_init(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
driver::info P700Driver::getInfo() {
|
driver::info P700Driver::getInfo() {
|
||||||
return driver::info{};
|
return driver::info{};
|
||||||
}
|
}
|
||||||
|
|
||||||
bool P700Driver::open() {
|
bool P700Driver::open() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool P700Driver::close() {
|
bool P700Driver::close() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool P700Driver::command() {
|
bool P700Driver::command() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ptprnt::driver
|
} // namespace ptprnt::driver
|
@@ -6,27 +6,27 @@
|
|||||||
namespace ptprnt::printer {
|
namespace ptprnt::printer {
|
||||||
|
|
||||||
P700Printer::P700Printer(std::unique_ptr<driver::P700Driver> driver) {
|
P700Printer::P700Printer(std::unique_ptr<driver::P700Driver> driver) {
|
||||||
if (!driver->open()) {
|
if (!driver->open()) {
|
||||||
throw std::invalid_argument("Could not open driver!");
|
throw std::invalid_argument("Could not open driver!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
P700Printer::~P700Printer() {
|
P700Printer::~P700Printer() {
|
||||||
if (!mDriver->close()) {
|
if (!mDriver->close()) {
|
||||||
std::cerr << "Could not close driver properly!" << std::endl;
|
std::cerr << "Could not close driver properly!" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printer::info P700Printer::getInfo() {
|
printer::info P700Printer::getInfo() {
|
||||||
return printer::info{};
|
return printer::info{};
|
||||||
}
|
}
|
||||||
|
|
||||||
bool P700Printer::printText(std::string_view text, uint32_t fontSize) {
|
bool P700Printer::printText(std::string_view text, uint32_t fontSize) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool P700Printer::printBitmap(std::shared_ptr<bitmap::Bitmap> bm) {
|
bool P700Printer::printBitmap(std::shared_ptr<bitmap::Bitmap> bm) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ptprnt::printer
|
} // namespace ptprnt::printer
|
12
src/main.cpp
12
src/main.cpp
@@ -9,11 +9,11 @@ using namespace ptprnt;
|
|||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
|
|
||||||
std::cout << "Hello ptprnt!" << std::endl;
|
std::cout << "Hello ptprnt!" << std::endl;
|
||||||
libusb_init(NULL);
|
|
||||||
auto driver = std::make_unique<driver::P700Driver>();
|
|
||||||
auto printer = std::make_unique<printer::P700Printer>(std::move(driver));
|
|
||||||
printer::info info = printer->getInfo();
|
|
||||||
|
|
||||||
return 0;
|
auto driver = std::make_unique<driver::P700Driver>();
|
||||||
|
auto printer = std::make_unique<printer::P700Printer>(std::move(driver));
|
||||||
|
printer::info info = printer->getInfo();
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
Reference in New Issue
Block a user