merged AI doc, some new pages
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
/*! \file piiostream.h
|
||||
* \ingroup IO
|
||||
* \~\brief
|
||||
* \~english PIBinaryStream functionality for PIIODevice
|
||||
* \~russian Функциональность PIBinaryStream для PIIODevice
|
||||
*/
|
||||
//! \~\file piiostream.h
|
||||
//! \~\ingroup IO
|
||||
//! \~\brief
|
||||
//! \~english Text and binary stream adapters for PIIODevice
|
||||
//! \~russian Адаптеры текстовых и бинарных потоков для PIIODevice
|
||||
/*
|
||||
PIP - Platform Independent Primitives
|
||||
PIBinaryStream functionality for PIIODevice
|
||||
@@ -30,35 +29,46 @@
|
||||
#include "pitextstream.h"
|
||||
|
||||
|
||||
//! \ingroup IO
|
||||
//! \~\ingroup IO
|
||||
//! \~\brief
|
||||
//! \~english PIBinaryStream functionality for PIIODevice.
|
||||
//! \~russian Функциональность PIBinaryStream для PIIODevice.
|
||||
//! \~english See details \ref iostream
|
||||
//! \~russian Подробнее \ref iostream
|
||||
//! \~english %PIBinaryStream adapter over a \a PIIODevice.
|
||||
//! \~russian Адаптер %PIBinaryStream поверх \a PIIODevice.
|
||||
//! \~\details
|
||||
//! \~english
|
||||
//! Provides binary stream operations for PIIODevice-based devices.
|
||||
//! See \ref iostream for the generic stream API.
|
||||
//! \~russian
|
||||
//! Предоставляет операции бинарного потока для устройств на основе PIIODevice.
|
||||
//! Общий API потоков описан в \ref iostream.
|
||||
class PIP_EXPORT PIIOBinaryStream: public PIBinaryStream<PIIOBinaryStream> {
|
||||
public:
|
||||
//! \~english Contructs %PIIOBinaryStream for "device" device
|
||||
//! \~russian Создает %PIIOBinaryStream для устройства "device"
|
||||
//! \~english Constructs a stream bound to "device".
|
||||
//! \~russian Создает поток, привязанный к устройству "device".
|
||||
PIIOBinaryStream(PIIODevice * device = nullptr): dev(device) {}
|
||||
|
||||
//! \~english Assign "device" device
|
||||
//! \~russian Назначает устройство "device"
|
||||
//! \~english Rebinds the stream to "device" and resets read-error state.
|
||||
//! \~russian Перепривязывает поток к устройству "device" и сбрасывает состояние ошибки чтения.
|
||||
void setDevice(PIIODevice * device) {
|
||||
dev = device;
|
||||
resetReadError();
|
||||
}
|
||||
|
||||
//! \~english Appends raw bytes through the bound device.
|
||||
//! \~russian Добавляет сырые байты через привязанное устройство.
|
||||
bool binaryStreamAppendImp(const void * d, size_t s) {
|
||||
if (!dev) return false;
|
||||
return (dev->write(d, s) == (int)s);
|
||||
}
|
||||
|
||||
//! \~english Reads raw bytes from the bound device.
|
||||
//! \~russian Читает сырые байты из привязанного устройства.
|
||||
bool binaryStreamTakeImp(void * d, size_t s) {
|
||||
if (!dev) return false;
|
||||
return (dev->read(d, s) == (int)s);
|
||||
}
|
||||
|
||||
//! \~english Returns the number of bytes currently available in the device.
|
||||
//! \~russian Возвращает количество байт, доступных в устройстве в данный момент.
|
||||
ssize_t binaryStreamSizeImp() const {
|
||||
if (!dev) return 0;
|
||||
return dev->bytesAvailable();
|
||||
@@ -69,27 +79,36 @@ private:
|
||||
};
|
||||
|
||||
|
||||
//! \ingroup IO
|
||||
//! \~\ingroup IO
|
||||
//! \~\brief
|
||||
//! \~english PITextStream functionality for PIIODevice.
|
||||
//! \~russian Функциональность PITextStream для PIIODevice.
|
||||
//! \~english %PITextStream adapter over a \a PIIODevice.
|
||||
//! \~russian Адаптер %PITextStream поверх \a PIIODevice.
|
||||
//! \~\details
|
||||
//! \~english
|
||||
//! Provides text stream operations for PIIODevice-based devices.
|
||||
//! \~russian
|
||||
//! Предоставляет операции текстового потока для устройств на основе PIIODevice.
|
||||
class PIP_EXPORT PIIOTextStream: public PITextStream<PIIOBinaryStream> {
|
||||
public:
|
||||
//! \~english Contructs %PIIOTextStream for "device" device
|
||||
//! \~russian Создает %PIIOTextStream для устройства "device"
|
||||
//! \~english Constructs a text stream bound to "device".
|
||||
//! \~russian Создает текстовый поток, привязанный к устройству "device".
|
||||
PIIOTextStream(PIIODevice * device): PITextStream<PIIOBinaryStream>(&bin_stream), bin_stream(device) {}
|
||||
|
||||
//! \~english Contructs %PIIOTextStream for "string" string
|
||||
//! \~russian Создает %PIIOTextStream для строки "string"
|
||||
//! \~english Constructs a text stream over "string" using "mode".
|
||||
//! \~russian Создает текстовый поток поверх строки "string" с режимом "mode".
|
||||
PIIOTextStream(PIString * string, PIIODevice::DeviceMode mode): PITextStream<PIIOBinaryStream>(&bin_stream) {
|
||||
io_string = new PIIOString(string, mode);
|
||||
bin_stream.setDevice(io_string);
|
||||
}
|
||||
|
||||
//! \~english Destroys the stream and owned temporary \a PIIOString, if any.
|
||||
//! \~russian Уничтожает поток и временный \a PIIOString, которым он владеет, если он был создан.
|
||||
~PIIOTextStream() {
|
||||
if (io_string) delete io_string;
|
||||
}
|
||||
|
||||
//! \~english Rebinds the text stream to another device.
|
||||
//! \~russian Перепривязывает текстовый поток к другому устройству.
|
||||
void setDevice(PIIODevice * device) {
|
||||
bin_stream = PIIOBinaryStream(device);
|
||||
setStream(&bin_stream);
|
||||
|
||||
Reference in New Issue
Block a user