Hello all<br><br>I've removed all the operator>>/<< from SvStream and replaced with Read/Write[sal_type] functions. While fixing up the references I noticed the template'd functions below:<br><br>template<typename prefix><br>
rtl::OString read_lenPrefixed_uInt8s_ToOString(SvStream& rStrm)<br>{<br> prefix nUnits = 0;<br> rStrm >> nUnits;<br> return read_uInt8s_ToOString(rStrm, nUnits);<br>}<br><br>and the corresponding write function:<br>
<br>template<typename prefix> sal_Size write_lenPrefixed_uInt8s_FromOString(SvStream& rStrm,<br> const rtl::OString &rStr)<br>{<br> SAL_WARN_IF(rStr.getLength() > std::numeric_limits<prefix>::max(),<br>
"tools.stream",<br> "string too long for prefix count to fit in output type");<br><br> sal_Size nWritten = 0;<br> prefix nUnits = std::min<sal_Size>(rStr.getLength(), std::numeric_limits<prefix>::max());<br>
rStrm << nUnits;<br> if (rStrm.good())<br> {<br> nWritten += sizeof(prefix);<br> nWritten += rStrm.Write(rStr.getStr(), nUnits);<br> }<br> return nWritten;<br>}<br><br>So I have a dilemma which I would appreciate advice on. In no particular order of preference here are my ideas:<br>
<br>a) Specialize the templates and call the appropriate Read/Write[sal_type] functions.<br>b) Change SvStream to have overloaded Read/WriteNumber functions of all the sal_ types.<br>c) Add the above mentioned functions along with the Read/Write[sal_type] functions to SvStream.<br>
<br>Thanks in advance<br>Keith<br><br>