FACT++  1.0
template<class T>
char** RemoteControl< T >::Completion ( const char *  text,
int  start,
int   
)
inlineprotected

Definition at line 99 of file RemoteControl.h.

100  {
101  if (T::fScript=="java")
102  {
103  return T::Complete(JsGetCommandList(text, start), text);
104  }
105 
106  // Get the whole buffer before the tab-position
107  const string b = string(T::GetBuffer());
108  const string s = b.substr(0, start);
109  const string l = Tools::Trim(s.c_str());
110  if (l.empty())
111  {
112  if (fCurrentServer.empty())
113  {
114  const size_t p1 = b.find_first_of(' ');
115  const size_t p2 = b.find_first_of('/');
116 
117  if (p1==string::npos && p2!=string::npos)
118  return T::Complete(GetCommandList(), text);
119 
120  std::vector<std::string> v = GetServerList();
121  for_each(v.begin(), v.end(), RemoteControl::append);
122  return T::Complete(v, text);
123  }
124  else
125  {
126  std::vector<std::string> v = GetCommandList(fCurrentServer);
127  for_each(v.begin(), v.end(), RemoteControl::chop);
128  return T::Complete(v, text);
129  }
130  }
131  return T::Complete(GetCommandList(l), text);
132  }
int start(int initState)
Definition: feeserver.c:1740
static void chop(std::string &str)
Definition: RemoteControl.h:89
vector< string > GetCommandList() const
std::vector< std::string > JsGetCommandList(const char *, int) const
std::string fCurrentServer
Output stream for local synchrounous output.
Definition: RemoteControl.h:28
vector< string > GetServerList() const
static void append(std::string &str)
Definition: RemoteControl.h:85
std::string Trim(const std::string &str)
Definition: tools.cc:68