more SvStream:operator>> conversion

Convert the template based read_lenPrefixed methods to regular
methods.

Change-Id: Ifd0e93aca055e55a0575e4377ec2b8e266dfb019
Reviewed-on: https://gerrit.libreoffice.org/7895
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
This commit is contained in:
Noel Grandin
2014-02-06 12:44:59 +02:00
committed by Michael Stahl
parent 15535e32dd
commit b2878af322
32 changed files with 116 additions and 92 deletions

View File

@@ -73,8 +73,8 @@ public:
friend SvStream& ReadINetMessageHeader (
SvStream& rStrm, INetMessageHeader& rHdr)
{
rHdr.m_aName = read_lenPrefixed_uInt8s_ToOString<sal_uInt16>(rStrm);
rHdr.m_aValue = read_lenPrefixed_uInt8s_ToOString<sal_uInt16>(rStrm);
rHdr.m_aName = read_uInt16_lenPrefixed_uInt8s_ToOString(rStrm);
rHdr.m_aValue = read_uInt16_lenPrefixed_uInt8s_ToOString(rStrm);
return rStrm;
}
};

View File

@@ -550,11 +550,17 @@ TOOLS_DLLPUBLIC OUString read_uInt16s_ToOUString(SvStream& rStrm,
/// Attempt to read a pascal-style length (of type prefix) prefixed sequence of
/// 16bit units to an OUString, returned OString's length is number of
/// units successfully read.
template<typename prefix>
OUString read_lenPrefixed_uInt16s_ToOUString(SvStream& rStrm)
TOOLS_DLLPUBLIC inline OUString read_uInt16_lenPrefixed_uInt16s_ToOUString(SvStream& rStrm)
{
prefix nUnits = 0;
rStrm >> nUnits;
sal_uInt16 nUnits = 0;
rStrm.ReadUInt16( nUnits );
return read_uInt16s_ToOUString(rStrm, nUnits);
}
TOOLS_DLLPUBLIC inline OUString read_uInt32_lenPrefixed_uInt16s_ToOUString(SvStream& rStrm)
{
sal_uInt32 nUnits = 0;
rStrm.ReadUInt32( nUnits );
return read_uInt16s_ToOUString(rStrm, nUnits);
}
@@ -595,21 +601,39 @@ TOOLS_DLLPUBLIC OUString read_zeroTerminated_uInt8s_ToOUString(SvStream& rStrm,
/// Attempt to read a pascal-style length (of type prefix) prefixed sequence of
/// 8bit units to an OString, returned OString's length is number of units
/// successfully read.
template<typename prefix>
OString read_lenPrefixed_uInt8s_ToOString(SvStream& rStrm)
TOOLS_DLLPUBLIC inline OString read_uInt16_lenPrefixed_uInt8s_ToOString(SvStream& rStrm)
{
prefix nUnits = 0;
rStrm >> nUnits;
sal_uInt16 nUnits = 0;
rStrm.ReadUInt16( nUnits );
return read_uInt8s_ToOString(rStrm, nUnits);
}
TOOLS_DLLPUBLIC inline OString read_uInt8_lenPrefixed_uInt8s_ToOString(SvStream& rStrm)
{
sal_uInt8 nUnits = 0;
rStrm.ReadUChar( nUnits );
return read_uInt8s_ToOString(rStrm, nUnits);
}
TOOLS_DLLPUBLIC inline OString read_uInt32_lenPrefixed_uInt8s_ToOString(SvStream& rStrm)
{
sal_uInt32 nUnits = 0;
rStrm.ReadUInt32( nUnits );
return read_uInt8s_ToOString(rStrm, nUnits);
}
/// Attempt to read a pascal-style length (of type prefix) prefixed sequence of
/// 8bit units to an OUString
template<typename prefix>
OUString read_lenPrefixed_uInt8s_ToOUString(SvStream& rStrm,
TOOLS_DLLPUBLIC inline OUString read_uInt16_lenPrefixed_uInt8s_ToOUString(SvStream& rStrm,
rtl_TextEncoding eEnc)
{
return OStringToOUString(read_lenPrefixed_uInt8s_ToOString<prefix>(rStrm), eEnc);
return OStringToOUString(read_uInt16_lenPrefixed_uInt8s_ToOString(rStrm), eEnc);
}
TOOLS_DLLPUBLIC inline OUString read_uInt8_lenPrefixed_uInt8s_ToOUString(SvStream& rStrm,
rtl_TextEncoding eEnc)
{
return OStringToOUString(read_uInt8_lenPrefixed_uInt8s_ToOString(rStrm), eEnc);
}
/// Attempt to write a prefixed sequence of nUnits 8bit units from an OString,