PIByteArray works on binary stream
This commit is contained in:
60
libs/main/core/pimemoryblock.h
Normal file
60
libs/main/core/pimemoryblock.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/*! \file pimemoryblock.h
|
||||
* \ingroup Core
|
||||
* \~\brief
|
||||
* \~english Base types and functions
|
||||
* \~russian Базовые типы и методы
|
||||
*/
|
||||
/*
|
||||
PIP - Platform Independent Primitives
|
||||
Base types and functions
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef PIMEMORYBLOCK_H
|
||||
#define PIMEMORYBLOCK_H
|
||||
|
||||
|
||||
//! \ingroup Core
|
||||
//! \include pimemoryblock.h
|
||||
//! \brief
|
||||
//! \~english Help struct to store/restore custom blocks of data to/from PIBinaryStream
|
||||
//! \~russian Вспомогательная структура для сохранения/извлечения произвольного блока данных в/из PIBinaryStream
|
||||
struct PIMemoryBlock {
|
||||
public:
|
||||
|
||||
//! \~english Constructs data block
|
||||
//! \~russian Создает блок данных
|
||||
PIMemoryBlock(void * data_ = 0, int size_ = 0) {d = data_; s = size_;}
|
||||
|
||||
//! \~english Constructs data block
|
||||
//! \~russian Создает блок данных
|
||||
PIMemoryBlock(const void * data_, const int size_) {d = const_cast<void * >(data_); s = size_;}
|
||||
|
||||
PIMemoryBlock(const PIMemoryBlock & o) {d = o.d; s = o.s;}
|
||||
|
||||
PIMemoryBlock & operator =(const PIMemoryBlock & o) {d = o.d; s = o.s; return *this;}
|
||||
|
||||
void * data() {return d;}
|
||||
const void * data() const {return d;}
|
||||
int size() const {return s;}
|
||||
|
||||
private:
|
||||
void * d;
|
||||
int s;
|
||||
|
||||
};
|
||||
|
||||
#endif // PIMEMORYBLOCK_H
|
||||
Reference in New Issue
Block a user