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


C++ TIXML_SNPRINTF函数代码示例

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


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

示例1: defined

void TiXmlAttribute::SetDoubleValue( double _value )
{
    char buf [256];
    #if defined(TIXML_SNPRINTF)
        TIXML_SNPRINTF( buf, sizeof(buf), "%lf", _value);
    #else
        sprintf (buf, "%lf", _value);
    #endif
    SetValue (buf);
}
开发者ID:Armanfarhang,项目名称:iris_core,代码行数:10,代码来源:tinyxml.cpp

示例2: defined

void TiXmlElement::SetDoubleAttribute( const char * name, double val )
{	
	char buf[256];
	#if defined(TIXML_SNPRINTF)		
		TIXML_SNPRINTF( buf, sizeof(buf), "%f", val );
	#else
		sprintf( buf, "%f", val );
	#endif
	SetAttribute( name, buf );
}
开发者ID:rgde,项目名称:rgdengine,代码行数:10,代码来源:tinyxml.cpp

示例3: defined

void TiXmlAttribute::SetUnsignedIntValue( unsigned int _value )
{
	char buf [256];
	#if defined(TIXML_SNPRINTF)		
		TIXML_SNPRINTF( buf, sizeof(buf), "%08x", _value);
	#else
		sprintf (buf, "%08x", _value);
	#endif
	SetValue (buf);
}
开发者ID:LibXenonProject,项目名称:xmplayer,代码行数:10,代码来源:tinyxml.cpp

示例4: TIXML_SNPRINTF

	void XMLDocument::PrintError() const
	{
		if (_errorID)
		{
			static const int LEN = 20;
			char buf1[LEN] = { 0 };
			char buf2[LEN] = { 0 };

			if (_errorStr1)
			{
				TIXML_SNPRINTF(buf1, LEN, "%s", _errorStr1);
			}
			if (_errorStr2)
			{
				TIXML_SNPRINTF(buf2, LEN, "%s", _errorStr2);
			}

			printf("XMLDocument error id=%d '%s' str1=%s str2=%s\n",
				_errorID, ErrorName(), buf1, buf2);
		}
	}
开发者ID:CooperCoders,项目名称:GraphicsProject,代码行数:21,代码来源:tinyxml2.cpp

示例5: setlocale

void TiXmlElement::SetDoubleAttribute( const char * name, double val )
{	
#ifndef WIN32
    // need to switch to default locale "C" to prevent problems when current locale uses comma
    // instead of decimal point
    const char* oldlocale = setlocale(LC_NUMERIC, "C");
#endif

    char buf[256];
	#if defined(TIXML_SNPRINTF)		
		TIXML_SNPRINTF( buf, sizeof(buf), "%f", val );
	#else
		sprintf( buf, "%f", val );
	#endif
	SetAttribute( name, buf );

#ifndef WIN32
    setlocale(LC_NUMERIC, oldlocale);
#endif
}
开发者ID:gobirdwang,项目名称:hmeshsimp,代码行数:20,代码来源:tinyxml.cpp

示例6: TIXML_SNPRINTF

	void XMLUtil::ToStr( double v, char* buffer, int bufferSize )
	{
		TIXML_SNPRINTF( buffer, bufferSize, "%f", v );
	}
开发者ID:dominik-uebele,项目名称:E1,代码行数:4,代码来源:tinyxml2.cpp

示例7: while

void TiXmlBase::EncodeString( const TIXML_STRING& str, TIXML_STRING* outString )
{
	int i=0;

	while( i<(int)str.length() )
	{
		unsigned char c = (unsigned char) str[i];

		if (    c == '&' 
		     && i < ( (int)str.length() - 2 )
			 && str[i+1] == '#'
			 && str[i+2] == 'x' )
		{
			// Hexadecimal character reference.
			// Pass through unchanged.
			// &#xA9;	-- copyright symbol, for example.
			//
			// The -1 is a bug fix from Rob Laveaux. It keeps
			// an overflow from happening if there is no ';'.
			// There are actually 2 ways to exit this loop -
			// while fails (error case) and break (semicolon found).
			// However, there is no mechanism (currently) for
			// this function to return an error.
			while ( i<(int)str.length()-1 )
			{
				outString->append( str.c_str() + i, 1 );
				++i;
				if ( str[i] == ';' )
					break;
			}
		}
		else if ( c == '&' )
		{
			outString->append( entity[0].str, entity[0].strLength );
			++i;
		}
		else if ( c == '<' )
		{
			outString->append( entity[1].str, entity[1].strLength );
			++i;
		}
		else if ( c == '>' )
		{
			outString->append( entity[2].str, entity[2].strLength );
			++i;
		}
		else if ( c == '\"' )
		{
			outString->append( entity[3].str, entity[3].strLength );
			++i;
		}
		else if ( c == '\'' )
		{
			outString->append( entity[4].str, entity[4].strLength );
			++i;
		}
		else if ( c < 32 )
		{
			// Easy pass at non-alpha/numeric/symbol
			// Below 32 is symbolic.
			char buf[ 32 ];
			
			#if defined(TIXML_SNPRINTF)		
				TIXML_SNPRINTF( buf, sizeof(buf), "&#x%02X;", (unsigned) ( c & 0xff ) );
			#else
				sprintf( buf, "&#x%02X;", (unsigned) ( c & 0xff ) );
			#endif		

			//*ME:	warning C4267: convert 'size_t' to 'int'
			//*ME:	Int-Cast to make compiler happy ...
			outString->append( buf, (int)strlen( buf ) );
			++i;
		}
		else
		{
			//char realc = (char) c;
			//outString->append( &realc, 1 );
			*outString += (char) c;	// somewhat more efficient function call.
			++i;
		}
	}
}
开发者ID:dos5gw,项目名称:TMeter,代码行数:82,代码来源:tinyxml.cpp

示例8: TIXML_SNPRINTF

void XMLUtil::ToStr( float v, char* buffer, int bufferSize )
{
    TIXML_SNPRINTF( buffer, bufferSize, "%.8g", v );
}
开发者ID:adityasraghav,项目名称:OpenGL_SolarSystem,代码行数:4,代码来源:tinyxml2.cpp

示例9: TIXML_SNPRINTF

std::string VarFloat::GetString()
{
	char buf[16];
	TIXML_SNPRINTF( buf, sizeof(buf), "%f", value );
	return std::string(buf);
}
开发者ID:Fissuras,项目名称:videoventure,代码行数:6,代码来源:Variable.cpp


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