mirror of
https://github.com/catchorg/Catch2.git
synced 2025-09-17 02:25:38 +02:00
Changed "const X ref"s to "X const ref"s
- Brought older code up to current convention (with the help of a Python script)
This commit is contained in:
@@ -28,8 +28,8 @@
|
||||
namespace Catch {
|
||||
|
||||
class NonCopyable {
|
||||
NonCopyable( const NonCopyable& );
|
||||
void operator = ( const NonCopyable& );
|
||||
NonCopyable( NonCopyable const& );
|
||||
void operator = ( NonCopyable const& );
|
||||
protected:
|
||||
NonCopyable() {}
|
||||
virtual ~NonCopyable();
|
||||
@@ -67,17 +67,17 @@ namespace Catch {
|
||||
}
|
||||
|
||||
template<typename ContainerT, typename Function>
|
||||
inline void forEach( const ContainerT& container, Function function ) {
|
||||
inline void forEach( ContainerT const& container, Function function ) {
|
||||
std::for_each( container.begin(), container.end(), function );
|
||||
}
|
||||
|
||||
inline bool startsWith( const std::string& s, const std::string& prefix ) {
|
||||
inline bool startsWith( std::string const& s, std::string const& prefix ) {
|
||||
return s.size() >= prefix.size() && s.substr( 0, prefix.size() ) == prefix;
|
||||
}
|
||||
inline bool endsWith( const std::string& s, const std::string& suffix ) {
|
||||
inline bool endsWith( std::string const& s, std::string const& suffix ) {
|
||||
return s.size() >= suffix.size() && s.substr( s.size()-suffix.size(), suffix.size() ) == suffix;
|
||||
}
|
||||
inline bool contains( const std::string& s, const std::string& infix ) {
|
||||
inline bool contains( std::string const& s, std::string const& infix ) {
|
||||
return s.find( infix ) != std::string::npos;
|
||||
}
|
||||
inline void toLowerInPlace( std::string& s ) {
|
||||
@@ -90,12 +90,12 @@ namespace Catch {
|
||||
}
|
||||
|
||||
struct pluralise {
|
||||
pluralise( std::size_t count, const std::string& label )
|
||||
pluralise( std::size_t count, std::string const& label )
|
||||
: m_count( count ),
|
||||
m_label( label )
|
||||
{}
|
||||
|
||||
friend std::ostream& operator << ( std::ostream& os, const pluralise& pluraliser ) {
|
||||
friend std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser ) {
|
||||
os << pluraliser.m_count << " " << pluraliser.m_label;
|
||||
if( pluraliser.m_count != 1 )
|
||||
os << "s";
|
||||
@@ -109,11 +109,11 @@ namespace Catch {
|
||||
struct SourceLineInfo {
|
||||
|
||||
SourceLineInfo() : line( 0 ){}
|
||||
SourceLineInfo( const std::string& _file, std::size_t _line )
|
||||
SourceLineInfo( std::string const& _file, std::size_t _line )
|
||||
: file( _file ),
|
||||
line( _line )
|
||||
{}
|
||||
SourceLineInfo( const SourceLineInfo& other )
|
||||
SourceLineInfo( SourceLineInfo const& other )
|
||||
: file( other.file ),
|
||||
line( other.line )
|
||||
{}
|
||||
@@ -125,7 +125,7 @@ namespace Catch {
|
||||
std::size_t line;
|
||||
};
|
||||
|
||||
inline std::ostream& operator << ( std::ostream& os, const SourceLineInfo& info ) {
|
||||
inline std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ) {
|
||||
#ifndef __GNUG__
|
||||
os << info.file << "(" << info.line << ")";
|
||||
#else
|
||||
@@ -135,7 +135,7 @@ namespace Catch {
|
||||
}
|
||||
|
||||
CATCH_ATTRIBUTE_NORETURN
|
||||
inline void throwLogicError( const std::string& message, const SourceLineInfo& locationInfo ) {
|
||||
inline void throwLogicError( std::string const& message, SourceLineInfo const& locationInfo ) {
|
||||
std::ostringstream oss;
|
||||
oss << locationInfo << ": Internal Catch error: '" << message << "'";
|
||||
throw std::logic_error( oss.str() );
|
||||
|
Reference in New Issue
Block a user