diff options
| author | levlam <levlam@telegram.org> | 2026-07-05 14:09:07 +0300 |
|---|---|---|
| committer | levlam <levlam@telegram.org> | 2026-07-05 14:09:07 +0300 |
| commit | 7d2ee4a69e52463a8a01d1c1dd1691db35ac53d4 (patch) | |
| tree | 659f3ebbf83d20d8642c4d506396734441b8ab08 | |
| parent | d6159234823aee742da1ebd31f21d62391439adf (diff) | |
Make LabeledPricePart fields private.
| -rw-r--r-- | td/telegram/LabeledPricePart.cpp | 4 | ||||
| -rw-r--r-- | td/telegram/LabeledPricePart.h | 23 |
2 files changed, 16 insertions, 11 deletions
diff --git a/td/telegram/LabeledPricePart.cpp b/td/telegram/LabeledPricePart.cpp index ff2776e1e..0efedda63 100644 --- a/td/telegram/LabeledPricePart.cpp +++ b/td/telegram/LabeledPricePart.cpp @@ -13,7 +13,7 @@ namespace td { telegram_api::object_ptr<telegram_api::labeledPrice> LabeledPricePart::get_input_labeled_price() const { - return telegram_api::make_object<telegram_api::labeledPrice>(label, amount); + return telegram_api::make_object<telegram_api::labeledPrice>(label_, amount_); } vector<telegram_api::object_ptr<telegram_api::labeledPrice>> LabeledPricePart::get_input_labeled_prices( @@ -55,7 +55,7 @@ Result<vector<LabeledPricePart>> LabeledPricePart::get_labeled_price_parts( } StringBuilder &operator<<(StringBuilder &string_builder, const LabeledPricePart &labeled_price_part) { - return string_builder << '[' << labeled_price_part.label << ": " << labeled_price_part.amount << ']'; + return string_builder << '[' << labeled_price_part.label_ << ": " << labeled_price_part.amount_ << ']'; } } // namespace td diff --git a/td/telegram/LabeledPricePart.h b/td/telegram/LabeledPricePart.h index 0c6e8e843..04e4ba68d 100644 --- a/td/telegram/LabeledPricePart.h +++ b/td/telegram/LabeledPricePart.h @@ -15,15 +15,20 @@ namespace td { -struct LabeledPricePart { - string label; - int64 amount = 0; +class LabeledPricePart { + string label_; + int64 amount_ = 0; telegram_api::object_ptr<telegram_api::labeledPrice> get_input_labeled_price() const; + friend bool operator==(const LabeledPricePart &lhs, const LabeledPricePart &rhs); + + friend StringBuilder &operator<<(StringBuilder &string_builder, const LabeledPricePart &labeled_price_part); + + public: LabeledPricePart() = default; - LabeledPricePart(string &&label, int64 amount) : label(std::move(label)), amount(amount) { + LabeledPricePart(string &&label, int64 amount) : label_(std::move(label)), amount_(amount) { } static Result<vector<LabeledPricePart>> get_labeled_price_parts( @@ -34,19 +39,19 @@ struct LabeledPricePart { template <class StorerT> void store(StorerT &storer) const { - storer.store_string(label); - storer.store_binary(amount); + storer.store_string(label_); + storer.store_binary(amount_); } template <class ParserT> void parse(ParserT &parser) { - label = parser.template fetch_string<string>(); - amount = parser.fetch_long(); + label_ = parser.template fetch_string<string>(); + amount_ = parser.fetch_long(); } }; inline bool operator==(const LabeledPricePart &lhs, const LabeledPricePart &rhs) { - return lhs.label == rhs.label && lhs.amount == rhs.amount; + return lhs.label_ == rhs.label_ && lhs.amount_ == rhs.amount_; } inline bool operator!=(const LabeledPricePart &lhs, const LabeledPricePart &rhs) { |
