mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-17 11:12:25 +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> resultingReporter;
|
||||
if( !existingReporter )
|
||||
return additionalReporter;
|
||||
|
||||
if( existingReporter ) {
|
||||
if( !existingReporter->supportsChainedReporters() ) {
|
||||
MultipleReporters* multi = new MultipleReporters;
|
||||
resultingReporter = Ptr<IStreamingReporter>( multi );
|
||||
if( existingReporter )
|
||||
multi->addChainedReporter( existingReporter );
|
||||
}
|
||||
else
|
||||
resultingReporter = existingReporter;
|
||||
resultingReporter->addChainedReporter( additionalReporter );
|
||||
if( existingReporter->supportsChainedReporters() ) {
|
||||
existingReporter->addChainedReporter( additionalReporter );
|
||||
return existingReporter;
|
||||
}
|
||||
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