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

C++ push_string函数代码示例

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

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



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

示例1: send_announcement

static void send_announcement(struct subnet_record *subrec, int announce_type,
                              const char *from_name, const char *to_name, int to_type, struct in_addr to_ip,
                              time_t announce_interval,
                              const char *server_name, int server_type, const char *server_comment)
{
    pstring outbuf;
    char *p;

    memset(outbuf,'\0',sizeof(outbuf));
    p = outbuf+1;

    SCVAL(outbuf,0,announce_type);

    /* Announcement parameters. */
    SCVAL(p,0,updatecount);
    SIVAL(p,1,announce_interval*1000); /* Milliseconds - despite the spec. */

    push_string(NULL, p+5, server_name, 15, STR_ASCII|STR_UPPER|STR_TERMINATE);

    SCVAL(p,21,lp_major_announce_version()); /* Major version. */
    SCVAL(p,22,lp_minor_announce_version()); /* Minor version. */

    SIVAL(p,23,server_type & ~SV_TYPE_LOCAL_LIST_ONLY);
    /* Browse version: got from NT/AS 4.00  - Value defined in smb.h (JHT). */
    SSVAL(p,27,BROWSER_ELECTION_VERSION);
    SSVAL(p,29,BROWSER_CONSTANT); /* Browse signature. */

    p += 31 + push_string(NULL, p+31, server_comment, -1, STR_ASCII|STR_TERMINATE);

    send_mailslot(False,BROWSE_MAILSLOT, outbuf, PTR_DIFF(p,outbuf),
                  from_name, 0x0, to_name, to_type, to_ip, subrec->myip,
                  DGRAM_PORT);
}
开发者ID:patrick-ken,项目名称:Vizio_XWR100_GPL,代码行数:33,代码来源:nmbd_sendannounce.c


示例2: udpsvc_process

static void
udpsvc_process(udpsvc_t *svc)
{
    int addrlen, cc;
    struct sockaddr_in addr;
    struct gdexception exception_frame;
    
    update_udp_av();

    exception_frame.e_exception = exception;
    exception_frame.e_catch = 0;

    exception = &exception_frame;

    
    if (setjmp(exception_frame.e_context) == 0)
    {
	push_string(inet_ntoa(addr.sin_addr), STRING_MSTRING);
	push_string((char *)nq_rptr(svc->nq), STRING_MSTRING);
	(void)apply_master_ob(M_INCOMING_UDP, 2);
    }
    exception = exception->e_exception;
    addrlen = sizeof (addr);

    if (!read_datagram(svc)) {
	nd_enable(svc->nd, ND_R);
	svc->task = 0;
	return;
    }
    reschedule_task(svc->task);
}
开发者ID:DruSatori,项目名称:AEMud,代码行数:31,代码来源:udpsvc.c


示例3: f_map

/*! @decl void map(string map, function(string, string:void) fun)
 *!
 *! For each entry in @[map], call the function specified by @[fun].
 *!
 *! @[fun] will get two arguments, the first being the key, and the
 *! second the value.
 *!
 *! @[map] is the YP-map to search in. This must be the full map name.
 *! eg @tt{[email protected]} instead of just @tt{[email protected]}.
 */
static void f_map(INT32 args)
{
  int err;
  char *retval, *retkey;
  int retlen, retkeylen;
  char *map;

  struct svalue *f = &sp[-1];

  check_all_args(NULL, args, BIT_STRING, BIT_FUNCTION|BIT_ARRAY, 0 );

  map = sp[-2].u.string->str;

  if(!(err = yp_first(this->domain,map, &retkey,&retkeylen, &retval, &retlen)))
    do {
      push_string(make_shared_binary_string(retkey, retkeylen));
      push_string(make_shared_binary_string(retval, retlen));
      apply_svalue( f, 2 );

      err = yp_next(this->domain, map, retkey, retkeylen,
		    &retkey, &retkeylen, &retval, &retlen);
    } while(!err);

  if(err != YPERR_NOMORE)
    YPERROR( err );
}
开发者ID:pikelang,项目名称:Pike,代码行数:36,代码来源:yp.c


示例4: main

int main( int argc, char *argv[] )
{
    cexception_t inner;
    SLLIST * volatile string_list = NULL;
    char * curr = NULL;
    char * one = "one";
    char * two = "two";
    char * three = "three";

    cexception_guard( inner ) {
	push_string( &string_list, &one, &inner );
	push_string( &string_list, &two, &inner );
	push_string( &string_list, &three, &inner );
    }
    cexception_catch {
	fprintf( stderr, "%s: %s\n", argv[0], cexception_message( &inner ));
    }

    curr = sllist_pop_data( &string_list );
    printf( "%s\n", curr ? curr : "(null)" );

    curr = sllist_pop_data( &string_list );
    printf( "%s\n", curr ? curr : "(null)" );

    curr = sllist_pop_data( &string_list );
    printf( "%s\n", curr ? curr : "(null)" );

    curr = sllist_pop_data( &string_list );
    printf( "%s\n", curr ? curr : "(null)" );

    dispose_sllist( &string_list );
    return 0;
}
开发者ID:sauliusg,项目名称:starta,代码行数:33,代码来源:pushpop2.c


示例5: print_ioctl

/*
  ioctl - used for job query
*/
static NTSTATUS print_ioctl(struct ntvfs_module_context *ntvfs,
			    struct ntvfs_request *req, union smb_ioctl *io)
{
	char *p;

	if (io->generic.level != RAW_IOCTL_IOCTL) {
		return NT_STATUS_NOT_IMPLEMENTED;
	}

	if (io->ioctl.in.request == IOCTL_QUERY_JOB_INFO) {

		/* a request for the print job id of an open print job */
		io->ioctl.out.blob = data_blob_talloc(req, NULL, 32);

		data_blob_clear(&io->ioctl.out.blob);

		p = (char *)io->ioctl.out.blob.data;
		SSVAL(p,0, 1 /* REWRITE: fsp->rap_print_jobid */);
		push_string(p+2, lpcfg_netbios_name(ntvfs->ctx->lp_ctx), 15, STR_TERMINATE|STR_ASCII);
		push_string(p+18, ntvfs->ctx->config->name, 13, STR_TERMINATE|STR_ASCII);
		return NT_STATUS_OK;
	}

	return NT_STATUS_INVALID_PARAMETER;
}
开发者ID:srimalik,项目名称:samba,代码行数:28,代码来源:vfs_print.c


示例6: f_all

/*! @decl mapping(string:string) all(string map)
 *!
 *! Returns the whole map as a mapping.
 *!
 *! @[map] is the YP-map to search in. This must be the full map name,
 *! you have to use @tt{[email protected]} instead of just @tt{[email protected]}.
 */
static void f_all(INT32 args)
{
  int err, num=0;
  char *retval, *retkey;
  int retlen, retkeylen;
  char *map;
  struct mapping *res_map;
  check_all_args(NULL, args, BIT_STRING, 0);

  map = sp[-1].u.string->str;
  res_map = allocate_mapping( (this->last_size?this->last_size+2:40) );

  if(!(err = yp_first(this->domain, map, &retkey,&retkeylen, &retval,&retlen)))
    do {
      push_string(make_shared_binary_string(retkey, retkeylen));
      push_string(make_shared_binary_string(retval, retlen));
      mapping_insert( res_map, sp-2, sp-1 );
      pop_stack(); pop_stack();

      err = yp_next(this->domain, map, retkey, retkeylen,
		    &retkey, &retkeylen, &retval, &retlen);
      num++;
    } while(!err);

  if(err != YPERR_NOMORE)
  {
    free_mapping( res_map );
    YPERROR( err );
  }

  this->last_size = num;
  pop_n_elems(args);
  push_mapping( res_map );
}
开发者ID:pikelang,项目名称:Pike,代码行数:41,代码来源:yp.c


示例7: cpio_mkslink

static int cpio_mkslink(const char *name, const char *target,
			 unsigned int mode, uid_t uid, gid_t gid)
{
	char s[256];

	if (name[0] == '/')
		name++;
	sprintf(s,"%s%08X%08X%08lX%08lX%08X%08lX"
	       "%08X%08X%08X%08X%08X%08X%08X",
		"070701",		/* magic */
		ino++,			/* ino */
		S_IFLNK | mode,		/* mode */
		(long) uid,		/* uid */
		(long) gid,		/* gid */
		1,			/* nlink */
		(long) default_mtime,	/* mtime */
		(unsigned)strlen(target)+1, /* filesize */
		3,			/* major */
		1,			/* minor */
		0,			/* rmajor */
		0,			/* rminor */
		(unsigned)strlen(name) + 1,/* namesize */
		0);			/* chksum */
	push_hdr(s);
	push_string(name);
	push_pad();
	push_string(target);
	push_pad();
	return 0;
}
开发者ID:32743069,项目名称:amlogic_common_3050,代码行数:30,代码来源:gen_init_cpio.c


示例8: check_game

/**
 * @brief Implementation of game:get_starting_location().
 * @param l The Lua context that is calling this function.
 * @return Number of values to return to Lua.
 */
int LuaContext::game_api_get_starting_location(lua_State* l) {

  Savegame& savegame = check_game(l, 1);

  push_string(l, savegame.get_string(Savegame::KEY_STARTING_MAP));
  push_string(l, savegame.get_string(Savegame::KEY_STARTING_POINT));
  return 2;
}
开发者ID:lambdaloop,项目名称:solarus,代码行数:13,代码来源:GameAPI.cpp


示例9: print_inverse_order

/* Prints the stack in the inverse order */
void print_inverse_order(StringStack *stack)
{
	StringStack *aux = initialize_string_stack();
	while (stack->size > 0)
		push_string(aux,pop_string(stack));
	while (aux->size > 0)
	{
		printf("%stack",top_string(aux));	
		push_string(stack,pop_string(aux));
	}
}
开发者ID:jlgasparrini,项目名称:c-tds,代码行数:12,代码来源:StringStack.c


示例10: lalpm_fileconflict_get_type

/* pmfileconflicttype_t alpm_fileconflict_get_type(pmfileconflict_t *conflict); */
static int lalpm_fileconflict_get_type(lua_State *L)
{
    pmfileconflict_t *conflict = check_pmfileconflict(L, 1);
    pmfileconflicttype_t type = alpm_fileconflict_get_type(conflict);
    switch(type) {
        case PM_FILECONFLICT_TARGET:
            return push_string(L, "FILECONFLICT_TARGET");
        case PM_FILECONFLICT_FILESYSTEM:
            return push_string(L, "FILECONFLICT_FILESYSTEM");
    }
    return 1;
}
开发者ID:Berticus,项目名称:clyde,代码行数:13,代码来源:trans.c


示例11: qgram_tree

/*Get qgram distances 
 * Input
 * s: a string
 * t: a string
 * x: length of s
 * y: length of t
 * q: the 'q' in q-gram
 * Q: a qtree
 * int: distance distance function to compute:
 *  0 : q-gram distance
 *  1 : cosine distance
 *  2 : jaccard distance
 *
 *
 * Return values:
 *  >=0 : qgram distance
 * -1   : infinite distance
 * -2   : Not enough memory
 */
static double qgram_tree(
    unsigned int *s, 
    unsigned int *t, 
    unsigned int x,
    unsigned int y,
    unsigned int q, 
    qtree *Q,
    int distance
  ){
  // return -1 when q is larger than the length of the shortest string.
  if ( q > (x <= y ? x : y) ) return -1.0;
  // rare edge cases.
  if ( q == 0 ){
    if ( x + y > 0 ){ // distance undefined
      return -1.0;
    } else { // x == y == 0.
      return 0.0;
    } 
  }

  double dist[3] = {0,0,0};
  Q = push_string(s, x, q, Q, 0, 2);
  if (Q == NULL) return -2.0;
  Q = push_string(t, y, q, Q, 1, 2);
  if (Q == NULL) return -2.0;

  switch ( distance ){
    case 0:
      getdist(Q,dist);
      break;
    case 1:
      getcosine(Q, dist);
      if (dist[0]==dist[1] && dist[0]==dist[2]){
        // strings are equal. Prevent machine rounding about 0.0
        dist[0] =  0.0;
      } else {
        // there are several ways to express the rhs (including ones that give 0L 
        // at equal strings) but this has least chance of overflow.
        dist[0] = 1.0 - dist[0]/(sqrt(dist[1]) * sqrt(dist[2]));
      }
      break;
    case 2:
      getjaccard(Q,dist);
      dist[0] = 1.0 - dist[0]/dist[1];
      break;
    default:
      break;
  }
  return dist[0];
}
开发者ID:richierocks,项目名称:stringdist,代码行数:69,代码来源:qgram.c


示例12: qgram_dist

/*Get qgram distances 
 * Input
 * s: a string
 * t: a string
 * x: length of s
 * y: length of t
 * q: the 'q' in q-gram
 * Q: a qtree
 * int: distance distance function to compute:
 *  0 : q-gram distance
 *  1 : cosine distance
 *  2 : jaccard distance
 *
 *
 * Return values:
 *  >=0 : qgram distance
 * -1   : infinite distance
 * -2   : Not enough memory
 */
double qgram_dist(
    unsigned int *s, 
    int x,
    unsigned int *t, 
    int y,
    unsigned int q, 
    qtree **Qp,
    int distance
  ){

  // rare edge case: q==0. Note that we return 0 for all cases where
  // q equals zero. In the R journal paper we used Inf for cases where 
  // q=0 and |s| or |t| > 0
  if ( q == 0 ) return 0.0;

  double dist[3] = {0,0,0};
  *Qp = push_string(s, x, q, *Qp, 0, 2);

  *Qp = push_string(t, y, q, *Qp, 1, 2);
  if (*Qp == NULL) return 0;
  

  qtree *Q = *Qp;
  switch ( distance ){
    case 0:
      getdist(Q,dist);
      break;
    case 1:
      getcosine(Q, dist);
      if (dist[0]==dist[1] && dist[0]==dist[2]){
        // strings are equal. Prevent machine rounding about 0.0
        dist[0] =  0.0;
      } else {
        // there are several ways to express the rhs (including ones that give 0L 
        // at equal strings) but this has least chance of overflow
        // fabs is taken to avoid numerical -0.
        dist[0] = fabs(1.0 - dist[0]/(sqrt(dist[1]) * sqrt(dist[2])));
      }
      break;
    case 2:
      getjaccard(*Qp,dist);
      dist[0] = 1.0 - dist[0]/dist[1];
      break;
    default:
      break;
  }

  return dist[0];
}
开发者ID:cran,项目名称:stringdist,代码行数:68,代码来源:qgram.c


示例13: push_long

std::vector<unsigned char> CEntityWriter::SaveMatrices(long rate, std::map<std::string, std::vector<float> >& animations)
{
		std::vector<unsigned char> out;
		push_long(out, rate);
		push_long(out, 1); // 1 - matrix animation
		std::map<std::string, std::vector<float> >::iterator it = animations.begin();
		CAnimationTransformer trans;
		while (it != animations.end() ) 
		{
			char buffer[200];
			memset(buffer, 0, 200);
			std::string component_name = it->first;
			int pos= component_name.find("/");
			strncpy(buffer, component_name.c_str(), pos);
			component_name = buffer;
			
			push_string(out,buffer);
			std::vector<float>& next = it->second;
			std::vector<CKeyFrame> frames = trans.GetFrames(next);

			//out.resize(sizeof(long) + pos + sizeof(float)*next.size());
			push_long(out,frames.size());
			for (int i= 0 ; i < frames.size() ; i ++ ) 
			{
				std::vector<unsigned char> frame;
				frame.resize(sizeof(CKeyFrame));
				memcpy(&frame[0], & frames[i] , sizeof(CKeyFrame));
				out.insert(out.end(),frame.begin(), frame.end());
			}
			it++;
		}
		return out;
}
开发者ID:vpa1977,项目名称:lock_free_mt,代码行数:33,代码来源:entity_writer.cpp


示例14: regexp_split

/*! @decl array(string) split(string s)
 *! Works as @[match], but returns an array of the strings that
 *! matched the subregexps. Subregexps are those contained in "( )" in
 *! the regexp. Subregexps that were not matched will contain zero.
 *! If the total regexp didn't match, zero is returned.
 *!
 *! @bugs
 *!   You can currently only have 39 subregexps.
 *!
 *! @bugs
 *!   The current implementation doesn't support searching
 *!   in strings containing the NUL character or any
 *!   wide character.
 *!
 *! @seealso
 *!   @[match]
 */
static void regexp_split(INT32 args)
{
  struct pike_string *s;
  struct regexp *r;

  get_all_args("Regexp.SimpleRegexp->split", args, "%S", &s);

  if(pike_regexec(r=THIS->regexp, s->str))
  {
    int i,j;
    add_ref(s);
    pop_n_elems(args);
    for(j=i=1;i<NSUBEXP;i++)
    {
      if(!r->startp[i] || !r->endp[i])
      {
	push_int(0);
      }else{
	push_string(make_shared_binary_string(r->startp[i],
					      r->endp[i]-r->startp[i]));
	j=i;
      }
    }
    if(j<i-1) pop_n_elems(i-j-1);
    push_array(aggregate_array(j));
    free_string(s);
  }else{
    pop_n_elems(args);
    push_int(0);
  }
}
开发者ID:ajinkya007,项目名称:pike-1,代码行数:48,代码来源:glue.c


示例15: get_lua_context

/**
 * @brief Implementation of sol.menu.stop().
 * @param l the Lua context that is calling this function
 * @return number of values to return to Lua
 */
int LuaContext::menu_api_stop(lua_State* l) {

  LuaContext& lua_context = get_lua_context(l);

  luaL_checktype(l, 1, LUA_TTABLE);

  int menu_ref = LUA_REFNIL;
  std::list<LuaMenuData>& menus = lua_context.menus;
  std::list<LuaMenuData>::iterator it;
  for (it = menus.begin(); it != menus.end(); it++) {
    int ref = it->ref;
    push_ref(l, ref);
    if (lua_equal(l, 1, -1)) {
      menu_ref = ref;
      lua_context.menu_on_finished(menu_ref);
      menus.erase(it);
      lua_context.destroy_ref(menu_ref);
      break;
    }
  }

  if (menu_ref == LUA_REFNIL) {
    push_string(l, "Unknown menu.");
    lua_error(l);
  }

  return 0;
}
开发者ID:xor-mind,项目名称:solarus,代码行数:33,代码来源:MenuAPI.cpp


示例16: image_ttf_face__names

static void image_ttf_face__names(INT32 args)
{
   int ns,res;
   TT_UShort i;
   TT_Face face=THISf->face;
   pop_n_elems(args);

   if ((ns=TT_Get_Name_Count(face))==-1)
      Pike_error("Image.TTF.Face->names(): Illegal face handler\n");

   for (i=0; i<ns; i++)
   {
      unsigned short platformID,encodingID,languageID,nameID;
      TT_UShort length;
      char *stringPtr;

      if ((res=TT_Get_Name_ID(face,i,
			      &platformID,&encodingID,&languageID,&nameID)))
	 my_tt_error("Image.TTF.Face->names()","TT_Get_Name_ID: ",res);

      push_int(platformID);
      push_int(encodingID);
      push_int(languageID);
      push_int(nameID);

      if ((res=TT_Get_Name_String(face,i,&stringPtr,&length)))
	 my_tt_error("Image.TTF.Face->names()","TT_Get_Name_String: ",res);

      push_string(make_shared_binary_string(stringPtr,length));

      f_aggregate(5);
   }
   f_aggregate(ns);
}
开发者ID:ajinkya007,项目名称:pike-1,代码行数:34,代码来源:image_ttf.c


示例17: f_crypt_md5

static void f_crypt_md5(INT32 args)
{
  char salt[8];
  char *ret, *saltp ="";
  char *choice =
    "cbhisjKlm4k65p7qrJfLMNQOPxwzyAaBDFgnoWXYCZ0123tvdHueEGISRTUV89./";
 
  if (args < 1)
    SIMPLE_TOO_FEW_ARGS_ERROR("crypt_md5", 1);

  if (Pike_sp[-args].type != T_STRING)
    SIMPLE_BAD_ARG_ERROR("crypt_md5", 1, "string");

  if (args > 1)
  {
    if (Pike_sp[1-args].type != T_STRING)
      SIMPLE_BAD_ARG_ERROR("crypt_md5", 2, "string");

    saltp = Pike_sp[1-args].u.string->str;
  } else {
    unsigned int i, r;
   for (i = 0; i < sizeof(salt); i++) 
    {
      r = my_rand();
      salt[i] = choice[r % (size_t) strlen(choice)];
    }
    saltp = salt;
  }

  ret = (char *)crypt_md5(Pike_sp[-args].u.string->str, saltp);

  pop_n_elems(args);
  push_string(make_shared_string(ret));
}
开发者ID:ajinkya007,项目名称:societyserver,代码行数:34,代码来源:md5_pike.c


示例18: check_item

/**
 * \brief Implementation of item:get_name().
 * \param l The Lua context that is calling this function.
 * \return Number of values to return to Lua.
 */
int LuaContext::item_api_get_name(lua_State* l) {

  EquipmentItem& item = check_item(l, 1);

  push_string(l, item.get_name());
  return 1;
}
开发者ID:Umigatsu,项目名称:solarus,代码行数:12,代码来源:ItemApi.cpp


示例19: push_u16

//--------------------------------------------------------
// moduleInit
//--------------------------------------------------------
void  MsgBase::packMsg(NetMsgBody &netMsg)
{
	netMsg.msgType = m_pMsgInfo->msgType;

	push_u16((uint16_t)m_pMsgInfo->info.size());

	for(map<string,string>::const_iterator it = m_pMsgInfo->info.begin();it!= m_pMsgInfo->info.end();it++)
	{
		push_string(it->first);
		push_string(it->second);

	}

	netMsg.msgHead.length = netMsg.msgData.length() + HEAD_SIZE;

}
开发者ID:rgmabs19357,项目名称:gameseer,代码行数:19,代码来源:msgBase.cpp


示例20: global_current_dir

static int global_current_dir (lua_State *L)
{
    check_args(L, 0);
    std::string dir = lua_current_dir(L);
    push_string(L, dir);
    return 1;
}
开发者ID:grit-engine,项目名称:luaimg,代码行数:7,代码来源:interpreter.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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