MCPcopy Create free account
hub / github.com/OGRECave/ogre-next / toString

Method toString

OgreMain/src/OgreStringConverter.cpp:93–118  ·  view source on GitHub ↗

-----------------------------------------------------------------------

Source from the content-addressed store, hash-verified

91 }
92 //-----------------------------------------------------------------------
93 String StringConverter::toString( float val, unsigned short precision, unsigned short width,
94 char fill, std::ios::fmtflags flags )
95 {
96#ifdef OGRE_HAS_CHARCONV_FLOAT
97 if( width == 0 && flags == std::ios::fmtflags( 0 ) )
98 {
99 char buf[32];
100 to_chars_result res =
101 precision ? to_chars( buf, buf + sizeof( buf ), val, chars_format::general, precision )
102 : to_chars( buf, buf + sizeof( buf ), val );
103 assert( res.ec == errc() );
104 return String( buf, res.ptr );
105 }
106#endif
107 StringStream stream;
108 if( msUseLocale )
109 stream.imbue( msLocale );
110 if( precision != 0 )
111 stream.precision( precision );
112 stream.width( width );
113 stream.fill( fill );
114 if( flags )
115 stream.setf( flags );
116 stream << val;
117 return stream.str();
118 }
119 //-----------------------------------------------------------------------
120 String StringConverter::toString( double val, unsigned short precision, unsigned short width,
121 char fill, std::ios::fmtflags flags )

Callers 3

writeFunction · 0.45
logMethod · 0.45
initialiseExtensionsMethod · 0.45

Calls 4

to_chars_allFunction · 0.85
widthMethod · 0.80
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected