FACT++  1.0
string RemoteConsole::GetUpdatePrompt ( ) const
virtual

Reimplemented from Readline.

Definition at line 54 of file RemoteControl.cc.

References RemoteControlImp::fCurrentServer, State::index, and State::name.

55 {
56  if (fImp->GetCurrentState()>=3)
57  return "";
58 
59  // If we are continously flushing the buffer omit the buffer size
60  // If we are buffering show the buffer size
61  const string beg = GetLinePrompt();
62 
63  // If we have not cd'ed to a server show only the line start
64  if (fCurrentServer.empty() || !fImp)
65  return beg + "> ";
66 
67  // Check if we have cd'ed to a valid server
68  const State state = fImp->GetServerState(fCurrentServer);
69  if (state.index==-256)
70  return beg + "> ";
71 
72  // The server
73  const string serv = "\033[34m\033[1m"+fCurrentServer+"\033[0m";
74 
75  // If no match found or something wrong found just output the server
76  if (state.index<-1)
77  return beg + " " + serv + "> ";
78 
79  // If everything found add the state to the server
80  return beg + " " + serv + ":\033[32m\033[1m" + state.name + "\033[0m> ";
81 }
int GetCurrentState() const
return the current state of the machine
StateMachineDimControl * fImp
Definition: RemoteControl.h:70
int index
Definition: State.h:11
Definition: dis.c:69
std::string fCurrentServer
Output stream for local synchrounous output.
Definition: RemoteControl.h:28
State GetServerState(const std::string &server)
std::string GetLinePrompt() const
Definition: Console.cc:172
std::string name
Index (e.g. 1)
Definition: State.h:12