From 4340f5444d0b298a5b1dc84b46009fdd203ebb7f Mon Sep 17 00:00:00 2001 From: peri4 Date: Thu, 27 Feb 2025 21:26:29 +0300 Subject: [PATCH] add spaces for PICout operators --- libs/main/math/piline.h | 1 + libs/main/math/pimathmatrix.h | 6 ++++++ libs/main/math/pimathvector.h | 6 ++++++ libs/main/math/pipoint.h | 1 + libs/main/math/pirect.h | 1 + 5 files changed, 15 insertions(+) diff --git a/libs/main/math/piline.h b/libs/main/math/piline.h index 2e43252d..9da36d57 100644 --- a/libs/main/math/piline.h +++ b/libs/main/math/piline.h @@ -179,6 +179,7 @@ public: //! \~russian Перегруженный оператор для вывода координат в \a PICout. template PICout operator<<(PICout & s, const PILine & v) { + s.space(); s.saveAndSetControls(0); s << "Line{" << v.p0 << ", " << v.p1 << "}"; s.restoreControls(); diff --git a/libs/main/math/pimathmatrix.h b/libs/main/math/pimathmatrix.h index e7e52d2e..3986e1a8 100644 --- a/libs/main/math/pimathmatrix.h +++ b/libs/main/math/pimathmatrix.h @@ -771,6 +771,8 @@ inline std::ostream & operator<<(std::ostream & s, const PIMathMatrixT inline PICout operator<<(PICout s, const PIMathMatrixT & m) { + s.space(); + s.saveAndSetControls(0); s << "{"; for (uint r = 0; r < Rows; ++r) { for (uint c = 0; c < Cols; ++c) { @@ -780,6 +782,7 @@ inline PICout operator<<(PICout s, const PIMathMatrixT & m) { if (r < Rows - 1) s << PICoutManipulators::NewLine << " "; } s << "}"; + s.restoreControls(); return s; } @@ -1465,6 +1468,8 @@ inline std::ostream & operator<<(std::ostream & s, const PIMathMatrix & m) //! \return непечатанная в консоль \a PICout. template inline PICout operator<<(PICout s, const PIMathMatrix & m) { + s.space(); + s.saveAndSetControls(0); s << "Matrix{"; for (uint r = 0; r < m.rows(); ++r) { for (uint c = 0; c < m.cols(); ++c) { @@ -1474,6 +1479,7 @@ inline PICout operator<<(PICout s, const PIMathMatrix & m) { if (r < m.rows() - 1) s << PICoutManipulators::NewLine << " "; } s << "}"; + s.restoreControls(); return s; } diff --git a/libs/main/math/pimathvector.h b/libs/main/math/pimathvector.h index 41b4daa5..f19bcc7d 100644 --- a/libs/main/math/pimathvector.h +++ b/libs/main/math/pimathvector.h @@ -333,12 +333,15 @@ inline PIMathVectorT operator*(const Type & x, const PIMathVectorT inline PICout operator<<(PICout s, const PIMathVectorT & v) { + s.space(); + s.saveAndSetControls(0); s << "Vector{"; PIMV_FOR { s << v[i]; if (i < Size - 1) s << ", "; } s << "}"; + s.restoreControls(); return s; } @@ -611,12 +614,15 @@ inline std::ostream & operator<<(std::ostream & s, const PIMathVector & v) template inline PICout operator<<(PICout s, const PIMathVector & v) { + s.space(); + s.saveAndSetControls(0); s << "Vector{"; for (uint i = 0; i < v.size(); ++i) { s << v[i]; if (i < v.size() - 1) s << ", "; } s << "}"; + s.restoreControls(); return s; } diff --git a/libs/main/math/pipoint.h b/libs/main/math/pipoint.h index 77e50721..8bca9a15 100644 --- a/libs/main/math/pipoint.h +++ b/libs/main/math/pipoint.h @@ -154,6 +154,7 @@ public: //! \~russian Перегруженный оператор для вывода координат в \a PICout. template PICout operator<<(PICout & s, const PIPoint & v) { + s.space(); s.saveAndSetControls(0); s << "Point{" << v.x << ", " << v.y << "}"; s.restoreControls(); diff --git a/libs/main/math/pirect.h b/libs/main/math/pirect.h index a4085b1a..d6c3ddf1 100644 --- a/libs/main/math/pirect.h +++ b/libs/main/math/pirect.h @@ -360,6 +360,7 @@ private: template PICout operator<<(PICout & s, const PIRect & v) { + s.space(); s.saveAndSetControls(0); s << "Rect{" << v.bottomLeft() << ":" << v.width() << "x" << v.height() << "}"; s.restoreControls();