Boost logo

Boost Users :

From: Eric MALENFANT (Eric.Malenfant_at_[hidden])
Date: 2008-01-08 08:35:59


boost-users-bounces_at_[hidden], le 8 janvier 2008 06:40:
> I want to write a filter but this filter needs to do some
> things when the stream is ending.
> Is it enough to do the following? I want the close function
> to be called at the end of the stream.
> Do I need to category_flag to inherit from (closable_tag)?
>
> class my_filter : public io::dual_use_filter {
> public:
> template<typename Source> int get(Source&) ;
> template<typename Sink> bool put(Sink&, int) ;
> template<typename Device> void close(Device&,
> std::ios_base::openmode) ; } ;

Well, there's nothing like trying it out but, from the docs:
- A dual_use_filter is a typedef for filter<dual_use>
- A filter's category is convertible to Mode, filter_tag, closable_tag and localizable_tag.
  (http://www.boost.org/libs/iostreams/doc/classes/filter.html#category)

Éric Malenfant
---------------------------------------------
Le tourisme est une industrie qui transporte des gens qui seraient
mieux chez eux dans des endroits qui seraient mieux sans eux. J. Mistler


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net