当前位置: 首页>>代码示例>>C++>>正文


C++ Network::addListener方法代码示例

本文整理汇总了C++中Network::addListener方法的典型用法代码示例。如果您正苦于以下问题:C++ Network::addListener方法的具体用法?C++ Network::addListener怎么用?C++ Network::addListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Network的用法示例。


在下文中一共展示了Network::addListener方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    Network n;
    TestGame g(&n);
    if (argc>1) n.addListener(argv[1]);
    QTimer::singleShot(1000, &g, SLOT(startOnEmpty()));

    return app.exec();
}
开发者ID:weidendo,项目名称:qenolaba,代码行数:10,代码来源:BoardWidget.cpp

示例2: if

/**
 * @brief (Re-)loads configuration from the configuration file.
 *
 * If loading failed, this method returns false.
 * Note: this method is automatically called when setConfigFileName is called,
 * and by the constructor.
 */
bool dazeus::DaZeus::loadConfig()
{
  assert( configFileName_.length() != 0 );

  if( config_ != 0 ) {
    delete config_;
  }

  config_ = new ConfigReader(configFileName_);

  if( !config_ )
    return false;

  config_->read();

  const std::vector<NetworkConfig*> &networks = config_->getNetworks();

  if(!connectDatabase()) {
    delete config_;
    config_ = 0;
    return false;
  }

  if(plugins_)
    delete plugins_;
  plugins_ = new PluginComm( database_, config_, this );

  std::vector<NetworkConfig*>::const_iterator it;
  for(it = networks.begin(); it != networks.end(); ++it)
  {
    Network *net = new Network( *it );
    net->addListener(plugins_);
    if( net == 0 ) {
      delete config_;
      config_ = 0;
      return false;
    }

    networks_.push_back( net );
  }

  // Pretty number of initialisations viewer -- and also an immediate database
  // check.
  std::stringstream numInitsStr;
  numInitsStr << database_->property("dazeus.numinits");
  int numInits;
  numInitsStr >> numInits;
  if(!numInitsStr)
    numInits = 0;
  ++numInits;
  numInitsStr.str(""); numInitsStr.clear();
  numInitsStr << numInits;
  database_->setProperty("dazeus.numinits", numInitsStr.str());
  const char *suffix = "th";
  if(numInits%100 == 11 ) ;
  else if(numInits%100 == 12) ;
  else if(numInits%100 == 13) ;
  else if(numInits%10 == 1) suffix = "st";
  else if(numInits%10 == 2) suffix = "nd";
  else if(numInits%10 == 3) suffix = "rd";
  printf("Initialising DaZeus for the %d%s time!\n", numInits, suffix);
  return true;
}
开发者ID:mrngm,项目名称:dazeus,代码行数:70,代码来源:dazeus.cpp


注:本文中的Network::addListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。