member variables renamed
This commit is contained in:
parent
21571215bc
commit
3e6e587df8
9 changed files with 37 additions and 41 deletions
|
@ -5,34 +5,34 @@
|
|||
#include <iomanip>
|
||||
#include <sstream>
|
||||
|
||||
Article::Article(int price) : price_(price) {}
|
||||
Article::Article(int price) : m_price(price) {}
|
||||
|
||||
void Article::setArticleNo(int articleNo) { articleNo_ = articleNo; }
|
||||
void Article::setArticleNo(int articleNo) { m_articleNo = articleNo; }
|
||||
|
||||
void Article::setPrice(int price) { price_ = price; }
|
||||
void Article::setPrice(int price) { m_price = price; }
|
||||
|
||||
void Article::setDescription(const std::string& description) { description_ = description; }
|
||||
void Article::setDescription(const std::string& description) { m_description = description; }
|
||||
|
||||
void Article::setSale(Sale* salePtr) { salePtr_ = salePtr; }
|
||||
void Article::setSale(Sale* salePtr) { m_salePtr = salePtr; }
|
||||
|
||||
void Article::setSeller(Seller* sellerPtr) { sellerPtr_ = sellerPtr; }
|
||||
void Article::setSeller(Seller* sellerPtr) { m_sellerPtr = sellerPtr; }
|
||||
|
||||
bool Article::isSold() { return salePtr_ ? true : false; }
|
||||
bool Article::isSold() { return m_salePtr ? true : false; }
|
||||
|
||||
std::string Article::getDescription() { return description_; }
|
||||
std::string Article::getDescription() { return m_description; }
|
||||
|
||||
Seller* Article::getSeller() { return sellerPtr_; }
|
||||
Sale* Article::getSale() { return salePtr_; }
|
||||
Seller* Article::getSeller() { return m_sellerPtr; }
|
||||
Sale* Article::getSale() { return m_salePtr; }
|
||||
|
||||
int Article::getPrice() const { return price_; }
|
||||
int Article::getPrice() const { return m_price; }
|
||||
|
||||
std::string Article::getPriceAsString() const { return formatCentAsEuroString(price_); }
|
||||
std::string Article::getPriceAsString() const { return formatCentAsEuroString(m_price); }
|
||||
|
||||
int Article::getArticleNo() const { return articleNo_; }
|
||||
int Article::getArticleNo() const { return m_articleNo; }
|
||||
|
||||
std::string Article::getCompleteArticleNo() const
|
||||
{
|
||||
std::stringstream artNoStream;
|
||||
artNoStream << sourceNo_ << "K" << std::setfill('0') << std::setw(5) << articleNo_;
|
||||
artNoStream << m_sourceNo << "K" << std::setfill('0') << std::setw(5) << m_articleNo;
|
||||
return artNoStream.str();
|
||||
}
|
||||
|
|
|
@ -33,12 +33,11 @@ class Article : public EntityUuid
|
|||
std::string getPriceAsString() const;
|
||||
|
||||
private:
|
||||
Seller* sellerPtr_{};
|
||||
Sale* salePtr_{};
|
||||
int articleNo_{};
|
||||
int price_{};
|
||||
std::string description_{};
|
||||
Seller* m_sellerPtr{};
|
||||
Sale* m_salePtr{};
|
||||
int m_articleNo{};
|
||||
int m_price{};
|
||||
std::string m_description{};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
#include "entity.h"
|
||||
|
||||
Entity::State Entity::getState() const
|
||||
{
|
||||
return state_;
|
||||
}
|
||||
Entity::State Entity::getState() const { return m_state; }
|
||||
|
|
|
@ -6,11 +6,11 @@ class Entity
|
|||
public:
|
||||
enum class State { NEW, UPDATE, DELETE, OK };
|
||||
virtual ~Entity() = default;
|
||||
void setState(State state) { state_ = state; }
|
||||
void setState(State state) { m_state = state; }
|
||||
virtual State getState() const;
|
||||
|
||||
private:
|
||||
State state_{State::NEW};
|
||||
State m_state{State::NEW};
|
||||
};
|
||||
|
||||
#endif // ENTITY_H
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "entityint.h"
|
||||
|
||||
EntityInt::EntityInt(int id) { id_ = id; }
|
||||
EntityInt::EntityInt(int id) { m_id = id; }
|
||||
|
||||
void EntityInt::setId(int id) { id_ = id; }
|
||||
void EntityInt::setId(int id) { m_id = id; }
|
||||
|
|
|
@ -10,10 +10,10 @@ class EntityInt : public Entity
|
|||
virtual ~EntityInt() = default;
|
||||
EntityInt(int id);
|
||||
void setId(int id);
|
||||
int getId() const { return id_; };
|
||||
int getId() const { return m_id; };
|
||||
|
||||
protected:
|
||||
int id_{};
|
||||
int m_id{};
|
||||
};
|
||||
|
||||
#endif // ENTITY_INT_H
|
||||
|
|
|
@ -8,15 +8,15 @@
|
|||
void EntityUuid::createUuid()
|
||||
{
|
||||
static boost::uuids::random_generator generator{};
|
||||
uuid_ = generator();
|
||||
m_uuid = generator();
|
||||
}
|
||||
|
||||
void EntityUuid::setUuidFromString(const std::string& uuidString)
|
||||
{
|
||||
boost::uuids::string_generator generator{};
|
||||
uuid_ = generator(uuidString);
|
||||
m_uuid = generator(uuidString);
|
||||
}
|
||||
|
||||
void EntityUuid::setSourceNo(int sourceNo) { sourceNo_ = sourceNo; }
|
||||
void EntityUuid::setSourceNo(int sourceNo) { m_sourceNo = sourceNo; }
|
||||
|
||||
int EntityUuid::getSourceNo() const { return sourceNo_; }
|
||||
int EntityUuid::getSourceNo() const { return m_sourceNo; }
|
||||
|
|
|
@ -18,15 +18,15 @@ class EntityUuid : public Entity
|
|||
void setUuidFromString(const std::string& uuidString);
|
||||
void setSourceNo(int sourceNo);
|
||||
|
||||
const boost::uuids::uuid& getUuid() const { return uuid_; };
|
||||
std::string getUuidAsString() const { return boost::uuids::to_string(uuid_); }
|
||||
const boost::uuids::uuid& getUuid() const { return m_uuid; };
|
||||
std::string getUuidAsString() const { return boost::uuids::to_string(m_uuid); }
|
||||
virtual int getSourceNo() const;
|
||||
|
||||
protected:
|
||||
int sourceNo_{};
|
||||
int m_sourceNo{};
|
||||
|
||||
private:
|
||||
boost::uuids::uuid uuid_{};
|
||||
boost::uuids::uuid m_uuid{};
|
||||
};
|
||||
|
||||
#endif // ENTITY_UUID_H
|
||||
|
|
|
@ -38,7 +38,7 @@ std::string Seller::getSellerNoAsString() const
|
|||
{
|
||||
std::stringstream selNoStr;
|
||||
|
||||
selNoStr << std::setfill('0') << std::setw(3) << id_;
|
||||
selNoStr << std::setfill('0') << std::setw(3) << m_id;
|
||||
|
||||
return selNoStr.str();
|
||||
;
|
||||
|
@ -103,8 +103,8 @@ int Seller::sumInCents()
|
|||
|
||||
std::string Seller::sumAsString() { return formatCentAsEuroString(sumInCents()); }
|
||||
|
||||
bool operator<(const Seller& li, const Seller& re) { return li.id_ < re.id_; }
|
||||
bool operator<(const Seller& li, const Seller& re) { return li.m_id < re.m_id; }
|
||||
bool operator<(const std::unique_ptr<Seller>& li, const std::unique_ptr<Seller>& re)
|
||||
{
|
||||
return li->id_ < re->id_;
|
||||
return li->m_id < re->m_id;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue