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

C++ setStr函数代码示例

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

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



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


示例16: id

	Token::Token( const Token& tok ) :
	  id( tok.id ),
	  type( tok.type ),
	  dval( tok.dval ),
	  precedence( tok.precedence ),
	  dbg_filenum( tok.dbg_filenum ),
	  dbg_linenum( tok.dbg_linenum ),
	  lval( tok.lval ),
	  userfunc( tok.userfunc ),
	  deprecated( tok.deprecated ),
      ownsStr( false ),
	  module( tok.module ),
	  token( NULL )
	{
	  register_instance();
	  if ( tok.token )
	  {
		if ( !tok.ownsStr )
		  setStr( tok.token );
		else
		  copyStr( tok.token );
	  }
	}
开发者ID:AlessandroMamusa,项目名称:polserver,代码行数:23,代码来源:token.cpp


示例17: errorAndExit

int ScriptParser::itoaCommand()
{
    bool itoa2_flag = false;

    if ( script_h.isName( "itoa2" ) )
        itoa2_flag = true;
    
    script_h.readVariable();
    if ( script_h.current_variable.type != ScriptHandler::VAR_STR )
        errorAndExit( "itoa: no string variable." );
    int no = script_h.current_variable.var_no;

    int val = script_h.readInt();

    char val_str[20];
    if (itoa2_flag)
        script_h.getStringFromInteger(val_str, val, -1, false, true);
    else
        sprintf( val_str, "%d", val );
    setStr( &script_h.getVariableData(no).str, val_str );
    
    return RET_CONTINUE;
}
开发者ID:brijohn,项目名称:onscripter-wii,代码行数:23,代码来源:ScriptParser_command.cpp


示例18: deleteRMenuLink

int ScriptParser::rmenuCommand()
{
    deleteRMenuLink();

    RMenuLink *link = &root_rmenu_link;
    bool comma_flag = true;
    while ( comma_flag ){
        link->next = new RMenuLink();

        const char *buf = script_h.readStr();
        setStr( &link->next->label, buf );
        if ( rmenu_link_width < strlen( buf )/2 + 1 )
            rmenu_link_width = strlen( buf )/2 + 1;

        link->next->system_call_no = getSystemCallNo( script_h.readName() );

        link = link->next;
        rmenu_link_num++;

        comma_flag = script_h.getEndStatus() & ScriptHandler::END_COMMA;
    }
    
    return RET_CONTINUE;
}
开发者ID:brijohn,项目名称:onscripter-wii,代码行数:24,代码来源:ScriptParser_command.cpp


示例19: if

int ScriptParser::movCommand()
{
    int count = 1;
    
    if ( script_h.isName( "mov10" ) ){
        count = 10;
    }
    else if ( script_h.isName( "movl" ) ){
        count = -1; // infinite
    }
    else if ( script_h.getStringBuffer()[3] >= '3' && script_h.getStringBuffer()[3] <= '9' ){
        count = script_h.getStringBuffer()[3] - '0';
    }

    script_h.readVariable();

    if ( script_h.current_variable.type == ScriptHandler::VAR_INT ||
         script_h.current_variable.type == ScriptHandler::VAR_ARRAY ){
        script_h.pushVariable();
        bool loop_flag = (script_h.getEndStatus() & ScriptHandler::END_COMMA);
        int i=0;
        while ( (count==-1 || i<count) && loop_flag ){
            int no = script_h.readInt();
            loop_flag = (script_h.getEndStatus() & ScriptHandler::END_COMMA);
            script_h.setInt( &script_h.pushed_variable, no, i++ );
        }
    }
    else if ( script_h.current_variable.type == ScriptHandler::VAR_STR ){
        script_h.pushVariable();
        const char *buf = script_h.readStr();
        setStr( &script_h.getVariableData(script_h.pushed_variable.var_no).str, buf );
    }
    else errorAndExit( "mov: no variable" );
    
    return RET_CONTINUE;
}
开发者ID:brijohn,项目名称:onscripter-wii,代码行数:36,代码来源:ScriptParser_command.cpp


示例20: deleteNestInfo


//.........这里部分代码省略.........
            ai->fill( ai->color[0], ai->color[1], ai->color[2], 0xff );
        }
        else{
            readInt(); // -1
            readInt(); // 0
            readInt(); // 0
            readInt(); // 0
            readInt(); // 0
            readInt(); // 0
        }
    }

    prnumclearCommand();
    for ( i=0 ; i<MAX_PARAM_NUM ; i++ ){
        j = readInt();
        if ( prnum_info[i] ){
            ai = prnum_info[i] = new AnimationInfo();
            ai->trans_mode = AnimationInfo::TRANS_STRING;
            ai->num_of_cells = 1;
            ai->color_list = new uchar3[1];

            ai->param = j;
            ai->orig_pos.x = readInt();
            ai->orig_pos.y = readInt();
            ai->scalePosXY( screen_ratio1, screen_ratio2 );
            ai->font_size_xy[0] = readInt();
            ai->font_size_xy[1] = readInt();
            for ( j=0 ; j<3 ; j++ )
                ai->color_list[0][2-j] = readChar();
            readChar(); // 0x00

            char num_buf[7];
            script_h.getStringFromInteger( num_buf, ai->param, 3 );
            setStr( &ai->file_name, num_buf );

            setupAnimationInfo( ai );
        }
        else{
            readInt(); // -1
            readInt(); // 0
            readInt(); // 0
            readInt(); // 0
            readInt(); // 0
        }
    }

    readInt(); // 1
    readInt(); // 0
    readInt(); // 1
    btndef_info.remove();
    readStr( &btndef_info.image_name );
    if ( btndef_info.image_name && btndef_info.image_name[0] != '\0' ){
        parseTaggedString( &btndef_info );
        setupAnimationInfo( &btndef_info );
        SDL_SetAlpha( btndef_info.image_surface, DEFAULT_BLIT_FLAG, SDL_ALPHA_OPAQUE );
    }

    if ( file_version >= 202 )
        readArrayVariable();
    
    readInt(); // 0
    if ( readChar() == 1 ) erase_text_window_mode = 2;
    readChar(); // 0
    readChar(); // 0
    readChar(); // 0
    readStr( &loop_bgm_name[0] );
开发者ID:alan-y-han,项目名称:onscripter-for-iOS-GBK,代码行数:67,代码来源:ONScripter_file2.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ setString函数代码示例发布时间:2022-05-30
下一篇:
C++ setStopBits函数代码示例发布时间: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