Add operator<< for BackgroundFill.

This commit is contained in:
levlam 2024-05-02 18:30:21 +03:00
parent d01cac3344
commit 51db71c250
2 changed files with 11 additions and 0 deletions

View File

@ -238,6 +238,11 @@ bool operator==(const BackgroundFill &lhs, const BackgroundFill &rhs) {
lhs.fourth_color_ == rhs.fourth_color_;
}
StringBuilder &operator<<(StringBuilder &string_builder, const BackgroundFill &fill) {
return string_builder << "BackgroundFill[" << fill.top_color_ << '~' << fill.bottom_color_ << '~' << fill.third_color_
<< '~' << fill.fourth_color_ << ':' << fill.rotation_angle_ << ']';
}
string BackgroundType::get_mime_type() const {
CHECK(has_file());
return type_ == Type::Pattern ? "image/png" : "image/jpeg";
@ -340,6 +345,8 @@ StringBuilder &operator<<(StringBuilder &string_builder, const BackgroundType &t
UNREACHABLE();
break;
}
// string_builder << ' ' << type.is_blurred_ << ' ' << type.is_moving_ << ' ' << type.intensity_ << ' ' << type.fill_
// << ' ' << type.theme_name_ << ' ';
return string_builder << '[' << type.get_link() << ']';
}

View File

@ -54,6 +54,8 @@ class BackgroundFill {
friend bool operator==(const BackgroundFill &lhs, const BackgroundFill &rhs);
friend StringBuilder &operator<<(StringBuilder &string_builder, const BackgroundFill &fill);
friend class BackgroundType;
static Result<BackgroundFill> get_background_fill(Slice name);
@ -63,6 +65,8 @@ class BackgroundFill {
bool operator==(const BackgroundFill &lhs, const BackgroundFill &rhs);
StringBuilder &operator<<(StringBuilder &string_builder, const BackgroundFill &fill);
class BackgroundType {
enum class Type : int32 { Wallpaper, Pattern, Fill, ChatTheme };
Type type_ = Type::Fill;