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

C++ NumToString函数代码示例

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

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



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

示例1: NumToString

SSRVideoStreamWriter::SSRVideoStreamWriter(const std::string& channel, const std::string& source) {

    std::string stream_name = NumToString(hrt_time_micro()) + "-" + NumToString(getpid()) + "-" + source + "-" + GetProgramName();

    m_channel_directory = "/dev/shm/ssr-" + ((channel.empty())? "channel-" + GetUserName() : channel);
    m_filename_main = m_channel_directory + "/video-" + stream_name;
    m_page_size = sysconf(_SC_PAGE_SIZE);
    m_width = 0;
    m_height = 0;
    m_stride = 0;
    m_next_frame_time = hrt_time_micro();

    m_fd_main = -1;
    m_mmap_ptr_main = MAP_FAILED;
    m_mmap_size_main = 0;

    for(unsigned int i = 0; i < GLINJECT_RING_BUFFER_SIZE; ++i) {
        FrameData &fd = m_frame_data[i];
        fd.m_filename_frame = m_channel_directory + "/videoframe" + NumToString(i) + "-" + stream_name;
        fd.m_fd_frame = -1;
        fd.m_mmap_ptr_frame = MAP_FAILED;
        fd.m_mmap_size_frame = 0;
    }

    try {
        Init();
    } catch(...) {
        Free();
        throw;
    }

}
开发者ID:Drakeo,项目名称:ssr,代码行数:32,代码来源:SSRVideoStreamWriter.cpp


示例2: NumToString

void Map::printBlank(bool invert)
{

	int neg;
	std::string id, temp;
	if (!invert){
		neg = 0;
		xpass++;
		temp = "Blank";
		id = NumToString(xpass);
		temp += id;
	}
	else{
		neg = 1;
		ypass++;
		temp = "Inverse_Blank";
		id = NumToString(ypass);
		temp += id;
	}

	save(temp);
	std::ofstream fout(path);
	for (int r = 0; r < y; r++)
	{
		for (int c = 0; c < x; c++)
		{
			fout << neg;
			if (r != (y - 1) || c != (x - 1))
				fout << ", ";
		}
		fout << std::endl;
	}
}
开发者ID:kchrome01,项目名称:Bit-Box,代码行数:33,代码来源:Map.cpp


示例3: BIMCreatePortName

static CFStringRef BIMCreatePortName( const ProcessSerialNumber *inProcessSerialNumber )
{
    CFMutableStringRef	portName;
    CFStringRef		processSerialNumberStringRef;
    Str255		processSerialNumberString;
    Str255		processSerialNumberLowString;

    //  Convert the high and low parts of the process serial number into a string.

    NumToString( inProcessSerialNumber->highLongOfPSN, processSerialNumberString );
    NumToString( inProcessSerialNumber->lowLongOfPSN, processSerialNumberLowString );
    BlockMoveData( processSerialNumberLowString + 1,
                   processSerialNumberString + processSerialNumberString [0] + 1,
                   processSerialNumberLowString [0] );
    processSerialNumberString [0] += processSerialNumberLowString [0];

    //  Create a CFString and append the process serial number string onto the end.

    portName = CFStringCreateMutableCopy( NULL, 255, CFSTR( kBasicServerPortName ) );
    processSerialNumberStringRef = CFStringCreateWithPascalString( NULL,
                                                                   processSerialNumberString,
                                                                   CFStringGetSystemEncoding() );
    CFStringAppend( portName, processSerialNumberStringRef );
    CFRelease( processSerialNumberStringRef );
    return portName;
}
开发者ID:fruitsamples,项目名称:BasicInputMethod,代码行数:26,代码来源:BIMMessageReceive.c


示例4: UpdateHistories

void UpdateHistories(GPtr globals, DialogPtr dp, short count, Str255 hS)
{
	Str255 	s = "";
	Str255  n1 = "";
	Str255	n2 = "";
	Str255	nT = "";
	Str255	ss = "";
	long	x = gCurrentHistory + (kDHistTotal - 1);
	short	loop;

	PICopy(ss, hS, hS[0]+1); // make a new copy

	for (loop = gCurrentHistory; loop < gCurrentHistory + kDHistTotal; loop++)
	{
		GetHistory (globals, loop, s);
		if (loop == gCurrentHistory && !s[0])
		{
			PIGetString(kNoHistories, s);
			PIResetString(ss);
		}
		StuffText (dp, kDHistItem1 + (loop - gCurrentHistory), s);
		if (s[0] < 1 && x > loop-1)
			x = loop-1;
	}

	if (ss[0] > 0)
	{ // got the display string.  Populate it.
		NumToString(gCurrentHistory, n1);
		NumToString(x, n2);
		NumToString(count, nT);
		PIParamText(ss, n1, n2, nT);
	}
	StuffText (dp, kDStatusText, ss);
	// even if nothing, stuff empty or string in field
}
开发者ID:jxfengzi,项目名称:AirPhoto,代码行数:35,代码来源:HistoryUIMac.cpp


示例5: ReadSetupValue

std::string cEpgsearchServiceHandler::ReadSetupValue(const std::string& entry)
{
   if (entry == "DefPriority") return NumToString(EPGSearchConfig.DefPriority);
   if (entry == "DefLifetime") return NumToString(EPGSearchConfig.DefLifetime);
   if (entry == "DefMarginStart") return NumToString(EPGSearchConfig.DefMarginStart);
   if (entry == "DefMarginStop") return NumToString(EPGSearchConfig.DefMarginStop);
   return "";
}
开发者ID:flensrocker,项目名称:vdr-plugin-epgsearch,代码行数:8,代码来源:services.c


示例6: BuildVectorOfTable

// Set the value of one of the members of a table's vector.
static void BuildVectorOfTable(const StructDef &struct_def,
                               const FieldDef &field,
                               std::string *code_ptr) {
  std::string &code = *code_ptr;
  code += "def " + struct_def.name + "Start";
  code += MakeCamel(field.name);
  code += "Vector(builder, numElems): return builder.StartVector(";
  auto vector_type = field.value.type.VectorType();
  auto alignment = InlineAlignment(vector_type);
  auto elem_size = InlineSize(vector_type);
  code += NumToString(elem_size);
  code += ", numElems, " + NumToString(alignment);
  code += ")\n";
}
开发者ID:TGIshib,项目名称:flatbuffers,代码行数:15,代码来源:idl_gen_python.cpp


示例7: EnumMember

// A single enum member.
static void EnumMember(const EnumVal ev, std::string *code_ptr) {
  std::string &code = *code_ptr;
  code += Indent;
  code += ev.name;
  code += " = ";
  code += NumToString(ev.value) + "\n";
}
开发者ID:TGIshib,项目名称:flatbuffers,代码行数:8,代码来源:idl_gen_python.cpp


示例8: OffsetPrefix

// Most field accessors need to retrieve and test the field offset first,
// this is the prefix code for that.
std::string OffsetPrefix(const FieldDef &field) {
  return "\n" + Indent + Indent +
         "o = flatbuffers.number_types.UOffsetTFlags.py_type" +
         "(self._tab.Offset(" +
         NumToString(field.value.offset) +
         "))\n" + Indent + Indent + "if o != 0:\n";
}
开发者ID:TGIshib,项目名称:flatbuffers,代码行数:9,代码来源:idl_gen_python.cpp


示例9: WriteNumToDebugFile

/* デバッグファイルに数字を出力 */
void WriteNumToDebugFile(short num)
{
	Str255	str;
	
	NumToString(num,str);
	WriteStrToDebugFile(str);
}
开发者ID:amatubu,项目名称:iconparty,代码行数:8,代码来源:DebugMode.c


示例10: GetUserName

SSRVideoStreamReader::SSRVideoStreamReader(const std::string& channel, const SSRVideoStream& stream) {

	m_stream = stream;
	m_channel_directory = "/dev/shm/ssr-" + ((channel.empty())? "channel-" + GetUserName() : channel);
	m_filename_main = m_channel_directory + "/video-" + stream.m_stream_name;
	m_page_size = sysconf(_SC_PAGE_SIZE);

	m_fd_main = -1;
	m_mmap_ptr_main = MAP_FAILED;
	m_mmap_size_main = 0;

	for(unsigned int i = 0; i < GLINJECT_RING_BUFFER_SIZE; ++i) {
		FrameData &fd = m_frame_data[i];
		fd.m_filename_frame = m_channel_directory + "/videoframe" + NumToString(i) + "-" + stream.m_stream_name;
		fd.m_fd_frame = -1;
		fd.m_mmap_ptr_frame = MAP_FAILED;
		fd.m_mmap_size_frame = 0;
	}

	try {
		Init();
	} catch(...) {
		Free();
		throw;
	}

}
开发者ID:MaartenBaert,项目名称:ssr-packages,代码行数:27,代码来源:SSRVideoStreamReader.cpp


示例11: CheckBitsFit

// Ensure that integer values we parse fit inside the declared integer type.
static void CheckBitsFit(int64_t val, size_t bits) {
  auto mask = (1ll << bits) - 1;  // Bits we allow to be used.
  if (bits < 64 &&
      (val & ~mask) != 0 &&  // Positive or unsigned.
      (val |  mask) != -1)   // Negative.
    Error("constant does not fit in a " + NumToString(bits) + "-bit field");
}
开发者ID:Jiboo,项目名称:Dwiinaar,代码行数:8,代码来源:idl_parser.cpp


示例12: jack_port_by_id

void JACKInput::PortConnectCallback(jack_port_id_t a, jack_port_id_t b, int connect, void* arg) {
	// This callback is called from the notification thread (not the realtime processing thread), so sadly the timing can never be fully accurate.
	// To make things worse, we're not allowed to connect/disconnect ports from this thread, so we have to send a command to the input thread instead.
	JACKInput *input = (JACKInput*) arg;
	if(input->m_connect_system_playback) {
		jack_port_t *port_a = jack_port_by_id(input->m_jack_client, a);
		if(port_a == NULL)
			return;
		jack_port_t *port_b = jack_port_by_id(input->m_jack_client, b);
		if(port_b == NULL)
			return;
		const char *port_a_name = jack_port_name(port_a);
		const char *port_b_name = jack_port_name(port_b);
		for(unsigned int i = 0; i < input->m_channels; ++i) {
			std::string playback_name = "system:playback_" + NumToString(i + 1);
			if(port_b_name == playback_name) {
				std::string port_name_full = std::string(jack_get_client_name(input->m_jack_client)) + ":in_" + NumToString(i + 1);
				SharedLock lock(&input->m_shared_data);
				ConnectCommand cmd;
				cmd.m_connect = connect;
				cmd.m_source = port_a_name;
				cmd.m_destination = port_name_full;
				lock->m_connect_commands.push_back(cmd);
			}
		}
	}
}
开发者ID:Faik-man,项目名称:ssr,代码行数:27,代码来源:JACKInput.cpp


示例13: ParTextOf

//---------------------------------------------------------------------------
static BaseString ParTextOf(int Error)
{
    switch(Error)
    {
        case 0 :                       return "";
        case errParAddressInUse      : return "PAR : Local address already in use";
        case errParNoRoom            : return "PAR : No more partners available";
        case errServerNoRoom         : return "PAR : No more servers available";
        case errParInvalidParams     : return "PAR : Invalid parameter supplied";
        case errParNotLinked         : return "PAR : Cannot perform, Partner not linked";
        case errParBusy              : return "PAR : Cannot perform, Partner Busy";
        case errParFrameTimeout      : return "PAR : Frame timeout";
        case errParInvalidPDU        : return "PAR : Invalid PDU received";
        case errParSendTimeout       : return "PAR : Send timeout";
        case errParRecvTimeout       : return "PAR : Recv timeout";
        case errParSendRefused       : return "PAR : Send refused by peer";
        case errParNegotiatingPDU    : return "PAR : Error negotiating PDU";
        case errParSendingBlock      : return "PAR : Error Sending Block";
        case errParRecvingBlock      : return "PAR : Error Receiving Block";
        case errParBindError         : return "PAR : Error Binding";
        case errParDestroying        : return "PAR : Cannot perform (destroying)";
        case errParInvalidParamNumber: return "PAR : Invalid Param Number";
        case errParCannotChangeParam : return "PAR : Cannot change this param now";
        case errParBufferTooSmall    : return "PAR : The buffer supplied is too small to accomplish the operation";
        default : return "PAR : Unknown error (0x"+NumToString(Error,16,8)+")";
    }

}
开发者ID:GermanBluefox,项目名称:ioBroker.s7,代码行数:29,代码来源:s7_text.cpp


示例14: BuildFieldOfTable

// Set the value of a table's field.
static void BuildFieldOfTable(const StructDef &struct_def,
                              const FieldDef &field,
                              const size_t offset,
                              std::string *code_ptr) {
  std::string &code = *code_ptr;
  code += "func " + struct_def.name + "Add" + MakeCamel(field.name);
  code += "(builder *flatbuffers.Builder, ";
  code += MakeCamel(field.name, false) + " ";
  if (!IsScalar(field.value.type.base_type) && (!struct_def.fixed)) {
    code += "flatbuffers.UOffsetT";
  } else {
    code += GenTypeBasic(field.value.type);
  }
  code += ") {\n";
  code += "\tbuilder.Prepend";
  code += GenMethod(field) + "Slot(";
  code += NumToString(offset) + ", ";
  if (!IsScalar(field.value.type.base_type) && (!struct_def.fixed)) {
    code += "flatbuffers.UOffsetT";
    code += "(";
    code += MakeCamel(field.name, false) + ")";
  } else {
    code += MakeCamel(field.name, false);
  }
  code += ", " + field.value.constant;
  code += ")\n}\n";
}
开发者ID:MinhHTML5,项目名称:FocusFire,代码行数:28,代码来源:idl_gen_go.cpp


示例15: drawPixelImageData

void drawPixelImageData()
{
	int				row, col;
	Rect			rect;
	unsigned char	value;
	char			*image;
	int				index = 0;
	Str255			string;
	RGBColor		color = { 32000, 32000, 32000 };
	//Byte			mode;
	Rect			tempRect1;
	
	ForeColor( blackColor );
	
	SetRect( &rect, 0, 0, 20, 20 );
	
	/* For this example, let's just use only the upper left corner of the image. */
	
	// Draw the offscreen image to the screen to see what it looks like.
	//CopyBits( (BitMap *)*gPixmap, &gWindow->portBits, &rect,
	//		&gWindow->portRect, srcCopy, 0 );
	//(**gPixmap).rowBytes ^= 0x8000;
	CopyBits( (BitMap *)*gPixmap, GetPortBitMapForCopyBits(GetWindowPort(gWindow)), &rect,
			GetPortBounds(GetWindowPort(gWindow), &tempRect1), srcCopy, 0 );
	//(**gPixmap).rowBytes ^= 0x8000;
	
	RGBForeColor( &color );
	
	// Again, set the pointer to the beginning of the pixel image.
	image = GetPixBaseAddr( gPixmap );
	
	/***************************************************************/
	/* Finally let's display the pixel values on top of the image. */
	/***************************************************************/
	
	/* Loop through the first 20 rows of the pixel image. */
	for (row = 0; row < rect.bottom; row++)
	{
		// Loop through the first 20 columns of the pixel image. 
		for (index = 0, col = 0; col < rect.right; col++)
		{
			// Get the value at this index into the pixel image. 
			value = (unsigned char)*(image + index);
			
			MoveTo( col * 30, row * 20 );
			LineTo( col * 30, (row + 1) * 20 );
			LineTo( (col + 1) * 30, (row + 1) * 20 );
			
			MoveTo( (col * 30) + 6, (row * 20) + 14 );
			NumToString( (long)value, string );
			DrawString( string );
			
			index++;
		}
		
		// Increment the pointer to the next row of the pixel image. 
		image += ((**gPixmap).rowBytes & 0x7fff);
	}
}
开发者ID:fruitsamples,项目名称:Direct_Pixel_Access,代码行数:59,代码来源:Direct+Pixel+Access.c


示例16: ReadSZLText

//---------------------------------------------------------------------------
static BaseString ReadSZLText(TSrvEvent &Event)
{
    BaseString Result="Read SZL request, ID:0x"+NumToString(Event.EvtParam1,16,4)+" INDEX:0x"+NumToString(Event.EvtParam2,16,4);
    if (Event.EvtRetCode == evrNoError)
        return Result+" --> OK";
    else
        return Result+" --> NOT AVAILABLE";
}
开发者ID:GermanBluefox,项目名称:ioBroker.s7,代码行数:9,代码来源:s7_text.cpp


示例17: GetStartOfTable

// Get the value of a table's starting offset.
static void GetStartOfTable(const StructDef &struct_def,
                            std::string *code_ptr) {
  std::string &code = *code_ptr;
  code += "func " + struct_def.name + "Start";
  code += "(builder *flatbuffers.Builder) {\n";
  code += "\tbuilder.StartObject(";
  code += NumToString(struct_def.fields.vec.size());
  code += ")\n}\n";
}
开发者ID:MinhHTML5,项目名称:FocusFire,代码行数:10,代码来源:idl_gen_go.cpp


示例18: EnumMember

// A single enum member.
static void EnumMember(const EnumDef &enum_def, const EnumVal ev,
                       std::string *code_ptr) {
  std::string &code = *code_ptr;
  code += "\t";
  code += enum_def.name;
  code += ev.name;
  code += " = ";
  code += NumToString(ev.value) + "\n";
}
开发者ID:MinhHTML5,项目名称:FocusFire,代码行数:10,代码来源:idl_gen_go.cpp


示例19: Error

// Parses exactly nibbles worth of hex digits into a number, or error.
int64_t Parser::ParseHexNum(int nibbles) {
  for (int i = 0; i < nibbles; i++)
    if (!isxdigit(cursor_[i]))
      Error("escape code must be followed by " + NumToString(nibbles) +
            " hex digits");
  auto val = StringToInt(cursor_, 16);
  cursor_ += nibbles;
  return val;
}
开发者ID:BlueBrain,项目名称:flatbuffers,代码行数:10,代码来源:idl_parser.cpp


示例20: GenStructBody

// Recusively generate struct construction statements of the form:
// builder.putType(name);
// and insert manual padding.
static void GenStructBody(const StructDef &struct_def, std::string *code_ptr,
                          const char *nameprefix) {
  std::string &code = *code_ptr;
  code += "    builder.prep(" + NumToString(struct_def.minalign) + ", 0);\n";
  for (auto it = struct_def.fields.vec.rbegin();
       it != struct_def.fields.vec.rend();
       ++it) {
    auto &field = **it;
    if (field.padding)
      code += "    builder.pad(" + NumToString(field.padding) + ");\n";
    if (IsStruct(field.value.type)) {
      GenStructBody(*field.value.type.struct_def, code_ptr,
                    (field.value.type.struct_def->name + "_").c_str());
    } else {
      code += "    builder.put" + GenMethod(field) + "(";
      code += nameprefix + MakeCamel(field.name, false) + ");\n";
    }
  }
}
开发者ID:Abioy,项目名称:flatbuffers,代码行数:22,代码来源:idl_gen_java.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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