• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ readConfigFile函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中readConfigFile函数的典型用法代码示例。如果您正苦于以下问题:C++ readConfigFile函数的具体用法?C++ readConfigFile怎么用?C++ readConfigFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: getCurrentBinaryFileFQN

void DBusConfiguration::retrieveCommonApiDBusConfiguration() {
    std::string fqnOfConfigFile = getCurrentBinaryFileFQN();
    std::ifstream addressConfigFile;

    fqnOfConfigFile += DBUS_CONFIG_SUFFIX;

    addressConfigFile.open(fqnOfConfigFile.c_str());

    if (addressConfigFile.is_open()) {
        readConfigFile(addressConfigFile);
        addressConfigFile.close();
    }

    addressConfigFile.clear();
    std::vector<std::string> splittedConfigFQN = split(fqnOfConfigFile, '/');
    std::string globalConfigFQN = DBUS_GLOBAL_CONFIG_ROOT + splittedConfigFQN.at(splittedConfigFQN.size() - 1);
    addressConfigFile.open(globalConfigFQN);
    if (addressConfigFile.is_open()) {
        readConfigFile(addressConfigFile);
        addressConfigFile.close();
    }
    addressConfigFile.clear();

    addressConfigFile.open(DBUS_GLOBAL_CONFIG_FQN);
    if(addressConfigFile.is_open()) {
        readConfigFile(addressConfigFile);
        addressConfigFile.close();
    }
}
开发者ID:breakreturn,项目名称:common-api-dbus-runtime,代码行数:29,代码来源:DBusConfiguration.cpp


示例2: main

int 
main(int argc, char *argv[])
{
  int fractal_window ;

  glutInitWindowSize(500, 250);
  glutInitWindowPosition ( 140, 140 );
  glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE );
  glutInit(&argc, argv);

  if ( argc > 1 )
    readConfigFile ( argv[1] ) ;
  else
    readConfigFile ( "fractals.dat" ) ;

  fractal_window = glutCreateWindow( window_title );

  glClearColor(1.0, 1.0, 1.0, 1.0);

  glutReshapeFunc(Reshape);
  glutKeyboardFunc(Key);
  glutSpecialFunc(Special);
  glutDisplayFunc(Display);

#ifdef WIN32
#endif

  while ( continue_in_main_loop )
    glutMainLoopEvent();

  printf ( "Back from the 'freeglut' main loop\n" ) ;

  return 0;             /* ANSI C requires main to return int. */
}
开发者ID:AzureCrab,项目名称:StarEngine,代码行数:34,代码来源:fractals.c


示例3: switch

int emct_main::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: exitChild(); break;
        case 1: closeEvent((*reinterpret_cast< QCloseEvent*(*)>(_a[1]))); break;
        case 2: getPath(); break;
        case 3: executeOption(); break;
        case 4: saveLog(); break;
        case 5: helpPdf(); break;
        case 6: { int _r = readConfigFile();
            if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; }  break;
        case 7: openCon((*reinterpret_cast< QWidget*(*)>(_a[1]))); break;
        case 8: disableButtons(); break;
        case 9: enableButtons(); break;
        case 10: changeEStatus((*reinterpret_cast< std::string(*)>(_a[1]))); break;
        case 11: { int _r = readVersionFile();
            if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; }  break;
        case 12: logAppend((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 13: logAppendError((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 14: logAppendOp((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 15;
    }
    return _id;
}
开发者ID:ecortejoso,项目名称:EMCT,代码行数:30,代码来源:moc_emct_main.cpp


示例4: conf

void Config::readConfigFile(QString filePath){
  QFile conf(filePath);
  bool ok = conf.open(QIODevice::ReadOnly | QIODevice::Text);
  if(!ok){ 
    Backend::log("Could not open configuration file: "+filePath+"\nLoading default configuration");
    if(filePath!=":samples/pcdm.conf"){ readConfigFile(":samples/pcdm.conf"); }
    return;
  }
  QTextStream in(&conf);
  while( !in.atEnd() ){
    QString line = in.readLine().simplified();
    //Skip comment lines
    if(!line.startsWith("#")){
      line = line.section("#",0,0).simplified(); //cut any comments off the end of the line
      QString var = line.section("=",0,0).simplified(); // get the variable
      QString val = line.section("=",1,1).simplified(); // get the value
      
      //Parse the Configuration File
      if(var=="THEME_FILE"){ confStruct[0] = val; }
      else if(var=="DE_STARTUP_DIR"){ confStruct[1] = val; }
      else if(var=="DE_STARTUP_IMAGE_DIR"){ confStruct[2] = val; }
      else if(var=="ENABLE_AUTO_LOGIN"){ confStruct[3] = val; }
      else if(var=="AUTO_LOGIN_USER"){ confStruct[4] = val; }
      //else if(var=="AUTO_LOGIN_DESKTOP"){ confStruct[5] = val; } //legacy option
      else if(var=="AUTO_LOGIN_PASSWORD"){ confStruct[6] = val; }
      else if(var=="SPLASHSCREEN_FILE"){ confStruct[7] = val; }
      else if(var=="ENABLE_VIEW_PASSWORD_BUTTON"){ confStruct[8] = val; }
      else if(var=="AUTO_LOGIN_DELAY"){ confStruct[9] = val; }
      else if(var=="SHOW_SYSTEM_USERS"){ confStruct[10] = val; }
      else{}
      
    }
  }
  conf.close();
}
开发者ID:DJHartley,项目名称:pcbsd,代码行数:35,代码来源:pcdm-config.cpp


示例5: main

void main(void)
{
        int tmpFlag;
        tmpFlag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
        tmpFlag |= _CRTDBG_CHECK_ALWAYS_DF;
        tmpFlag |= _CRTDBG_LEAK_CHECK_DF;
        _CrtSetDbgFlag( tmpFlag );

        readConfigFile("C:\\Simulink_SimServer\\io_config.cfg");

        PortNumber = 80;

        startServer();

        printf("\n");
        printf("***** Press any key to quit *****\n");
        printf("\n");

        while(1)
        {

                if(kbhit())
                {
                        break;
                }
        }

        stopServer();

#ifdef TEST_HARNESS
_ASSERTE(_CrtCheckMemory());
#endif
}
开发者ID:jonmills,项目名称:simserver,代码行数:33,代码来源:simserver.c


示例6: main

int main(int argc, char **argv) {
    CommandStruct_t theCmd;
    char *progName=basename(argv[0]);
    int count;

    readConfigFile();
    makeDirectories(CMDD_COMMAND_LINK_DIR);

    theCmd.numCmdBytes=0;
    theCmd.fromSipd=0;
    if(argc>1) {
       for(count=1;count<argc;count++) {
           theCmd.cmd[count-1]=(unsigned char)atoi(argv[count]);
           theCmd.numCmdBytes++;
       }
    }
    else {
	fprintf(stderr,"Usage:\n\t%s <cmd byte 1> .... <cmd byte N> (N<=20)\n",
		progName);
	exit(0);	
    }

    if(theCmd.numCmdBytes!=cmdLengths[(int)theCmd.cmd[0]]) {
	fprintf(stderr,"Command %d requires %d bytes\n",(int)theCmd.cmd[0],cmdLengths[(int)theCmd.cmd[0]]);
	exit(0);
    }
    return writeCommandAndLink(&theCmd);
}
开发者ID:anitaNeutrino,项目名称:anitaFlightSoft,代码行数:28,代码来源:CmdTest.c


示例7: QObject

PhoneGap::PhoneGap(QWebView *webView) : QObject(webView) {
    m_webView = webView;
    // Configure web view
    m_webView->settings()->enablePersistentStorage();

    // Listen to load finished signal
    QObject::connect( m_webView, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool)) );

    // Set our own WebPage class
    m_webView->setPage( new PGWebPage() );

    // Read the phonegap.xml options config file
    readConfigFile();

    if (QCoreApplication::instance()->arguments().size() == 2) {
        // If user specified a URL on the command line, use that
        m_webView->load( QUrl::fromUserInput(QCoreApplication::instance()->arguments()[1]));
    } else {
        // Otherwise load www/index.html relative to current working directory

        // Determine index file path
        m_workingDir = QDir::current();
        QDir wwwDir( m_workingDir );
        wwwDir.cd( "www" );

        // Load the correct startup file
        m_webView->load( QUrl::fromUserInput(wwwDir.absoluteFilePath("index.html")) );
        //m_webView->load( QUrl::fromUserInput("http://html5test.com/") );
    }
}
开发者ID:tranter,项目名称:callback-qt,代码行数:30,代码来源:phonegap.cpp


示例8: getpwuid

Settings::Settings(){
	m_db_type = e_db_Unknown;
	m_db_connected	= false;
	m_db_filename	= "";
	m_db_address	= "127.0.0.1";
	m_db_username	= "user";
	m_db_password	= "";
	m_db_dbname		= "qt_sql";
	m_db_tablename	= "books";
	m_db_type		= e_db_SQL;
	mp_qsettings	= 0;

	m_remember_password = false;

#ifndef Q_OS_WIN32
	struct passwd *pw = getpwuid(getuid());

	const char *homedir = pw->pw_dir;
	char filename[512] = { 0 };
	strcpy(filename, homedir);
	strcat(filename, "/.ltr-acc/config.ini");
	if( 0 != access( filename, 0 ) ){
		strcpy(filename, "config.ini");
	}
	m_conf_file.setFileName(filename);
 #else
    m_conf_file.setFileName("config.ini");
#endif
    mp_qsettings = new QSettings( m_conf_file.fileName(), QSettings::IniFormat );
	readConfigFile();
}
开发者ID:streamx3,项目名称:ltr-acc,代码行数:31,代码来源:settings.cpp


示例9: main

int main(int argc, char** argv)
{
	int opt;
	int pid;

	while ((opt = getopt(argc, argv, "vdh")) != -1) {
		switch(opt)  {
		case 'v':
			printf("udp2can V.02 " __DATE__" " __TIME__ "\n(C) Marum, 2014\n   [email protected]\n");
			exit(EXIT_SUCCESS);
		case 'h':
			printUsage();
			exit(EXIT_SUCCESS);
		case 'd':
			debug = 1;
			printf("Start in foreground, debug messages are printed\n");
			break;
		default:
			printf("Unknown option!\n");
			printUsage();
			exit(EXIT_FAILURE);
		}
	}

	signal(SIGTERM, signalHandler);

	if (debug) {
		can_setDebug(1);
		udp_setDebug(1);
	}

	readConfigFile();


	if ((initCanDevice() < 0) || (initUDPSocket() < 0)) {
		fprintf(stderr, "Unable to initialze CAN device or UDP socket\nAbort.....\n");
		close(canFd);
		close(udpFd);
		exit(EXIT_FAILURE);
	}


	if (debug == 0) {
		/* Fork off the parent process */
		pid = fork();
		if (pid < 0) {
			exit(EXIT_FAILURE);
		}

		if (pid > 0) {
			printf("Going into background ...\n");
			exit(EXIT_SUCCESS);
		}
	}

	run();

	return EXIT_SUCCESS;
}
开发者ID:jrenken,项目名称:cantools-udp2can,代码行数:59,代码来源:udp2can.c


示例10: loadDefaults

//******** PUBLIC FUNCTIONS **************
void Config::loadConfigFile(QString filePath){
  loadDefaults();
  if(!QFile::exists(filePath)){
    Backend::log("Configuration file does not exist: "+filePath+"\nLoading default configuration");
    filePath=":samples/pcdm.conf";
  }
  readConfigFile(filePath);
}
开发者ID:DJHartley,项目名称:pcbsd,代码行数:9,代码来源:pcdm-config.cpp


示例11: ReadProfile

/*
 * ReadProfile - read our current status from the .ini file
 */
void ReadProfile( void )
{
    getConfigFilePaths();   /* get paths to ini files */
    readToolBarSize();
    readInitialPosition();
    readConfigFile();

} /* ReadProfile */
开发者ID:Azarien,项目名称:open-watcom-v2,代码行数:11,代码来源:profile.c


示例12: main

//!
int main(int argc, char *argv[])
{
  if (argc != 5)
  {
    fprintf(stderr, "Usage: gep_test <config_file> <input_samples_file> <output_samples_file> <enable_graphics>\n");
    exit(0);
  }

  gep_short_params_t *short_params = createDefaultParams();

  const char *arg_config_filename         = argv[1];
  const char *arg_input_samples_filename  = argv[2];
  const char *arg_output_samples_filename = argv[3];
  const char *arg_enable_graphics_str     = argv[4];

  readConfigFile(arg_config_filename, short_params);
  strncpy(short_params->input_samples_filename,  arg_input_samples_filename,  sizeof(short_params->input_samples_filename));
  strncpy(short_params->output_samples_filename, arg_output_samples_filename, sizeof(short_params->output_samples_filename));

  sscanf(arg_enable_graphics_str, "%d",  &graph_enabled);

  gep_ctx = GEP_CreateContext(short_params, &stat_params);

  if (signal(SIGUSR1, gep_sigterm_handler) == SIG_ERR)
  {
    fprintf(stderr, "Can't setup SIGUSR1 hanlder\n");
  }

  last_frame_rendered = simulation_started = last_output_printed = getTimeNs();

  if (graph_enabled)
  {
    graph_init(argc, argv);

    pthread_t gep_thread;
    int status = pthread_create(&gep_thread, NULL, gep_run_routine, NULL);
    if (0 != status)
    {
      fprintf(stderr, "Can't create GEP thread!\n");
      exit(-1);
    }

    glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
    glutMainLoop();

    pthread_join(gep_thread, NULL);
  }
  else
  {
    GEP_Run(gep_ctx, stat_callback);
  }

  GEP_DestroyContext(gep_ctx);
  free(short_params);

  return 0;
}
开发者ID:SergMir,项目名称:gep,代码行数:58,代码来源:test.c


示例13: generator_

ConfigFile::ConfigFile() :
  generator_(NULL),
  handler_(NULL)
{
  char const * const home = getenv("HOME");
  configFile_ = QString(home) + "/" + ConfigFileName::instance()->fileName();

  readConfigFile();  
}
开发者ID:BackupTheBerlios,项目名称:miro-middleware-svn,代码行数:9,代码来源:ConfigFile.cpp


示例14: readConfigFile

string Config::getScriptPath()
{
	if (!init)
	{
		readConfigFile();
	}

	return scriptPath;
}
开发者ID:rarosu,项目名称:FnulAI,代码行数:9,代码来源:Config.cpp


示例15: ensure

void testObj::test<4>(void)
{
  ensure("oops - registration failed", g_rhPP.isRegistered());
  readConfigFile("testdata/preproc_test_trigger_reject_all.xml");
  TriggersCollection fc=create(queue_);
  ensure_equals("no triggers created", fc.size(), 1u);
  ensure_equals("interface already called", g_testInterfaceCalled, 0);
  fc.at(0)->process(sn_);
  usleep(500*1000);         // wait a while, until data is processed...
  ensure_equals("call not blocked by preprocessor", g_testInterfaceCalled, 0);
}
开发者ID:el-bart,项目名称:ACARM-ng,代码行数:11,代码来源:Factory.t.cpp


示例16: dimension2du

// ----------------------------------------------------------------------------
bool Editor::init()
{
    m_maps_path         = NULL;
    m_music_loc         = NULL;
    m_indicator         = NULL;
    m_valid_data_dir    = false;
    m_exe_loc           = "";
    m_toolbar           = NULL;
    m_toolbox           = NULL;
    m_rcs               = NULL;
    m_tex_sel           = NULL;
    m_indicator         = NULL;
    m_viewport          = NULL;
    m_rcs               = NULL;
    m_font              = NULL;
    m_new_dialog_wndw   = NULL;

    m_screen_size = dimension2du(10, 10);

    IrrlichtDevice *nulldevice = createDevice(video::EDT_NULL);
    m_screen_size = nulldevice->getVideoModeList()->getDesktopResolution();
    readConfigFile(nulldevice->getFileSystem());
    nulldevice->drop();

    m_device = createDevice(EDT_OPENGL, m_screen_size, 16, false, false, true);
    if (!m_device) return false;

    m_device->setResizable(true);
    m_device->setWindowCaption(L"SuperTuxKart Track Editor Beta v0.03");

    if (m_screen_size.Width < 20 || m_screen_size.Height < 20)
        m_device->maximizeWindow();

    m_video_driver  = m_device->getVideoDriver();
    m_scene_manager = m_device->getSceneManager();
    m_gui_env       = m_device->getGUIEnvironment();

    m_screen_size   = m_video_driver->getScreenSize();
    m_def_wd        = m_device->getFileSystem()->getWorkingDirectory();

    // lights
    m_scene_manager->setAmbientLight(SColorf(0.3f, 0.3f, 0.3f, 1.0f));
    ILightSceneNode* l = m_scene_manager->addLightSceneNode(0, vector3df(0, 1, 0),
                                              SColorf(1.0f, 1.0f, 1.0f), 500, -1);
    l->setLightType(ELT_DIRECTIONAL);
    l->setPosition(vector3df(0,
        1, 0));

    m_device->setEventReceiver(this);

    if (!isValidDataLoc()) dataDirLocDlg();

    return true;
} // init
开发者ID:CruzR,项目名称:stk-editor,代码行数:55,代码来源:editor.cpp


示例17: main

int 
main(int argc, char *argv[])
{
  int fractal_window ;

  glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE );

  glutInitWindowSize(500, 250);
  glutInitWindowPosition ( 140, 140 ) ;
  glutInit(&argc, argv);

  if ( argc > 1 )
    readConfigFile ( argv[1] ) ;
  else
    readConfigFile ( "fractals.dat" ) ;

  fractal_window = glutCreateWindow( window_title );

  glClearColor(1.0, 1.0, 1.0, 1.0);

  glutReshapeFunc(Reshape);
  glutKeyboardFunc(Key);
  glutSpecialFunc(Special);
  glutDisplayFunc(Display);
  glutMouseFunc(Mouse);
  glutMotionFunc(MouseMotion);
  glutMouseWheelFunc(MouseWheel);

  glutMainLoop();

  printf ( "Back from the 'freeglut' main loop\n" ) ;

  free ( affine ) ;

#ifdef _MSC_VER
  /* DUMP MEMORY LEAK INFORMATION */
  _CrtDumpMemoryLeaks () ;
#endif

  return 0;             /* ANSI C requires main to return int. */
}
开发者ID:Chenhx,项目名称:moai-dev,代码行数:41,代码来源:fractals_random.c


示例18: readConfigFile

bool GhostwriterPlugin::init(PluginHub *hub, int id, int groupId, const QString &)
{
	//Q_UNUSED( groupId );
	
	m_hub = hub;
	m_id = id;
	m_groupId = groupId;
	m_logoDirName = NULL;

	readConfigFile();
	return true;
}
开发者ID:susannej,项目名称:Ghostwriter,代码行数:12,代码来源:GhostwriterPlugin.cpp


示例19: ReadFidoConfig

void ReadFidoConfig(void) {
  int i;
  for(i = 0; i < 10; i++) {
    Servermem->fidodata.fd[i].domain[0] = '\0';
  }
  for(i = 0; i < 20; i++) {
    Servermem->fidodata.fa[i].namn[0] = '\0';
  }
  Servermem->fidodata.mailgroups = 0;

  readConfigFile("NiKom:DatoCfg/NiKomFido.cfg", handleFidoConfigLine);
}
开发者ID:punktniklas,项目名称:NiKom,代码行数:12,代码来源:Config.c


示例20: tr

void AddCamera::on_readYAML_clicked()
{

    QString filename = QFileDialog::getOpenFileName(this,tr("Load Distortion Coefficients"), ".", tr(".yaml Files (*.yaml)"));

    if(filename != "")
    {
        std::cout << filename.toStdString() << std::endl;

        readConfigFile(filename);
    }
}
开发者ID:kaajo,项目名称:WebCamCap,代码行数:12,代码来源:addcamera.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ readData函数代码示例发布时间:2022-05-30
下一篇:
C++ readConfig函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap