fix8  version 1.4.0
Open Source C++ FIX Framework
FIX8::ConsoleMenu Class Reference

Console test harness menu. More...

#include <consolemenu.hpp>

Public Member Functions

 ConsoleMenu (const F8MetaCntx &ctx, std::istream &is=std::cin, std::ostream &os=std::cout, int lpp=20)
 
virtual ~ConsoleMenu ()
 Dtor. More...
 
virtual F8API const BaseMsgEntrySelectMsg () const
 
virtual F8API const FieldTable::PairSelectField (const Message *msg, int groupid=0) const
 
virtual F8API int SelectRealm (const unsigned short fnum, const RealmBase *rb) const
 
F8API MessageSelectFromMsg (const MsgList &lst) const
 
virtual F8API int CreateMsgs (tty_save_state &tty, MsgList &lst) const
 
F8API int CreateMsgsFrom (tty_save_state &tty, MsgList &lst, const MsgList &from) const
 
F8API MessageRemoveMsg (tty_save_state &tty, MsgList &lst) const
 
F8API void EditMsg (tty_save_state &tty, const FieldTable::Pair *fld, Message *msg) const
 
virtual F8API int EditMsgs (tty_save_state &tty, MsgList &lst) const
 
virtual F8API int DeleteMsgs (tty_save_state &tty, MsgList &lst) const
 
virtual F8API int DeleteAllMsgs (tty_save_state &tty, MsgList &lst) const
 
int get_lpp () const
 
void set_lpp (int lpp)
 
bool get_yn (const f8String &prompt, bool echo=false) const
 
char get_key (const f8String &prompt=std::string(), bool echo=false) const
 
F8API f8StringGetString (tty_save_state &tty, f8String &to) const
 

Private Attributes

const F8MetaCntx_ctx
 
std::istream & _is
 
std::ostream & _os
 
int _lpp
 

Static Private Attributes

static const f8String _opt_keys
 
static const f8String _fld_prompt
 

Detailed Description

Console test harness menu.

Definition at line 48 of file consolemenu.hpp.

Constructor & Destructor Documentation

FIX8::ConsoleMenu::ConsoleMenu ( const F8MetaCntx ctx,
std::istream &  is = std::cin,
std::ostream &  os = std::cout,
int  lpp = 20 
)
inline

Ctor

Parameters
ctx- reference to generated metadata
is- reference to input stream
os- reference to output stream
lpp- lines to print per page

Definition at line 62 of file consolemenu.hpp.

63  : _ctx(ctx), _is(is), _os(os), _lpp(lpp) {}
std::ostream & _os
Definition: consolemenu.hpp:52
const F8MetaCntx & ctx()
Compiler generated metadata object, accessed through this function.
const F8MetaCntx & _ctx
Definition: consolemenu.hpp:50
std::istream & _is
Definition: consolemenu.hpp:51
virtual FIX8::ConsoleMenu::~ConsoleMenu ( )
inlinevirtual

Dtor.

Definition at line 66 of file consolemenu.hpp.

66 {}

Member Function Documentation

int ConsoleMenu::CreateMsgs ( tty_save_state tty,
MsgList lst 
) const
virtual

Definition at line 302 of file consolemenu.cpp.

References FIX8::BaseMsgEntry::_create, and FIX8::Minst::_do.

303 {
304  for (;;)
305  {
306  const BaseMsgEntry *mc(SelectMsg());
307  if (!mc)
308  break;
309  unique_ptr<Message> msg(mc->_create._do(true));
310  const FieldTable::Pair *fld;
311  while((fld = SelectField(msg.get())))
312  EditMsg(tty, fld, msg.get());
313  _os << endl << endl << *static_cast<MessageBase *>(msg.get()) << endl;
314  if (get_yn("Add to list? (y/n):", true))
315  lst.push_back(msg.release());
316  }
317 
318  return static_cast<int>(lst.size());
319 }
Message instantiation table entry.
Definition: message.hpp:192
Pair abstraction for use with GeneratedTable.
Definition: f8types.hpp:69
F8API void EditMsg(tty_save_state &tty, const FieldTable::Pair *fld, Message *msg) const
bool get_yn(const f8String &prompt, bool echo=false) const
Definition: consolemenu.hpp:83
virtual F8API const FieldTable::Pair * SelectField(const Message *msg, int groupid=0) const
virtual F8API const BaseMsgEntry * SelectMsg() const
Definition: consolemenu.cpp:50
int ConsoleMenu::CreateMsgsFrom ( tty_save_state tty,
MsgList lst,
const MsgList from 
) const

Definition at line 279 of file consolemenu.cpp.

References FIX8::BaseMsgEntry::_create, and FIX8::Minst::_do.

280 {
281  for (;;)
282  {
283  const BaseMsgEntry *mc(SelectMsg());
284  if (!mc)
285  break;
286  unique_ptr<Message> msg(mc->_create._do(true));
287  Message *fmsg(SelectFromMsg(from));
288  if (fmsg)
289  fmsg->copy_legal(msg.get());
290  const FieldTable::Pair *fld;
291  while((fld = SelectField(msg.get())))
292  EditMsg(tty, fld, msg.get());
293  _os << endl << endl << *static_cast<MessageBase *>(msg.get()) << endl;
294  if (get_yn("Add to list? (y/n):", true))
295  lst.push_back(msg.release());
296  }
297 
298  return static_cast<int>(lst.size());
299 }
Message instantiation table entry.
Definition: message.hpp:192
Pair abstraction for use with GeneratedTable.
Definition: f8types.hpp:69
F8API void EditMsg(tty_save_state &tty, const FieldTable::Pair *fld, Message *msg) const
A complete Fix message with header, body and trailer.
Definition: message.hpp:1058
F8API Message * SelectFromMsg(const MsgList &lst) const
bool get_yn(const f8String &prompt, bool echo=false) const
Definition: consolemenu.hpp:83
virtual F8API const FieldTable::Pair * SelectField(const Message *msg, int groupid=0) const
virtual F8API const BaseMsgEntry * SelectMsg() const
Definition: consolemenu.cpp:50
int ConsoleMenu::DeleteAllMsgs ( tty_save_state tty,
MsgList lst 
) const
virtual

Definition at line 408 of file consolemenu.cpp.

409 {
410  if (lst.size() && get_yn("Delete all msgs? (y/n):", true))
411  {
412  for_each(lst.begin(), lst.end(), [](const Message *pp){ delete pp; pp = nullptr; });
413  lst.clear();
414  }
415 
416  return 0;
417 }
A complete Fix message with header, body and trailer.
Definition: message.hpp:1058
bool get_yn(const f8String &prompt, bool echo=false) const
Definition: consolemenu.hpp:83
int ConsoleMenu::DeleteMsgs ( tty_save_state tty,
MsgList lst 
) const
virtual

Definition at line 420 of file consolemenu.cpp.

421 {
422  for (;;)
423  {
424  Message *msg(SelectFromMsg(lst));
425  if (!msg)
426  break;
427  for (MsgList::iterator itr(lst.begin()); itr != lst.end(); ++itr)
428  {
429  if (*itr == msg)
430  {
431  if (get_yn(" Delete msg? (y/n):", true))
432  {
433  delete *itr;
434  lst.erase(itr);
435  }
436  break;
437  }
438  }
439  }
440 
441  return static_cast<int>(lst.size());
442 }
A complete Fix message with header, body and trailer.
Definition: message.hpp:1058
F8API Message * SelectFromMsg(const MsgList &lst) const
bool get_yn(const f8String &prompt, bool echo=false) const
Definition: consolemenu.hpp:83
void ConsoleMenu::EditMsg ( tty_save_state tty,
const FieldTable::Pair fld,
Message msg 
) const

Definition at line 332 of file consolemenu.cpp.

References FIX8::_pair< Key, Val >::_key, FIX8::_pair< Key, Val >::_value, FIX8::MessageBase::add_field(), FIX8::presorted_set< unsigned short, FieldTrait, FieldTrait::Compare >::end(), FIX8::MessageBase::find_group(), FIX8::MessageBase::get_fp(), FIX8::FieldTraits::get_presence(), FIX8::BaseField::get_tag(), and FIX8::FieldTraits::is_group().

333 {
334  string txt;
335  int rval(-1);
336  if (fld->_value._rlm)
337  rval = SelectRealm(fld->_key, fld->_value._rlm);
338  else
339  {
340  _os << endl << fld->_value._name << ": " << flush;
341  GetString(tty, txt);
342  if (msg->get_fp().is_group(fld->_key))
343  {
344  int cnt(stoi(txt));
345  GroupBase *gb(msg->find_group(fld->_key));
346  if (gb && cnt)
347  {
348  for (int ii(0); ii < cnt; ++ii)
349  {
350  Message *gmsg(static_cast<Message *>(gb->create_group(true)));
351  const FieldTable::Pair *fld;
352  while((fld = SelectField(gmsg, ii + 1)))
353  EditMsg(tty, fld, gmsg);
354  _os << endl << endl << *static_cast<MessageBase *>(gmsg) << endl;
355  if (get_yn("Add group to msg? (y/n):", true))
356  *gb += gmsg;
357  }
358  }
359  }
360  }
361 
362  BaseField *bf(fld->_value._create._do(txt.c_str(), fld->_value._rlm, rval));
363  msg->add_field(bf->get_tag(), msg->get_fp().get_presence().end(), 0, bf, true);
364 }
F8API f8String & GetString(tty_save_state &tty, f8String &to) const
Pair abstraction for use with GeneratedTable.
Definition: f8types.hpp:69
GroupBase * find_group() const
Definition: message.hpp:792
Val _value
Definition: f8types.hpp:72
std::ostream & _os
Definition: consolemenu.hpp:52
const Presence & get_presence() const
Definition: traits.hpp:658
F8API void EditMsg(tty_save_state &tty, const FieldTable::Pair *fld, Message *msg) const
virtual F8API int SelectRealm(const unsigned short fnum, const RealmBase *rb) const
Abstract base class for all repeating groups.
Definition: message.hpp:59
A complete Fix message with header, body and trailer.
Definition: message.hpp:1058
bool is_group(const unsigned short field, Presence::const_iterator &itr) const
Definition: traits.hpp:602
const FieldTraits & get_fp() const
Definition: message.hpp:878
void add_field(const unsigned short fnum, Presence::const_iterator itr, const unsigned pos, BaseField *what, bool check)
Definition: message.hpp:556
The base field class (ABC) for all fields.
Definition: field.hpp:127
bool get_yn(const f8String &prompt, bool echo=false) const
Definition: consolemenu.hpp:83
virtual F8API const FieldTable::Pair * SelectField(const Message *msg, int groupid=0) const
int ConsoleMenu::EditMsgs ( tty_save_state tty,
MsgList lst 
) const
virtual

Definition at line 367 of file consolemenu.cpp.

368 {
369  for (;;)
370  {
371  Message *msg(SelectFromMsg(lst));
372  if (!msg)
373  break;
374  const FieldTable::Pair *fld;
375  while((fld = SelectField(msg)))
376  EditMsg(tty, fld, msg);
377  _os << endl << endl << *static_cast<MessageBase *>(msg) << endl;
378  }
379 
380  return static_cast<int>(lst.size());
381 }
Pair abstraction for use with GeneratedTable.
Definition: f8types.hpp:69
F8API void EditMsg(tty_save_state &tty, const FieldTable::Pair *fld, Message *msg) const
A complete Fix message with header, body and trailer.
Definition: message.hpp:1058
F8API Message * SelectFromMsg(const MsgList &lst) const
virtual F8API const FieldTable::Pair * SelectField(const Message *msg, int groupid=0) const
char FIX8::ConsoleMenu::get_key ( const f8String prompt = std::string(),
bool  echo = false 
) const
inline

Definition at line 84 of file consolemenu.hpp.

Referenced by get_yn().

85  {
86  char ch(0);
87  _is.clear();
88  if (!prompt.empty())
89  _os << prompt << std::flush;
90  _is.get(ch);
91  if (!_is.bad() && ch != 0x3 && ch != 0xa)
92  {
93  if (echo)
94  _os << ch;
95  return ch;
96  }
97  return 0;
98  }
std::ostream & _os
Definition: consolemenu.hpp:52
std::istream & _is
Definition: consolemenu.hpp:51
int FIX8::ConsoleMenu::get_lpp ( ) const
inline

Definition at line 80 of file consolemenu.hpp.

References _lpp.

80 { return _lpp; }
bool FIX8::ConsoleMenu::get_yn ( const f8String prompt,
bool  echo = false 
) const
inline

Definition at line 83 of file consolemenu.hpp.

References get_key().

83 { return toupper(get_key(prompt, echo)) == 'Y'; }
char get_key(const f8String &prompt=std::string(), bool echo=false) const
Definition: consolemenu.hpp:84
f8String & ConsoleMenu::GetString ( tty_save_state tty,
f8String to 
) const

Definition at line 322 of file consolemenu.cpp.

References FIX8::tty_save_state::set_raw_mode(), and FIX8::tty_save_state::unset_raw_mode().

323 {
324  char buff[128] {};
325  tty.unset_raw_mode();
326  _is.getline(buff, sizeof(buff));
327  tty.set_raw_mode();
328  return to = buff;
329 }
std::istream & _is
Definition: consolemenu.hpp:51
Message * ConsoleMenu::RemoveMsg ( tty_save_state tty,
MsgList lst 
) const

Definition at line 384 of file consolemenu.cpp.

References FIX8::Message::clone().

385 {
386  Message *msg(SelectFromMsg(lst));
387  if (msg)
388  {
389  for (MsgList::iterator itr(lst.begin()); itr != lst.end(); ++itr)
390  {
391  if (*itr == msg)
392  {
393  _os << endl;
394  if (get_yn("Remove msg from list? (y/n, n=return a copy):", true))
395  {
396  lst.erase(itr);
397  return msg;
398  }
399  return msg->clone();
400  }
401  }
402  }
403 
404  return nullptr;;
405 }
std::ostream & _os
Definition: consolemenu.hpp:52
A complete Fix message with header, body and trailer.
Definition: message.hpp:1058
F8API Message * SelectFromMsg(const MsgList &lst) const
bool get_yn(const f8String &prompt, bool echo=false) const
Definition: consolemenu.hpp:83
const FieldTable::Pair * ConsoleMenu::SelectField ( const Message msg,
int  groupid = 0 
) const
virtual

Definition at line 101 of file consolemenu.cpp.

References FIX8::presorted_set< unsigned short, FieldTrait, FieldTrait::Compare >::at(), FIX8::presorted_set< unsigned short, FieldTrait, FieldTrait::Compare >::begin(), FIX8::presorted_set< unsigned short, FieldTrait, FieldTrait::Compare >::end(), FIX8::MessageBase::get_fp(), FIX8::MessageBase::get_msgtype(), FIX8::FieldTraits::get_presence(), FIX8::MessageBase::have(), FIX8::FieldTraits::is_mandatory(), FIX8::MessageBase::print_field(), and FIX8::presorted_set< unsigned short, FieldTrait, FieldTrait::Compare >::size().

102 {
103  ostringstream ostr;
104  if (grpid)
105  ostr << msg->get_msgtype() << " (" << grpid << ')';
106  else
107  ostr << _ctx._bme.find_ptr(msg->get_msgtype().c_str())->_name;
108 
109  for(;;)
110  {
112  char opt(0);
113  _os << endl;
114  _os << "--------------------------------------------------" << endl;
115  _os << ' ' << ostr.str() << ": Select field to add (*:mandatory +:present)" << endl;
116  _os << "--------------------------------------------------" << endl;
117 
118  int page(0);
119  for (unsigned nlines(0); itr != msg->get_fp().get_presence().end(); ++itr)
120  {
121  const BaseEntry *tbe(_ctx.find_be(itr->_fnum));
122  _os << '[' << _opt_keys[nlines] << "] ";
123  if (msg->have(itr->_fnum))
124  {
125  _os << '+';
126  msg->print_field(itr->_fnum, _os);
127  _os << endl;
128  }
129  else
130  _os << (msg->get_fp().is_mandatory(itr->_fnum) ? '*' : ' ')
131  << tbe->_name << '(' << itr->_fnum << ')' << endl;
132 
133  ++nlines;
134 
135  if (nlines % _lpp == 0 || (nlines + _lpp * page) == msg->get_fp().get_presence().size())
136  {
137  _os << "Page " << (page + 1) << '/' << (1 + (msg->get_fp().get_presence().size() / _lpp)) << ' ';
138  if ((opt = get_key(_fld_prompt, true)))
139  break;
140  ++page;
141  nlines = 0;
142  _os << endl;
143  }
144  }
145 
146  size_t idx;
147  if (opt)
148  {
149  if (opt == '.')
150  return nullptr;
151 
152  if ((idx = _opt_keys.find_first_of(opt)) != f8String::npos)
153  {
154  idx += (page * _lpp);
155  Presence::const_iterator fitr(msg->get_fp().get_presence().at(idx));
156  if (fitr != msg->get_fp().get_presence().end())
157  return _ctx._be.find_pair_ptr(fitr->_fnum);
158  }
159  }
160  }
161 
162  return nullptr;
163 }
const MsgTable & _bme
Framework generated lookup table to generate Fix messages.
Definition: message.hpp:216
bool have(const unsigned short fnum) const
Definition: message.hpp:725
const_iterator find_pair_ptr(const Key &key) const
Definition: f8types.hpp:163
virtual F8API void print_field(const unsigned short fnum, std::ostream &os) const
Definition: message.cpp:554
bool is_mandatory(const unsigned short field) const
Definition: traits.hpp:596
std::ostream & _os
Definition: consolemenu.hpp:52
const Presence & get_presence() const
Definition: traits.hpp:658
static const f8String _fld_prompt
Definition: consolemenu.hpp:54
Used for static trait interrogation.
Definition: traits.hpp:57
const f8String & get_msgtype() const
Definition: message.hpp:538
const FieldTable & _be
Framework generated lookup table to generate Fix fields.
Definition: message.hpp:218
const F8MetaCntx & _ctx
Definition: consolemenu.hpp:50
char get_key(const f8String &prompt=std::string(), bool echo=false) const
Definition: consolemenu.hpp:84
const BaseEntry * find_be(const unsigned short fnum) const
Definition: message.hpp:267
const FieldTraits & get_fp() const
Definition: message.hpp:878
const Val * find_ptr(const Key &key) const
Definition: f8types.hpp:154
static const f8String _opt_keys
Definition: consolemenu.hpp:54
Message * ConsoleMenu::SelectFromMsg ( const MsgList lst) const

Definition at line 218 of file consolemenu.cpp.

References FIX8::_pair< Key, Val >::_key, and FIX8::_pair< Key, Val >::_value.

219 {
220  if (lst.empty())
221  return nullptr;
222 
223  for(;;)
224  {
225  MsgList::const_iterator itr(lst.begin());
226  char opt(0);
227  _os << endl;
228  _os << "--------------------------------------------------" << endl;
229  _os << "Select from " << lst.size() << " messages" << endl;
230  _os << "--------------------------------------------------" << endl;
231 
232  int page(0);
233  for (unsigned nlines(0); itr != lst.end(); ++itr)
234  {
235  const MsgTable::Pair *tbme(_ctx._bme.find_pair_ptr((*itr)->get_msgtype().c_str()));
236  text txt;
237  (*itr)->get(txt);
238  sending_time sndtime;
239  msg_seq_num msgseqnum;
240  if ((*itr)->Header())
241  {
242  (*itr)->Header()->get(sndtime);
243  (*itr)->Header()->get(msgseqnum);
244  }
245  _os << '[' << _opt_keys[nlines] << "] " << tbme->_value._name << '(' << tbme->_key << ")\t"
246  << sndtime() << ' ' << msgseqnum() << ' ' << txt() << endl;
247 
248  ++nlines;
249  if (nlines % _lpp == 0 || (nlines + _lpp * page) == lst.size())
250  {
251  _os << "Page " << (page + 1) << ' ';
252  if ((opt = get_key(_fld_prompt, true)))
253  break;
254  ++page;
255  nlines = 0;
256  _os << endl;
257  }
258  }
259 
260  size_t idx;
261  if (opt)
262  {
263  if (opt == '.')
264  return nullptr;
265 
266  if ((idx = _opt_keys.find_first_of(opt)) != f8String::npos)
267  {
268  idx += (page * _lpp);
269  if (idx < lst.size())
270  return lst[idx];
271  }
272  }
273  }
274 
275  return nullptr;
276 }
const MsgTable & _bme
Framework generated lookup table to generate Fix messages.
Definition: message.hpp:216
const_iterator find_pair_ptr(const Key &key) const
Definition: f8types.hpp:163
Pair abstraction for use with GeneratedTable.
Definition: f8types.hpp:69
std::ostream & _os
Definition: consolemenu.hpp:52
static const f8String _fld_prompt
Definition: consolemenu.hpp:54
const F8MetaCntx & _ctx
Definition: consolemenu.hpp:50
Field template. There will ONLY be partial template specialisations of this template.
Definition: field.hpp:256
char get_key(const f8String &prompt=std::string(), bool echo=false) const
Definition: consolemenu.hpp:84
static const f8String _opt_keys
Definition: consolemenu.hpp:54
const BaseMsgEntry * ConsoleMenu::SelectMsg ( ) const
virtual

Definition at line 50 of file consolemenu.cpp.

References FIX8::_pair< Key, Val >::_value.

51 {
52  for(;;)
53  {
54  const MsgTable::Pair *pp(_ctx._bme.begin());
55  char opt(0);
56  _os << endl;
57  _os << "--------------------------------------------------" << endl;
58  _os << " Select message to create" << endl;
59  _os << "--------------------------------------------------" << endl;
60 
61  int page(0);
62  for (unsigned nlines(0); pp != _ctx._bme.end(); ++pp)
63  {
64  _os << '[' << _opt_keys[nlines] << "] " << pp->_value._name << '(' << pp->_key << ')' << endl;
65 
66  ++nlines;
67  if (nlines % _lpp == 0 || (nlines + _lpp * page) == _ctx._bme.size())
68  {
69  _os << "Page " << (page + 1) << '/' << (1 + (_ctx._bme.size() / _lpp)) << ' ';
70  if ((opt = get_key(_fld_prompt, true)))
71  break;
72  ++page;
73  nlines = 0;
74  _os << endl;
75  }
76  }
77 
78  size_t idx;
79  if (opt)
80  {
81  if (opt == '.')
82  return nullptr;
83 
84  if ((idx = _opt_keys.find_first_of(opt)) != f8String::npos)
85  {
86  idx += (page * _lpp);
87  if (idx < _ctx._bme.size())
88  {
89  const MsgTable::Pair *pr(_ctx._bme.at(idx));
90  if (pr)
91  return &pr->_value;
92  }
93  }
94  }
95  }
96 
97  return nullptr;
98 }
const MsgTable & _bme
Framework generated lookup table to generate Fix messages.
Definition: message.hpp:216
const_iterator begin() const
Definition: f8types.hpp:133
Pair abstraction for use with GeneratedTable.
Definition: f8types.hpp:69
Val _value
Definition: f8types.hpp:72
std::ostream & _os
Definition: consolemenu.hpp:52
static const f8String _fld_prompt
Definition: consolemenu.hpp:54
size_t size() const
Definition: f8types.hpp:176
const F8MetaCntx & _ctx
Definition: consolemenu.hpp:50
char get_key(const f8String &prompt=std::string(), bool echo=false) const
Definition: consolemenu.hpp:84
const_iterator at(const size_t idx) const
Definition: f8types.hpp:172
static const f8String _opt_keys
Definition: consolemenu.hpp:54
const_iterator end() const
Definition: f8types.hpp:137
int ConsoleMenu::SelectRealm ( const unsigned short  fnum,
const RealmBase rb 
) const
virtual

Definition at line 166 of file consolemenu.cpp.

References FIX8::RealmBase::_descriptions, FIX8::RealmBase::_sz, and FIX8::RealmBase::print().

167 {
168  const BaseEntry *be(_ctx.find_be(fnum));
169 
170  for(;;)
171  {
172  int pp(0);
173  char opt(0);
174 
175  _os << endl;
176  _os << "--------------------------------------------------" << endl;
177  _os << ' ' << be->_name << ": Select realm value to add" << endl;
178  _os << "--------------------------------------------------" << endl;
179 
180  int page(0);
181  for (int nlines(0); pp < rb->_sz; ++pp)
182  {
183  _os << '[' << _opt_keys[nlines] << "] " << *(rb->_descriptions + pp) << " (";
184  rb->print(_os, pp);
185  _os << ')' << endl;
186 
187  ++nlines;
188  if (nlines % _lpp == 0 || (nlines + _lpp * page) == rb->_sz)
189  {
190  _os << "Page " << (page + 1) << '/' << (1 + (rb->_sz / _lpp)) << ' ';
191  if ((opt = get_key(_fld_prompt, true)))
192  break;
193  ++page;
194  nlines = 0;
195  _os << endl;
196  }
197  }
198 
199  int idx;
200  if (opt)
201  {
202  if (opt == '.')
203  return 0;
204 
205  if (static_cast<size_t>((idx = (static_cast<int>(_opt_keys.find_first_of(opt))))) != f8String::npos)
206  {
207  idx += (page * _lpp);
208  if (idx < rb->_sz)
209  return idx;
210  }
211  }
212  }
213 
214  return 0;
215 }
std::ostream & _os
Definition: consolemenu.hpp:52
static const f8String _fld_prompt
Definition: consolemenu.hpp:54
const int _sz
Definition: field.hpp:65
const F8MetaCntx & _ctx
Definition: consolemenu.hpp:50
std::ostream & print(std::ostream &os, int idx) const
Definition: field.hpp:116
char get_key(const f8String &prompt=std::string(), bool echo=false) const
Definition: consolemenu.hpp:84
const BaseEntry * find_be(const unsigned short fnum) const
Definition: message.hpp:267
static const f8String _opt_keys
Definition: consolemenu.hpp:54
const char *const * _descriptions
Definition: field.hpp:66
void FIX8::ConsoleMenu::set_lpp ( int  lpp)
inline

Definition at line 81 of file consolemenu.hpp.

81 { _lpp = lpp; }

Member Data Documentation

const F8MetaCntx& FIX8::ConsoleMenu::_ctx
private

Definition at line 50 of file consolemenu.hpp.

const f8String ConsoleMenu::_fld_prompt
staticprivate

Definition at line 54 of file consolemenu.hpp.

std::istream& FIX8::ConsoleMenu::_is
private

Definition at line 51 of file consolemenu.hpp.

int FIX8::ConsoleMenu::_lpp
private

Definition at line 53 of file consolemenu.hpp.

Referenced by get_lpp().

const f8String ConsoleMenu::_opt_keys
staticprivate

Definition at line 54 of file consolemenu.hpp.

std::ostream& FIX8::ConsoleMenu::_os
private

Definition at line 52 of file consolemenu.hpp.


The documentation for this class was generated from the following files: