add spaces for PICout operators

This commit is contained in:
2025-02-27 21:26:29 +03:00
parent 8e96750046
commit 4340f5444d
5 changed files with 15 additions and 0 deletions

View File

@@ -179,6 +179,7 @@ public:
//! \~russian Перегруженный оператор для вывода координат в \a PICout.
template<typename Type>
PICout operator<<(PICout & s, const PILine<Type> & v) {
s.space();
s.saveAndSetControls(0);
s << "Line{" << v.p0 << ", " << v.p1 << "}";
s.restoreControls();

View File

@@ -771,6 +771,8 @@ inline std::ostream & operator<<(std::ostream & s, const PIMathMatrixT<Rows, Col
//! \return непечатанная в консоль \a PICout.
template<uint Rows, uint Cols, typename Type>
inline PICout operator<<(PICout s, const PIMathMatrixT<Rows, Cols, Type> & 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<Rows, Cols, Type> & 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<Type> & m)
//! \return непечатанная в консоль \a PICout.
template<typename Type>
inline PICout operator<<(PICout s, const PIMathMatrix<Type> & 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<Type> & m) {
if (r < m.rows() - 1) s << PICoutManipulators::NewLine << " ";
}
s << "}";
s.restoreControls();
return s;
}

View File

@@ -333,12 +333,15 @@ inline PIMathVectorT<Size, Type> operator*(const Type & x, const PIMathVectorT<S
template<uint Size, typename Type>
inline PICout operator<<(PICout s, const PIMathVectorT<Size, Type> & 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<Type> & v)
template<typename Type>
inline PICout operator<<(PICout s, const PIMathVector<Type> & 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;
}

View File

@@ -154,6 +154,7 @@ public:
//! \~russian Перегруженный оператор для вывода координат в \a PICout.
template<typename Type>
PICout operator<<(PICout & s, const PIPoint<Type> & v) {
s.space();
s.saveAndSetControls(0);
s << "Point{" << v.x << ", " << v.y << "}";
s.restoreControls();

View File

@@ -360,6 +360,7 @@ private:
template<typename Type>
PICout operator<<(PICout & s, const PIRect<Type> & v) {
s.space();
s.saveAndSetControls(0);
s << "Rect{" << v.bottomLeft() << ":" << v.width() << "x" << v.height() << "}";
s.restoreControls();