mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-01 10:36:17 +00:00
Implement an assignment operator on gui2::legacy_menu_item
This commit is contained in:
parent
c31a9d36ed
commit
895f6b333c
@ -20,8 +20,12 @@ namespace gui2 {
|
||||
legacy_menu_item::legacy_menu_item(const std::string& str)
|
||||
: icon_(), label_(str), desc_(), default_(false)
|
||||
{
|
||||
if(label_.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle selection.
|
||||
if(!label_.empty() && label_[0] == '*') {
|
||||
if(label_[0] == '*') {
|
||||
default_ = true;
|
||||
label_.erase(0, 1);
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ class legacy_menu_item
|
||||
* with special meanings for certain characters.
|
||||
*/
|
||||
public:
|
||||
legacy_menu_item(const std::string& str);
|
||||
legacy_menu_item(const std::string& str = std::string());
|
||||
|
||||
const std::string& icon() const {
|
||||
return icon_;
|
||||
@ -59,6 +59,15 @@ public:
|
||||
return default_;
|
||||
}
|
||||
|
||||
legacy_menu_item& operator=(const legacy_menu_item& o) {
|
||||
if(&o != this) {
|
||||
icon_ = o.icon_;
|
||||
label_ = o.label_;
|
||||
desc_ = o.desc_;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
std::string icon_, label_, desc_;
|
||||
bool default_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user