restructure libs
This commit is contained in:
parent
ec0b7cbf0d
commit
e89728846c
19 changed files with 79 additions and 67 deletions
|
@ -29,11 +29,11 @@ set(CORE_SOURCES
|
|||
add_library(core STATIC ${CORE_SOURCES})
|
||||
target_include_directories(core PRIVATE ${PROJECT_SOURCE_DIR}/3rdparty/csv-parser/include)
|
||||
if (WIN32)
|
||||
target_link_libraries(core PRIVATE printer Boost::boost Boost::date_time sqlite3 nlohmann_json::nlohmann_json ${XLNT_LIBRARY} csv)
|
||||
target_link_libraries(core PRIVATE Boost::boost Boost::date_time sqlite3 nlohmann_json::nlohmann_json ${XLNT_LIBRARY} csv)
|
||||
target_link_libraries(core PRIVATE bcrypt)
|
||||
else()
|
||||
target_link_libraries(core PRIVATE printer Boost::boost Boost::date_time sqlite3 nlohmann_json::nlohmann_json ${XLNT_LIBRARIES} csv)
|
||||
target_link_libraries(core PRIVATE Boost::boost Boost::date_time sqlite3 nlohmann_json::nlohmann_json ${XLNT_LIBRARIES} csv)
|
||||
endif()
|
||||
|
||||
#target_include_directories(core PRIVATE ${PROJECT_SOURCE_DIR}/3rdparty/csv-parser)
|
||||
target_include_directories(core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_include_directories(core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/..)
|
||||
|
|
|
@ -21,31 +21,6 @@ std::string formatCentAsEuroString(const int cent, int width)
|
|||
return currStream.str();
|
||||
}
|
||||
|
||||
std::optional<PrinterDevice> convertToPosPrinterDevice(const std::string& device,
|
||||
const std::string& endpoint)
|
||||
{
|
||||
if (device.empty()) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
PrinterDevice printerDevice;
|
||||
std::string delimiter = ":";
|
||||
try {
|
||||
printerDevice.idVendor = std::stoi(device.substr(0, device.find(delimiter)), 0, 16);
|
||||
printerDevice.idProduct = std::stoi(device.substr(device.find(delimiter) + 1), 0, 16);
|
||||
if (endpoint.empty()) {
|
||||
printerDevice.endpoint = 0x03;
|
||||
} else {
|
||||
printerDevice.endpoint = std::stoi(endpoint, 0, 16);
|
||||
}
|
||||
|
||||
} catch (std::exception& ex) {
|
||||
throw ex;
|
||||
}
|
||||
|
||||
return printerDevice;
|
||||
}
|
||||
|
||||
std::string& ltrim(std::string& str, const std::string& chars)
|
||||
{
|
||||
str.erase(0, str.find_first_not_of(chars));
|
||||
|
@ -71,4 +46,4 @@ bool case_insensitive_match(std::string s1, std::string s2)
|
|||
if (s1.compare(s2) == 0)
|
||||
return true; // The strings are same
|
||||
return false; // not matched
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,11 @@
|
|||
#ifndef UTILS_H
|
||||
#define UTILS_H
|
||||
|
||||
#include "posprinter.h"
|
||||
#ifndef CORE_UTILS_H
|
||||
#define CORE_UTILS_H
|
||||
|
||||
#include <locale>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
std::string formatCentAsEuroString(const int cent, int width = 10);
|
||||
std::optional<PrinterDevice> convertToPosPrinterDevice(const std::string& vendor,
|
||||
const std::string& endpoint);
|
||||
std::string& ltrim(std::string& str, const std::string& chars = "\t\n\v\f\r ");
|
||||
std::string& rtrim(std::string& str, const std::string& chars = "\t\n\v\f\r ");
|
||||
std::string& trim(std::string& str, const std::string& chars = "\t\n\v\f\r ");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue