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"
15 #include "support/std_sstream.h"
22 using std::istringstream;
27 FuncRequest::FuncRequest()
28 : action(LFUN_NOACTION), x(0), y(0), button_(mouse_button::none)
32 FuncRequest::FuncRequest(kb_action act)
33 : action(act), x(0), y(0), button_(mouse_button::none)
37 FuncRequest::FuncRequest(kb_action act, string const & arg)
38 : action(act), argument(arg), x(0), y(0), button_(mouse_button::none)
42 FuncRequest::FuncRequest(kb_action act, int ax, int ay, mouse_button::state but)
43 : action(act), x(ax), y(ay), button_(but)
47 FuncRequest::FuncRequest(FuncRequest const & cmd, string const & arg)
48 : action(cmd.action), argument(arg),
49 x(cmd.x), y(cmd.y), button_(cmd.button_)
53 mouse_button::state FuncRequest::button() const
59 void split(vector<string> & args, string str)
61 istringstream is(str);
77 string FuncRequest::getArg(unsigned int i) const
80 split(args, argument);
81 return i < args.size() ? args[i] : string();
85 bool operator==(FuncRequest const & lhs, FuncRequest const & rhs)
87 return lhs.action == rhs.action && lhs.argument == rhs.argument;
91 std::ostream & operator<<(std::ostream & os, FuncRequest const & cmd)
94 << " action: " << cmd.action
95 << " arg: '" << cmd.argument << "'"