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

List:       kde-core-devel
Subject:    Re: New KDE printing system
From:       Harri Porten <harri () trolltech ! com>
Date:       2001-02-28 15:03:07
[Download RAW message or body]

Michael Goffioul wrote:
> 
> Actually the factory is (will be) used to create other objects as well, like
> job lister, printer manager, UI manager (those are objects defined in the
> printing management tool I'm developing).

Ok. Then I take back my suggestion to hide it completely. But your
initial description was:

> 1.1 KPrinterFactory class
> 
> This class is used to create KPrinter object (see below). Developers shouldn't
> construct directly KPrinter object, but use "KPrinterFactory::self()->printer()".
> The factory takes care of the user settings and construct an object for the
> appropriate underlying printing system. DO NOT delete the KPrinter object, as
> it will be reused for other calls.

The "DO NOT delete" warning indicates that the API is tricky to use,
doesn't ? 

> Of course I could define a static
> wrapper in KPrinter class like
> 
> static KPrinter* self()
> {
>     return KPrinterFactory::self()->printer();
> }
> 
> to hide the factory object from the developer. Is this better ?

Would be more intuitive IMHO. Especially when KPrinterFactory::printer()
would be a private.

Harri.

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

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