From 7d2ee4a69e52463a8a01d1c1dd1691db35ac53d4 Mon Sep 17 00:00:00 2001 From: levlam Date: Sun, 5 Jul 2026 14:09:07 +0300 Subject: Make LabeledPricePart fields private. --- td/telegram/LabeledPricePart.cpp | 4 ++-- 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 LabeledPricePart::get_input_labeled_price() const { - return telegram_api::make_object(label, amount); + return telegram_api::make_object(label_, amount_); } vector> LabeledPricePart::get_input_labeled_prices( @@ -55,7 +55,7 @@ Result> 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 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> get_labeled_price_parts( @@ -34,19 +39,19 @@ struct LabeledPricePart { template void store(StorerT &storer) const { - storer.store_string(label); - storer.store_binary(amount); + storer.store_string(label_); + storer.store_binary(amount_); } template void parse(ParserT &parser) { - label = parser.template fetch_string(); - amount = parser.fetch_long(); + label_ = parser.template fetch_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) { -- cgit v1.2.3