On 01/26/2012 12:40 PM, Keith McRae wrote:
I've removed all the operator>>/<< from SvStream and replaced with
Read/Write[sal_type] functions.
Great.
While fixing up the references I noticed the template'd functions below:
template<typename prefix>
rtl::OString read_lenPrefixed_uInt8s_ToOString(SvStream& rStrm)
[...]
template<typename prefix> sal_Size
write_lenPrefixed_uInt8s_FromOString(SvStream& rStrm,
const rtl::OString &rStr)
[...]
So I have a dilemma which I would appreciate advice on. In no particular
order of preference here are my ideas:
a) Specialize the templates and call the appropriate
Read/Write[sal_type] functions.
b) Change SvStream to have overloaded Read/WriteNumber functions of all
the sal_ types.
c) Add the above mentioned functions along with the Read/Write[sal_type]
functions to SvStream.
Given that these are almost exclusively called with <sal_uInt16>, I
would simply un-template'ize the functions, substituting sal_uInt16 for
prefix.
For instantiations with prefix != sal_uInt16, I count four uses of
read_lenPrefixed_uInt8s_ToOString<sal_uInt8>, two of
read_lenPrefixed_uInt8s_ToOUString<sal_uInt8>, and one use of
read_lenPrefixed_uInt8s_ToOString<sal_uInt32>. All of them are reads,
for which the functions in question are rather trivial, anyway. I would
just explicitly outline them at the call sites (or, if there are
multiple calls from a single .cxx, add a local helper function).
Stephan
_______________________________________________
LibreOffice mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice