mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-17 03:02:24 +01:00
refactor: Clean up addReporter()
This commit is contained in:
parent
218d0bdcc7
commit
27373d4f2c
@ -128,23 +128,18 @@ public: // IStreamingReporter
|
|||||||
};
|
};
|
||||||
|
|
||||||
Ptr<IStreamingReporter> addReporter( Ptr<IStreamingReporter> const& existingReporter, Ptr<IStreamingReporter> const& additionalReporter ) {
|
Ptr<IStreamingReporter> addReporter( Ptr<IStreamingReporter> const& existingReporter, Ptr<IStreamingReporter> const& additionalReporter ) {
|
||||||
Ptr<IStreamingReporter> resultingReporter;
|
if( !existingReporter )
|
||||||
|
return additionalReporter;
|
||||||
|
|
||||||
if( existingReporter ) {
|
if( existingReporter->supportsChainedReporters() ) {
|
||||||
if( !existingReporter->supportsChainedReporters() ) {
|
existingReporter->addChainedReporter( additionalReporter );
|
||||||
MultipleReporters* multi = new MultipleReporters;
|
return existingReporter;
|
||||||
resultingReporter = Ptr<IStreamingReporter>( multi );
|
|
||||||
if( existingReporter )
|
|
||||||
multi->addChainedReporter( existingReporter );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
resultingReporter = existingReporter;
|
|
||||||
resultingReporter->addChainedReporter( additionalReporter );
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
resultingReporter = additionalReporter;
|
|
||||||
|
|
||||||
return resultingReporter;
|
Ptr<MultipleReporters> multi = Ptr<MultipleReporters>( new MultipleReporters );
|
||||||
|
multi->addChainedReporter( existingReporter );
|
||||||
|
multi->addChainedReporter( additionalReporter );
|
||||||
|
return Ptr<IStreamingReporter>( multi.get() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user