From 9eab931708b4ebd18b2e30e9188d02a1784649e4 Mon Sep 17 00:00:00 2001 From: Michael Andres Date: Wed, 6 Apr 2011 11:49:27 +0200 Subject: [PATCH] genclass: add dumpOn to template --- devel/genclass.in | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/devel/genclass.in b/devel/genclass.in index a917a07..faa493a 100644 --- a/devel/genclass.in +++ b/devel/genclass.in @@ -111,11 +111,13 @@ ${INDENT} */ ${INDENT}class ${CLASS} : protected base::SafeBool<${CLASS}>, private base::NonCopyable ${INDENT}{ ${INDENT} friend std::ostream & operator<<( std::ostream & str, const ${CLASS} & obj ); +${INDENT} friend std::ostream & dumpOn( std::ostream & str, const ${CLASS} & obj ); ${INDENT} friend bool operator==( const ${CLASS} & lhs, const ${CLASS} & rhs ); ${INDENT} public: ${INDENT} /** Default ctor */ ${INDENT} ${CLASS}(); + ${INDENT} /** Dtor */ ${INDENT} ~${CLASS}(); @@ -144,6 +146,9 @@ ${INDENT}}; ${INDENT}/** \relates ${CLASS} Stream output */ ${INDENT}std::ostream & operator<<( std::ostream & str, const ${CLASS} & obj ); +${INDENT}/** \relates ${CLASS} Verbose stream output */ +${INDENT}std::ostream & dumOn( std::ostream & str, const ${CLASS} & obj ); + ${INDENT}/** \relates ${CLASS} */ ${INDENT}bool operator==( const ${CLASS} & lhs, const ${CLASS} & rhs ); @@ -174,6 +179,10 @@ ${INDENT}/** ${CLASS} implementation. ${INDENT} */ ${INDENT}struct ${CLASS}::Impl ${INDENT}{ +${INDENT} friend std::ostream & operator<<( std::ostream & str, const Impl & obj ); +${INDENT} friend std::ostream & dumpOn( std::ostream & str, const Impl & obj ); + +${INDENT} public: ${INDENT} public: ${INDENT} /** Offer default Impl. */ @@ -182,7 +191,6 @@ ${INDENT} { ${INDENT} static shared_ptr _nullimpl( new Impl ); ${INDENT} return _nullimpl; ${INDENT} } - ${INDENT} private: ${INDENT} friend Impl * rwcowClone( const Impl * rhs ); ${INDENT} /** clone for RWCOW_pointer */ @@ -194,6 +202,10 @@ ${INDENT}/** \relates ${CLASS}::Impl Stream output */ ${INDENT}inline std::ostream & operator<<( std::ostream & str, const ${CLASS}::Impl & obj ) ${INDENT}{ return str << "${CLASS}::Impl"; } +${INDENT}/** \relates ${CLASS}::Impl Verbose stream output */ +${INDENT}inline std::ostream & dumpOn( std::ostream & str, const ${CLASS}::Impl & obj ) +${INDENT}{ return str << obj; } + ${INDENT}/////////////////////////////////////////////////////////////////// ${INDENT}// ${INDENT}// CLASS NAME : ${CLASS} @@ -210,6 +222,9 @@ ${INDENT}{} ${INDENT}std::ostream & operator<<( std::ostream & str, const ${CLASS} & obj ) ${INDENT}{ return str << *obj._pimpl; } +${INDENT}std::ostream & dumpOn( std::ostream & str, const ${CLASS} & obj ) +${INDENT}{ return dumpOn( str, *obj._pimpl ); } + ${INDENT}bool operator==( const ${CLASS} & lhs, const ${CLASS} & rhs ) ${INDENT}{ return lhs._pimpl == rhs._pimpl || lhs._pimpl && rhs._pimpl && *lhs._pimpl == *rhs._pimpl; } -- 2.7.4