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

@ -41,7 +41,8 @@ std::string Seller::getSellerNoAsString() const
selNoStr << std::setfill('0') << std::setw(3) << sellerNo_; selNoStr << std::setfill('0') << std::setw(3) << sellerNo_;
return selNoStr.str();; return selNoStr.str();
;
} }
std::vector<Article*> Seller::getArticles(bool onlySold) const std::vector<Article*> Seller::getArticles(bool onlySold) const
@ -103,7 +104,6 @@ int Seller::sumInCents()
std::string Seller::sumAsString() { return formatCentAsEuroString(sumInCents()); } std::string Seller::sumAsString() { return formatCentAsEuroString(sumInCents()); }
bool operator<(const Seller& li, const Seller& re) { return li.sellerNo_ < re.sellerNo_; } 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) bool operator<(const std::unique_ptr<Seller>& li, const std::unique_ptr<Seller>& re)
{ {

View file

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

View file

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