refactor: inline simple getters (#41125)

This commit is contained in:
Charles Kerr 2024-01-29 20:43:28 -06:00 committed by GitHub
parent 4e19321ba8
commit ffec3127d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 93 additions and 192 deletions

View file

@ -89,55 +89,6 @@ gin::Handle<Notification> Notification::New(gin_helper::ErrorThrower thrower,
return gin::CreateHandle(thrower.isolate(), new Notification(args));
}
// Getters
std::u16string Notification::GetTitle() const {
return title_;
}
std::u16string Notification::GetSubtitle() const {
return subtitle_;
}
std::u16string Notification::GetBody() const {
return body_;
}
bool Notification::GetSilent() const {
return silent_;
}
bool Notification::GetHasReply() const {
return has_reply_;
}
std::u16string Notification::GetTimeoutType() const {
return timeout_type_;
}
std::u16string Notification::GetReplyPlaceholder() const {
return reply_placeholder_;
}
std::u16string Notification::GetSound() const {
return sound_;
}
std::u16string Notification::GetUrgency() const {
return urgency_;
}
std::vector<electron::NotificationAction> Notification::GetActions() const {
return actions_;
}
std::u16string Notification::GetCloseButtonText() const {
return close_button_text_;
}
std::u16string Notification::GetToastXml() const {
return toast_xml_;
}
// Setters
void Notification::SetTitle(const std::u16string& new_title) {
title_ = new_title;
@ -263,25 +214,23 @@ void Notification::FillObjectTemplate(v8::Isolate* isolate,
gin::ObjectTemplateBuilder(isolate, GetClassName(), templ)
.SetMethod("show", &Notification::Show)
.SetMethod("close", &Notification::Close)
.SetProperty("title", &Notification::GetTitle, &Notification::SetTitle)
.SetProperty("subtitle", &Notification::GetSubtitle,
.SetProperty("title", &Notification::title, &Notification::SetTitle)
.SetProperty("subtitle", &Notification::subtitle,
&Notification::SetSubtitle)
.SetProperty("body", &Notification::GetBody, &Notification::SetBody)
.SetProperty("silent", &Notification::GetSilent, &Notification::SetSilent)
.SetProperty("hasReply", &Notification::GetHasReply,
.SetProperty("body", &Notification::body, &Notification::SetBody)
.SetProperty("silent", &Notification::is_silent, &Notification::SetSilent)
.SetProperty("hasReply", &Notification::has_reply,
&Notification::SetHasReply)
.SetProperty("timeoutType", &Notification::GetTimeoutType,
.SetProperty("timeoutType", &Notification::timeout_type,
&Notification::SetTimeoutType)
.SetProperty("replyPlaceholder", &Notification::GetReplyPlaceholder,
.SetProperty("replyPlaceholder", &Notification::reply_placeholder,
&Notification::SetReplyPlaceholder)
.SetProperty("urgency", &Notification::GetUrgency,
&Notification::SetUrgency)
.SetProperty("sound", &Notification::GetSound, &Notification::SetSound)
.SetProperty("actions", &Notification::GetActions,
&Notification::SetActions)
.SetProperty("closeButtonText", &Notification::GetCloseButtonText,
.SetProperty("urgency", &Notification::urgency, &Notification::SetUrgency)
.SetProperty("sound", &Notification::sound, &Notification::SetSound)
.SetProperty("actions", &Notification::actions, &Notification::SetActions)
.SetProperty("closeButtonText", &Notification::close_button_text,
&Notification::SetCloseButtonText)
.SetProperty("toastXml", &Notification::GetToastXml,
.SetProperty("toastXml", &Notification::toast_xml,
&Notification::SetToastXml)
.Build();
}