diff options
Diffstat (limited to 'package/inc/ByteChucker.hxx')
-rw-r--r-- | package/inc/ByteChucker.hxx | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/package/inc/ByteChucker.hxx b/package/inc/ByteChucker.hxx index 7e3e60c0ce65..e317e8acd6c4 100644 --- a/package/inc/ByteChucker.hxx +++ b/package/inc/ByteChucker.hxx @@ -48,12 +48,37 @@ public: sal_Int64 GetPosition() throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - ByteChucker& WriteInt8(sal_Int8 nInt8); - ByteChucker& WriteInt16(sal_Int16 nInt16); - ByteChucker& WriteInt32(sal_Int32 nInt32); - ByteChucker& WriteUInt8(sal_uInt8 nuInt8); - ByteChucker& WriteUInt16(sal_uInt16 nuInt16); - ByteChucker& WriteUInt32(sal_uInt32 nuInt32); + void WriteInt16(sal_Int16 nInt16) + { + p2Sequence[0] = static_cast< sal_Int8 >((nInt16 >> 0 ) & 0xFF); + p2Sequence[1] = static_cast< sal_Int8 >((nInt16 >> 8 ) & 0xFF); + WriteBytes( a2Sequence ); + } + + void WriteInt32(sal_Int32 nInt32) + { + p4Sequence[0] = static_cast< sal_Int8 >((nInt32 >> 0 ) & 0xFF); + p4Sequence[1] = static_cast< sal_Int8 >((nInt32 >> 8 ) & 0xFF); + p4Sequence[2] = static_cast< sal_Int8 >((nInt32 >> 16 ) & 0xFF); + p4Sequence[3] = static_cast< sal_Int8 >((nInt32 >> 24 ) & 0xFF); + WriteBytes( a4Sequence ); + } + + void WriteUInt16(sal_uInt16 nuInt16) + { + p2Sequence[0] = static_cast< sal_Int8 >((nuInt16 >> 0 ) & 0xFF); + p2Sequence[1] = static_cast< sal_Int8 >((nuInt16 >> 8 ) & 0xFF); + WriteBytes( a2Sequence ); + } + + void WriteUInt32(sal_uInt32 nuInt32) + { + p4Sequence[0] = static_cast < sal_Int8 > ((nuInt32 >> 0 ) & 0xFF); + p4Sequence[1] = static_cast < sal_Int8 > ((nuInt32 >> 8 ) & 0xFF); + p4Sequence[2] = static_cast < sal_Int8 > ((nuInt32 >> 16 ) & 0xFF); + p4Sequence[3] = static_cast < sal_Int8 > ((nuInt32 >> 24 ) & 0xFF); + WriteBytes( a4Sequence ); + } }; #endif |