2 * \file FuncRequest.cpp
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"
23 FuncRequest const FuncRequest::unknown(LFUN_UNKNOWN_ACTION);
24 FuncRequest const FuncRequest::noaction(LFUN_NOACTION);
26 FuncRequest::FuncRequest(Origin o)
27 : action(LFUN_NOACTION), origin(o), x(0), y(0),
28 button_(mouse_button::none)
32 FuncRequest::FuncRequest(FuncCode act, Origin o)
33 : action(act), origin(o), x(0), y(0), button_(mouse_button::none)
37 FuncRequest::FuncRequest(FuncCode act, docstring const & arg, Origin o)
38 : action(act), argument_(arg), origin(o), x(0), y(0),
39 button_(mouse_button::none)
43 FuncRequest::FuncRequest(FuncCode act, string const & arg, Origin o)
44 : action(act), argument_(from_utf8(arg)), origin(o), x(0), y(0),
45 button_(mouse_button::none)
49 FuncRequest::FuncRequest(FuncCode act, int ax, int ay,
50 mouse_button::state but, Origin o)
51 : action(act), origin(o), x(ax), y(ay), button_(but)
55 FuncRequest::FuncRequest(FuncRequest const & cmd, docstring const & arg, Origin o)
56 : action(cmd.action), argument_(arg), origin(o),
57 x(cmd.x), y(cmd.y), button_(cmd.button_)
61 FuncRequest::FuncRequest(FuncRequest const & cmd, string const & arg, Origin o)
62 : action(cmd.action), argument_(from_utf8(arg)), origin(o),
63 x(cmd.x), y(cmd.y), button_(cmd.button_)
67 mouse_button::state FuncRequest::button() const
73 void splitArg(vector<string> & args, string const & str)
75 istringstream is(str);
93 string FuncRequest::getArg(unsigned int i) const
96 splitArg(args, to_utf8(argument_));
97 return i < args.size() ? args[i] : string();
101 bool operator==(FuncRequest const & lhs, FuncRequest const & rhs)
103 return lhs.action == rhs.action && lhs.argument() == rhs.argument();
107 ostream & operator<<(ostream & os, FuncRequest const & cmd)
110 << " action: " << cmd.action
111 << " arg: '" << to_utf8(cmd.argument()) << "'"