Skip to content

Commit 2a9d8d9

Browse files
committed
Changed "const X ref"s to "X const ref"s
- Brought older code up to current convention (with the help of a Python script)
1 parent d0d4d93 commit 2a9d8d9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+297
-297
lines changed

Diff for: include/internal/catch_approx.hpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace Detail {
2424
m_value( value )
2525
{}
2626

27-
Approx( const Approx& other )
27+
Approx( Approx const& other )
2828
: m_epsilon( other.m_epsilon ),
2929
m_scale( other.m_scale ),
3030
m_value( other.m_value )
@@ -41,20 +41,20 @@ namespace Detail {
4141
return approx;
4242
}
4343

44-
friend bool operator == ( double lhs, const Approx& rhs ) {
44+
friend bool operator == ( double lhs, Approx const& rhs ) {
4545
// Thanks to Richard Harris for his help refining this formula
4646
return fabs( lhs - rhs.m_value ) < rhs.m_epsilon * (rhs.m_scale + (std::max)( fabs(lhs), fabs(rhs.m_value) ) );
4747
}
4848

49-
friend bool operator == ( const Approx& lhs, double rhs ) {
49+
friend bool operator == ( Approx const& lhs, double rhs ) {
5050
return operator==( rhs, lhs );
5151
}
5252

53-
friend bool operator != ( double lhs, const Approx& rhs ) {
53+
friend bool operator != ( double lhs, Approx const& rhs ) {
5454
return !operator==( lhs, rhs );
5555
}
5656

57-
friend bool operator != ( const Approx& lhs, double rhs ) {
57+
friend bool operator != ( Approx const& lhs, double rhs ) {
5858
return !operator==( rhs, lhs );
5959
}
6060

@@ -82,7 +82,7 @@ namespace Detail {
8282
}
8383

8484
template<>
85-
inline std::string toString<Detail::Approx>( const Detail::Approx& value ) {
85+
inline std::string toString<Detail::Approx>( Detail::Approx const& value ) {
8686
return value.toString();
8787
}
8888

Diff for: include/internal/catch_assertionresult.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ namespace Catch {
1616
struct AssertionInfo
1717
{
1818
AssertionInfo() {}
19-
AssertionInfo( const std::string& _macroName,
20-
const SourceLineInfo& _lineInfo,
21-
const std::string& _capturedExpression,
19+
AssertionInfo( std::string const& _macroName,
20+
SourceLineInfo const& _lineInfo,
21+
std::string const& _capturedExpression,
2222
ResultDisposition::Flags _resultDisposition );
2323

2424
std::string macroName;
@@ -39,7 +39,7 @@ namespace Catch {
3939
class AssertionResult {
4040
public:
4141
AssertionResult();
42-
AssertionResult( const AssertionInfo& info, const AssertionResultData& data );
42+
AssertionResult( AssertionInfo const& info, AssertionResultData const& data );
4343
~AssertionResult();
4444

4545
bool isOk() const;

Diff for: include/internal/catch_assertionresult.hpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
namespace Catch {
1414

1515

16-
AssertionInfo::AssertionInfo( const std::string& _macroName,
17-
const SourceLineInfo& _lineInfo,
18-
const std::string& _capturedExpression,
16+
AssertionInfo::AssertionInfo( std::string const& _macroName,
17+
SourceLineInfo const& _lineInfo,
18+
std::string const& _capturedExpression,
1919
ResultDisposition::Flags _resultDisposition )
2020
: macroName( _macroName ),
2121
lineInfo( _lineInfo ),
@@ -28,7 +28,7 @@ namespace Catch {
2828

2929
AssertionResult::AssertionResult() {}
3030

31-
AssertionResult::AssertionResult( const AssertionInfo& info, const AssertionResultData& data )
31+
AssertionResult::AssertionResult( AssertionInfo const& info, AssertionResultData const& data )
3232
: m_info( info ),
3333
m_resultData( data )
3434
{}

Diff for: include/internal/catch_capture.hpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ namespace Catch {
2727
}
2828

2929
template<typename MatcherT>
30-
ExpressionResultBuilder expressionResultBuilderFromMatcher( const MatcherT& matcher,
31-
const std::string& matcherCallAsString ) {
30+
ExpressionResultBuilder expressionResultBuilderFromMatcher( MatcherT const& matcher,
31+
std::string const& matcherCallAsString ) {
3232
std::string matcherAsString = matcher.toString();
3333
if( matcherAsString == "{?}" )
3434
matcherAsString = matcherCallAsString;
@@ -38,18 +38,18 @@ namespace Catch {
3838
}
3939

4040
template<typename MatcherT, typename ArgT>
41-
ExpressionResultBuilder expressionResultBuilderFromMatcher( const MatcherT& matcher,
42-
const ArgT& arg,
43-
const std::string& matcherCallAsString ) {
41+
ExpressionResultBuilder expressionResultBuilderFromMatcher( MatcherT const& matcher,
42+
ArgT const& arg,
43+
std::string const& matcherCallAsString ) {
4444
return expressionResultBuilderFromMatcher( matcher, matcherCallAsString )
4545
.setLhs( Catch::toString( arg ) )
4646
.setResultType( matcher.match( arg ) );
4747
}
4848

4949
template<typename MatcherT, typename ArgT>
50-
ExpressionResultBuilder expressionResultBuilderFromMatcher( const MatcherT& matcher,
50+
ExpressionResultBuilder expressionResultBuilderFromMatcher( MatcherT const& matcher,
5151
ArgT* arg,
52-
const std::string& matcherCallAsString ) {
52+
std::string const& matcherCallAsString ) {
5353
return expressionResultBuilderFromMatcher( matcher, matcherCallAsString )
5454
.setLhs( Catch::toString( arg ) )
5555
.setResultType( matcher.match( arg ) );

Diff for: include/internal/catch_commandline.hpp

+28-28
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,20 @@ namespace Catch {
1717
public:
1818
Command(){}
1919

20-
explicit Command( const std::string& name ) : m_name( name ) {
20+
explicit Command( std::string const& name ) : m_name( name ) {
2121
}
2222

23-
Command& operator += ( const std::string& arg ) {
23+
Command& operator += ( std::string const& arg ) {
2424
m_args.push_back( arg );
2525
return *this;
2626
}
27-
Command& operator += ( const Command& other ) {
27+
Command& operator += ( Command const& other ) {
2828
std::copy( other.m_args.begin(), other.m_args.end(), std::back_inserter( m_args ) );
2929
if( m_name.empty() )
3030
m_name = other.m_name;
3131
return *this;
3232
}
33-
Command operator + ( const Command& other ) {
33+
Command operator + ( Command const& other ) {
3434
Command newCommand( *this );
3535
newCommand += other;
3636
return newCommand;
@@ -45,7 +45,7 @@ namespace Catch {
4545
std::size_t argsCount() const { return m_args.size(); }
4646

4747
CATCH_ATTRIBUTE_NORETURN
48-
void raiseError( const std::string& message ) const {
48+
void raiseError( std::string const& message ) const {
4949
std::ostringstream oss;
5050
if( m_name.empty() )
5151
oss << "Error while parsing " << m_name << ". " << message << ".";
@@ -76,14 +76,14 @@ namespace Catch {
7676
exeName = exeName.substr( pos+1 );
7777
return exeName;
7878
}
79-
Command find( const std::string& arg1, const std::string& arg2, const std::string& arg3 ) const {
79+
Command find( std::string const& arg1, std::string const& arg2, std::string const& arg3 ) const {
8080
return find( arg1 ) + find( arg2 ) + find( arg3 );
8181
}
8282

83-
Command find( const std::string& shortArg, const std::string& longArg ) const {
83+
Command find( std::string const& shortArg, std::string const& longArg ) const {
8484
return find( shortArg ) + find( longArg );
8585
}
86-
Command find( const std::string& arg ) const {
86+
Command find( std::string const& arg ) const {
8787
if( arg.empty() )
8888
return getArgs( "", 1 );
8989
else
@@ -97,7 +97,7 @@ namespace Catch {
9797
}
9898

9999
private:
100-
Command getArgs( const std::string& cmdName, std::size_t from ) const {
100+
Command getArgs( std::string const& cmdName, std::size_t from ) const {
101101
Command command( cmdName );
102102
for( std::size_t i = from; i < m_argc && m_argv[i][0] != '-'; ++i )
103103
command += m_argv[i];
@@ -116,7 +116,7 @@ namespace Catch {
116116

117117
virtual ~OptionParser() {}
118118

119-
Command find( const CommandParser& parser ) const {
119+
Command find( CommandParser const& parser ) const {
120120
Command cmd;
121121
for( std::vector<std::string>::const_iterator it = m_optionNames.begin();
122122
it != m_optionNames.end();
@@ -125,7 +125,7 @@ namespace Catch {
125125
return cmd;
126126
}
127127

128-
void validateArgs( const Command& args ) const {
128+
void validateArgs( Command const& args ) const {
129129
if( tooFewArgs( args ) || tooManyArgs( args ) ) {
130130
std::ostringstream oss;
131131
if( m_maxArgs == -1 )
@@ -138,14 +138,14 @@ namespace Catch {
138138
}
139139
}
140140

141-
void parseIntoConfig( const CommandParser& parser, ConfigData& config ) {
141+
void parseIntoConfig( CommandParser const& parser, ConfigData& config ) {
142142
if( Command cmd = find( parser ) ) {
143143
validateArgs( cmd );
144144
parseIntoConfig( cmd, config );
145145
}
146146
}
147147

148-
virtual void parseIntoConfig( const Command& cmd, ConfigData& config ) = 0;
148+
virtual void parseIntoConfig( Command const& cmd, ConfigData& config ) = 0;
149149
virtual std::string argsSynopsis() const = 0;
150150
virtual std::string optionSummary() const = 0;
151151
virtual std::string optionDescription() const { return ""; }
@@ -171,10 +171,10 @@ namespace Catch {
171171

172172
protected:
173173

174-
bool tooFewArgs( const Command& args ) const {
174+
bool tooFewArgs( Command const& args ) const {
175175
return args.argsCount() < static_cast<std::size_t>( m_minArgs );
176176
}
177-
bool tooManyArgs( const Command& args ) const {
177+
bool tooManyArgs( Command const& args ) const {
178178
return m_maxArgs >= 0 && args.argsCount() > static_cast<std::size_t>( m_maxArgs );
179179
}
180180
std::vector<std::string> m_optionNames;
@@ -201,7 +201,7 @@ namespace Catch {
201201
return "";
202202
}
203203

204-
virtual void parseIntoConfig( const Command&, ConfigData& ) {
204+
virtual void parseIntoConfig( Command const&, ConfigData& ) {
205205
// Does not affect config
206206
}
207207
};
@@ -254,7 +254,7 @@ namespace Catch {
254254
"that start with 'a/b/', except 'a/b/c', which is included";
255255
}
256256

257-
virtual void parseIntoConfig( const Command& cmd, ConfigData& config ) {
257+
virtual void parseIntoConfig( Command const& cmd, ConfigData& config ) {
258258
std::string groupName;
259259
for( std::size_t i = 0; i < cmd.argsCount(); ++i ) {
260260
if( i != 0 )
@@ -300,7 +300,7 @@ namespace Catch {
300300
"matches all tests tagged [one], except those also tagged [two]";
301301
}
302302

303-
virtual void parseIntoConfig( const Command& cmd, ConfigData& config ) {
303+
virtual void parseIntoConfig( Command const& cmd, ConfigData& config ) {
304304
std::string groupName;
305305
for( std::size_t i = 0; i < cmd.argsCount(); ++i ) {
306306
if( i != 0 )
@@ -345,7 +345,7 @@ namespace Catch {
345345
;//" -l xml";
346346
}
347347

348-
virtual void parseIntoConfig( const Command& cmd, ConfigData& config ) {
348+
virtual void parseIntoConfig( Command const& cmd, ConfigData& config ) {
349349
config.listSpec = List::Tests;
350350
if( cmd.argsCount() >= 1 ) {
351351
if( cmd[0] == "all" )
@@ -404,7 +404,7 @@ namespace Catch {
404404
"of the root node.";
405405
}
406406

407-
virtual void parseIntoConfig( const Command& cmd, ConfigData& config ) {
407+
virtual void parseIntoConfig( Command const& cmd, ConfigData& config ) {
408408
config.reporter = cmd[0];
409409
}
410410
};
@@ -438,7 +438,7 @@ namespace Catch {
438438
" -o %debug \t(The IDE's debug output window - currently only Windows' "
439439
"OutputDebugString is supported).";
440440
}
441-
virtual void parseIntoConfig( const Command& cmd, ConfigData& config ) {
441+
virtual void parseIntoConfig( Command const& cmd, ConfigData& config ) {
442442
if( cmd[0][0] == '%' )
443443
config.stream = cmd[0].substr( 1 );
444444
else
@@ -465,7 +465,7 @@ namespace Catch {
465465
"added worked first time!). To see successful, as well as failing, test results "
466466
"just pass this option.";
467467
}
468-
virtual void parseIntoConfig( const Command&, ConfigData& config ) {
468+
virtual void parseIntoConfig( Command const&, ConfigData& config ) {
469469
config.includeWhichResults = Include::SuccessfulResults;
470470
}
471471
};
@@ -491,7 +491,7 @@ namespace Catch {
491491
"built your code with the DEBUG preprocessor symbol";
492492
}
493493

494-
virtual void parseIntoConfig( const Command&, ConfigData& config ) {
494+
virtual void parseIntoConfig( Command const&, ConfigData& config ) {
495495
config.shouldDebugBreak = true;
496496
}
497497
};
@@ -521,7 +521,7 @@ namespace Catch {
521521
" -n \"tests of the widget component\"";
522522
}
523523

524-
virtual void parseIntoConfig( const Command& cmd, ConfigData& config ) {
524+
virtual void parseIntoConfig( Command const& cmd, ConfigData& config ) {
525525
config.name = cmd[0];
526526
}
527527
};
@@ -550,7 +550,7 @@ namespace Catch {
550550
"number causes it to abort after that number of assertion failures.";
551551
}
552552

553-
virtual void parseIntoConfig( const Command& cmd, ConfigData& config ) {
553+
virtual void parseIntoConfig( Command const& cmd, ConfigData& config ) {
554554
int threshold = 1;
555555
if( cmd.argsCount() == 1 ) {
556556
std::stringstream ss;
@@ -589,7 +589,7 @@ namespace Catch {
589589
"as not to contribute additional noise.";
590590
}
591591

592-
virtual void parseIntoConfig( const Command&, ConfigData& config ) {
592+
virtual void parseIntoConfig( Command const&, ConfigData& config ) {
593593
config.allowThrows = false;
594594
}
595595
};
@@ -620,7 +620,7 @@ namespace Catch {
620620
" -w NoAssertions";
621621
}
622622

623-
virtual void parseIntoConfig( const Command& cmd, ConfigData& config ) {
623+
virtual void parseIntoConfig( Command const& cmd, ConfigData& config ) {
624624
for( std::size_t i = 0; i < cmd.argsCount(); ++i ) {
625625
if( cmd[i] == "NoAssertions" )
626626
config.warnings = (ConfigData::WarnAbout::What)( config.warnings | ConfigData::WarnAbout::NoAssertions );
@@ -655,7 +655,7 @@ namespace Catch {
655655
add<Options::HelpOptionParser>(); // Keep this one last
656656
}
657657

658-
void parseIntoConfig( const CommandParser& parser, ConfigData& config ) {
658+
void parseIntoConfig( CommandParser const& parser, ConfigData& config ) {
659659
config.name = parser.exeName();
660660
if( endsWith( config.name, ".exe" ) )
661661
config.name = config.name.substr( 0, config.name.size()-4 );

0 commit comments

Comments
 (0)