Exemplo n.º 1
0
TSTRING cFCOPropUint64::AsString() const
{
    //TODO:mdb -- implement this through twlocale!
    //
    TOSTRINGSTREAM ostr;
    ostr.imbue( std::locale::classic() );
    ostr << (int32)mValue ;
    return TSTRING(ostr.str());
}
TSTRING cCRC32Signature::AsStringHex() const
{
    TOSTRINGSTREAM ss;

    ss.imbue( std::locale::classic() );
    ss.setf( ios::hex, ios::basefield );

    ss << (size_t)mCRCInfo.crc;

    return ss.str();
}
TSTRING cChecksumSignature::AsStringHex() const
{
    TOSTRINGSTREAM ss;

    ss.imbue( std::locale::classic() );
    ss.setf( ios::hex, ios::basefield );
    
    ASSERT( false ); 
    ss << (size_t)(uint32) mChecksum; // TODO:BAM -- this is truncating a 64-bit value to 32 bits!

    return ss.str();
}
TSTRING cCharEncoderUtil::char_to_hex( TCHAR ch )
{
    TOSTRINGSTREAM ss;

    ss.imbue( std::locale::classic() );
    ss.fill ( _T('0') );
    ss.width( TCHAR_AS_HEX__IN_TCHARS );
    ss.setf( std::ios_base::hex, std::ios_base::basefield );

    ss << tss::util::char_to_size( ch );

    if( ss.bad() || ss.fail() || 
        ss.str().length() != TCHAR_AS_HEX__IN_TCHARS )
        ThrowAndAssert( eBadHexConversion( TSTRING( 1, ch ) ) );
    return ss.str();
}