[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: KFilterDevice and KFilterBase prob
From:       David Faure <david () mandrakesoft ! com>
Date:       2000-11-03 23:04:17
[Download RAW message or body]

On Friday 03 November 2000 17:37, aleXXX wrote:
> Hi,
> 
> with these both there is a small problem when no filter is needed (e.g. 
> uncompressed man pages), KFilterBase:findFilterByName() then returns 0. Ok.
> Now if we want to construct a KFilterDevice using this filterbase, well, it 
> doesn't work.
> You can look at my current solution in kdebase/kioslave/man/kio_man.cpp 
> MANProtocol::readManPage(), but this doesn't feel optimal.
> 
> We could have a function like 
> 
> QIODevice* getFilterDevice(KFilterBase* base, QIODevice* file=0)
> {
>    if ((base==0) && (file==0))
>       return 0;
> 
>    if (base==0)
>       return new QFile(file->name());
> 
>    base->setDevice(file);
>    return new KFilterDevice(base);   
> };
> 
> (I know this is not very OO but should work)
> 
> What do you think ?

Looks ok to me. As a static method of KFilterBase, of course, not a c-like function :)

Hmm, maybe it would be even better to create the filterbase in the method ? Ah, the
problem was ownership of it, I remember now.

-- 
David FAURE, david@mandrakesoft.com, faure@kde.org
http://www.mandrakesoft.com/~david/, http://www.konqueror.org/
KDE, Making The Future of Computing Available Today
See http://www.kde.org/kde1-and-kde2.html for how to set up KDE 2

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic