3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 #include "funcrequest.h"
21 using std::istringstream;
26 FuncRequest::FuncRequest(Origin o)
27 : action(LFUN_NOACTION), origin(o), x(0), y(0),
28 button_(mouse_button::none)
32 FuncRequest::FuncRequest(kb_action act, Origin o)
33 : action(act), origin(o), x(0), y(0), button_(mouse_button::none)
37 FuncRequest::FuncRequest(kb_action act, string const & arg, Origin o)
38 : action(act), argument(arg), origin(o), x(0), y(0),
39 button_(mouse_button::none)
43 FuncRequest::FuncRequest(kb_action act, int ax, int ay,
44 mouse_button::state but, Origin o)
45 : action(act), origin(o), x(ax), y(ay), button_(but)
49 FuncRequest::FuncRequest(FuncRequest const & cmd, string const & arg, Origin o)
50 : action(cmd.action), argument(arg), origin(o),
51 x(cmd.x), y(cmd.y), button_(cmd.button_)
55 mouse_button::state FuncRequest::button() const
61 void split(vector<string> & args, string const & str)
63 istringstream is(str);
81 string FuncRequest::getArg(unsigned int i) const
84 split(args, argument);
85 return i < args.size() ? args[i] : string();
89 bool operator==(FuncRequest const & lhs, FuncRequest const & rhs)
91 return lhs.action == rhs.action && lhs.argument == rhs.argument;
95 std::ostream & operator<<(std::ostream & os, FuncRequest const & cmd)
98 << " action: " << cmd.action
99 << " arg: '" << cmd.argument << "'"