Hello, I have implemented a test SymmetricFilter and works ok.
Although to my suprise I had to declare two different methods of filter
differing only in the signature by the const char*& src_end.
If I supress either of those i get a compile time error.
Perhaps it is because it's being used as a bidirectional filter? as the
two signatures might be the ones in boost/iostreams/filter/symmetric.hpp
read and write?
Pedro.
Regards.
My code:
class smashing_filter_impl {
public:
typedef char char_type;
smashing_filter_impl() { }
bool filter(const char*& src_begin, char*& src_end, char*&
dst_begin, char*& dst_end, bool flush)
{
bool eof = false;
ptrdiff_t src_sz = src_end - src_begin;
if( src_sz <= 0 )
return false;
while(src_begin < src_end && dst_begin < dst_end)
*dst_begin++ = tolower(*src_begin++);
return true;
}
bool filter(const char*& src_begin, const char*& src_end, char*&
dst_begin, char*& dst_end, bool flush)
{
bool eof = false;
ptrdiff_t src_sz = src_end - src_begin;
if( src_sz <= 0 )
return false;
while(src_begin < src_end && dst_begin < dst_end)
*dst_begin++ = tolower(*src_begin++);
return true;
}
void close() {}
private:
};
struct smashing_filter : symmetric_filter
participants (1)
-
plarroy