code beautifying

This commit is contained in:
Martin Brodbeck 2018-10-12 11:49:52 +02:00
parent e9fde76a60
commit 4fb6d2f98b
3 changed files with 10 additions and 9 deletions

View file

@ -35,13 +35,14 @@ std::string Seller::getLastName() const { return lastName_; }
int Seller::getSellerNo() const { return sellerNo_; }
std::string Seller::getSellerNoAsString() const
std::string Seller::getSellerNoAsString() const
{
std::stringstream selNoStr;
selNoStr << std::setfill('0') << std::setw(3) << sellerNo_;
return selNoStr.str();;
return selNoStr.str();
;
}
std::vector<Article*> Seller::getArticles(bool onlySold) const
@ -103,7 +104,6 @@ int Seller::sumInCents()
std::string Seller::sumAsString() { return formatCentAsEuroString(sumInCents()); }
bool operator<(const Seller& li, const Seller& re) { return li.sellerNo_ < re.sellerNo_; }
bool operator<(const std::unique_ptr<Seller>& li, const std::unique_ptr<Seller>& re)
{

View file

@ -8,13 +8,13 @@
#include <string>
#include <vector>
//class Article;
// class Article;
class Seller : public Entity
{
public:
Seller() = default;
//virtual ~Seller() = default;
// virtual ~Seller() = default;
Seller(const std::string& firstName, const std::string& lastName, int sellerNo = 0,
int numArticlesOffered = 0);

View file

@ -46,7 +46,8 @@ PosPrinter::PosPrinter(const PrinterDevice& printerDevice) : printerDevice_(prin
if (printerDevice_.idVendor == 0) {
for (const auto& supported : supportedPrinters_.models) {
if (desc.idVendor == std::get<0>(supported) && desc.idProduct == std::get<1>(supported)) {
if (desc.idVendor == std::get<0>(supported) &&
desc.idProduct == std::get<1>(supported)) {
numDevice = i;
printerEndpoint_ = std::get<2>(supported);
break;
@ -161,8 +162,8 @@ void PosPrinter::printSaleReceipt(Sale* sale)
commandStream << sale->getTimestampFormatted() << "\n\n";
commandStream << Command::LEFT_ALIGN;
for (const auto& article : sale->getArticles()) {
commandStream << "Verk.Nr. " << article->getSeller()->getSellerNoAsString() << "........... "
<< article->getPriceAsString() << "\n";
commandStream << "Verk.Nr. " << article->getSeller()->getSellerNoAsString()
<< "........... " << article->getPriceAsString() << "\n";
}
commandStream << "\nGesamt................. " << sale->sumAsString() << "\n";
commandStream << Command::CENTERING;