Add output stream operator for COLOR4D

This commit is contained in:
Jon Evans 2017-03-30 22:09:19 -04:00 committed by Chris Pavlina
parent f16f39fd4c
commit 8cd1df0524
2 changed files with 10 additions and 2 deletions

View File

@ -73,7 +73,7 @@ COLOR4D::COLOR4D( EDA_COLOR_T aColor )
}
wxString COLOR4D::ToWxString( long flags )
wxString COLOR4D::ToWxString( long flags ) const
{
wxColour c = ToColour();
return c.GetAsString( flags );
@ -256,6 +256,11 @@ const bool operator!=( const COLOR4D& lhs, const COLOR4D& rhs )
return !( lhs == rhs );
}
std::ostream &operator<<( std::ostream &aStream, COLOR4D const &aColor )
{
return aStream << aColor.ToWxString( wxC2S_CSS_SYNTAX );
}
}

View File

@ -87,7 +87,7 @@ public:
*/
bool SetFromWxString( const wxString& aColorString );
wxString ToWxString( long flags );
wxString ToWxString( long flags ) const;
wxColour ToColour() const
{
@ -297,6 +297,9 @@ const bool operator==( const COLOR4D& lhs, const COLOR4D& rhs );
/// @brief Not equality operator, are two colors not equal
const bool operator!=( const COLOR4D& lhs, const COLOR4D& rhs );
/// Syntactic sugar for outputting colors to strings
std::ostream &operator<<( std::ostream &aStream, COLOR4D const &aColor );
} // namespace KIGFX
#endif /* COLOR4D_H_ */