From 3e6e587df8a36f3ce90dd1f259a9ce34dcc39cf1 Mon Sep 17 00:00:00 2001 From: Martin Brodbeck Date: Thu, 7 Jul 2022 15:03:39 +0200 Subject: [PATCH] member variables renamed --- src/core/article.cpp | 28 ++++++++++++++-------------- src/core/article.h | 11 +++++------ src/core/entity.cpp | 5 +---- src/core/entity.h | 4 ++-- src/core/entityint.cpp | 4 ++-- src/core/entityint.h | 4 ++-- src/core/entityuuid.cpp | 8 ++++---- src/core/entityuuid.h | 8 ++++---- src/core/seller.cpp | 6 +++--- 9 files changed, 37 insertions(+), 41 deletions(-) diff --git a/src/core/article.cpp b/src/core/article.cpp index e17589b..6309b32 100644 --- a/src/core/article.cpp +++ b/src/core/article.cpp @@ -5,34 +5,34 @@ #include #include -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(); } diff --git a/src/core/article.h b/src/core/article.h index ab6be52..30e7292 100644 --- a/src/core/article.h +++ b/src/core/article.h @@ -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 - diff --git a/src/core/entity.cpp b/src/core/entity.cpp index 4a8cfb4..9f07489 100644 --- a/src/core/entity.cpp +++ b/src/core/entity.cpp @@ -1,6 +1,3 @@ #include "entity.h" -Entity::State Entity::getState() const -{ - return state_; -} +Entity::State Entity::getState() const { return m_state; } diff --git a/src/core/entity.h b/src/core/entity.h index a0eb97c..3517297 100644 --- a/src/core/entity.h +++ b/src/core/entity.h @@ -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 diff --git a/src/core/entityint.cpp b/src/core/entityint.cpp index 28e210e..2d0f6af 100644 --- a/src/core/entityint.cpp +++ b/src/core/entityint.cpp @@ -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; } diff --git a/src/core/entityint.h b/src/core/entityint.h index 06a332b..ea92937 100644 --- a/src/core/entityint.h +++ b/src/core/entityint.h @@ -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 diff --git a/src/core/entityuuid.cpp b/src/core/entityuuid.cpp index 570c624..7ae3163 100644 --- a/src/core/entityuuid.cpp +++ b/src/core/entityuuid.cpp @@ -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; } diff --git a/src/core/entityuuid.h b/src/core/entityuuid.h index c9491a6..bc6bf77 100644 --- a/src/core/entityuuid.h +++ b/src/core/entityuuid.h @@ -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 diff --git a/src/core/seller.cpp b/src/core/seller.cpp index cc053ce..e5de07d 100644 --- a/src/core/seller.cpp +++ b/src/core/seller.cpp @@ -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& li, const std::unique_ptr& re) { - return li->id_ < re->id_; + return li->m_id < re->m_id; }