示例#1
0
bool
ClParserParser::
readIdentifier(ClParserIdentifierPtr &identifier)
{
  StringVectorT scopes;
  std::string   idstr, str;

  if (! parse_.readIdentifier(idstr))
    return false;

  while (parse_.isString("::")) {
    parse_.skipChars(2);

    if (! parse_.readIdentifier(str))
      break;

    scopes.push_back(idstr);

    idstr = str;
  }

  identifier = ClParserIdentifierMgrInst->createIdentifier(idstr);

  StringVectorT::const_iterator p1 = scopes.begin();
  StringVectorT::const_iterator p2 = scopes.end  ();

  for ( ; p1 != p2; ++p1)
    identifier->addScope(*p1);

  return true;
}
示例#2
0
bool Params::prepare() {
    const int default_gw_ipc_port = 3333;
    size_t pos;
    for(std::vector<std::string>::iterator it(ipcgwvec.begin()); it != ipcgwvec.end(); ++it) {
        pos = it->find(':');
        if(pos == std::string::npos) {
            ResolveData		rd = synchronous_resolve(it->c_str(), default_gw_ipc_port, 0, SocketInfo::Inet4, SocketInfo::Datagram);
            if(!rd.empty()) {
                ipcgwaddrvec.push_back(SocketAddressInet4(rd.begin()));
            } else {
                cout<<"Invalid address: "<<*it<<endl;
                return false;
            }
        } else {
            (*it)[pos] = '\0';
            int port = atoi(it->c_str() + pos + 1);
            ResolveData		rd = synchronous_resolve(it->c_str(), port, 0, SocketInfo::Inet4, SocketInfo::Datagram);
            if(!rd.empty()) {
                ipcgwaddrvec.push_back(SocketAddressInet4(rd.begin()));
            } else {
                cout<<"Invalid address: "<<*it<<endl;
                return false;
            }
        }
        cout<<"added ipc gateway address "<<ipcgwaddrvec.back()<<endl;
    }
    return true;
}