PICout refactoring, new SHSTKMacros

This commit is contained in:
2022-08-07 22:07:26 +03:00
parent 1eaecb288f
commit 8551499a5e
36 changed files with 106 additions and 106 deletions

View File

@@ -20,12 +20,7 @@ main library
cmake_policy(SET CMP0011 NEW) # don`t affect includer policies
include(SHSTKMacros)
shstk_set_find_dirs(pip)
if(PIP_DIR)
list(APPEND pip_LIBDIR "${PIP_DIR}/lib")
list(APPEND pip_INCDIR "${PIP_DIR}/include/pip")
list(APPEND pip_BINDIR "${PIP_DIR}/bin")
endif()
shstk_set_find_dirs(pip PIP)
set(__libs "usb;crypt;console;fftw;compress;io_utils;opencl;cloud;lua")

View File

@@ -4,7 +4,7 @@
inline PICout operator <<(PICout s, const PIByteArray & ba) {
s.space(); // insert space after previous output
s.quote(); // ONLY if you want to quoted your type
s.setControl(0, true); // clear all features and
s.saveAndSetControls(0); // clear all features and
// save them to stack,
// now it`s behavior similar to std::cout
@@ -12,7 +12,7 @@ inline PICout operator <<(PICout s, const PIByteArray & ba) {
for (uint i = 0; i < ba.size(); ++i)
s << ba[i];
s.restoreControl(); // restore features from stack
s.restoreControls(); // restore features from stack
s.quote(); // ONLY if you want to quoted your type
return s;
}

View File

@@ -538,12 +538,11 @@ TilePICout::TilePICout(const PIString & n): TileList(n) {
max_lines = 1024;
selection_mode = TileList::SingleSelection;
PICout::setOutputDevices(PICout::Buffer);
PICout::setBufferActive(true);
}
void TilePICout::drawEvent(PIScreenDrawer * d) {
PIString out = PICout::buffer(true);
PIString out = PICout::getBufferAndClear();
if (!out.isEmpty()) {
PIStringList l = out.split("\n");
bool scroll = (cur == content.size_s() - 1) || !has_focus;

View File

@@ -218,7 +218,7 @@ inline PICout operator <<(PICout s, const PICodeInfo::TypeInfo & v) {
inline PICout operator <<(PICout s, const PICodeInfo::EnumeratorInfo & v) {s << v.name << " = " << v.value << " Meta" << v.meta; return s;}
inline PICout operator <<(PICout s, const PICodeInfo::ClassInfo & v) {
s.setControl(0, true);
s.saveAndSetControls(0);
s << "class " << v.name;
if (!v.parents.isEmpty()) {
s << ": ";
@@ -246,12 +246,12 @@ inline PICout operator <<(PICout s, const PICodeInfo::ClassInfo & v) {
s << PICoutManipulators::Tab << i << " Meta" << i.meta << ";\n";
}
s << "}\n";
s.restoreControl();
s.restoreControls();
return s;
}
inline PICout operator <<(PICout s, const PICodeInfo::EnumInfo & v) {
s.setControl(0, true);
s.saveAndSetControls(0);
s << "enum " << v.name << " Meta" << v.meta << " {\n";
for (const auto & i: v.members) {
bool f = true;
@@ -260,7 +260,7 @@ inline PICout operator <<(PICout s, const PICodeInfo::EnumInfo & v) {
s << PICoutManipulators::Tab << i << "\n";
}
s << "}\n";
s.restoreControl();
s.restoreControls();
return s;
}

View File

@@ -2439,14 +2439,14 @@ inline std::ostream & operator <<(std::ostream & s, const PIDeque<T> & v) {
template<typename T>
inline PICout operator <<(PICout s, const PIDeque<T> & v) {
s.space();
s.setControl(0, true);
s.saveAndSetControls(0);
s << "{";
for (size_t i = 0; i < v.size(); ++i) {
s << v[i];
if (i < v.size() - 1) s << ", ";
}
s << "}";
s.restoreControl();
s.restoreControls();
return s;
}

View File

@@ -845,7 +845,7 @@ inline std::ostream & operator <<(std::ostream & s, const PIMap<Key, Type> & v)
template<typename Key, typename Type>
inline PICout operator <<(PICout s, const PIMap<Key, Type> & v) {
s.space();
s.setControl(0, true);
s.saveAndSetControls(0);
s << "{";
bool first = true;
for (typename PIMap<Key, Type>::const_iterator i = v.begin(); i != v.end(); ++i) {
@@ -855,7 +855,7 @@ inline PICout operator <<(PICout s, const PIMap<Key, Type> & v) {
s << i.key() << ": " << i.value();
}
s << "}";
s.restoreControl();
s.restoreControls();
return s;
}

View File

@@ -114,9 +114,9 @@ inline std::ostream & operator <<(std::ostream & s, const PIPair<Type0, Type1> &
template<typename Type0, typename Type1>
inline PICout operator <<(PICout s, const PIPair<Type0, Type1> & v) {
s.space();
s.setControl(0, true);
s.saveAndSetControls(0);
s << "(" << v.first << ", " << v.second << ")";
s.restoreControl();
s.restoreControls();
return s;
}

View File

@@ -145,7 +145,7 @@ template <typename T> PISet<T> operator &(const PISet<T> & v0, const PISet<T> &
template<typename Type>
inline PICout operator <<(PICout s, const PISet<Type> & v) {
s.space();
s.setControl(0, true);
s.saveAndSetControls(0);
s << "{";
bool first = true;
for (typename PIMap<Type, uchar>::const_iterator i = v.begin(); i != v.end(); ++i) {
@@ -155,7 +155,7 @@ inline PICout operator <<(PICout s, const PISet<Type> & v) {
s << i.key();
}
s << "}";
s.restoreControl();
s.restoreControls();
return s;
}

View File

@@ -2316,7 +2316,7 @@ inline std::ostream & operator <<(std::ostream & s, const PIVector<T> & v) {
template<typename T>
inline PICout operator <<(PICout s, const PIVector<T> & v) {
s.space();
s.setControl(0, true);
s.saveAndSetControls(0);
s << "{";
for (size_t i = 0; i < v.size(); ++i) {
s << v[i];
@@ -2325,7 +2325,7 @@ inline PICout operator <<(PICout s, const PIVector<T> & v) {
}
}
s << "}";
s.restoreControl();
s.restoreControls();
return s;
}

View File

@@ -292,7 +292,7 @@ protected:
template<typename T>
inline PICout operator <<(PICout s, const PIVector2D<T> & v) {
s.setControl(0, true);
s.saveAndSetControls(0);
s << "{";
for (size_t i = 0; i < v.rows(); ++i) {
s << "{ ";
@@ -305,7 +305,7 @@ inline PICout operator <<(PICout s, const PIVector2D<T> & v) {
}
if (v.isEmpty()) s << "{ }";
s << "}";
s.restoreControl();
s.restoreControls();
return s;
}

View File

@@ -23,12 +23,12 @@
PICout operator <<(PICout s, const PIBitArray & ba) {
s.space();
s.setControl(0, true);
s.saveAndSetControls(0);
for (uint i = 0; i < ba.bitSize(); ++i) {
s << int(ba[i]);
if (i % 8 == 7) s << ' ';
}
s.restoreControl();
s.restoreControls();
return s;
}

View File

@@ -406,14 +406,14 @@ PIByteArray PIByteArray::fromHex(PIString str) {
PICout operator <<(PICout s, const PIByteArray & ba) {
s.space();
s.setControl(0, true);
s.saveAndSetControls(0);
s << "{";
for (uint i = 0; i < ba.size(); ++i) {
s << ba[i];
if (i < ba.size() - 1) s << ", ";
}
s << "}";
s.restoreControl();
s.restoreControls();
return s;
}

View File

@@ -359,7 +359,7 @@ PIChar PIChar::toLower() const {
PICout operator <<(PICout s, const PIChar & v) {
s.space();
s.setControl(0, true);
s.saveAndSetControls(0);
if (v.isAscii()) s << char(v.ch);
else {
#ifdef PIP_ICU
@@ -380,6 +380,6 @@ PICout operator <<(PICout s, const PIChar & v) {
s << PIString(v);
#endif
}
s.restoreControl();
s.restoreControls();
return s;
}

View File

@@ -267,8 +267,8 @@ PICout PICout::operator <<(const PICoutAction v) {
#endif
}
break;
case PICoutManipulators::SaveContol: saveControl(); break;
case PICoutManipulators::RestoreControl: restoreControl(); break;
case PICoutManipulators::SaveContol: saveControls(); break;
case PICoutManipulators::RestoreControl: restoreControls(); break;
default: break;
};
return *this;
@@ -440,14 +440,14 @@ PICout PICout::operator <<(const PICoutSpecialChar v) {
}
PICout & PICout::saveControl() {
PICout & PICout::saveControls() {
if (!act_) return *this;
PRIVATE->cos_.push(co_);
return *this;
}
PICout & PICout::restoreControl() {
PICout & PICout::restoreControls() {
if (!act_) return *this;
if (!PRIVATE->cos_.isEmpty()) {
co_ = PRIVATE->cos_.top();
@@ -650,24 +650,17 @@ void PICout::applyFormat(PICoutFormat f) {
}
bool PICout::setBufferActive(bool on, bool clear) {
PIString PICout::getBuffer() {
PIMutexLocker ml(PICout::__mutex__());
bool ret = isBufferActive();
if (clear) PICout::__string__().clear();
setOutputDevice(Buffer, on);
PIString ret = PICout::__string__();
return ret;
}
bool PICout::isBufferActive() {
return isOutputDeviceActive(Buffer);
}
PIString PICout::buffer(bool clear) {
PIString PICout::getBufferAndClear() {
PIMutexLocker ml(PICout::__mutex__());
PIString ret = PICout::__string__();
if (clear) PICout::__string__().clear();
PICout::__string__().clear();
return ret;
}

View File

@@ -261,19 +261,23 @@ public:
//! \~russian Установить флаг "c" в "on" состояние
PICout & setControl(PICoutManipulators::PICoutControl c, bool on = true) {co_.setFlag(c, on); return *this;}
//! \~english Set control flags "c" and if "save" exec \a saveControl()
//! \~russian Установить флаг "c" и если "save" то выполнить \a saveControl()
PICout & setControl(PICoutManipulators::PICoutControls c, bool save = false) {if (save) saveControl(); co_ = c; return *this;}
//! \~english Set control flags "c"
//! \~russian Установить флаги "c"
PICout & setControls(PICoutManipulators::PICoutControls c) {co_ = c; return *this;}
//! \~english Exec \a saveControls() and set control flags to "c"
//! \~russian Иыполнить \a saveControls() и Установить флаги "c"
PICout & saveAndSetControls(PICoutManipulators::PICoutControls c) {saveControls(); co_ = c; return *this;}
//! \~english Save control flags to internal stack
//! \~russian Сохраняет состояние флагов во внутренний стек
//! \~\sa \a restoreControl()
PICout & saveControl();
PICout & saveControls();
//! \~english Restore control flags from internal stack
//! \~russian Восстанавливает состояние флагов из внутреннего стека
//! \~\sa \a saveControl()
PICout & restoreControl();
PICout & restoreControls();
//! \~english Conditional put space character to output
//! \~russian Условно добавляет пробел
@@ -307,17 +311,13 @@ public:
//! \~russian Вывод \a PIString в stdout
static void stdoutPIString(const PIString & s);
//! \~english Set output device to \a PICout::Buffer and if "clear" clear it
//! \~russian Устанавливает устройство вывода на \a PICout::Buffer и если "clear" то очищает его
static bool setBufferActive(bool on, bool clear = false);
//! \~english Returns internal PIString buffer
//! \~russian Возвращает внутренний PIString буфер
static PIString getBuffer();
//! \~english Equivalent to \a isOutputDeviceActive(OutputDevice)
//! \~russian Аналог \a isOutputDeviceActive(OutputDevice)
static bool isBufferActive();
//! \~english Returns internal PIString buffer and if "clear" clear it
//! \~russian Возвращает внутренний PIString буфер и если "clear" то очищает его
static PIString buffer(bool clear = false);
//! \~english Returns internal PIString buffer and clear it
//! \~russian Возвращает внутренний PIString буфер и очищает его
static PIString getBufferAndClear();
//! \~english Clear internal PIString buffer
//! \~russian Очищает внутренний PIString буфер
@@ -328,10 +328,22 @@ public:
//! \~russian Устройство вывода "d" устанавливается в "on". Возвращает было ли устройство активно
static bool setOutputDevice(OutputDevice d, bool on = true);
//! \~english Turn on output device "d". Returns if it was enabled
//! \~russian Включает устройство вывода "d". Возвращает было ли устройство активно
static bool enableOutputDevice(OutputDevice d) {return setOutputDevice(d, true);}
//! \~english Turn off output device "d". Returns if it was enabled
//! \~russian Выключает устройство вывода "d". Возвращает было ли устройство активно
static bool disableOutputDevice(OutputDevice d) {return setOutputDevice(d, false);}
//! \~english Set output to devices to "d"
//! \~russian Устанавливает устройства вывода "d"
static void setOutputDevices(OutputDevices d);
//! \~english Returns current output devices
//! \~russian Возвращает текущие устройства вывода
static OutputDevices currentOutputDevices() {return devs;}
//! \~english Returns if output device "d" is active
//! \~russian Возвращает активно ли устройство вывода "d"
static bool isOutputDeviceActive(OutputDevice d);

View File

@@ -312,30 +312,30 @@ PIString datetime2string(const PIDateTime & date, const PIString & format) {
PICout operator <<(PICout s, const PITime & v) {
s.space();
s.setControl(0, true);
s.saveAndSetControls(0);
s << "PITime(" << v.hours << ":";
s << PIString::fromNumber(v.minutes).expandLeftTo(2, '0') << ":";
s << PIString::fromNumber(v.seconds).expandLeftTo(2, '0') << ":";
s << PIString::fromNumber(v.milliseconds).expandLeftTo(3, '0') << ")";
s.restoreControl();
s.restoreControls();
return s;
}
PICout operator <<(PICout s, const PIDate & v) {
s.space();
s.setControl(0, true);
s.saveAndSetControls(0);
s << "PIDate(" << v.day << "-";
s << PIString::fromNumber(v.month).expandLeftTo(2, '0') << "-";
s << v.year << ")";
s.restoreControl();
s.restoreControls();
return s;
}
PICout operator <<(PICout s, const PIDateTime & v) {
s.space();
s.setControl(0, true);
s.saveAndSetControls(0);
s << "PIDateTime(";
s << v.day << "-";
s << PIString::fromNumber(v.month).expandLeftTo(2, '0') << "-";
@@ -344,7 +344,7 @@ PICout operator <<(PICout s, const PIDateTime & v) {
s << PIString::fromNumber(v.minutes).expandLeftTo(2, '0') << ":";
s << PIString::fromNumber(v.seconds).expandLeftTo(2, '0') << ":";
s << PIString::fromNumber(v.milliseconds).expandLeftTo(3, '0') << ")";
s.restoreControl();
s.restoreControls();
return s;
}

View File

@@ -751,13 +751,14 @@ bool dumpApplicationToFile(const PIString & path, bool with_objects) {
f.setName("__S__DumpFile");
f.clear();
if (!f.open(PIIODevice::WriteOnly)) return false;
bool ba = PICout::isBufferActive();
PICout::setBufferActive(true, true);
auto out_devs = PICout::currentOutputDevices();
PICout::setOutputDevices(PICout::Buffer);
PICout::clearBuffer();
dumpApplication(with_objects);
PIIOTextStream ts(&f);
ts << PICout::buffer();
ts << PICout::getBuffer();
f.close();
PICout::setBufferActive(ba, true);
PICout::setOutputDevices(out_devs);
PIFile::rename(path + "_tmp", path);
return true;
}

View File

@@ -146,6 +146,6 @@ BINARY_STREAM_READ(PIStringList) {
//! \relatesalso PICout
//! \~english Output operator to \a PICout
//! \~russian Оператор вывода в \a PICout
inline PICout operator <<(PICout s, const PIStringList & v) {s.space(); s.setControl(0, true); s << "{"; for (uint i = 0; i < v.size(); ++i) {s << "\"" << v[i] << "\""; if (i < v.size() - 1) s << ", ";} s << "}"; s.restoreControl(); return s;}
inline PICout operator <<(PICout s, const PIStringList & v) {s.space(); s.saveAndSetControls(0); s << "{"; for (uint i = 0; i < v.size(); ++i) {s << "\"" << v[i] << "\""; if (i < v.size() - 1) s << ", ";} s << "}"; s.restoreControls(); return s;}
#endif // PISTRINGLIST_H

View File

@@ -186,7 +186,7 @@ private:
//! \relatesalso PICout
//! \~english \brief Output operator to PICout
//! \~russian \brief Оператор вывода в PICout
inline PICout operator <<(PICout s, const PISystemTime & v) {s.space(); s.setControl(0, true); s << "(" << v.seconds << " s, " << v.nanoseconds << " ns)"; s.restoreControl(); return s;}
inline PICout operator <<(PICout s, const PISystemTime & v) {s.space(); s.saveAndSetControls(0); s << "(" << v.seconds << " s, " << v.nanoseconds << " ns)"; s.restoreControls(); return s;}

View File

@@ -809,12 +809,12 @@ BINARY_STREAM_READ(PIVariant) {
}
inline PICout operator <<(PICout s, const PIVariant & v) {
s.space(); s.setControl(0, true);
s.space(); s.saveAndSetControls(0);
s << "PIVariant(" << v.typeName();
if (v.isValid())
s << ", " << v.toString();
s << ")";
s.restoreControl(); return s;
s.restoreControls(); return s;
}

View File

@@ -172,7 +172,7 @@ inline PICout operator <<(PICout s, const PIVariantTypes::File & v) {s << "File(
inline PICout operator <<(PICout s, const PIVariantTypes::Dir & v) {s << "Dir(\"" << v.dir << "\")"; return s;}
inline PICout operator <<(PICout s, const PIVariantTypes::Color & v) {s.saveControl(); s << PICoutManipulators::Hex << "Color(#" << v.rgba << ")"; s.restoreControl(); return s;}
inline PICout operator <<(PICout s, const PIVariantTypes::Color & v) {s.saveControls(); s << PICoutManipulators::Hex << "Color(#" << v.rgba << ")"; s.restoreControls(); return s;}
inline PICout operator <<(PICout s, const PIVariantTypes::IODevice & v) {s << v.toPICout(); return s;}

View File

@@ -350,25 +350,25 @@ private:
//! \relatesalso PICout \brief Output operator PIBinaryLog::BinLogInfo to PICout
inline PICout operator <<(PICout s, const PIBinaryLog::BinLogInfo & bi) {
s.space();
s.setControl(0, true);
s.saveAndSetControls(0);
s << "[PIBinaryLog] " << bi.path << "\n";
if (bi.log_size < 0) {
s << "invalid file path";
s.restoreControl();
s.restoreControls();
return s;
}
if (bi.log_size == 0) {
s << "Invalid empty file";
s.restoreControl();
s.restoreControls();
return s;
} if (bi.records_count < 0 && bi.records_count > -4) {
s << "Invalid file or corrupted signature";
s.restoreControl();
s.restoreControls();
return s;
}
if (bi.records_count < -3) {
s << "Invalid binlog version";
s.restoreControl();
s.restoreControls();
return s;
}
s << "read records " << bi.records_count << " in " << bi.records.size() << " types, log size " << bi.log_size;
@@ -380,7 +380,7 @@ inline PICout operator <<(PICout s, const PIBinaryLog::BinLogInfo & bi) {
s << "\n record start " << bri.start_time << " , end " << bri.end_time;
s << "\n record size " << bri.minimum_size << " - " << bri.maximum_size;
}
s.restoreControl();
s.restoreControls();
return s;
}

View File

@@ -518,7 +518,7 @@ PIP_EXPORT std::ostream & operator <<(std::ostream & s, const PIConfig::Branch &
PIP_EXPORT std::ostream & operator <<(std::ostream & s, const PIConfig::Entry & v);
#endif
inline PICout operator <<(PICout s, const PIConfig::Branch & v) {s.setControl(0, true); v.piCoutt(s, ""); s.restoreControl(); return s;}
inline PICout operator <<(PICout s, const PIConfig::Branch & v) {s.saveAndSetControls(0); v.piCoutt(s, ""); s.restoreControls(); return s;}
inline PICout operator <<(PICout s, const PIConfig::Entry & v) {
s << v.value() << "(" << v.type() << v.comment() << ")";
return s;

View File

@@ -189,7 +189,7 @@ inline bool operator !=(const PIFile::FileInfo & v0, const PIFile::FileInfo & v1
//! \relatesalso PICout
//! \~english Output operator to \a PICout
//! \~russian Оператор вывода в \a PICout
inline PICout operator <<(PICout s, const PIDir & v) {s.setControl(0, true); s << "PIDir(\"" << v.path() << "\")"; s.restoreControl(); return s;}
inline PICout operator <<(PICout s, const PIDir & v) {s.saveAndSetControls(0); s << "PIDir(\"" << v.path() << "\")"; s.restoreControls(); return s;}
#endif // PIDIR_H

View File

@@ -515,7 +515,7 @@ private:
inline bool operator <(const PIEthernet::Interface & v0, const PIEthernet::Interface & v1) {return (v0.name < v1.name);}
inline bool operator ==(const PIEthernet::Interface & v0, const PIEthernet::Interface & v1) {return (v0.name == v1.name && v0.address == v1.address && v0.netmask == v1.netmask);}
inline bool operator !=(const PIEthernet::Interface & v0, const PIEthernet::Interface & v1) {return (v0.name != v1.name || v0.address != v1.address || v0.netmask != v1.netmask);}
inline PICout operator <<(PICout s, const PIEthernet::Address & v) {s.space(); s.setControl(0, true); s << "Address(" << v.toString() << ")"; s.restoreControl(); return s;}
inline PICout operator <<(PICout s, const PIEthernet::Address & v) {s.space(); s.saveAndSetControls(0); s << "Address(" << v.toString() << ")"; s.restoreControls(); return s;}
inline bool operator ==(const PIEthernet::Address & v0, const PIEthernet::Address & v1) {return (v0.ip() == v1.ip() && v0.port() == v1.port());}
inline bool operator !=(const PIEthernet::Address & v0, const PIEthernet::Address & v1) {return (v0.ip() != v1.ip() || v0.port() != v1.port());}

View File

@@ -334,12 +334,12 @@ private:
//! \~english Output operator to \a PICout
//! \~russian Оператор вывода в \a PICout
inline PICout operator <<(PICout s, const PIFile::FileInfo & v) {
s.setControl(0, true);
s.saveAndSetControls(0);
s << "FileInfo(\"" << v.path << "\", " << PIString::readableSize(v.size) << ", "
<< v.perm_user.toString() << " " << v.perm_group.toString() << " " << v.perm_other.toString() << ", "
<< v.time_access.toString() << ", " << v.time_modification.toString()
<< ", 0x" << PICoutManipulators::Hex << v.flags << ")";
s.restoreControl();
s.restoreControls();
return s;
}

View File

@@ -154,7 +154,7 @@ BINARY_STREAM_READ (PIBaseTransfer::Part) {s >> v.id >> v.size >> v.start; retur
BINARY_STREAM_WRITE(PIBaseTransfer::StartRequest) {s << v.packets << v.size; return s;}
BINARY_STREAM_READ (PIBaseTransfer::StartRequest) {s >> v.packets >> v.size; return s;}
inline PICout operator <<(PICout s, const PIBaseTransfer::Part & v) {s.setControl(0, true); s << "Part(\"" << v.id << "\", " << PIString::readableSize(v.start) << " b | " << PIString::readableSize(v.size) << " b)"; s.restoreControl(); return s;}
inline PICout operator <<(PICout s, const PIBaseTransfer::Part & v) {s.saveAndSetControls(0); s << "Part(\"" << v.id << "\", " << PIString::readableSize(v.start) << " b | " << PIString::readableSize(v.size) << " b)"; s.restoreControls(); return s;}
#endif // PIBASETRANSFER_H

View File

@@ -126,12 +126,12 @@ BINARY_STREAM_READ (PIFileTransfer::PFTFileInfo) {
}
inline PICout operator <<(PICout s, const PIFileTransfer::PFTFileInfo & v) {
s.setControl(0, true);
s.saveAndSetControls(0);
s << "FileInfo(\"" << v.dest_path << "\", " << PIString::readableSize(v.size) << ", "
<< v.perm_user.toString() << " " << v.perm_group.toString() << " " << v.perm_other.toString() << ", "
<< v.time_access.toString() << ", " << v.time_modification.toString()
<< ", 0x" << PICoutManipulators::Hex << v.flags << ")";
s.restoreControl();
s.restoreControls();
return s;
}
#endif // PIFILETRANSFER_H

View File

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

View File

@@ -70,7 +70,7 @@ inline complexd log10(const complexd & c) {return log(c) / M_LN10;}
#endif
template<typename T>
inline PICout operator <<(PICout s, const complex<T> & v) {s.space(); s.setControl(0, true); s << "(" << v.real() << "; " << v.imag() << ")"; s.restoreControl(); return s;}
inline PICout operator <<(PICout s, const complex<T> & v) {s.space(); s.saveAndSetControls(0); s << "(" << v.real() << "; " << v.imag() << ")"; s.restoreControls(); return s;}
inline PIVector<double> abs(const PIVector<complexd> & v) {

View File

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

View File

@@ -341,9 +341,9 @@ private:
template<typename Type>
PICout operator <<(PICout & s, const PIRect<Type> & v) {
s.setControl(0, true);
s.saveAndSetControls(0);
s << "Rect{" << v.bottomLeft() << ":" << v.width() << "x" << v.height() << "}";
s.restoreControl();
s.restoreControls();
return s;
}

View File

@@ -144,12 +144,12 @@ private:
//! \~english Output operator to \a PICout
//! \~russian Оператор вывода в \a PICout
inline PICout operator <<(PICout s, const PISystemInfo::MountInfo & v) {
s.setControl(0, true);
s.saveAndSetControls(0);
s << "MountInfo(" << v.device << " mounted on \"" << v.mount_point << "\", type " << v.filesystem
<< ", label \"" << v.label << "\", all " << PIString::readableSize(v.space_all)
<< ", used " << PIString::readableSize(v.space_used)
<< ", free " << PIString::readableSize(v.space_free) << ")";
s.restoreControl();
s.restoreControls();
return s;
}

View File

@@ -280,13 +280,13 @@ private:
//! \~english Output operator to \a PICout
//! \~russian Оператор вывода в \a PICout
inline PICout operator <<(PICout s, const PISystemMonitor::ThreadStats & v) {
s.setControl(0, true);
s.saveAndSetControls(0);
s << "ThreadInfo(\"" << v.name << "\", created " << v.created
<< ", work " << v.work_time.toMilliseconds() << " ms"
<< ", kernel " << v.kernel_time.toMilliseconds() << " ms"
<< ", user " << v.user_time.toMilliseconds() << " ms"
<< ")\n";
s.restoreControl();
s.restoreControls();
return s;
}

View File

@@ -701,6 +701,6 @@ void PIOpenCL::KernelArg::init(void * _k, uint index) {
PICout operator <<(PICout s, const PIOpenCL::KernelArg & v) {
s.setControl(0); s << "Arg(" << v.base_type_name << " " << v.arg_name << " (addr=" << v.address_qualifier << ",acc=" << v.access_qualifier << ",typ=" << v.type_qualifier << ",dims=" << v.dims << "))";
s.restoreControl(); return s;
s.setControls(0); s << "Arg(" << v.base_type_name << " " << v.arg_name << " (addr=" << v.address_qualifier << ",acc=" << v.access_qualifier << ",typ=" << v.type_qualifier << ",dims=" << v.dims << "))";
s.restoreControls(); return s;
}

View File

@@ -375,7 +375,7 @@ void PIUSB::flush() {
PICout operator<<(PICout s, const PIUSB::Endpoint & v) {
s.setControl(0, true);
s.saveAndSetControls(0);
s << PICoutManipulators::NewLine << "{" << PICoutManipulators::NewLine;
if (v.isNull())
s << " " << "Null Endpoint";
@@ -411,7 +411,7 @@ PICout operator<<(PICout s, const PIUSB::Endpoint & v) {
s << " " << "Max Packet Size: " << v.max_packet_size << PICoutManipulators::NewLine;
}
s << "}" << PICoutManipulators::NewLine;
s.restoreControl();
s.restoreControls();
return s;
}