doc ru
This commit is contained in:
@@ -30,6 +30,82 @@
|
||||
#endif
|
||||
|
||||
|
||||
//! \addtogroup Core
|
||||
//! \{
|
||||
//! \~\class PICout picout.h
|
||||
//! \~\brief
|
||||
//! \~english Universal output to console class
|
||||
//! \~russian Универсальный вывод в консоль
|
||||
//!
|
||||
//! \~english \section PICout_sec0 Synopsis
|
||||
//! \~russian \section PICout_sec0 Краткий обзор
|
||||
//! \~english
|
||||
//! This class provide many stream operators for output with some features.
|
||||
//! Output to %PICout is thread-sequential, i.e. doesn`t mixed from parallel
|
||||
//! threads.
|
||||
//!
|
||||
//! \~russian
|
||||
//! Данный класс предоставляет множество операторов для вывода в консоль.
|
||||
//! Вывод в %PICout потоково-последовательный, т.е. не смешивается из параллельных
|
||||
//! потоков.
|
||||
//!
|
||||
//! \~english \section PICout_sec1 Features
|
||||
//! \~russian \section PICout_sec1 Особенности
|
||||
//! \~english
|
||||
//! * support text formatting (color, style)
|
||||
//! * insertion spaces between entries
|
||||
//! * insertion new line at the end of output
|
||||
//! * strings are quoted
|
||||
//! * custom output operator can be easily written
|
||||
//! * can outpur to console, internal buffer or both
|
||||
//!
|
||||
//! \~russian
|
||||
//! * поддержка форматирования (цвет, стиль)
|
||||
//! * вставка пробелов между выводами
|
||||
//! * вставка новой строки после последнего вывода
|
||||
//! * строки обрамляются кавычками
|
||||
//! * легко создавать сови операторы вывода
|
||||
//! * может выводить в консоль, внутренний буфер или в оба места
|
||||
//!
|
||||
//! \~english \section PICout_ex0 Usage
|
||||
//! \~russian \section PICout_ex0 Использование
|
||||
//! \~\snippet picout.cpp 0
|
||||
//!
|
||||
//! \~english \section PICout_ex1 Writing your own output operator
|
||||
//! \~russian \section PICout_ex1 Создание своего оператора вывода
|
||||
//! \~\snippet picout.cpp own
|
||||
//!
|
||||
//! \}
|
||||
|
||||
|
||||
//! \addtogroup Core
|
||||
//! \{
|
||||
//! \~\class PICout::Notifier picout.h
|
||||
//! \~\brief
|
||||
//! \~english Class for emit notifications of PICout
|
||||
//! \~russian Класс для посылки событий от PICout
|
||||
//!
|
||||
//! \~english \section PICout_sec0 Synopsis
|
||||
//! \~russian \section PICout_sec0 Краткий обзор
|
||||
//! \~english
|
||||
//! This class used as PICout events emitter. When
|
||||
//! PICout constructs with external PIString* buffer
|
||||
//! and some ID, last copy of this PICout on delete
|
||||
//! emit event "finished()" on object Notifier::object().
|
||||
//! Sample:
|
||||
//!
|
||||
//! \~russian
|
||||
//! Этот класс используется как источник событий PICout.
|
||||
//! Когда PICout сконструирован с внешним буфером PIString*
|
||||
//! и каким-то ID, последняя копия этого PICout при уничтожении
|
||||
//! посылает событие "finished()" у объекта Notifier::object().
|
||||
//! Пример:
|
||||
//!
|
||||
//! \~\snippet picout.cpp notifier
|
||||
//!
|
||||
//! \}
|
||||
|
||||
|
||||
class NotifierObject: public PIObject {
|
||||
PIOBJECT(NotifierObject)
|
||||
public:
|
||||
@@ -204,22 +280,65 @@ PICout PICout::operator <<(const PICoutAction v) {
|
||||
}
|
||||
|
||||
|
||||
PICout PICout::operator <<(const PICoutManipulators::PICoutFormat v) {
|
||||
switch (v) {
|
||||
case PICoutManipulators::Bin: cnb_ = 2; break;
|
||||
case PICoutManipulators::Oct: cnb_ = 8; break;
|
||||
case PICoutManipulators::Dec: cnb_ = 10; break;
|
||||
case PICoutManipulators::Hex: cnb_ = 16; break;
|
||||
default: applyFormat(v);
|
||||
};
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
PICout PICout::operator <<(const PIFlags<PICoutManipulators::PICoutFormat> & v) {
|
||||
if (v[PICoutManipulators::Bin]) cnb_ = 2;
|
||||
if (v[PICoutManipulators::Oct]) cnb_ = 8;
|
||||
if (v[PICoutManipulators::Dec]) cnb_ = 10;
|
||||
if (v[PICoutManipulators::Hex]) cnb_ = 16;
|
||||
if (v[PICoutManipulators::Bold]) applyFormat(PICoutManipulators::Bold);
|
||||
if (v[PICoutManipulators::Faint]) applyFormat(PICoutManipulators::Faint);
|
||||
if (v[PICoutManipulators::Italic]) applyFormat(PICoutManipulators::Italic);
|
||||
if (v[PICoutManipulators::Underline]) applyFormat(PICoutManipulators::Underline);
|
||||
if (v[PICoutManipulators::Blink]) applyFormat(PICoutManipulators::Blink);
|
||||
if (v[PICoutManipulators::Black]) applyFormat(PICoutManipulators::Black);
|
||||
if (v[PICoutManipulators::Red]) applyFormat(PICoutManipulators::Red);
|
||||
if (v[PICoutManipulators::Green]) applyFormat(PICoutManipulators::Green);
|
||||
if (v[PICoutManipulators::Blue]) applyFormat(PICoutManipulators::Blue);
|
||||
if (v[PICoutManipulators::Yellow]) applyFormat(PICoutManipulators::Yellow);
|
||||
if (v[PICoutManipulators::Magenta]) applyFormat(PICoutManipulators::Magenta);
|
||||
if (v[PICoutManipulators::Cyan]) applyFormat(PICoutManipulators::Cyan);
|
||||
if (v[PICoutManipulators::White]) applyFormat(PICoutManipulators::White);
|
||||
if (v[PICoutManipulators::BackBlack]) applyFormat(PICoutManipulators::BackBlack);
|
||||
if (v[PICoutManipulators::BackRed]) applyFormat(PICoutManipulators::BackRed);
|
||||
if (v[PICoutManipulators::BackGreen]) applyFormat(PICoutManipulators::BackGreen);
|
||||
if (v[PICoutManipulators::BackBlue]) applyFormat(PICoutManipulators::BackBlue);
|
||||
if (v[PICoutManipulators::BackYellow]) applyFormat(PICoutManipulators::BackYellow);
|
||||
if (v[PICoutManipulators::BackMagenta]) applyFormat(PICoutManipulators::BackMagenta);
|
||||
if (v[PICoutManipulators::BackCyan]) applyFormat(PICoutManipulators::BackCyan);
|
||||
if (v[PICoutManipulators::BackWhite]) applyFormat(PICoutManipulators::BackWhite);
|
||||
if (v[PICoutManipulators::Default]) applyFormat(PICoutManipulators::Default);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
#define PICOUTTOTARGET(v) { \
|
||||
if (buffer_) {\
|
||||
(*buffer_) << (v);\
|
||||
(*buffer_) << (v);\
|
||||
} else {\
|
||||
if (PICout::isOutputDeviceActive(PICout::StdOut)) std::cout << (v);\
|
||||
if (PICout::isOutputDeviceActive(PICout::Buffer)) PICout::__string__() << (v);\
|
||||
if (PICout::isOutputDeviceActive(PICout::StdOut)) std::cout << (v);\
|
||||
if (PICout::isOutputDeviceActive(PICout::Buffer)) PICout::__string__() << (v);\
|
||||
}\
|
||||
}
|
||||
}
|
||||
#define PICOUTTOTARGETS(v) { \
|
||||
if (buffer_) {\
|
||||
(*buffer_) << (v);\
|
||||
(*buffer_) << (v);\
|
||||
} else {\
|
||||
if (PICout::isOutputDeviceActive(PICout::StdOut)) std::cout << (v).dataConsole();\
|
||||
if (PICout::isOutputDeviceActive(PICout::Buffer)) PICout::__string__() << (v);\
|
||||
if (PICout::isOutputDeviceActive(PICout::StdOut)) std::cout << (v).dataConsole();\
|
||||
if (PICout::isOutputDeviceActive(PICout::Buffer)) PICout::__string__() << (v);\
|
||||
}\
|
||||
}
|
||||
}
|
||||
#define PINUMERICCOUT if (cnb_ == 10) PICOUTTOTARGET(v) else PICOUTTOTARGETS(PIString::fromNumber(v, cnb_))
|
||||
|
||||
|
||||
@@ -346,6 +465,12 @@ PICout & PICout::restoreControl() {
|
||||
#undef PICOUTTOTARGET
|
||||
#undef PINUMERICCOUT
|
||||
|
||||
//! \details
|
||||
//! \~english
|
||||
//! If it is not a first output and control \a AddSpaces is set space character is put
|
||||
//! \~russian
|
||||
//! Добавляет пробел если это не первый вывод и установлен флаг \a AddSpaces
|
||||
//! \~\sa \a quote(), \a newLine()
|
||||
PICout & PICout::space() {
|
||||
if (!act_) return *this;
|
||||
if (!fo_ && co_[AddSpaces]) {
|
||||
@@ -360,6 +485,12 @@ PICout & PICout::space() {
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! \details
|
||||
//! \~english
|
||||
//! If control \a AddQuotes is set quote character is put
|
||||
//! \~russian
|
||||
//! Добавляет кавычки если установлен флаг \a AddQuotes
|
||||
//! \~\sa \a space(), \a newLine()
|
||||
PICout & PICout::quote() {
|
||||
if (!act_) return *this;
|
||||
if (co_[AddQuotes]) {
|
||||
@@ -374,6 +505,12 @@ PICout & PICout::quote() {
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! \details
|
||||
//! \~english
|
||||
//! If control \a AddNewLine is set new line character is put
|
||||
//! \~russian
|
||||
//! Добавляет новую строку если установлен флаг \a AddNewLine
|
||||
//! \~\sa \a space(), \a quote()
|
||||
PICout & PICout::newLine() {
|
||||
if (!act_) return *this;
|
||||
if (co_[AddNewLine]) {
|
||||
|
||||
Reference in New Issue
Block a user