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


C++ GetConfigValue函数代码示例

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


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

示例1: GetConfigValue

/*----------------------------------------------------------------------
|   NPT_LogManager::ConfigureLogger
+---------------------------------------------------------------------*/
NPT_Result
NPT_LogManager::ConfigureLogger(NPT_Logger* logger)
{
    /* configure the level */
    NPT_String* level_value = GetConfigValue(logger->m_Name,".level");
    if (level_value) {
        NPT_Int32 value;
        /* try a symbolic name */
        value = NPT_Log::GetLogLevel(*level_value);
        if (value < 0) {
            /* try a numeric value */
            if (NPT_FAILED(level_value->ToInteger(value, false))) {
                value = -1;
            }
        }
        if (value >= 0) {
            logger->m_Level = value;
            logger->m_LevelIsInherited = false;
        }
    }

    /* remove any existing handlers */
    logger->DeleteHandlers();

    /* configure the handlers */
    NPT_String* handlers = GetConfigValue(logger->m_Name,".handlers");
    if (handlers) {
        const char*     handlers_list = handlers->GetChars();
        const char*     cursor = handlers_list;
        const char*     name_start = handlers_list;
        NPT_String      handler_name;
        NPT_LogHandler* handler;
        for (;;) {
            if (*cursor == '\0' || *cursor == ',') {
                if (cursor != name_start) {
                    handler_name.Assign(name_start, (NPT_Size)(cursor-name_start));
                    handler_name.Trim(" \t");
                    
                    /* create a handler */
                    if (NPT_SUCCEEDED(
                        NPT_LogHandler::Create(logger->m_Name, handler_name, handler))) {
                        logger->AddHandler(handler);
                    }

                }
                if (*cursor == '\0') break;
                name_start = cursor+1;
            }
            ++cursor;
        }
    }

    /* configure the forwarding */
    NPT_String* forward = GetConfigValue(logger->m_Name,".forward");
    if (forward && !ConfigValueIsBooleanTrue(*forward)) {
        logger->m_ForwardToParent = false;
    }

    return NPT_SUCCESS;
}
开发者ID:danelledeano,项目名称:VTech-InnoTab,代码行数:63,代码来源:NptLogging.cpp

示例2: alc_oss_probe

void alc_oss_probe( int type )
{
	if ( type == DEVICE_PROBE )
	{
#ifdef HAVE_STAT
		struct stat buf;

		if ( stat( GetConfigValue( "oss", "device", "/dev/dsp" ), &buf ) == 0 )
#endif
			AppendDeviceList( oss_device );
	}
	else if ( type == ALL_DEVICE_PROBE )
	{
#ifdef HAVE_STAT
		struct stat buf;

		if ( stat( GetConfigValue( "oss", "device", "/dev/dsp" ), &buf ) == 0 )
#endif
			AppendAllDeviceList( oss_device );
	}
	else if ( type == CAPTURE_DEVICE_PROBE )
	{
#ifdef HAVE_STAT
		struct stat buf;

		if ( stat( GetConfigValue( "oss", "capture", "/dev/dsp" ), &buf ) == 0 )
#endif
			AppendCaptureDeviceList( oss_device );
	}
}
开发者ID:BlastarIndia,项目名称:Android-NDK-Game-Development-Cookbook,代码行数:30,代码来源:oss.c

示例3: if

void CSetDialogs3::LoadDataImpl(git_config * config)
{
	{
		CString value;
		if (GetConfigValue(config, PROJECTPROPNAME_PROJECTLANGUAGE, value) == GIT_ENOTFOUND && m_iConfigSource != 0)
			m_langCombo.SetCurSel(0);
		else if (value == _T("-1"))
			m_langCombo.SetCurSel(2);
		else if (!value.IsEmpty())
		{
			LPTSTR strEnd;
			long longValue = _tcstol(value, &strEnd, 0);
			if (longValue == 0)
			{
				if (m_iConfigSource == 0)
					SelectLanguage(m_langCombo, CRegDWORD(_T("Software\\TortoiseGit\\LanguageID"), 1033));
				else
					m_langCombo.SetCurSel(1);
			}
			else
				SelectLanguage(m_langCombo, longValue);
		}
		else if (m_iConfigSource == 0)
			SelectLanguage(m_langCombo, CRegDWORD(_T("Software\\TortoiseGit\\LanguageID"), 1033));
		else
			m_langCombo.SetCurSel(1);
	}

	{
		m_LogMinSize = _T("");
		CString value;
		m_bInheritLogMinSize = (GetConfigValue(config, PROJECTPROPNAME_LOGMINSIZE, value) == GIT_ENOTFOUND);
		if (!value.IsEmpty() || m_iConfigSource == 0)
		{
			int nMinLogSize = _ttoi(value);
			m_LogMinSize.Format(L"%d", nMinLogSize);
			m_bInheritLogMinSize = FALSE;
		}
	}

	{
		m_Border = _T("");
		CString value;
		m_bInheritBorder = (GetConfigValue(config, PROJECTPROPNAME_LOGWIDTHLINE, value) == GIT_ENOTFOUND);
		if (!value.IsEmpty() || m_iConfigSource == 0)
		{
			int nLogWidthMarker = _ttoi(value);
			m_Border.Format(L"%d", nLogWidthMarker);
			m_bInheritBorder = FALSE;
		}
	}

	GetBoolConfigValueComboBox(config, PROJECTPROPNAME_WARNNOSIGNEDOFFBY, m_cWarnNoSignedOffBy);

	m_bInheritIconFile = (GetConfigValue(config, PROJECTPROPNAME_ICON, m_iconFile) == GIT_ENOTFOUND);

	m_bNeedSave = false;
	SetModified(FALSE);
	UpdateData(FALSE);
}
开发者ID:Blonder,项目名称:TortoiseGit,代码行数:60,代码来源:SetDialogs3.cpp

示例4: InitInstance

int PostMetaStrategy::Execute(FileManager* fm, CredentialsManager* cm) {
    int status = ret::A_OK;
    status = InitInstance(fm, cm);

    post_path_ = GetConfigValue("post_path");
    posts_feed_ = GetConfigValue("posts_feed");
    std::string filepath = GetConfigValue("filepath");
    std::string entity = GetConfigValue("entity");

    std::cout<<" Post meta strategy " << std::endl;
    if(ValidMasterKey()) {
        FileHandler fh(file_manager_);
        if(!fh.DoesFileExist(filepath)) {
            std::cout<<" File doesn't exist yet, create meta post" << std::endl;
            FileInfo fi;
            status = CreateFileEntry(filepath, fi);
        }
        else {
           // no nead to throw an error, postfilestrategy should dif the hashes 
           // and really determine if it should acutally be re-uploaded
           //
           // status = ret::A_FAIL_FILE_ALREADY_EXISTS;
        }
    }
    else {
        status = ret::A_FAIL_INVALID_MASTERKEY;
    }
    std::cout<<" post meta strategy status : " << status << std::endl;
    return status;
}
开发者ID:danielsiders,项目名称:libattic,代码行数:30,代码来源:postmetastrategy.cpp

示例5: alc_alsa_init

ALCboolean alc_alsa_init(BackendFuncs *func_list)
{
    if(!alsa_load())
        return ALC_FALSE;
    device_prefix = GetConfigValue("alsa", "device-prefix", "plughw:");
    capture_prefix = GetConfigValue("alsa", "capture-prefix", "plughw:");
    *func_list = alsa_funcs;
    return ALC_TRUE;
}
开发者ID:9heart,项目名称:DT3,代码行数:9,代码来源:alsa.c

示例6: wxFrame

SpokePOVFrame::SpokePOVFrame(const wxString &title)
  :  wxFrame((wxFrame *)NULL, wxID_ANY, title,
	     wxPoint(150, 150),
	     wxSize(750, 550),
	     (wxDEFAULT_FRAME_STYLE | wxFULL_REPAINT_ON_RESIZE))
{
  wxString *key;
  LoadConfiguration();
  key = GetConfigValue(wxT("num_leds"));
  if (key == NULL)
    num_leds = 30;
  else {
    long foo;
    if (key->ToLong(&foo))
      num_leds = foo;
    else
      num_leds = 30;
  }
  wxLogDebug(wxT("Config: %d LEDs"), num_leds);
  SetConfigValue(wxT("num_leds"), wxString::Format(wxT("%d"),num_leds));
  
  key = GetConfigValue(wxT("hub_size"));
  if (key == NULL)
    hub_size = 5;
  else {
    long foo;
    if (key->ToLong(&foo))
      hub_size = foo;
    else
      hub_size = 5;
  }
  wxLogDebug(wxT("Config: %d\" hub"), hub_size);
  SetConfigValue(wxT("hub_size"), wxString::Format(wxT("%d"),hub_size));

  
  key = GetConfigValue(wxT("comm_delay"));
  if (key == NULL)
    comm_delay = 500;
  else {
    long foo;
    if (key->ToLong(&foo))
      comm_delay = foo;
    else
      comm_delay = 500;
  }
  wxLogDebug(wxT("Delay: %d\" us"), comm_delay);
  SetConfigValue(wxT("comm_delay"), wxString::Format(wxT("%d"),comm_delay));

  key = GetConfigValue(wxT("commlink"));
#if defined (W32_NATIVE)
  if (key == NULL)  {
    commlink = wxT("parallel");
  } else if ((key->IsSameAs("parallel")) || (key->IsSameAs("serial")) || (key->IsSameAs("usb"))) {
    commlink = wxString(*key);
    wxLogDebug(wxT("Config: %s", commlink.c_str());
  } else {
开发者ID:evan-arm,项目名称:spokepov-loader,代码行数:56,代码来源:spokepov.cpp

示例7: GetConfig

int GetConfig()
{
	int nNumber, i;
	char buf[20];
	ASSERT(GetConfigValue("./config.ini", "USER", "NUMBER", &nNumber, STRINT) == 0);												/* 用户数量 */
	for (i=0; i<nNumber; i++)
	{
		memset(pDesk+i, 0, sizeof(MONITORDESK));									sprintf(buf, "USER%d", i+1);					/* 用户信息项 */ 
		ASSERT(GetConfigValue("./config.ini", buf, "NAME", pDesk[i].szUser, STRSTR) == 0);												/* 用户名称 */
		ASSERT(GetConfigValue("./config.ini", buf, "PASS", pDesk[i].szPass, STRSTR) == 0);												/* 用户密码 */
		pDesk[i].nActive = 0;							/* 未签到 */
	}
	*pTopDesk = i;										/* 用户数量 */
	return 0;
}
开发者ID:zhiliang729,项目名称:ctest,代码行数:15,代码来源:trans1.c

示例8: InitAutoUpdate

void
InitAutoUpdate()
{
    int		interval;
    char		*update, *timer;
    char		*key1="autoupdate";
    char		*key2="update_timer";
    BooleanType	updateOn;


    /*
     *	Read in configuration parameters
     */
    update = GetConfigValue( key1 );
    if ( update == NULL ) {
        printf("Warning: key '%s' is not defined in Garp_defaults\n",
               key1);
        return;
    }

    timer = GetConfigValue( key2 );
    if ( timer == NULL ) {
        printf("Warning: key '%s' is not defined in Garp_defaults\n",
               key2);
        return;
    }

    /*
     *	Check for invalid interval
     */
    interval = atoi ( timer );
    if ( interval > MAXINTERVAL || interval <= 0 )
    {
        printf ("InitAutoUpdate: Invalid auto update interval (%d).\n", interval);
        interval = DEFAULTINTERVAL;
    }

    updateOn = False;
    if ( *update == 'y' || *update == 'Y' ) updateOn = True;

    SetAutoUpdateWidgets ( updateOn, interval );

    SetAutoUpdateObject ( updateOn, interval );

    if ( update ) Free (update);
    if ( timer  ) Free (timer);

}
开发者ID:mjames-upc,项目名称:garp,代码行数:48,代码来源:updateobj.c

示例9: alsa_open_playback

static ALCboolean alsa_open_playback(ALCdevice *device, const ALCchar *deviceName)
{
    alsa_data *data;
    char driver[64];
    int i;

    if(!alsa_load())
        return ALC_FALSE;

    strncpy(driver, GetConfigValue("alsa", "device", "default"), sizeof(driver)-1);
    driver[sizeof(driver)-1] = 0;

    if(!deviceName)
        deviceName = alsaDevice;
    else if(strcmp(deviceName, alsaDevice) != 0)
    {
        size_t idx;

        if(!allDevNameMap)
            allDevNameMap = probe_devices(SND_PCM_STREAM_PLAYBACK, &numDevNames);

        for(idx = 0;idx < numDevNames;idx++)
        {
            if(allDevNameMap[idx].name &&
               strcmp(deviceName, allDevNameMap[idx].name) == 0)
            {
                if(idx > 0)
                    sprintf(driver, "hw:%d,%d", allDevNameMap[idx].card, allDevNameMap[idx].dev);
                break;
            }
        }
        if(idx == numDevNames)
            return ALC_FALSE;
    }

    data = (alsa_data*)calloc(1, sizeof(alsa_data));

    i = psnd_pcm_open(&data->pcmHandle, driver, SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK);
    if(i < 0)
    {
        Sleep(200);
        i = psnd_pcm_open(&data->pcmHandle, driver, SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK);
    }
    if(i >= 0)
    {
        i = psnd_pcm_nonblock(data->pcmHandle, 0);
        if(i < 0)
            psnd_pcm_close(data->pcmHandle);
    }
    if(i < 0)
    {
        free(data);
        AL_PRINT("Could not open playback device '%s': %s\n", driver, psnd_strerror(i));
        return ALC_FALSE;
    }

    device->szDeviceName = strdup(deviceName);
    device->ExtraData = data;
    return ALC_TRUE;
}
开发者ID:3dseals,项目名称:furseal,代码行数:60,代码来源:alsa.c

示例10: wave_open_playback

static ALCboolean wave_open_playback(ALCdevice *device, const ALCchar *deviceName)
{
    wave_data *data;
    const char *fname;

    fname = GetConfigValue("wave", "file", "");
    if(!fname[0])
        return ALC_FALSE;

    if(!deviceName)
        deviceName = waveDevice;
    else if(strcmp(deviceName, waveDevice) != 0)
        return ALC_FALSE;

    data = (wave_data*)alCalloc(1, sizeof(wave_data));

    data->f = fopen(fname, "wb");
    if(!data->f)
    {
        alFree(data);
        AL_PRINT("Could not open file '%s': %s\n", fname, strerror(errno));
        return ALC_FALSE;
    }

    device->szDeviceName = strdup(deviceName);
    device->ExtraData = data;
    return ALC_TRUE;
}
开发者ID:soundsrc,项目名称:openal-soft,代码行数:28,代码来源:wave.c

示例11: wave_open_playback

static ALCenum wave_open_playback(ALCdevice *device, const ALCchar *deviceName)
{
    wave_data *data;
    const char *fname;

    fname = GetConfigValue("wave", "file", "");
    if(!fname[0])
        return ALC_INVALID_VALUE;

    if(!deviceName)
        deviceName = waveDevice;
    else if(strcmp(deviceName, waveDevice) != 0)
        return ALC_INVALID_VALUE;

    data = (wave_data*)calloc(1, sizeof(wave_data));

    data->f = fopen(fname, "wb");
    if(!data->f)
    {
        free(data);
        ERR("Could not open file '%s': %s\n", fname, strerror(errno));
        return ALC_INVALID_VALUE;
    }

    device->szDeviceName = strdup(deviceName);
    device->ExtraData = data;
    return ALC_NO_ERROR;
}
开发者ID:Abce,项目名称:OpenAL,代码行数:28,代码来源:wave.c

示例12: HelpCB

void
HelpCB ( Widget parent )
{
	char	*file, *dpath;
	int	verbose;
/*
 *  Callback to popup HTML dialog.
 */
	verbose = GetVerboseLevel();
	if( verbose > VERBOSE_0 )
	    printf ("HelpCB\n");

        dpath = GetConfigValue ("GarpHTML");
        file = builddirpath ( dpath, home_html );

/*
 *	Initialize hypertext file list.
 */
	historyList = ListCreate();
	if ( file ) ListAddEntry ( historyList, strdup(file) );

/*
 *	Popup HTML dialog.
 */
	XtManageChild ( help.dialog );
	XtPopup ( XtParent ( help.dialog ), XtGrabNone);

	Free ( dpath );
	Free ( file );
}
开发者ID:mjames-upc,项目名称:garp,代码行数:30,代码来源:help.c

示例13: assert

void LoginCallback::DoLogin( std::string user, std::string pass )
{
	assert(LoginManager::GetInstance()->GetLoginStatus() == LoginStatus_NONE);
	LoginManager::GetInstance()->SetLoginStatus(LoginStatus_LOGIN);

	LoginManager::GetInstance()->SetAccount(user);
	std::string pass_md5 = QString::GetMd5(pass);
	LoginManager::GetInstance()->SetPassword(pass_md5);

	_InitUserFolder();
	_InitLog();
	{
		int ver = 0;
		std::wstring vf;
		LocalHelper::GetAppLocalVersion(ver, vf);
		QLOG_APP(L"App Version {0}") << ver;
		QLOG_APP(L"Account {0}") << LoginManager::GetInstance()->GetAccount();
		QLOG_APP(L"UI ThreadId {0}") << GetCurrentThreadId();
		QLOG_APP(L"-----login begin-----");
	}

	//app key是应用的标识,不同应用之间的数据(用户、消息、群组等)是完全隔离的。开发自己的应用时,请替换为自己的app key。
	std::string app_key = "45c6af3c98409b18a84451215d0bdd6e";
	std::string new_app_key = GetConfigValue(g_AppKey);
	if (!new_app_key.empty())
	{
		app_key = new_app_key;
	}
	auto cb = std::bind(OnLoginCallback, std::placeholders::_1, nullptr);
	nim::Client::Login(app_key, LoginManager::GetInstance()->GetAccount(), LoginManager::GetInstance()->GetPassword(), cb);
}
开发者ID:sunpeng196,项目名称:NIM_PC_UIKit,代码行数:31,代码来源:login_callback.cpp

示例14: while

void CNutConfDoc::SaveComponentOptions(FILE *fp, NUTCOMPONENT * compo)
{
    while (compo) {
        NUTCOMPONENTOPTION *opts = compo->nc_opts;
        while (opts) {
            if(opts->nco_enabled && opts->nco_active) {
                char *value;
                if (opts->nco_value) {
                    /* Save edited value. */
                    value = strdup(opts->nco_value);
                } else {
                    /* Save configured value. */
                    value = GetConfigValue(m_repository, opts->nco_name);
                }
                /* Do not save empty values, unless they are boolean. */
                if (value && *value == '\0') {
                    char *flavor = GetOptionFlavour(m_repository, opts->nco_compo, opts->nco_name);
                    if (flavor == NULL || strncasecmp(flavor, "bool", 4)) {
                        free(value);
                        value = NULL;
                    }
                }
                if (value) {
					wxString escapedValue(*value, strlen(value) );
					escapedValue.Replace(wxT("\""), wxT("\\\"")); // escape (") to (\");
                    fprintf(fp, "%s = \"%s\"\n", opts->nco_name, (char *) escapedValue.c_str());
                    free(value);
                }
            }
            opts = opts->nco_nxt;
        }
        SaveComponentOptions(fp, compo->nc_child);
        compo = compo->nc_nxt;
    }
}
开发者ID:niziak,项目名称:ethernut-4.9,代码行数:35,代码来源:nutconfdoc.cpp

示例15: oss_open_playback

static ALCboolean oss_open_playback(ALCdevice *device, const ALCchar *deviceName)
{
    char driver[64];
    oss_data *data;

    strncpy(driver, GetConfigValue("oss", "device", "/dev/dsp"), sizeof(driver)-1);
    driver[sizeof(driver)-1] = 0;
    if(!deviceName)
        deviceName = oss_device;
    else if(strcmp(deviceName, oss_device) != 0)
        return ALC_FALSE;

    data = (oss_data*)calloc(1, sizeof(oss_data));
    data->killNow = 0;

    data->fd = open(driver, O_WRONLY);
    if(data->fd == -1)
    {
        free(data);
        if(errno != ENOENT)
            AL_PRINT("Could not open %s: %s\n", driver, strerror(errno));
        return ALC_FALSE;
    }

    device->szDeviceName = strdup(deviceName);
    device->ExtraData = data;
    return ALC_TRUE;
}
开发者ID:3dseals,项目名称:furseal,代码行数:28,代码来源:oss.c


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