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


C++ readConfigFile函数代码示例

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


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


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