Re: [Libxmlplusplus-general] Parser abstraction



On Sat, Feb 01, 2003 at 03:27:20PM -0500, Stefan Seefeld wrote:

> Christophe de Vienne wrote:
> 
> >The way parse_stream or an eventual parse_chunk is implemented could be 
> >shared, since only the parser state is initialised differently (and 
> >partialy only, since some options are the same ones).
> >Even the parse_file and parse_memory could share the same implementation 
> >in both classes if we used more low level libxml calls.
> 
> ok. Well, right now they don't share *any* code. And even if they would use
> those common function(s), it would be a single line (or two). So code reuse
> can't be an issue here.

In any case, public inheritance shouldn't be used for code reuse.

> >Still in libxml, the domparser is built on top of saxparser : the 
> >two concepts share more things that it seems at first sight.
> 
> again, would you derive your dom parser privately from the sax parser,
> i.e. would you use 'derived from' in terms of 'implemented by', I would
> (possibly) agree.

Yes. The C library has no access control, but the C++ wrapper should use
protected or private inheritance in order to share implementations.

jon

-- 





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]