/*! \file piiostream.h * \ingroup IO * \~\brief * \~english PIBinaryStream functionality for PIIODevice * \~russian Функциональность PIBinaryStream для PIIODevice */ /* PIP - Platform Independent Primitives PIBinaryStream functionality for PIIODevice Ivan Pelipenko peri4ko@yandex.ru This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef PIIOSTREAM_H #define PIIOSTREAM_H #include "piiodevice.h" #include "pitextstream.h" //! \ingroup IO //! \~\brief //! \~english PIBinaryStream functionality for PIIODevice. //! \~russian Функциональность PIBinaryStream для PIIODevice. class PIP_EXPORT PIIOBinaryStream: public PIBinaryStream { public: //! \~english Contructs %PIIOBinaryStream for "device" device //! \~russian Создает %PIIOBinaryStream для устройства "device" PIIOBinaryStream(PIIODevice * device): dev(device) {} bool binaryStreamAppendImp(const void * d, size_t s) { if (!dev) return false; return dev->write(d, s); } bool binaryStreamTakeImp(void * d, size_t s) { if (!dev) return false; return dev->read(d, s); } private: PIIODevice * dev; }; //! \ingroup IO //! \~\brief //! \~english PITextStream functionality for PIIODevice. //! \~russian Функциональность PITextStream для PIIODevice. class PIP_EXPORT PIIOTextStream: public PITextStream { public: //! \~english Contructs %PIIOTextStream for "device" device //! \~russian Создает %PIIOTextStream для устройства "device" PIIOTextStream(PIIODevice * device): PITextStream(&bin_stream), bin_stream(device){} private: PIIOBinaryStream bin_stream; }; #endif // PIIOSTREAM_H