doc ru
This commit is contained in:
@@ -19,45 +19,77 @@
|
||||
|
||||
#include "pichunkstream.h"
|
||||
|
||||
/*! \class PIChunkStream
|
||||
* \brief Class for binary serialization
|
||||
*
|
||||
* \section PIChunkStream_sec0 Synopsis
|
||||
* This class provides very handly mechanism to store and restore values to and from
|
||||
* \a PIByteArray. The main advantage of using this class is that your binary data
|
||||
* become independent from order and collection of your values.
|
||||
*
|
||||
* \section PIChunkStream_sec1 Mechanism
|
||||
* %PIChunkStream works with items called "chunk". Chunk is an ID and any value that
|
||||
* can be stored and restored to \a PIByteArray with stream operators << and >>.
|
||||
* You can place chunks to stream and read chunks from stream.
|
||||
*
|
||||
* To construct %PIChunkStream for writing data use any constructor. Empty constructor
|
||||
* creates internal empty buffer that can be accessed by function \a data().
|
||||
* Non-empty constructor works with given byte array.
|
||||
*
|
||||
* To read chunks from byte array use function \a read() that returns ID of
|
||||
* next chunk. Then you can get value of this chunk with function \a getData(),
|
||||
* but you should definitely know type of this value. You can read from byte array
|
||||
* while \a atEnd() if false.
|
||||
*
|
||||
* \section PIChunkStream_sec2 Examples
|
||||
*
|
||||
* Using simple operator and cascade serialization:
|
||||
*
|
||||
* Prepare your structs to work with %PIChunkStream:
|
||||
* \snippet pichunkstream.cpp struct
|
||||
* Old-style writing to %PIChunkStream:
|
||||
* \snippet pichunkstream.cpp write
|
||||
* Fastest reading from %PIChunkStream:
|
||||
* \snippet pichunkstream.cpp read
|
||||
*
|
||||
* And next code show how to serialize your struct with %PIChunkStream:
|
||||
* \snippet pichunkstream.cpp write_new
|
||||
*
|
||||
* ... and deserialize:
|
||||
* \snippet pichunkstream.cpp read_new
|
||||
*/
|
||||
//! \addtogroup Core
|
||||
//! \{
|
||||
//! \class PIChunkStream pichunkstream.h
|
||||
//! \brief
|
||||
//! \~english Class for binary de/serialization
|
||||
//! \~russian Класс для бинарной де/сериализации
|
||||
//!
|
||||
//! \~english \section PIChunkStream_sec0 Synopsis
|
||||
//! \~russian \section PIChunkStream_sec0 Краткий обзор
|
||||
//! \~english
|
||||
//! This class provides very handly mechanism to store and restore values to and from
|
||||
//! \a PIByteArray. The main advantage of using this class is that your binary data
|
||||
//! become independent from order and collection of your values.
|
||||
//!
|
||||
//! \~russian
|
||||
//! Этот класс предоставляет очень удобный механизм для сохранения и извлечения значений
|
||||
//! в/из \a PIByteArray. Главным плюсом является то, что данные не будут зависеть от порядка
|
||||
//! и наличия значений.
|
||||
//!
|
||||
//! \~english \section PIChunkStream_sec1 Mechanism
|
||||
//! \~russian \section PIChunkStream_sec1 Механизм
|
||||
//! \~english
|
||||
//! %PIChunkStream works with items called "chunk". Chunk is an ID, size and any value that
|
||||
//! can be stored and restored to/from %PIChunkStream with stream operators << and >>.
|
||||
//!
|
||||
//! To construct %PIChunkStream for writing data use any non-default constructor. Empty constructor
|
||||
//! creates internal buffer that can be accessed by function \a data().
|
||||
//! Non-empty constructor works with given byte array.
|
||||
//!
|
||||
//! To read chunks from byte array use function \a read() that returns ID of
|
||||
//! readed chunk. Then you can get value of this chunk with functions \a getData() or \a get(),
|
||||
//! but you should definitely know type of this value. You can read from byte array
|
||||
//! while \a atEnd() if false.
|
||||
//!
|
||||
//! \~russian
|
||||
//! %PIChunkStream работает с элементами под названием "чанк". Чанк имеет ID, размер и значение,
|
||||
//! и может быть записан или прочитан в/из %PIChunkStream с помощью операторов << и >>.
|
||||
//!
|
||||
//! Для создания потока на запись используется любой не-умолчальный конструктор. Пустой конструктор
|
||||
//! создает внутренний буфер, который можно получить с помощью метода \a data().
|
||||
//! Непустой конструктор работает с переданным байтовым массивом.
|
||||
//!
|
||||
//! Для чтения чанков из байтового массива используется метод \a read(), который возвращает
|
||||
//! ID прочитанного чанка. Получить значение этого чанка далее можно с помощью методов \a getData() или get(),
|
||||
//! но тип значения должен быть известен. Читать из потока можно пока метод \a atEnd() возвращает ложь.
|
||||
//!
|
||||
//! \~english \section PIChunkStream_sec2 Examples
|
||||
//! \~russian \section PIChunkStream_sec2 Пример
|
||||
//!
|
||||
//! \~english Using simple operator and cascade serialization:
|
||||
//! \~russian Использование простого оператора и каскадная сериализация:
|
||||
//!
|
||||
//! \~english Prepare your structs to work with %PIChunkStream:
|
||||
//! \~russian Подготовка своей структуры для работы с %PIChunkStream:
|
||||
//! \~\snippet pichunkstream.cpp struct
|
||||
//! \~english Old-style writing to %PIChunkStream:
|
||||
//! \~russian Старый стиль использования %PIChunkStream:
|
||||
//! \~\snippet pichunkstream.cpp write
|
||||
//! \~english Fastest reading from %PIChunkStream:
|
||||
//! \~russian Самое быстрое чтение из %PIChunkStream:
|
||||
//! \~\snippet pichunkstream.cpp read
|
||||
//!
|
||||
//! \~english And next code show how to serialize your struct with %PIChunkStream:
|
||||
//! \~russian Следующий код показывает, как сериализовать свою структуру в %PIChunkStream:
|
||||
//! \~\snippet pichunkstream.cpp write_new
|
||||
//!
|
||||
//! \~english ... and deserialize:
|
||||
//! \~russian ... в десериализовать:
|
||||
//! \~\snippet pichunkstream.cpp read_new
|
||||
//!
|
||||
//! \}
|
||||
|
||||
|
||||
void PIChunkStream::setSource(const PIByteArray & data) {
|
||||
|
||||
Reference in New Issue
Block a user