diff --git a/internal/catch_capture.hpp b/internal/catch_capture.hpp index 89752a20..b647c8e1 100644 --- a/internal/catch_capture.hpp +++ b/internal/catch_capture.hpp @@ -57,7 +57,11 @@ namespace Detail template struct StringMaker { - static std::string apply( const T& value ) + /////////////////////////////////////////////////////////////////////// + static std::string apply + ( + const T& value + ) { std::ostringstream oss; oss << value; @@ -69,7 +73,11 @@ namespace Detail template struct StringMaker { - static std::string apply( const T& ) + /////////////////////////////////////////////////////////////////////// + static std::string apply + ( + const T& + ) { return "{?}"; } @@ -77,28 +85,52 @@ namespace Detail }// end namespace Detail +/////////////////////////////////////////////////////////////////////////////// template -std::string toString( const T& value ) +std::string toString +( + const T& value +) { return Detail::StringMaker::value>::apply( value ); } // Shortcut overloads -inline std::string toString( const std::string& value ) + +/////////////////////////////////////////////////////////////////////////////// +inline std::string toString +( + const std::string& value +) { return value; } -inline std::string toString( const char* value ) + +/////////////////////////////////////////////////////////////////////////////// +inline std::string toString +( + const char* value +) { return value; } -inline std::string toString( int value ) + +/////////////////////////////////////////////////////////////////////////////// +inline std::string toString +( + int value +) { std::ostringstream oss; oss << value; return oss.str(); } -inline std::string toString( const double value ) + +/////////////////////////////////////////////////////////////////////////////// +inline std::string toString +( + const double value +) { std::ostringstream oss; oss << value; @@ -116,14 +148,29 @@ class MutableResultInfo : public ResultInfo { public: - MutableResultInfo() + /////////////////////////////////////////////////////////////////////////// + MutableResultInfo + () {} - MutableResultInfo( const char* expr, bool isNot, const char* filename, std::size_t line, const char* macroName ) + /////////////////////////////////////////////////////////////////////////// + MutableResultInfo + ( + const char* expr, + bool isNot, + const char* filename, + std::size_t line, + const char* macroName + ) : ResultInfo( expr, ResultWas::Unknown, isNot, filename, line, macroName ) { } - void setResultType( ResultWas::OfType result ) + + /////////////////////////////////////////////////////////////////////////// + void setResultType + ( + ResultWas::OfType result + ) { // Flip bool results if isNot is set if( m_isNot && result == ResultWas::Ok ) @@ -133,13 +180,22 @@ public: else m_result = result; } - void setMessage( const std::string& message ) + + /////////////////////////////////////////////////////////////////////////// + void setMessage + ( + const std::string& message + ) { m_message = message; } + /////////////////////////////////////////////////////////////////////////// template - MutableResultInfo& operator ||( const RhsT& ) + MutableResultInfo& operator || + ( + const RhsT& + ) { m_expressionIncomplete = true; return *this; @@ -147,11 +203,22 @@ public: private: friend class ResultBuilder; - void setLhs( const std::string& lhs ) + + /////////////////////////////////////////////////////////////////////////// + void setLhs + ( + const std::string& lhs + ) { m_lhs = lhs; } - MutableResultInfo& setRhs( const std::string& op, const std::string& rhs ) + + /////////////////////////////////////////////////////////////////////////// + MutableResultInfo& setRhs + ( + const std::string& op, + const std::string& rhs + ) { m_op = op; m_rhs = rhs; @@ -162,49 +229,93 @@ private: class ResultBuilder { public: - ResultBuilder( const char* expr, bool isNot, const char* filename, std::size_t line, const char* macroName ) + + /////////////////////////////////////////////////////////////////////////// + ResultBuilder + ( + const char* expr, + bool isNot, + const char* filename, + std::size_t line, + const char* macroName + ) : m_result( expr, isNot, filename, line, macroName ) {} + /////////////////////////////////////////////////////////////////////////// template - ResultBuilder& operator->*(const T & operand) + ResultBuilder& operator->* + ( + const T & operand + ) { m_result.setLhs( toString( operand ) ); return *this; } + /////////////////////////////////////////////////////////////////////////// template - MutableResultInfo& operator == ( const RhsT& rhs ) + MutableResultInfo& operator == + ( + const RhsT& rhs + ) { return m_result.setRhs( "==", toString( rhs ) ); } + + /////////////////////////////////////////////////////////////////////////// template - MutableResultInfo& operator != ( const RhsT& rhs ) + MutableResultInfo& operator != + ( + const RhsT& rhs + ) { return m_result.setRhs( "!=", toString( rhs ) ); } + + /////////////////////////////////////////////////////////////////////////// template - MutableResultInfo& operator < ( const RhsT& rhs ) + MutableResultInfo& operator < + ( + const RhsT& rhs + ) { return m_result.setRhs( "<", toString( rhs ) ); } + + /////////////////////////////////////////////////////////////////////////// template - MutableResultInfo& operator > ( const RhsT& rhs ) + MutableResultInfo& operator > + ( + const RhsT& rhs + ) { return m_result.setRhs( ">", toString( rhs ) ); } + + /////////////////////////////////////////////////////////////////////////// template - MutableResultInfo& operator <= ( const RhsT& rhs ) + MutableResultInfo& operator <= + ( + const RhsT& rhs + ) { return m_result.setRhs( "<=", toString( rhs ) ); } + + /////////////////////////////////////////////////////////////////////////// template - MutableResultInfo& operator >= ( const RhsT& rhs ) + MutableResultInfo& operator >= + ( + const RhsT& rhs + ) { return m_result.setRhs( ">=", toString( rhs ) ); } - operator MutableResultInfo&() + /////////////////////////////////////////////////////////////////////////// + operator MutableResultInfo& + () { return m_result; } @@ -217,23 +328,34 @@ private: class ScopedInfo { public: - ScopedInfo() + /////////////////////////////////////////////////////////////////////////// + ScopedInfo + () { Hub::getResultCapture().pushScopedInfo( this ); } - ~ScopedInfo() + /////////////////////////////////////////////////////////////////////////// + ~ScopedInfo + () { Hub::getResultCapture().popScopedInfo( this ); } - ScopedInfo& operator << ( const char* str ) + /////////////////////////////////////////////////////////////////////////// + ScopedInfo& operator << + ( + const char* str + ) { m_oss << str; return *this; } - std::string getInfo() const + /////////////////////////////////////////////////////////////////////////// + std::string getInfo + () + const { return m_oss.str(); } @@ -255,13 +377,23 @@ inline double catch_max( double x, double y ) class Approx { public: + /////////////////////////////////////////////////////////////////////////// // !TBD more generic - Approx( double d ) + Approx + ( + double d + ) : m_d( d ) { } + + /////////////////////////////////////////////////////////////////////////// template - friend bool operator == ( const T& lhs, const Approx& rhs ) + friend bool operator == + ( + const T& lhs, + const Approx& rhs + ) { // !TBD Use proper tolerance // From: http://realtimecollisiondetection.net/blog/?p=89 @@ -269,8 +401,13 @@ public: return fabs( lhs - rhs.m_d ) <= catch_max( CATCH_absTol, CATCH_relTol * catch_max( fabs(lhs), fabs(rhs.m_d) ) ); } + /////////////////////////////////////////////////////////////////////////// template - friend bool operator != ( const T& lhs, const Approx& rhs ) + friend bool operator != + ( + const T& lhs, + const Approx& rhs + ) { return ! operator==( lhs, rhs ); } @@ -278,22 +415,31 @@ public: double m_d; }; +/////////////////////////////////////////////////////////////////////////////// template<> -inline std::string toString( const Approx& value ) +inline std::string toString +( + const Approx& value +) { std::ostringstream oss; oss << "Approx( " << value.m_d << ")"; return oss.str(); } +/////////////////////////////////////////////////////////////////////////////// // This is just here to avoid compiler warnings with macro constants -inline bool isTrue( bool value ) +inline bool isTrue +( + bool value +) { return value; } } // end namespace Catch +/////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_ACCEPT_RESULT( result, stopOnFailure ) \ if( Catch::ResultAction::Value action = Catch::Hub::getResultCapture().acceptResult( result ) ) \ { \ @@ -301,12 +447,14 @@ inline bool isTrue( bool value ) if( Catch::isTrue( stopOnFailure ) ) throw Catch::TestFailureException(); \ } +/////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_TEST( expr, isNot, stopOnFailure, macroName ) \ { \ Catch::Hub::getResultCapture().acceptExpression( Catch::ResultBuilder( #expr, isNot, __FILE__, __LINE__, macroName )->*expr ); \ INTERNAL_CATCH_ACCEPT_RESULT( expr, stopOnFailure ) \ } +/////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_THROWS( expr, exceptionType, nothrow, stopOnFailure, macroName ) \ Catch::Hub::getResultCapture().acceptExpression( Catch::ResultBuilder( #expr, false, __FILE__, __LINE__, macroName ) ); \ try \ @@ -319,6 +467,7 @@ inline bool isTrue( bool value ) INTERNAL_CATCH_ACCEPT_RESULT( !(nothrow), stopOnFailure ) \ } +/////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_THROWS_AS( expr, exceptionType, nothrow, stopOnFailure, macroName ) \ INTERNAL_CATCH_THROWS( expr, exceptionType, nothrow, stopOnFailure, macroName ) \ catch( ... ) \ @@ -326,6 +475,7 @@ catch( ... ) \ INTERNAL_CATCH_ACCEPT_RESULT( false, stopOnFailure ) \ } +/////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_MSG( reason, resultType, stopOnFailure, macroName ) \ { \ std::ostringstream INTERNAL_CATCH_UNIQUE_NAME( strm ); \ @@ -335,6 +485,7 @@ catch( ... ) \ INTERNAL_CATCH_ACCEPT_RESULT( resultType, stopOnFailure ) \ } +/////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_SCOPED_INFO( log ) Catch::ScopedInfo INTERNAL_CATCH_UNIQUE_NAME( info ); INTERNAL_CATCH_UNIQUE_NAME( info ) << log #endif // TWOBLUECUBES_CATCH_CAPTURE_HPP_INCLUDED diff --git a/internal/catch_commandline.hpp b/internal/catch_commandline.hpp index 2cf4ae39..76189718 100644 --- a/internal/catch_commandline.hpp +++ b/internal/catch_commandline.hpp @@ -47,7 +47,13 @@ namespace Catch }; public: - ArgParser( int argc, char * const argv[], Config& config ) + /////////////////////////////////////////////////////////////////////// + ArgParser + ( + int argc, + char * const argv[], + Config& config + ) : m_mode( modeNone ), m_config( config ) { @@ -82,7 +88,9 @@ namespace Catch } private: - std::string argsAsString() + /////////////////////////////////////////////////////////////////////// + std::string argsAsString + () { std::ostringstream oss; std::vector::const_iterator it = m_args.begin(); @@ -96,7 +104,12 @@ namespace Catch return oss.str(); } - void changeMode( const std::string& cmd, Mode mode ) + /////////////////////////////////////////////////////////////////////// + void changeMode + ( + const std::string& cmd, + Mode mode + ) { m_command = cmd; switch( m_mode ) @@ -179,7 +192,11 @@ namespace Catch m_mode = mode; } - void setErrorMode( const std::string& errorMessage ) + /////////////////////////////////////////////////////////////////////// + void setErrorMode + ( + const std::string& errorMessage + ) { m_mode = modeError; m_command = ""; diff --git a/internal/catch_list.hpp b/internal/catch_list.hpp index 1628832f..85e19345 100644 --- a/internal/catch_list.hpp +++ b/internal/catch_list.hpp @@ -18,7 +18,11 @@ namespace Catch { - inline int List( const Config& config ) + /////////////////////////////////////////////////////////////////////////// + inline int List + ( + const Config& config + ) { if( config.listWhat() & Config::List::Reports ) { diff --git a/internal/catch_reporter_registrars.hpp b/internal/catch_reporter_registrars.hpp index f576732e..f18e2aae 100644 --- a/internal/catch_reporter_registrars.hpp +++ b/internal/catch_reporter_registrars.hpp @@ -52,6 +52,7 @@ namespace Catch }; } +/////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType ) \ Catch::ReporterRegistrar catch_internal_RegistrarFor##reporterType( name ); diff --git a/internal/catch_self_test.hpp b/internal/catch_self_test.hpp index 65a6ac45..d9b04b00 100644 --- a/internal/catch_self_test.hpp +++ b/internal/catch_self_test.hpp @@ -21,26 +21,32 @@ namespace Catch { public: /////////////////////////////////////////////////////////////////////////// - SelfTestReporter() + SelfTestReporter + () : m_succeeded( 0 ), m_failed( 0 ) { } /////////////////////////////////////////////////////////////////////////// - static std::string getDescription() + static std::string getDescription + () { return "Captures results for self test purposes"; } /////////////////////////////////////////////////////////////////////////// - size_t getSucceeded() const + size_t getSucceeded + () + const { return m_succeeded; } /////////////////////////////////////////////////////////////////////////// - size_t getFailed() const + size_t getFailed + () + const { return m_failed; } @@ -55,16 +61,23 @@ namespace Catch private: // IReporter /////////////////////////////////////////////////////////////////////////// - virtual void StartTesting(){} + virtual void StartTesting + () + {} /////////////////////////////////////////////////////////////////////////// - virtual void EndTesting( std::size_t succeeded, std::size_t failed ) + virtual void EndTesting + ( + std::size_t succeeded, + std::size_t failed + ) { m_succeeded = succeeded; m_failed = failed; } /////////////////////////////////////////////////////////////////////////// + // Deliberately unimplemented: virtual void StartGroup( const std::string& ){} virtual void EndGroup( const std::string&, std::size_t, std::size_t ){} virtual void StartTestCase( const TestCaseInfo& ){} @@ -83,7 +96,8 @@ namespace Catch { public: /////////////////////////////////////////////////////////////////////////// - SelfTestConfig() + SelfTestConfig + () : m_reporter( new SelfTestReporter() ) { // reporter will be deleted by the base config class @@ -92,7 +106,8 @@ namespace Catch } /////////////////////////////////////////////////////////////////////////// - SelfTestReporter& getReporter() + SelfTestReporter& getReporter + () { return *m_reporter; } @@ -107,7 +122,8 @@ namespace Catch { public: /////////////////////////////////////////////////////////////////////////// - EmbeddedRunner() + EmbeddedRunner + () { } @@ -125,7 +141,8 @@ namespace Catch } /////////////////////////////////////////////////////////////////////////// - SelfTestReporter& getReporter() + SelfTestReporter& getReporter + () { return m_config.getReporter(); } diff --git a/internal/catch_stream.hpp b/internal/catch_stream.hpp index a70f0e58..7fc254c1 100644 --- a/internal/catch_stream.hpp +++ b/internal/catch_stream.hpp @@ -25,17 +25,26 @@ namespace Catch WriterF m_writer; public: - StreamBufImpl() + /////////////////////////////////////////////////////////////////////// + StreamBufImpl + () { setp( data, data + sizeof(data) ); } - ~StreamBufImpl() + + /////////////////////////////////////////////////////////////////////// + ~StreamBufImpl + () { sync(); } private: - int overflow( int c ) + /////////////////////////////////////////////////////////////////////// + int overflow + ( + int c + ) { sync(); @@ -49,7 +58,9 @@ namespace Catch return 0; } - int sync() + /////////////////////////////////////////////////////////////////////// + int sync + () { if( pbase() != pptr() ) { @@ -60,9 +71,16 @@ namespace Catch } }; + /////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////// + struct OutputDebugWriter { - void operator()( const std::string &str ) + /////////////////////////////////////////////////////////////////////// + void operator() + ( + const std::string &str + ) { writeToDebugConsole( str ); } diff --git a/internal/catch_test_registry.hpp b/internal/catch_test_registry.hpp index 9fdc21d1..e20bdc84 100644 --- a/internal/catch_test_registry.hpp +++ b/internal/catch_test_registry.hpp @@ -21,28 +21,48 @@ namespace Catch template struct MethodTestCase : ITestCase { - MethodTestCase( void (C::*method)() ) + /////////////////////////////////////////////////////////////////////////// + MethodTestCase + ( + void (C::*method)() + ) : m_method( method ) {} - virtual void invoke() const + /////////////////////////////////////////////////////////////////////////// + virtual void invoke + () + const { C obj; (obj.*m_method)(); } - virtual ITestCase* clone() const + /////////////////////////////////////////////////////////////////////////// + virtual ITestCase* clone + () + const { return new MethodTestCase( m_method ); } - virtual bool operator == ( const ITestCase& other ) const + /////////////////////////////////////////////////////////////////////////// + virtual bool operator == + ( + const ITestCase& other + ) + const { const MethodTestCase* mtOther = dynamic_cast( &other ); return mtOther && m_method == mtOther->m_method; } - virtual bool operator < ( const ITestCase& other ) const + /////////////////////////////////////////////////////////////////////////// + virtual bool operator < + ( + const ITestCase& other + ) + const { const MethodTestCase* mtOther = dynamic_cast( &other ); return mtOther && &m_method < &mtOther->m_method; @@ -56,21 +76,41 @@ typedef void(*TestFunction)(); struct AutoReg { - AutoReg( TestFunction function, const char* name, const char* description ); + AutoReg + ( TestFunction function, + const char* name, + const char* description + ); + /////////////////////////////////////////////////////////////////////////// template - AutoReg( void (C::*method)(), const char* name, const char* description ) + AutoReg + ( + void (C::*method)(), + const char* name, + const char* description + ) { registerTestCase( new MethodTestCase( method ), name, description ); } - void registerTestCase( ITestCase* testCase, const char* name, const char* description ); + /////////////////////////////////////////////////////////////////////////// + void registerTestCase + ( + ITestCase* testCase, + const char* name, + const char* description + ); - ~AutoReg(); + ~AutoReg + (); private: - AutoReg( const AutoReg& ); - void operator=( const AutoReg& ); + AutoReg + ( const AutoReg& ); + + void operator= + ( const AutoReg& ); }; template @@ -78,19 +118,23 @@ struct FixtureWrapper{}; } // end namespace Catch +/////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_TESTCASE( Name, Desc ) \ static void INTERNAL_CATCH_UNIQUE_NAME( catch_internal_TestFunction )(); \ namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &INTERNAL_CATCH_UNIQUE_NAME( catch_internal_TestFunction ), Name, Desc ); }\ static void INTERNAL_CATCH_UNIQUE_NAME( catch_internal_TestFunction )() +/////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_TESTCASE_NORETURN( Name, Desc ) \ static void INTERNAL_CATCH_UNIQUE_NAME( catch_internal_TestFunction )() ATTRIBUTE_NORETURN; \ namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &INTERNAL_CATCH_UNIQUE_NAME( catch_internal_TestFunction ), Name, Desc ); }\ static void INTERNAL_CATCH_UNIQUE_NAME( catch_internal_TestFunction )() +/////////////////////////////////////////////////////////////////////////////// #define CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, Name, Desc ) \ namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &QualifiedMethod, Name, Desc ); } +/////////////////////////////////////////////////////////////////////////////// #define TEST_CASE_METHOD( ClassName, TestName, Desc )\ namespace Catch{ template<> struct FixtureWrapper : ClassName \ { \ diff --git a/internal/catch_xmlwriter.hpp b/internal/catch_xmlwriter.hpp index 7c9ed3e5..4642e581 100644 --- a/internal/catch_xmlwriter.hpp +++ b/internal/catch_xmlwriter.hpp @@ -24,30 +24,50 @@ namespace Catch class ScopedElement { public: - ScopedElement( XmlWriter* writer ) + /////////////////////////////////////////////////////////////////// + ScopedElement + ( + XmlWriter* writer + ) : m_writer( writer ) { } - ScopedElement( const ScopedElement& other ) + /////////////////////////////////////////////////////////////////// + ScopedElement + ( + const ScopedElement& other + ) : m_writer( other.m_writer ) { other.m_writer = NULL; } - ~ScopedElement() + /////////////////////////////////////////////////////////////////// + ~ScopedElement + () { if( m_writer ) m_writer->endElement(); } - ScopedElement& writeText( const std::string& text ) + /////////////////////////////////////////////////////////////////// + ScopedElement& writeText + ( + const std::string& text + ) { m_writer->writeText( text ); return *this; } + + /////////////////////////////////////////////////////////////////// template - ScopedElement& writeAttribute( const std::string& name, const T& attribute ) + ScopedElement& writeAttribute + ( + const std::string& name, + const T& attribute + ) { m_writer->writeAttribute( name, attribute ); return *this; @@ -57,21 +77,29 @@ namespace Catch mutable XmlWriter* m_writer; }; - XmlWriter() + /////////////////////////////////////////////////////////////////////// + XmlWriter + () : m_tagIsOpen( false ), m_needsNewline( false ), m_os( &std::cout ) { } - XmlWriter( std::ostream& os) + /////////////////////////////////////////////////////////////////////// + XmlWriter + ( + std::ostream& os + ) : m_tagIsOpen( false ), m_needsNewline( false ), m_os( &os ) { } - ~XmlWriter() + /////////////////////////////////////////////////////////////////////// + ~XmlWriter + () { while( !m_tags.empty() ) { @@ -79,14 +107,22 @@ namespace Catch } } - XmlWriter& operator = ( const XmlWriter& other ) + /////////////////////////////////////////////////////////////////////// + XmlWriter& operator = + ( + const XmlWriter& other + ) { XmlWriter temp( other ); swap( temp ); return *this; } - void swap( XmlWriter& other ) + /////////////////////////////////////////////////////////////////////// + void swap + ( + XmlWriter& other + ) { std::swap( m_tagIsOpen, other.m_tagIsOpen ); std::swap( m_needsNewline, other.m_needsNewline ); @@ -95,7 +131,11 @@ namespace Catch std::swap( m_os, other.m_os ); } - XmlWriter& startElement( const std::string& name ) + /////////////////////////////////////////////////////////////////////// + XmlWriter& startElement + ( + const std::string& name + ) { ensureTagClosed(); newlineIfNecessary(); @@ -106,14 +146,20 @@ namespace Catch return *this; } - ScopedElement scopedElement( const std::string& name ) + /////////////////////////////////////////////////////////////////////// + ScopedElement scopedElement + ( + const std::string& name + ) { ScopedElement scoped( this ); startElement( name ); return scoped; } - XmlWriter& endElement() + /////////////////////////////////////////////////////////////////////// + XmlWriter& endElement + () { newlineIfNecessary(); m_indent = m_indent.substr( 0, m_indent.size()-2 ); @@ -130,7 +176,12 @@ namespace Catch return *this; } - XmlWriter& writeAttribute( const std::string& name, const std::string& attribute ) + /////////////////////////////////////////////////////////////////////// + XmlWriter& writeAttribute + ( + const std::string& name, + const std::string& attribute + ) { if( !name.empty() && !attribute.empty() ) { @@ -140,14 +191,25 @@ namespace Catch } return *this; } - XmlWriter& writeAttribute( const std::string& name, bool attribute ) + + /////////////////////////////////////////////////////////////////////// + XmlWriter& writeAttribute + ( + const std::string& name, + bool attribute + ) { stream() << " " << name << "=\"" << ( attribute ? "true" : "false" ) << "\""; return *this; } + /////////////////////////////////////////////////////////////////////// template - XmlWriter& writeAttribute( const std::string& name, const T& attribute ) + XmlWriter& writeAttribute + ( + const std::string& name, + const T& attribute + ) { if( !name.empty() ) { @@ -156,7 +218,11 @@ namespace Catch return *this; } - XmlWriter& writeText( const std::string& text ) + /////////////////////////////////////////////////////////////////////// + XmlWriter& writeText + ( + const std::string& text + ) { if( !text.empty() ) { @@ -170,7 +236,11 @@ namespace Catch return *this; } - XmlWriter& writeComment( const std::string& text ) + /////////////////////////////////////////////////////////////////////// + XmlWriter& writeComment + ( + const std::string& text + ) { ensureTagClosed(); stream() << m_indent << ""; @@ -178,7 +248,9 @@ namespace Catch return *this; } - XmlWriter& writeBlankLine() + /////////////////////////////////////////////////////////////////////// + XmlWriter& writeBlankLine + () { ensureTagClosed(); stream() << "\n"; @@ -187,12 +259,16 @@ namespace Catch private: - std::ostream& stream() + /////////////////////////////////////////////////////////////////////// + std::ostream& stream + () { return *m_os; } - void ensureTagClosed() + /////////////////////////////////////////////////////////////////////// + void ensureTagClosed + () { if( m_tagIsOpen ) { @@ -201,7 +277,9 @@ namespace Catch } } - void newlineIfNecessary() + /////////////////////////////////////////////////////////////////////// + void newlineIfNecessary + () { if( m_needsNewline ) { @@ -210,7 +288,11 @@ namespace Catch } } - void writeEncodedText( const std::string& text ) + /////////////////////////////////////////////////////////////////////// + void writeEncodedText + ( + const std::string& text + ) { // !TBD finish this if( !findReplaceableString( text, "<", "<" ) && @@ -221,7 +303,13 @@ namespace Catch } } - bool findReplaceableString( const std::string& text, const std::string& replaceWhat, const std::string& replaceWith ) + /////////////////////////////////////////////////////////////////////// + bool findReplaceableString + ( + const std::string& text, + const std::string& replaceWhat, + const std::string& replaceWith + ) { std::string::size_type pos = text.find_first_of( replaceWhat ); if( pos != std::string::npos )