FIX: change to uniqe_ptr
This commit is contained in:
parent
e435291279
commit
df4b34545e
@ -7,6 +7,6 @@
|
||||
|
||||
// Auto generated header file containing the last git revision
|
||||
|
||||
#define GIT_HASH "b7b396d"
|
||||
#define GIT_HASH "5f98ee9"
|
||||
|
||||
#endif //FLOATPUMP_GIT_REVISION_TEMPLATE_H
|
@ -173,8 +173,8 @@ int main(void) {
|
||||
|
||||
|
||||
Menu mainmenu("Hauptmenu");
|
||||
mainmenu.addSubmenu(&tankmenu);
|
||||
mainmenu.addSubmenu(&refillmenu);
|
||||
mainmenu.addSubmenu(tankmenu);
|
||||
mainmenu.addSubmenu(refillmenu);
|
||||
|
||||
|
||||
|
||||
|
@ -143,9 +143,8 @@ namespace floatpump {
|
||||
|
||||
}
|
||||
|
||||
auto addSubmenu(Menu *submenu) -> void {
|
||||
submenu->m_parent = this;
|
||||
m_submenus.push_back(submenu);
|
||||
auto addSubmenu(Menu &menu) -> void {
|
||||
m_submenus.emplace_back(std::make_unique<Menu>(std::move(menu)))->m_parent = this;
|
||||
}
|
||||
|
||||
auto printLine() -> const std::string {
|
||||
@ -168,7 +167,7 @@ namespace floatpump {
|
||||
|
||||
private:
|
||||
std::vector<std::unique_ptr<IMenuEntry>> m_entries;
|
||||
std::vector<Menu *> m_submenus;
|
||||
std::vector<std::unique_ptr<Menu>> m_submenus;
|
||||
Menu *m_parent = nullptr;
|
||||
std::string m_name;
|
||||
};
|
||||
|
@ -98,7 +98,7 @@ namespace floatpump::menu {
|
||||
|
||||
auto Menu::getSubmenu(int index) -> Menu * {
|
||||
if (index >= 0 && index < m_submenus.size()) {
|
||||
return m_submenus[index];
|
||||
return m_submenus[index].get();
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user