[Qt-creator] Use IBuildStepFactory in IBuildConfigurationFactory

Mateusz Loskot mateusz at loskot.net
Thu Nov 14 10:29:12 CET 2013


On 14 November 2013 09:23, Tobias Hunger <tobias.hunger at digia.com> wrote:
> On 13.11.2013 18:38, Mateusz Loskot wrote:
>> Is the creation of a factory so terribly complex that it excuses
>> copy-n-paste of code and managing of strings with process arguments
>> and overall initialisation of a processing step instance in multiple places?
>
> I think
>
>      WhatEverStep *step = new WhatEverStep;
>      step->setSomething(42);
>      step->setSomethingElse("42");
>      step->setSomethingSpecial("this needs to be different from the
> default");
>      step->setDisplayName("whatever is appropriate here");
>
> is simpler to follow than this:
>
>      WhatEverStepFactory *factory =
> ExtensionSystem::PluginManager::getObject<WhatEverStepFactory>();
>      QTC_ASSERT(factory, return);
>      WhatEverStep *step = factory->create(...);
>      // Use factory defaults for Something and SomethingElse
>      step->setSomethingSpecial("this needs to be different from the
> default");
>      step->setDisplayName("whatever is appropriate here");
>
> Of course that does depend on the situation and the number of properties
> to set on a buildstep.
> [...]

I see your point.
Thanks for the comparative example and explanation, very helpful.

Best regards,
-- 
Mateusz  Loskot, http://mateusz.loskot.net



More information about the Qt-creator mailing list