當前位置: 首頁>>代碼示例>>C++>>正文


C++ CFG函數代碼示例

本文整理匯總了C++中CFG函數的典型用法代碼示例。如果您正苦於以下問題:C++ CFG函數的具體用法?C++ CFG怎麽用?C++ CFG使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了CFG函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: CFG

LRESULT CDlgPublishHtml::OnRefresh(WPARAM wParam, LPARAM lParam)
{
	// Get the target path
	CWinFile::GetPathFromFileName( m_sMain, m_szPath );
	
	// Get filename
	char fname[ CWF_STRSIZE ];
	CWinFile::GetFileNameFromPath( m_sMain, fname );

	// Get filename
	m_sFilename = CFG().GetSz( "Settings", "HtmlPubFilename" );
	if ( m_sFilename.IsEmpty() ) m_sFilename = fname;

//	m_sFilename = fname;

	// Add a few choice filenames
	m_comboFilename.AddString( "Index.htm" );
	m_comboFilename.AddString( fname );
	if ( strcmpi( m_sFilename, fname ) && strcmpi( m_sFilename, "Index.htm" ) )
		m_comboFilename.AddString( m_sFilename );

	// Initialize folder
	m_sDir = CFG().GetSz( "Settings", "HtmlPubDir" );

	UpdateData( FALSE );

	FillCombo();

	DoEnable();

	return 1;
}
開發者ID:sanyaade-webdev,項目名稱:wpub,代碼行數:32,代碼來源:DlgPublishHtml.cpp

示例2: calloc

zbar_image_scanner_t *zbar_image_scanner_create ()
{
    zbar_image_scanner_t *iscn = calloc(1, sizeof(zbar_image_scanner_t));
    if(!iscn)
        return(NULL);
    iscn->dcode = zbar_decoder_create();
    iscn->scn = zbar_scanner_create(iscn->dcode);
    if(!iscn->dcode || !iscn->scn) {
        zbar_image_scanner_destroy(iscn);
        return(NULL);
    }
    zbar_decoder_set_userdata(iscn->dcode, iscn);
    zbar_decoder_set_handler(iscn->dcode, symbol_handler);

#ifdef ENABLE_QRCODE
    iscn->qr = _zbar_qr_create();
#endif

    /* apply default configuration */
    CFG(iscn, ZBAR_CFG_X_DENSITY) = 1;
    CFG(iscn, ZBAR_CFG_Y_DENSITY) = 1;
    zbar_image_scanner_set_config(iscn, 0, ZBAR_CFG_POSITION, 1);
    zbar_image_scanner_set_config(iscn, 0, ZBAR_CFG_UNCERTAINTY, 2);
    zbar_image_scanner_set_config(iscn, ZBAR_QRCODE, ZBAR_CFG_UNCERTAINTY, 0);
    zbar_image_scanner_set_config(iscn, ZBAR_CODE128, ZBAR_CFG_UNCERTAINTY, 0);
    zbar_image_scanner_set_config(iscn, ZBAR_CODE93, ZBAR_CFG_UNCERTAINTY, 0);
    zbar_image_scanner_set_config(iscn, ZBAR_CODE39, ZBAR_CFG_UNCERTAINTY, 0);
    zbar_image_scanner_set_config(iscn, ZBAR_CODABAR, ZBAR_CFG_UNCERTAINTY, 1);
    zbar_image_scanner_set_config(iscn, ZBAR_COMPOSITE, ZBAR_CFG_UNCERTAINTY, 0);
    return(iscn);
}
開發者ID:corobotics,項目名稱:ZBar,代碼行數:31,代碼來源:img_scanner.c

示例3: decoder_set_config_int

static inline int decoder_set_config_int (zbar_decoder_t *dcode,
                                          zbar_symbol_type_t sym,
                                          zbar_config_t cfg,
                                          int val)
{
    switch(sym) {

#ifdef ENABLE_I25
    case ZBAR_I25:
        CFG(dcode->i25, cfg) = val;
        break;
#endif
#ifdef ENABLE_CODE39
    case ZBAR_CODE39:
        CFG(dcode->code39, cfg) = val;
        break;
#endif
#ifdef ENABLE_CODE128
    case ZBAR_CODE128:
        CFG(dcode->code128, cfg) = val;
        break;
#endif
#ifdef ENABLE_PDF417
    case ZBAR_PDF417:
        CFG(dcode->pdf417, cfg) = val;
        break;
#endif

    default:
        return(1);
    }
    return(0);
}
開發者ID:foaf,項目名稱:foaftown,代碼行數:33,代碼來源:decoder.c

示例4: influxdb_put

void
influxdb_put(const char *id, double value)
{
  char url[1024];
  cfg_root(root);

  const char *urlprefix = cfg_get_str(root, CFG("influxdb", "url"), NULL);
  const char *db        = cfg_get_str(root, CFG("influxdb", "db"), NULL);
  const char *username  = cfg_get_str(root, CFG("influxdb", "username"), NULL);
  const char *password  = cfg_get_str(root, CFG("influxdb", "password"), NULL);
  if(urlprefix == NULL || db == NULL || username == NULL || password == NULL)
    return;

  snprintf(url, sizeof(url), "%s/db/%s/series?u=%s&p=%s",
           urlprefix, db, username, password);

  htsmsg_t *doc = htsmsg_create_list();
  htsmsg_t *item = htsmsg_create_map();

  htsmsg_add_str(item, "name", id);

  htsmsg_t *columns = htsmsg_create_list();
  htsmsg_add_str(columns, NULL, "value");
  htsmsg_add_msg(item, "columns", columns);

  htsmsg_t *points = htsmsg_create_list();
  htsmsg_t *point = htsmsg_create_list();
  htsmsg_add_dbl(point, NULL, value);
  htsmsg_add_msg(points, NULL, point);
  htsmsg_add_msg(item, "points", points);

  htsmsg_add_msg(doc, NULL, item);

  char *data = htsmsg_json_serialize_to_str(doc, 0);
  htsmsg_destroy(doc);

  size_t len = strlen(data);

  FILE *f = fmemopen(data, len, "r");

  CURL *curl = curl_easy_init();
  curl_easy_setopt(curl, CURLOPT_URL, url);
  curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
  curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L);
  curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &libsvc_curl_waste_output);
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
  curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
  curl_easy_setopt(curl, CURLOPT_READDATA, (void *)f);
  curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, (curl_off_t)len);

  CURLcode result = curl_easy_perform(curl);

  curl_easy_cleanup(curl);

  if(result)
    trace(LOG_ERR, "CURL Failed %s error %d", url, result);
  fclose(f);
  free(data);
}
開發者ID:andoma,項目名稱:hapd,代碼行數:59,代碼來源:influxdb.c

示例5: calloc

zbar_decoder_t *zbar_decoder_create ()
{
    zbar_decoder_t *dcode = calloc(1, sizeof(zbar_decoder_t));
    dcode->buf_alloc = BUFFER_MIN;
    dcode->buf = malloc(dcode->buf_alloc);

    /* initialize default configs */
#ifdef ENABLE_EAN
    dcode->ean.enable = 1;
    dcode->ean.ean13_config = ((1 << ZBAR_CFG_ENABLE) |
                               (1 << ZBAR_CFG_EMIT_CHECK));
    dcode->ean.ean8_config = ((1 << ZBAR_CFG_ENABLE) |
                              (1 << ZBAR_CFG_EMIT_CHECK));
    dcode->ean.upca_config = 1 << ZBAR_CFG_EMIT_CHECK;
    dcode->ean.upce_config = 1 << ZBAR_CFG_EMIT_CHECK;
    dcode->ean.isbn10_config = 1 << ZBAR_CFG_EMIT_CHECK;
    dcode->ean.isbn13_config = 1 << ZBAR_CFG_EMIT_CHECK;
# ifdef FIXME_ADDON_SYNC
    dcode->ean.ean2_config = 1 << ZBAR_CFG_ENABLE;
    dcode->ean.ean5_config = 1 << ZBAR_CFG_ENABLE;
# endif
#endif
#ifdef ENABLE_I25
    dcode->i25.config = 1 << ZBAR_CFG_ENABLE;
    CFG(dcode->i25, ZBAR_CFG_MIN_LEN) = 6;
#endif
#ifdef ENABLE_DATABAR
    dcode->databar.config = ((1 << ZBAR_CFG_ENABLE) |
                             (1 << ZBAR_CFG_EMIT_CHECK));
    dcode->databar.config_exp = ((1 << ZBAR_CFG_ENABLE) |
                                 (1 << ZBAR_CFG_EMIT_CHECK));
    dcode->databar.csegs = 4;
    dcode->databar.segs = calloc(4, sizeof(*dcode->databar.segs));
#endif
#ifdef ENABLE_CODABAR
    dcode->codabar.config = 1 << ZBAR_CFG_ENABLE;
    CFG(dcode->codabar, ZBAR_CFG_MIN_LEN) = 4;
#endif
#ifdef ENABLE_CODE39
    dcode->code39.config = 1 << ZBAR_CFG_ENABLE;
    CFG(dcode->code39, ZBAR_CFG_MIN_LEN) = 1;
#endif
#ifdef ENABLE_CODE93
    dcode->code93.config = 1 << ZBAR_CFG_ENABLE;
#endif
#ifdef ENABLE_CODE128
    dcode->code128.config = 1 << ZBAR_CFG_ENABLE;
#endif
#ifdef ENABLE_PDF417
    dcode->pdf417.config = 1 << ZBAR_CFG_ENABLE;
#endif
#ifdef ENABLE_QRCODE
    dcode->qrf.config = 1 << ZBAR_CFG_ENABLE;
#endif

    zbar_decoder_reset(dcode);
    return(dcode);
}
開發者ID:hartcw,項目名稱:ZBar,代碼行數:58,代碼來源:decoder.c

示例6: REG

void Timer<ID>::init(void) {
  // Set Waveform Generator Mode to Normal
  // Set Prescaler to 0
  REG(timer<ID>::control) = 
    CFG(timer<ID>::control::wgm::normal) |
      CFG(timer<ID>::control::prescaler::template value<1>);
  
  // Set Counter to 0
  REG(timer<ID>::counter) = VAL(timer<ID>::counter, 0);
}
開發者ID:astralien3000,項目名稱:aversive--,代碼行數:10,代碼來源:timer.cpp

示例7: lisp_merge_config

static void *
lisp_merge_config (apr_pool_t * pool, void * base_cfg, void * add_cfg)
{
  return
    ((SERVER_SPECIFIED_P (CFG (add_cfg)))
          ? (copy_lisp_cfg (pool, add_cfg))
	       : (SERVER_SPECIFIED_P (CFG (base_cfg)))
	            ? (copy_lisp_cfg (pool, base_cfg))
		         : (default_lisp_cfg (pool)));
}
開發者ID:mbattyani,項目名稱:mod_lisp,代碼行數:10,代碼來源:mod_lisp2.c

示例8: CHAR

void CGameControllerOpenFNG::HandleMelt(int Melter, int Meltee)
{
	CCharacter *pMeltee = CHAR(Meltee);
	if (!pMeltee) //due to HandleFreeze, i suspect this COULD also possibly happen. 
	{
		D("no pMeltee in HandleMelt(%d, %d)", Melter, Meltee);
		return;
	}

	int MeltTeam = pMeltee->GetPlayer()->GetTeam()&1;
	m_aTeamscore[MeltTeam] += CFG(MeltTeamscore);

	if (CFG(MeltTeamscore) && CFG(MeltBroadcast))
	{
		char aBuf[64];
		str_format(aBuf, sizeof aBuf, "%s melted (%+d)", GetTeamName(MeltTeam), CFG(MeltTeamscore));
		m_Broadcast.Update(-1, aBuf, CFG(BroadcastTime) * TS);
	}

	CPlayer *pPlMelter = TPLAYER(Melter);

	if (!pPlMelter)
		return;

	pPlMelter->m_Score += CFG(MeltScore);
	SendFreezeKill(Melter, Meltee, WEAPON_HAMMER);

	if (pPlMelter->GetCharacter() && CFG(MeltLoltext) && CFG(MeltScore))
	{
		char aBuf[64];
		str_format(aBuf, sizeof aBuf, "%+d", CFG(MeltScore));
		GS->CreateLolText(pPlMelter->GetCharacter(), false, vec2(0.f, -50.f), vec2(0.f, 0.f), 50, aBuf);
	}
}
開發者ID:Schwertspize,項目名稱:speedfng,代碼行數:34,代碼來源:openfng.cpp

示例9: UpdateData

void CDlgSimpleSettings::OnOK() 
{
	UpdateData( TRUE );

	CFG().SetValue( "CMSettings", "EmailBtn", (DWORD)( m_bEmail ? 1 : 0 ) );
	CFG().SetValue( "CMSettings", "PrintBtn", (DWORD)( m_bPrint ? 1 : 0 ) );
	CFG().SetValue( "CMSettings", "FtpBtn", (DWORD)( m_bFtp ? 1 : 0 ) );
	CFG().SetValue( "CMSettings", "SaveBtn", (DWORD)( m_bFtp ? 1 : 0 ) );
	CFG().SetValue( "CMSettings", "SetupBtn", (DWORD)( m_bSetup ? 1 : 0 ) );

	CFG().SetValue( "CMSettings", "XMax", (DWORD)strtoul( m_xMax, NULL, 10 ) );
	CFG().SetValue( "CMSettings", "YMax", (DWORD)strtoul( m_yMax, NULL, 10 ) );

	int sel = m_comboImage.GetCurSel();
	if ( sel != -1 )
	{	DWORD driver = m_comboImage.GetItemData( sel );
		CFG().SetValue( "CMSettings", "Driver", driver );
	} // end if

	sel = m_comboFtpServer.GetCurSel();
	if ( sel != -1 )
	{	char txt[ CWF_STRSIZE ];
		m_comboFtpServer.GetLBText( sel, txt );
		CFG().SetValue( "CMSettings", "FtpServer", txt );	
	} // end if

	CDialog::OnOK();
}
開發者ID:sanyaade-webdev,項目名稱:wpub,代碼行數:28,代碼來源:DlgSimpleSettings.cpp

示例10: CFG

void CGameControllerOpenFNG::DoBroadcasts(bool ForceSend)
{
	if (m_GameOverTick != -1)
		return;

	if (max(m_aTeamscore[0], m_aTeamscore[1]) + CFG(AllYourBase) >= CFG(Scorelimit))
		m_Broadcast.Update(-1, CFG(AllYourBaseMsg), -1);

	m_Broadcast.SetDef(CFG(DefBroadcast));

	m_Broadcast.Operate();
}
開發者ID:Schwertspize,項目名稱:speedfng,代碼行數:12,代碼來源:openfng.cpp

示例11: DoBroadcasts

void CGameControllerBoomFNG::DoBroadcasts(bool ForceSend)
{
	if (m_GameOverTick != -1)
		return;

	if (max(m_aTeamscore[0], m_aTeamscore[1]) + CFG(AllYourBase) >= CFG(Scorelimit))
		m_Broadcast.Update(-1, "ALL YOUR BASE ARE BELONG TO US.", -1);

	m_Broadcast.SetDef(CFG(DefBroadcast));

	m_Broadcast.Operate();
}
開發者ID:TsFreddie,項目名稱:teeworlds-solofng,代碼行數:12,代碼來源:boomfng.cpp

示例12: CHAR

void CGameControllerSoloFNG::DoHookers()
{
	for(int i = 0; i < MAX_CLIENTS; i++)
	{
		CCharacter *pChr = CHAR(i);
		if (!pChr)
			continue;
		
		int Hooking = pChr->GetHookedPlayer();

		if (Hooking >= 0)
		{
			CCharacter *pVic = CHAR(Hooking);
			
			if (!pVic || (/*pVic->GetPlayer()->GetTeam() != pChr->GetPlayer()->GetTeam() && */pChr->GetHookTick() < CFG(HookRegisterDelay)))
				Hooking = -1;
			
		}

		int HammeredBy = pChr->LastHammeredBy();
		pChr->ClearLastHammeredBy();

		if (Hooking >= 0)
		{
			CCharacter *pVic = CHAR(Hooking);
			if (pVic)
			{
				//bool SameTeam = pChr->GetPlayer()->GetTeam() == pVic->GetPlayer()->GetTeam();
				m_aLastInteraction[Hooking] = /*SameTeam ? -1 : */ i;
			}
		}

		if (HammeredBy >= 0)
		{	
			CCharacter *pHam = CHAR(HammeredBy);
			if (pHam)
			{
				//bool SameTeam = pChr->GetPlayer()->GetTeam() == pHam->GetPlayer()->GetTeam();
				m_aLastInteraction[i] = /*SameTeam ? -1 : */ HammeredBy;
				if (/* !SameTeam &&*/ CFG(HammerFreeze) && pChr->GetFreezeTicks() <= 0)
				{
					pChr->Freeze(CFG(HammerFreeze) * TS, HammeredBy);
					m_aFrozenBy[i] = HammeredBy; //suppress kill event being generated
				}
			}
			else
				m_aLastInteraction[i] = -1;
		}
	}
}
開發者ID:TsFreddie,項目名稱:teeworlds-solofng,代碼行數:50,代碼來源:solofng.cpp

示例13: CFG

BOOL CDlgSimpleSettings::OnInitDialog() 
{
	CDialog::OnInitDialog();

	// Update flags
	m_bEmail = CFG().GetDword( "CMSettings", "EmailBtn", (DWORD)1 ) != 0;
	m_bPrint = CFG().GetDword( "CMSettings", "PrintBtn", (DWORD)1 ) != 0;
	m_bFtp = CFG().GetDword( "CMSettings", "FtpBtn", (DWORD)1 ) != 0;
	m_bSave = CFG().GetDword( "CMSettings", "SaveBtn", (DWORD)1 ) != 0;
	m_bSetup = CFG().GetDword( "CMSettings", "SetupBtn", (DWORD)1 ) != 0;
	m_sFtpFilename = CFG().GetSz( "CMSettings", "FtpFilename", "webcam.jpg" );
	m_xMax = CFG().GetSz( "CMSettings", "XMax", "800" );
	m_yMax = CFG().GetSz( "CMSettings", "YMax", "600" );

	UpdateData( FALSE );

	FillImageCombo();
	FillFtpCombo();

	DoEnable();


	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
開發者ID:sanyaade-webdev,項目名稱:wpub,代碼行數:25,代碼來源:DlgSimpleSettings.cpp

示例14: i25_decode_end

static inline signed char i25_decode_end (zbar_decoder_t *dcode)
{
    i25_decoder_t *dcode25 = &dcode->i25;

    /* check trailing quiet zone */
    unsigned quiet = get_width(dcode, 0);
    if((quiet && quiet < dcode25->width * 3 / 8) ||
            decode_e(get_width(dcode, 1), dcode25->width, 45) > 2 ||
            decode_e(get_width(dcode, 2), dcode25->width, 45) > 2) {
        dprintf(3, " s=%d q=%d [invalid qz]\n", dcode25->width, quiet);
        return(ZBAR_NONE);
    }

    /* check exit condition */
    unsigned char E = decode_e(get_width(dcode, 3), dcode25->width, 45);
    if((!dcode25->direction)
            ? E - 3 > 4
            : (E > 2 ||
               decode_e(get_width(dcode, 4), dcode25->width, 45) > 2))
        return(ZBAR_NONE);

    if(dcode25->direction) {
        /* reverse buffer */
        dprintf(2, " (rev)");
        int i;
        for(i = 0; i < dcode25->character / 2; i++) {
            unsigned j = dcode25->character - 1 - i;
            char c = dcode->buf[i];
            dcode->buf[i] = dcode->buf[j];
            dcode->buf[j] = c;
        }
    }

    if(dcode25->character < CFG(*dcode25, ZBAR_CFG_MIN_LEN) ||
            (CFG(*dcode25, ZBAR_CFG_MAX_LEN) > 0 &&
             dcode25->character > CFG(*dcode25, ZBAR_CFG_MAX_LEN))) {
        dprintf(2, " [invalid len]\n");
        dcode->lock = 0;
        dcode25->character = -1;
        return(ZBAR_NONE);
    }

    dcode->buflen = dcode25->character;
    dcode->buf[dcode25->character] = '\0';
    dprintf(2, " [valid end]\n");
    dcode25->character = -1;
    return(ZBAR_I25);
}
開發者ID:radityaprawira,項目名稱:MoSync,代碼行數:48,代碼來源:i25.c

示例15: UpdateData

void CDlgPublishHtml::OnChangeDir() 
{
	UpdateData( TRUE );

	// Save publish folder
	CFG().SetValue( "Settings", "HtmlPubDir", (LPCTSTR)m_sDir );	
}
開發者ID:sanyaade-webdev,項目名稱:wpub,代碼行數:7,代碼來源:DlgPublishHtml.cpp


注:本文中的CFG函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。