本文整理汇总了C++中StringStream::width方法的典型用法代码示例。如果您正苦于以下问题:C++ StringStream::width方法的具体用法?C++ StringStream::width怎么用?C++ StringStream::width使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringStream
的用法示例。
在下文中一共展示了StringStream::width方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: toString
String toString(UINT64 val, unsigned short width, char fill, std::ios::fmtflags flags)
{
StringStream stream;
stream.width(width);
stream.fill(fill);
if (flags)
stream.setf(flags);
stream << val;
return stream.str();
}
示例2: toString
//-----------------------------------------------------------------------
String StringConverter::toString(double val, unsigned short precision,
unsigned short width, char fill, std::ios::fmtflags flags)
{
StringStream stream;
stream.precision(precision);
stream.width(width);
stream.fill(fill);
if (flags)
stream.setf(flags);
stream << val;
return stream.str();
}
示例3: toString
//-----------------------------------------------------------------------
String StringConverter::toString(int val,
unsigned short width, char fill, std::ios::fmtflags flags)
{
StringStream stream;
if (msUseLocale)
stream.imbue(msLocale);
stream.width(width);
stream.fill(fill);
if (flags)
stream.setf(flags);
stream << val;
return stream.str();
}
示例4: DoWriteBinary
String CDatabaseConnectionMySql::DoWriteBinary( const ByteArray & array ) const
{
StringStream stream;
stream.setf( std::ios::hex, std::ios::basefield );
for ( auto && it = array.begin(); it != array.end(); ++it )
{
stream.width( 2 );
stream.fill( STR( '0' ) );
stream << int( *it );
}
return STR( "X'" ) + stream.str() + STR( "'" );
}
示例5: _toString
String StringConverter::_toString(T val, uint16 width, char fill, std::ios::fmtflags flags)
{
StringStream stream;
stream.width(width);
stream.fill(fill);
if (flags & std::ios::basefield) {
stream.setf(flags, std::ios::basefield);
stream.setf((flags & ~std::ios::basefield) | std::ios::showbase);
}
else if (flags)
stream.setf(flags);
stream << val;
return stream.str();
}