refactor: inline simple getters (#41125)
This commit is contained in:
parent
4e19321ba8
commit
ffec3127d5
17 changed files with 93 additions and 192 deletions
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -67,18 +67,20 @@ class Notification : public gin::Wrappable<Notification>,
|
|||
void Close();
|
||||
|
||||
// Prop Getters
|
||||
std::u16string GetTitle() const;
|
||||
std::u16string GetSubtitle() const;
|
||||
std::u16string GetBody() const;
|
||||
bool GetSilent() const;
|
||||
bool GetHasReply() const;
|
||||
std::u16string GetTimeoutType() const;
|
||||
std::u16string GetReplyPlaceholder() const;
|
||||
std::u16string GetUrgency() const;
|
||||
std::u16string GetSound() const;
|
||||
std::vector<electron::NotificationAction> GetActions() const;
|
||||
std::u16string GetCloseButtonText() const;
|
||||
std::u16string GetToastXml() const;
|
||||
const std::u16string& title() const { return title_; }
|
||||
const std::u16string& subtitle() const { return subtitle_; }
|
||||
const std::u16string& body() const { return body_; }
|
||||
bool is_silent() const { return silent_; }
|
||||
bool has_reply() const { return has_reply_; }
|
||||
const std::u16string& timeout_type() const { return timeout_type_; }
|
||||
const std::u16string& reply_placeholder() const { return reply_placeholder_; }
|
||||
const std::u16string& urgency() const { return urgency_; }
|
||||
const std::u16string& sound() const { return sound_; }
|
||||
const std::vector<electron::NotificationAction>& actions() const {
|
||||
return actions_;
|
||||
}
|
||||
const std::u16string& close_button_text() const { return close_button_text_; }
|
||||
const std::u16string& toast_xml() const { return toast_xml_; }
|
||||
|
||||
// Prop Setters
|
||||
void SetTitle(const std::u16string& new_title);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue