Renamed toStringUncached -> describe

This commit is contained in:
Phil Nash 2017-02-14 09:04:26 +00:00
parent 1400127d6f
commit a5a013811c
3 changed files with 7 additions and 7 deletions

View File

@ -22,12 +22,12 @@ namespace Matchers {
public: public:
std::string toString() const { std::string toString() const {
if( m_cachedToString.empty() ) if( m_cachedToString.empty() )
m_cachedToString = toStringUncached(); m_cachedToString = describe();
return m_cachedToString; return m_cachedToString;
} }
protected: protected:
virtual std::string toStringUncached() const = 0; virtual std::string describe() const = 0;
mutable std::string m_cachedToString; mutable std::string m_cachedToString;
}; };
@ -50,7 +50,7 @@ namespace Matchers {
} }
return true; return true;
} }
virtual std::string toStringUncached() const CATCH_OVERRIDE { virtual std::string describe() const CATCH_OVERRIDE {
std::string description; std::string description;
description.reserve( 4 + m_matchers.size()*32 ); description.reserve( 4 + m_matchers.size()*32 );
description += "( "; description += "( ";
@ -80,7 +80,7 @@ namespace Matchers {
} }
return false; return false;
} }
virtual std::string toStringUncached() const CATCH_OVERRIDE { virtual std::string describe() const CATCH_OVERRIDE {
std::string description; std::string description;
description.reserve( 4 + m_matchers.size()*32 ); description.reserve( 4 + m_matchers.size()*32 );
description += "( "; description += "( ";
@ -110,7 +110,7 @@ namespace Matchers {
return !m_underlyingMatcher.match( arg ); return !m_underlyingMatcher.match( arg );
} }
virtual std::string toStringUncached() const CATCH_OVERRIDE { virtual std::string describe() const CATCH_OVERRIDE {
return "not " + m_underlyingMatcher.toString(); return "not " + m_underlyingMatcher.toString();
} }
MatcherBase<ArgT> const& m_underlyingMatcher; MatcherBase<ArgT> const& m_underlyingMatcher;

View File

@ -27,7 +27,7 @@ namespace Matchers {
struct StringMatcherBase : Impl::MatcherBase<std::string> { struct StringMatcherBase : Impl::MatcherBase<std::string> {
StringMatcherBase( std::string operation, CasedString const& comparator ); StringMatcherBase( std::string operation, CasedString const& comparator );
virtual std::string toStringUncached() const CATCH_OVERRIDE; virtual std::string describe() const CATCH_OVERRIDE;
CasedString m_comparator; CasedString m_comparator;
std::string m_operation; std::string m_operation;

View File

@ -34,7 +34,7 @@ namespace Matchers {
m_operation( operation ) { m_operation( operation ) {
} }
std::string StringMatcherBase::toStringUncached() const { std::string StringMatcherBase::describe() const {
std::string description; std::string description;
description.reserve(5 + m_operation.size() + m_comparator.m_str.size() + description.reserve(5 + m_operation.size() + m_comparator.m_str.size() +
m_comparator.caseSensitivitySuffix().size()); m_comparator.caseSensitivitySuffix().size());