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


C++ ADD_STRING函数代码示例

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


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

示例1: ADD_STRING

// NotifyListenerRequest
status_t
NotifyListenerRequest::GetAddressInfos(AddressInfo* infos, int32* count)
{
	ADD_STRING(oldName);
	ADD_STRING(name);
	return B_OK;
}
开发者ID:DonCN,项目名称:haiku,代码行数:8,代码来源:Requests.cpp

示例2: multi_options_update_start_game

// update the standalone with the settings I have picked at the "start game" screen
void multi_options_update_start_game(netgame_info *ng)
{
	ubyte data[MAX_PACKET_SIZE],code;
	int packet_size = 0;

	// should be a host on a standalone
	Assert((Net_player->flags & NETINFO_FLAG_GAME_HOST) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER));

	// build the header
	BUILD_HEADER(OPTIONS_UPDATE);
	code = MULTI_OPTION_START_GAME;
	ADD_DATA(code);

	// add the start game options
	ADD_STRING(ng->name);
	ADD_INT(ng->mode);
	ADD_INT(ng->security);

	// add mode-specific data
	switch(ng->mode){
	case NG_MODE_PASSWORD:
		ADD_STRING(ng->passwd);
		break;
	case NG_MODE_RANK_ABOVE:
	case NG_MODE_RANK_BELOW:
		ADD_INT(ng->rank_base);
		break;
	}

	// send to the standalone server	
	multi_io_send_reliable(Net_player, data, packet_size);
}
开发者ID:DahBlount,项目名称:fs2open.github.com,代码行数:33,代码来源:multi_options.cpp

示例3: multi_options_update_mission

// update the standalone with the mission settings I have picked (mission filename, etc)
void multi_options_update_mission(netgame_info *ng, int campaign_mode)
{
	ubyte data[MAX_PACKET_SIZE],code;
	int packet_size = 0;

	// should be a host on a standalone
	Assert((Net_player->flags & NETINFO_FLAG_GAME_HOST) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER));

	// build the header
	BUILD_HEADER(OPTIONS_UPDATE);
	code = MULTI_OPTION_MISSION;
	ADD_DATA(code);

	// type (coop or team vs. team)
	ADD_INT(ng->type_flags);

	// respawns
	ADD_UINT(ng->respawn);

	// add the mission/campaign filename
	code = (ubyte)campaign_mode;
	ADD_DATA(code);
	if(campaign_mode){
		ADD_STRING(ng->campaign_name);
	} else {
		ADD_STRING(ng->mission_name);
	}

	// send to the server	
	multi_io_send_reliable(Net_player, data, packet_size);
}
开发者ID:DahBlount,项目名称:fs2open.github.com,代码行数:32,代码来源:multi_options.cpp

示例4: say_message

/*%
 * Internal print routine used to print short form replies.
 */
static isc_result_t
say_message(dns_rdata_t *rdata, dig_query_t *query, isc_buffer_t *buf) {
	isc_result_t result;
	isc_uint64_t diff;
	isc_time_t now;
	char store[sizeof("12345678901234567890")];

	if (query->lookup->trace || query->lookup->ns_search_only) {
		result = dns_rdatatype_totext(rdata->type, buf);
		if (result != ISC_R_SUCCESS)
			return (result);
		ADD_STRING(buf, " ");
	}
	result = dns_rdata_totext(rdata, NULL, buf);
	if (result == ISC_R_NOSPACE)
		return (result);
	check_result(result, "dns_rdata_totext");
	if (query->lookup->identify) {
		TIME_NOW(&now);
		diff = isc_time_microdiff(&now, &query->time_sent);
		ADD_STRING(buf, " from server ");
		ADD_STRING(buf, query->servname);
		snprintf(store, 19, " in %d ms.", (int)diff/1000);
		ADD_STRING(buf, store);
	}
	ADD_STRING(buf, "\n");
	return (ISC_R_SUCCESS);
}
开发者ID:Gradwell,项目名称:bind9,代码行数:31,代码来源:dig.c

示例5: MEMBERASSERT

//===============================================================================================
// FUNCTION: WriteMathInfo
// PURPOSE:  Writes the math channel info to the data file.
// NOTES:    We currently only support one math channel, but the file can support any number.
//
BOOL CProtocolWriterABF2::WriteMathInfo()
{
   MEMBERASSERT();

   BOOL bOK    = TRUE;
   ABF_MathInfo Math;
   if( m_pFH->nArithmeticEnable )
   {
      Math.nMathEnable     = m_pFH->nArithmeticEnable;

      Math.nMathExpression = m_pFH->nArithmeticExpression;   
      Math.fMathUpperLimit = m_pFH->fArithmeticUpperLimit;   
      Math.fMathLowerLimit = m_pFH->fArithmeticLowerLimit;  

      Math.nMathADCNum[0]  = m_pFH->nArithmeticADCNumA;   
      Math.nMathADCNum[1]  = m_pFH->nArithmeticADCNumB;   

      Math.fMathK[0]       = m_pFH->fArithmeticK1;     
      Math.fMathK[1]       = m_pFH->fArithmeticK2;     
      Math.fMathK[2]       = m_pFH->fArithmeticK3;     
      Math.fMathK[3]       = m_pFH->fArithmeticK4;     
      Math.fMathK[4]       = m_pFH->fArithmeticK5;     
      Math.fMathK[5]       = m_pFH->fArithmeticK6;     

      Math.uMathOperatorIndex = ADD_STRING( m_pFH->sArithmeticOperator );
      Math.uMathUnitsIndex    = ADD_STRING( m_pFH->sArithmeticUnits );

      m_FileInfo.MathSection.Set( m_lNextBlock, sizeof( ABF_MathInfo ), 1 );
      bOK &= m_pFI->Write( &Math, sizeof( Math ) );
      bOK &= m_pFI->FillCurrentBlock( &m_lNextBlock );
   }

   return bOK;
}
开发者ID:yamad,项目名称:libabf,代码行数:39,代码来源:ProtocolWriterABF2.cpp

示例6: php_ns_sapi_register_variables

static void
php_ns_sapi_register_variables(zval *track_vars_array)
{
	int i;
	char buf[NS_BUF_SIZE + 1];
	char *tmp;

	for(i = 0; i < Ns_SetSize(NSG(conn->headers)); i++) {
		char *key = Ns_SetKey(NSG(conn->headers), i);
		char *value = Ns_SetValue(NSG(conn->headers), i);
		char *p;
		char c;

		snprintf(buf, NS_BUF_SIZE, "HTTP_%s", key);
		
		for(p = buf + 5; (c = *p); p++) {
			c = toupper(c);
			if(c < 'A' || c > 'Z') {
				c = '_';
			}
			*p = c;
		}

		ADD_STRINGX(buf, value);
	}
	
	snprintf(buf, NS_BUF_SIZE, "%s/%s", Ns_InfoServerName(), Ns_InfoServerVersion());
	ADD_STRING("SERVER_SOFTWARE");
	snprintf(buf, NS_BUF_SIZE, "HTTP/%1.1f", NSG(conn)->request->version);
	ADD_STRING("SERVER_PROTOCOL");

	ADD_STRINGX("REQUEST_METHOD", NSG(conn)->request->method);

	if(NSG(conn)->request->query)
		ADD_STRINGX("QUERY_STRING", NSG(conn)->request->query);
	
	ADD_STRINGX("SERVER_BUILDDATE", Ns_InfoBuildDate());

	ADD_STRINGX("REMOTE_ADDR", Ns_ConnPeer(NSG(conn)));

	snprintf(buf, NS_BUF_SIZE, "%d", Ns_ConnPeerPort(NSG(conn)));
	ADD_STRING("REMOTE_PORT");

	snprintf(buf, NS_BUF_SIZE, "%d", Ns_ConnPort(NSG(conn)));
	ADD_STRING("SERVER_PORT");

	tmp = Ns_ConnHost(NSG(conn));
	if (tmp)
		ADD_STRINGX("SERVER_NAME", tmp);

	ADD_STRINGX("PATH_TRANSLATED", SG(request_info).path_translated);
	ADD_STRINGX("REQUEST_URI", SG(request_info).request_uri);
	ADD_STRINGX("PHP_SELF", SG(request_info).request_uri);

	ADD_STRINGX("GATEWAY_INTERFACE", "CGI/1.1");

	snprintf(buf, NS_BUF_SIZE, "%d", Ns_InfoBootTime());
	ADD_STRING("SERVER_BOOTTIME");
}
开发者ID:AmesianX,项目名称:php-src,代码行数:59,代码来源:aolserver.c

示例7: ADD_NON_NULL_STRING

// MountVolumeRequest
status_t
MountVolumeRequest::GetAddressInfos(AddressInfo* infos, int32* count)
{
	ADD_NON_NULL_STRING(cwd);
	ADD_STRING(device);
	ADD_STRING(parameters);
	return B_OK;
}
开发者ID:DonCN,项目名称:haiku,代码行数:9,代码来源:Requests.cpp

示例8: exportData

/*
  this function will be called upon a scheduled data collection 
  for a specific rule. it has to write measurement values from 
  'flowdata' into 'buf' and set len accordingly
*/
int exportData( void **exp, int *len, void *flowdata )
{
    uint32_t i;
    packetData_t *pkt;
    flowRec_t *data = (flowRec_t *) flowdata;

    /* check if enough buffer space is available and reserve extra memory if not */
    if (expSize < ROWSTRSIZE * (data->nrows + 1)) {
        uint8_t *newMemory = realloc(expData, ROWSTRSIZE * (data->nrows + 1));
	if (newMemory != NULL) {
	    expData = newMemory;
	    expSize = ROWSTRSIZE * data->nrows;
	} else {
	    /* not enough memory to write data to -> don't write data at all */
	    STARTEXPORT(expData);
	    ADD_LIST(0);
	    END_LIST();
	    ENDEXPORT(exp, len);
	    return -1;
	}
    }


    STARTEXPORT(expData);
    ADD_LIST( data->nrows );

    pkt = data->pkt;

    for (i = 0; i < data->nrows; i++) {

	ADD_UINT8(  pkt->ipversion );
	ADD_UINT8(  pkt->ttl );
	ADD_UINT16( pkt->pktlen );
	ADD_UINT16( pkt->iphdrlen );
	
	ADD_UINT16( pkt->proto );
	ADD_UINT16( pkt->tcpudphdrlen );
	
	ADD_STRING( pkt->srcip );
	ADD_UINT16( pkt->srcport );
	
	ADD_STRING( pkt->dstip );
	ADD_UINT16( pkt->dstport );

	ADD_UINT32( pkt->tcpseqno );
	ADD_STRING( printFlags(pkt->tcpflags) );

	pkt++;
    }

    END_LIST();
    ENDEXPORT(exp, len);

    data->nrows = 0;
    
    return 0;
}
开发者ID:DanielArndt,项目名称:netmate-flowcalc,代码行数:62,代码来源:show_ascii.c

示例9: multi_respawn_broadcast

// send a broadcast pack indicating a player has respawned
void multi_respawn_broadcast(net_player *np)
{
	ubyte data[50],val;
	int packet_size = 0;
	ushort signature;
	vector pos;

	// broadcast the packet to all players
	Assert(Net_player->flags & NETINFO_FLAG_AM_MASTER);

	signature = Objects[np->player->objnum].net_signature;
	pos = Objects[np->player->objnum].pos;

	// build the header and add the opcode
	BUILD_HEADER(RESPAWN_NOTICE);
	val = RESPAWN_BROADCAST;
	ADD_DATA(val);

	// add the data for the respawn
	ADD_USHORT(signature);
    add_vector_data( data, &packet_size, pos );
	ADD_SHORT(np->player_id);
	ADD_DATA(np->s_info.cur_primary_bank);
	ADD_DATA(np->s_info.cur_secondary_bank);
	ADD_DATA(np->s_info.cur_link_status);
	ADD_USHORT(np->s_info.ship_ets);
	ADD_STRING(np->p_info.p_objp->name);

	Assert( np->s_info.ship_ets != 0 );		// find dave or allender

	multi_io_send_to_all_reliable(data, packet_size);
}
开发者ID:lubomyr,项目名称:freespace2,代码行数:33,代码来源:multi_respawn.cpp

示例10: ADD_NEW_STRING

char *int_new_string (int size)
#endif
{
    malloc_block_t *mbt;

#if 0
    if (!size) {
        the_null_string_blocks[0].ref++;
        ADD_NEW_STRING(0, sizeof(malloc_block_t));
        return the_null_string;
    }
#endif
    
    mbt = (malloc_block_t *)DXALLOC(size + sizeof(malloc_block_t) + 1, TAG_MALLOC_STRING, tag);
    if (size < USHRT_MAX) {
        mbt->size = size;
        ADD_NEW_STRING(size, sizeof(malloc_block_t));
    } else {
        mbt->size = USHRT_MAX;
        ADD_NEW_STRING(USHRT_MAX, sizeof(malloc_block_t));
    }
    mbt->ref = 1;
    ADD_STRING(mbt->size);
    CHECK_STRING_STATS;
    return (char *)(mbt + 1);
}
开发者ID:Yuffster,项目名称:fluffOS,代码行数:26,代码来源:stralloc.c

示例11: zend_accel_script_persist_calc

uint zend_accel_script_persist_calc(zend_persistent_script *new_persistent_script, char *key, unsigned int key_length)
{
	new_persistent_script->mem = NULL;
	new_persistent_script->size = 0;
	new_persistent_script->arena_mem = NULL;
	new_persistent_script->arena_size = 0;
	ZCG(current_persistent_script) = new_persistent_script;

	ADD_DUP_SIZE(new_persistent_script, sizeof(zend_persistent_script));
	if (key) {
		ADD_DUP_SIZE(key, key_length + 1);
	}
	ADD_STRING(new_persistent_script->full_path);

#ifdef __SSE2__
	/* Align size to 64-byte boundary */
	new_persistent_script->size = (new_persistent_script->size + 63) & ~63;
#endif

	zend_accel_persist_class_table_calc(&new_persistent_script->class_table);
	zend_hash_persist_calc(&new_persistent_script->function_table, zend_persist_op_array_calc);
	zend_persist_op_array_calc_ex(&new_persistent_script->main_op_array);

#ifdef __SSE2__
	/* Align size to 64-byte boundary */
	new_persistent_script->arena_size = (new_persistent_script->arena_size + 63) & ~63;
#endif

	new_persistent_script->size += new_persistent_script->arena_size;

	ZCG(current_persistent_script) = NULL;

	return new_persistent_script->size;
}
开发者ID:Crell,项目名称:php-src,代码行数:34,代码来源:zend_persist_calc.c

示例12: PropertiesChangedSignal

/**
 * PropertiesChangedSignal() synthetizes and sends the
 * org.freedesktop.DBus.Properties.PropertiesChanged signal
 */
static DBusHandlerResult
PropertiesChangedSignal( intf_thread_t    *p_intf,
                         vlc_dictionary_t *p_changed_properties )
{
    DBusConnection  *p_conn = p_intf->p_sys->p_conn;
    DBusMessageIter changed_properties, invalidated_properties;
    const char *psz_interface_name = DBUS_MPRIS_PLAYER_INTERFACE;
    char **ppsz_properties = NULL;

    SIGNAL_INIT( DBUS_INTERFACE_PROPERTIES,
                 DBUS_MPRIS_OBJECT_PATH,
                 "PropertiesChanged" );

    OUT_ARGUMENTS;
    ADD_STRING( &psz_interface_name );

    if( !dbus_message_iter_open_container( &args, DBUS_TYPE_ARRAY, "{sv}",
                                           &changed_properties ) )
        return DBUS_HANDLER_RESULT_NEED_MEMORY;

    ppsz_properties = vlc_dictionary_all_keys( p_changed_properties );

    if( unlikely(!ppsz_properties) )
    {
        dbus_message_iter_abandon_container( &args, &changed_properties );
        return DBUS_HANDLER_RESULT_NEED_MEMORY;
    }

    for( int i = 0; ppsz_properties[i]; i++ )
    {
        PROPERTY_MAPPING_BEGIN
        PROPERTY_ENTRY( Metadata,       "a{sv}" )
        PROPERTY_ENTRY( PlaybackStatus, "s"     )
        PROPERTY_ENTRY( LoopStatus,     "s"     )
        PROPERTY_ENTRY( Rate,           "d"     )
        PROPERTY_ENTRY( Shuffle,        "b"     )
        PROPERTY_ENTRY( Volume,         "d"     )
        PROPERTY_ENTRY( CanSeek,        "b"     )
        PROPERTY_ENTRY( CanPlay,        "b"     )
        PROPERTY_ENTRY( CanPause,       "b"     )
        PROPERTY_MAPPING_END

        free( ppsz_properties[i] );
    }

    free( ppsz_properties );

    if( !dbus_message_iter_close_container( &args, &changed_properties ) )
        return DBUS_HANDLER_RESULT_NEED_MEMORY;

    if( !dbus_message_iter_open_container( &args, DBUS_TYPE_ARRAY, "s",
                                           &invalidated_properties ) )
        return DBUS_HANDLER_RESULT_NEED_MEMORY;

    if( !dbus_message_iter_close_container( &args, &invalidated_properties ) )
        return DBUS_HANDLER_RESULT_NEED_MEMORY;

    SIGNAL_SEND;
}
开发者ID:chouquette,项目名称:vlc,代码行数:63,代码来源:dbus_player.c

示例13: PropertiesChangedSignal

/**
 * PropertiesChangedSignal: synthetizes and sends the
 * org.freedesktop.DBus.Properties.PropertiesChanged signal
 */
static DBusHandlerResult
PropertiesChangedSignal( intf_thread_t    *p_intf,
                         vlc_dictionary_t *p_changed_properties )
{
    DBusConnection  *p_conn = p_intf->p_sys->p_conn;
    DBusMessageIter changed_properties, invalidated_properties;
    const char *psz_interface_name = DBUS_MPRIS_TRACKLIST_INTERFACE;
    char **ppsz_properties = NULL;
    int i_properties = 0;

    SIGNAL_INIT( DBUS_INTERFACE_PROPERTIES,
                 DBUS_MPRIS_OBJECT_PATH,
                 "PropertiesChanged" );

    OUT_ARGUMENTS;
    ADD_STRING( &psz_interface_name );

    if( unlikely(!dbus_message_iter_open_container( &args,
                                                    DBUS_TYPE_ARRAY, "{sv}",
                                                    &changed_properties )) )
        return DBUS_HANDLER_RESULT_NEED_MEMORY;

    if( unlikely(!dbus_message_iter_close_container( &args,
                                                     &changed_properties )) )
        return DBUS_HANDLER_RESULT_NEED_MEMORY;

    if( unlikely(!dbus_message_iter_open_container( &args, DBUS_TYPE_ARRAY, "s",
                                                    &invalidated_properties )) )
        return DBUS_HANDLER_RESULT_NEED_MEMORY;

    i_properties    = vlc_dictionary_keys_count( p_changed_properties );
    ppsz_properties = vlc_dictionary_all_keys( p_changed_properties );

    if( unlikely(!ppsz_properties) )
    {
        dbus_message_iter_abandon_container( &args, &invalidated_properties );
        return DBUS_HANDLER_RESULT_NEED_MEMORY;
    }

    for( int i = 0; i < i_properties; i++ )
    {
        if( !strcmp( ppsz_properties[i], "Tracks" ) )
            dbus_message_iter_append_basic( &invalidated_properties,
                                            DBUS_TYPE_STRING,
                                            &ppsz_properties[i] );

        free( ppsz_properties[i] );
    }

    free( ppsz_properties );

    if( unlikely(!dbus_message_iter_close_container( &args,
                    &invalidated_properties )) )
        return DBUS_HANDLER_RESULT_NEED_MEMORY;

    SIGNAL_SEND;
}
开发者ID:371816210,项目名称:vlc_vlc,代码行数:61,代码来源:dbus_tracklist.c

示例14: zend_persist_property_info_calc

static void zend_persist_property_info_calc(zval *zv)
{
	zend_property_info *prop = Z_PTR_P(zv);

	ADD_ARENA_SIZE(sizeof(zend_property_info));
	ADD_INTERNED_STRING(prop->name, 0);
	if (ZCG(accel_directives).save_comments && prop->doc_comment) {
		ADD_STRING(prop->doc_comment);
	}
}
开发者ID:vucms,项目名称:php-src,代码行数:10,代码来源:zend_persist_calc.c

示例15: CountMessages

wxString COARfile::FormatLocusAlerts(
  const COARsample *pSample,
  COARlocus *pLocus,
  const CAlertViewStatus &viewStatus,
  const wxDateTime *pTime) const
{
  COmittedAlerts mapOmitted;
  wxString sRtn;
  vector<wxString> vs;
  size_t nLen = 0;
  bool bOmit = !viewStatus.GetSampleLocus();
  if(pLocus != NULL)
  {
    wxString s;
    wxString sReview;
    wxString sTitle;
    wxString sNotes = pLocus->GetNotes(pTime);;
    vector<int> vn;
    pLocus->AppendAlerts(&vn,pTime);
    if(bOmit)
    {
      int n = CountMessages(vn,pTime);
      mapOmitted.Add(CAlertViewStatus::SAMPLE_LOCUS,n);
    }
    else
    {
      if(CanEditArtifacts())
      {
        int nReview;
        int nAccept;
        GetReviewerCounts(&nReview,&nAccept,CLabReview::REVIEW_LOCUS);
        sReview = pLocus->FormatReviewAcceptance(pTime);
        s = CheckLocusStatus(pLocus,nReview,nAccept,pTime);
        APPEND_STRING(sReview,s);
        s.Clear();
      }
      if(vn.size())
      {
        s = FormatMessages(vn,2,pTime);
      }
      if( !(s.IsEmpty() && sNotes.IsEmpty() && sReview.IsEmpty()) )
      {
        sTitle = pLocus->GetName();
        sTitle.Append(_T(" " COAR_NOTICE_DISPLAY ":"));
        ADD_STRING(sTitle);
        ADD_STRINGE(s);
        ADD_REVIEW_NOTES(sReview,sNotes,2);
        s.Empty();
      }
    }
  }
  _FormatCommonAlerts(&mapOmitted,pSample,vs,nLen,viewStatus, pTime,true);
  _JoinStrings(sRtn,vs,&mapOmitted,nLen);
  return sRtn;
}
开发者ID:ForensicBioinformatics,项目名称:osiris,代码行数:55,代码来源:COARfile.cpp


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