
Edward Diener wrote:
I have a filter, derived from multichar_output_filter, in which I am both prepending data and appending data. In other words the data being written to the sink will be greater than the data being passed into the filter's 'template<typename Sink> std::streamsize write(Sink& dest, const char* s, std::streamsize n)' member function, which my filter is implementing.
Is this an allowable use of filters ?
yes.
Do I still return the 'n' streamsize data being passed in or do I return the actual length of the data being written ?
From one of the tutorial examples: template<typename Sink> std::streamsize write(Sink& dest, const char* s, std::streamsize n) { // Consume up to n filtered characters from the buffer s, // writing filtered characters to dest. Return the number // of characters consumed. }
Can I use the
'template<typename T> std::streamsize write( T& t, const typename char_type_of<T>::type* s, std::streamsize n );'
function to write the data,
yes