//------------------------------------------------------------------------------------------------- int ConsoleMenu::CreateMsgs(tty_save_state& tty, MsgList& lst) const { for (;;) { const BaseMsgEntry *mc(SelectMsg()); if (!mc) break; unique_ptr<Message> msg(mc->_create._do(true)); const FieldTable::Pair *fld; while((fld = SelectField(msg.get()))) EditMsg(tty, fld, msg.get()); _os << endl << endl << *static_cast<MessageBase *>(msg.get()) << endl; if (get_yn("Add to list? (y/n):", true)) lst.push_back(msg.release()); } return static_cast<int>(lst.size()); }
//------------------------------------------------------------------------------------------------- int ConsoleMenu::CreateMsgs(tty_save_state& tty, MsgList& lst) const { for (;;) { const BaseMsgEntry *mc(SelectMsg()); if (mc) { Message *msg(mc->_create()); const FieldTable::Pair *fld; while((fld = SelectField(msg))) EditMsg(tty, fld, msg); _os << endl << endl << *static_cast<MessageBase *>(msg) << endl; if (get_yn("Add to list? (y/n):", true)) lst.push_back(msg); } else break; } return lst.size(); }