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


C++ setStr函数代码示例

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


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

示例1: readConfig

  static bool readConfig(EVMod *mod)  {
    HSP_mod_OVS *mdata = (HSP_mod_OVS *)mod->data;
    HSP *sp = (HSP *)EVROOTDATA(mod);

    resetConfig(&mdata->config);

    if(sp->sFlowSettings == NULL)
      return NO;

    mdata->config.sampling_n = sp->sFlowSettings->samplingRate;
    mdata->config.polling_secs = sp->actualPollingInterval;
    mdata->config.header_bytes = sp->sFlowSettings->headerBytes;
    char ipbuf[51];
    SFLAddress_print(&sp->agentIP, ipbuf, 50);
    setStr(&mdata->config.agent_ip, ipbuf);
    setStr(&mdata->config.agent_dev, sp->agentDevice);
    for(HSPCollector *coll = sp->sFlowSettings->collectors; coll; coll = coll->nxt) {
      if(mdata->config.num_collectors == SFVS_MAX_COLLECTORS) {
	myLog(LOG_ERR, "OVS: MAX collectors exceeded");
      }
      else {
	uint32_t i = mdata->config.num_collectors++;
	SFLAddress_print(&coll->ipAddr, ipbuf, 50);
	setStr(&mdata->config.collectors[i].ip, ipbuf);
	mdata->config.collectors[i].port = coll->udpPort;
	mdata->config.collectors[i].priority = 0;
      }
    }
    // turn the collectors list into the targets string
    formatTargets(mod);
    return YES;
  }
开发者ID:sflow,项目名称:host-sflow,代码行数:32,代码来源:mod_ovs.c

示例2: setStr

int ScriptParser::rubyonCommand()
{
    rubyon_flag = true;

    char *buf = script_h.getNext();
    if ( buf[0] == 0x0a || buf[0] == ':' || buf[0] == ';' ){
        ruby_struct.font_size_xy[0] = -1;
        ruby_struct.font_size_xy[1] = -1;
        setStr( &ruby_struct.font_name, NULL );
    }
    else{
        ruby_struct.font_size_xy[0] = script_h.readInt();
        ruby_struct.font_size_xy[1] = script_h.readInt();

        if ( script_h.getEndStatus() & ScriptHandler::END_COMMA ){
            setStr( &ruby_struct.font_name, script_h.readStr() );
        }
        else{
            setStr( &ruby_struct.font_name, NULL );
        }
    }
    sentence_font.setRubyOnFlag(true);

    return RET_CONTINUE;
}
开发者ID:brijohn,项目名称:onscripter-wii,代码行数:25,代码来源:ScriptParser_command.cpp

示例3: errorAndExit

int ScriptParser::getparamCommand()
{
    if ( !last_nest_info->previous || last_nest_info->nest_mode != NestInfo::LABEL )
        errorAndExit( "getparam: not in a subroutine" );

    bool getparam2_flag = false;
    if ( script_h.isName( "getparam2") ) getparam2_flag = true;
    
    int end_status, end_status2;
    do{
        script_h.readVariable();
        end_status2 = script_h.getEndStatus();
        
        script_h.pushVariable();
        
        script_h.pushCurrent(last_nest_info->next_script);

        if ( script_h.pushed_variable.type & ScriptHandler::VAR_PTR ){
            script_h.readVariable();
            script_h.setInt( &script_h.pushed_variable, script_h.current_variable.var_no );
        }
        else if ( script_h.pushed_variable.type & ScriptHandler::VAR_INT ||
                  script_h.pushed_variable.type & ScriptHandler::VAR_ARRAY ){
            script_h.setInt( &script_h.pushed_variable, script_h.readInt() );
        }
        else if ( script_h.pushed_variable.type & ScriptHandler::VAR_STR ){
            const char *buf = script_h.readStr();
            setStr( &script_h.getVariableData(script_h.pushed_variable.var_no).str, buf );
        }
        
        end_status = script_h.getEndStatus();
        
        last_nest_info->next_script = script_h.getNext();
        script_h.popCurrent();
    }
    while(end_status & ScriptHandler::END_COMMA);

    if (getparam2_flag){
        while (end_status2 & ScriptHandler::END_COMMA){
            script_h.readVariable();
            end_status2 = script_h.getEndStatus();

            if ( script_h.current_variable.type & ScriptHandler::VAR_PTR ){
                script_h.setInt( &script_h.current_variable, 0 );
            }
            else if ( script_h.current_variable.type & ScriptHandler::VAR_INT ||
                      script_h.current_variable.type & ScriptHandler::VAR_ARRAY ){
                script_h.setInt( &script_h.current_variable, 0 );
            }
            else if ( script_h.current_variable.type & ScriptHandler::VAR_STR ){
                setStr( &script_h.getVariableData(script_h.current_variable.var_no).str, NULL );
            }
        }
    }
    
    return RET_CONTINUE;
}
开发者ID:MagicLeo21,项目名称:ONScripter-GBK,代码行数:57,代码来源:ScriptParser_command.cpp

示例4: setStr

void iniConfig::setEnum(LPCSTR section, LPCSTR key, int value, std::pair<int, LPCSTR> map[], int size) const
{
	for (int i = 0; i < size; i++)
		if (map[i].first == value)
		{
			setStr(section, key, map[i].second);
			return;
		}
	setStr(section, key, std::to_string(value));
}
开发者ID:jaryn-kubik,项目名称:ddda-dinput8,代码行数:10,代码来源:iniConfig.cpp

示例5: resetConfig

 static void resetConfig(SFVSConfig *cfg) {
   cfg->error = NO;
   cfg->sampling_n = 0;
   cfg->polling_secs = 0;
   cfg->header_bytes = SFL_DEFAULT_HEADER_SIZE;
   setStr(&cfg->agent_ip, NULL);
   setStr(&cfg->agent_dev, NULL);
   cfg->num_collectors = 0;
   strArrayReset(cfg->targets);
   setStr(&cfg->targetStr, NULL);
 }
开发者ID:sflow,项目名称:host-sflow,代码行数:11,代码来源:mod_ovs.c

示例6: removeBGMFadeEvent

void ONScripter::stopBGM( bool continue_flag )
{
    removeBGMFadeEvent();
    if (timer_bgmfade_id) SDL_RemoveTimer( timer_bgmfade_id );
    timer_bgmfade_id = NULL;
    mp3fadeout_duration_internal = 0;

#ifdef USE_CDROM
    if ( cdaudio_flag && cdrom_info ){
        extern SDL_TimerID timer_cdaudio_id;

        if ( timer_cdaudio_id ){
            SDL_RemoveTimer( timer_cdaudio_id );
            timer_cdaudio_id = NULL;
        }
        if (SDL_CDStatus( cdrom_info ) >= CD_PLAYING )
            SDL_CDStop( cdrom_info );
    }
#endif

    if ( wave_sample[MIX_BGM_CHANNEL] ){
        Mix_Pause( MIX_BGM_CHANNEL );
        Mix_FreeChunk( wave_sample[MIX_BGM_CHANNEL] );
        wave_sample[MIX_BGM_CHANNEL] = NULL;
    }

    if ( music_info ){
        ext_music_play_once_flag = true;
        Mix_HaltMusic();
        Mix_FreeMusic( music_info );
        music_info = NULL;
    }

    if ( midi_info ){
        ext_music_play_once_flag = true;
        Mix_HaltMusic();
        Mix_FreeMusic( midi_info );
        midi_info = NULL;
    }

    if ( !continue_flag ){
        setStr( &music_file_name, NULL );
        music_play_loop_flag = false;
        if (music_buffer){
            delete[] music_buffer;
            music_buffer = NULL;
        }

        setStr( &midi_file_name, NULL );
        midi_play_loop_flag = false;

        current_cd_track = -1;
    }
}
开发者ID:houzhenggang,项目名称:ONScripter-CN,代码行数:54,代码来源:ONScripter_sound.cpp

示例7: snprintf

void iniConfig::setUInt(LPCSTR section, LPCSTR key, unsigned value, bool hex) const
{
	if (hex)
	{
		char buf[16];
		snprintf(buf, sizeof buf, "0x%08X", value);
		setStr(section, key, buf);
	}
	else
		setStr(section, key, std::to_string(value));
}
开发者ID:jaryn-kubik,项目名称:ddda-dinput8,代码行数:11,代码来源:iniConfig.cpp

示例8: setType

void SubstItem::parseString(  const char * &pBegin, const char * pEnd,
                            const char * stopChars )
{
    char * pCur;
    char * pBufEnd;
    char achBuf[40960];
    pCur = achBuf;
    pBufEnd = &achBuf[40959];
    setType( REF_STRING );
    while( pBegin < pEnd )
    {
        char ch = *pBegin;
        if (strchr( stopChars, ch ))
        {
            break;
        }
        else if (ch == '\\' )
        {
            if ( ++pBegin >= pEnd )
            {
                break;
            }
            ch = *pBegin;
        }
        if ( pCur < pBufEnd )
            *pCur++ = ch;
        ++pBegin;
    }
    *pCur = 0;
    setStr( achBuf, pCur - achBuf );
}
开发者ID:diegomontoya,项目名称:openlitespeed,代码行数:31,代码来源:requestvars.cpp

示例9: nulStr

	Token& Token::operator=( const Token& tok )
	{
	  module = tok.module;
	  id = tok.id;
	  type = tok.type;
	  precedence = tok.precedence;
	  deprecated = tok.deprecated;

	  nulStr();
      ownsStr = false;
	  if ( tok.token )
	  {
		if ( !tok.ownsStr )
		  setStr( tok.token );
		else
		  copyStr( tok.token );
	  }
	  dval = tok.dval;
	  lval = tok.lval;

	  dbg_filenum = tok.dbg_filenum;
	  dbg_linenum = tok.dbg_linenum;

	  userfunc = tok.userfunc;

	  return *this;
	}
开发者ID:AlessandroMamusa,项目名称:polserver,代码行数:27,代码来源:token.cpp

示例10: bridgeList

  int bridgeList(void *magic, char *line)
  {
    EVMod *mod = (EVMod *)magic;
    HSP_mod_OVS *mdata = (HSP_mod_OVS *)mod->data;
    // we're looking for the lines that have "name : <bridge-name>"
    // or specifically the sequence:
    // name
    // <whitespace>
    // :
    // <whitespace>
    // <bridge-name>
    // sscanf with format string "name%*[\t ]:%*[\t ]%s" works, but
    // assumes that the whitespace is not empty.  I don't think we
    // can necessarily assume that (?)
    char bridgeName[SFVS_MAX_LINELEN];
    if(sscanf(line, "name%*[\t ]:%*[\t ]%s", bridgeName) == 1) {
      // copy the bridge name
      char *br = stripQuotes(bridgeName, SFVS_QUOTES);
      myDebug(1, "bridgeList> %s", br);
      if(br && (br[0] != '\0')) {
	setStr(&mdata->bridge, br);
	// now run a command to check (and possible change) the bridge sFlow setting
	char *bridge_get_sflow_cmd[] = { SFVS_OVS_CMD, "get", "bridge", br, "sflow", NULL };
	char line[SFVS_MAX_LINELEN];
	if(myExec(mod, bridge_get_sflow_cmd, bridgeGetSFlow, line, SFVS_MAX_LINELEN, NULL) == NO) return NO;
      }
    }
    return YES;
  }
开发者ID:sflow,项目名称:host-sflow,代码行数:29,代码来源:mod_ovs.c

示例11: UserFuncLUT

int ScriptParser::defsubCommand()
{
    last_user_func->next = new UserFuncLUT();
    setStr( &last_user_func->next->command, script_h.readName() );
    last_user_func = last_user_func->next;
    
    return RET_CONTINUE;
}
开发者ID:brijohn,项目名称:onscripter-wii,代码行数:8,代码来源:ScriptParser_command.cpp

示例12: pCode_

PatMat::PatElmt_::PatElmt_(const Character* str, const Natural l)
:
    pCode_(PC_Null),
    index_(1),
    pNext_(EOP)
{
    setStr(str, l);
}
开发者ID:Henry,项目名称:PatMat,代码行数:8,代码来源:PatElmt.C

示例13: setStr

//------------------------------------------------------------------------------
// copyData() -- copy member data
//------------------------------------------------------------------------------
void String::copyData(const String& org, const bool cc)
{
   BaseClass::copyData(org);
   if (!cc && str != 0) delete[] str;
   str = 0;
   nn = 0;
   n = 0;
   setStr(org);
}
开发者ID:AFIT-Hodson,项目名称:OpenEaagles,代码行数:12,代码来源:String.cpp

示例14: UserFuncLUT

int ScriptParser::defsubCommand()
{
    const char *cmd = script_h.readLabel();

    if (cmd[0] >= 'a' && cmd[0] <= 'z'){
        UserFuncHash &ufh = user_func_hash[cmd[0]-'a'];
        ufh.last->next = new UserFuncLUT();
        ufh.last = ufh.last->next;
        setStr( &ufh.last->command, cmd );
    }
    
    return RET_CONTINUE;
}
开发者ID:MagicLeo21,项目名称:ONScripter-GBK,代码行数:13,代码来源:ScriptParser_command.cpp

示例15: submitCreate

  int submitCreate(void *magic, char *line)
  {
    EVMod *mod = (EVMod *)magic;
    HSP_mod_OVS *mdata = (HSP_mod_OVS *)mod->data;
    char *uuid = stripQuotes(line, SFVS_QUOTES);
    if(!uuid)
      return NO;
    if(my_strlen(uuid) < 32)
      return NO;
    char binUUID[16];
    if(parseUUID(uuid, binUUID) == NO)
      return NO;

    setStr(&mdata->sflowUUID, uuid);
    return YES;
  }
开发者ID:sflow,项目名称:host-sflow,代码行数:16,代码来源:mod_ovs.c


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