Browse Source

Add output stream operator for COLOR4D

pull/3/merge
Jon Evans 9 years ago
committed by Chris Pavlina
parent
commit
8cd1df0524
  1. 7
      common/gal/color4d.cpp
  2. 5
      include/gal/color4d.h

7
common/gal/color4d.cpp

@ -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 );
}
}

5
include/gal/color4d.h

@ -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_ */
Loading…
Cancel
Save