示例#1
0
文件: consolemenu.cpp 项目: fix8/fix8
//-------------------------------------------------------------------------------------------------
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());
}
示例#2
0
//-------------------------------------------------------------------------------------------------
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();
}