FACT++  1.0
bool RemoteControlImp::ProcessCommand ( const std::string &  str,
bool  change = true 
)
protected

Definition at line 5 of file RemoteControl.cc.

References fCurrentServer, HasServer(), kRed, lout, SendDimCommand(), and str.

6 {
7  if (fCurrentServer.empty())
8  {
9  const size_t p1 = str.find_first_of(' ');
10  const size_t p2 = str.find_first_of('/');
11 
12  const bool is_cmd = p2!=string::npos && p1>p2;
13 
14  string s = str;
15  if (is_cmd)
16  s = str.substr(0, p2);
17 
18  if (p2<p1 && p2!=str.length()-1)
19  {
20  const string c = str.substr(p2+1);
21  return SendDimCommand(lout, s, c, !change);
22  }
23 
24  if (HasServer(s))
25  {
26  if (!change)
27  return SendDimCommand(lout, str, "", !change);
28 
29  fCurrentServer = s;
30  return true;
31  }
32 
33  if (!change && is_cmd)
34  throw runtime_error("Unkown server '"+s+"'");
35 
36  if (change)
37  lout << kRed << "Unkown server '" << s << "'" << endl;
38 
39  return false;
40  }
41 
42  if (!fCurrentServer.empty() && str=="..")
43  {
44  fCurrentServer = "";
45  return true;
46  }
47  return SendDimCommand(lout, fCurrentServer, str, !change);
48 }
char str[80]
Definition: test_client.c:7
Set color Red.
Definition: WindowLog.h:17
virtual bool HasServer(const std::string &)
Definition: RemoteControl.h:38
std::ostream & lout
Output stream for local synchrounous output.
Definition: RemoteControl.h:26
std::string fCurrentServer
Output stream for local synchrounous output.
Definition: RemoteControl.h:28
virtual bool SendDimCommand(ostream &, const std::string &, const std::string &, bool=false)
Definition: RemoteControl.h:39

+ Here is the call graph for this function: