⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mybyteseq.cpp

📁 ICE-3.2 一个开源的中间件
💻 CPP
字号:
// **********************************************************************//// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved.//// This copy of Ice is licensed to you under the terms described in the// ICE_LICENSE file included in this distribution.//// **********************************************************************#include <MyByteSeq.h>MyByteSeq::MyByteSeq()    : _size(0),      _data(0){}MyByteSeq::MyByteSeq(size_t size)    : _size(size),      _data(0){    if(_size != 0)    {        _data = new Ice::Byte[_size];    }}MyByteSeq::MyByteSeq(const MyByteSeq& seq){    _size = seq._size;    if(_size != 0)    {        _data = new Ice::Byte[_size];        memcpy(_data, seq._data, _size);    }    else    {        _data = 0;    }}MyByteSeq::~MyByteSeq(){    delete[] _data;}size_tMyByteSeq::size() const{    return _size;}void MyByteSeq::swap(MyByteSeq& seq){    size_t tmpSize = seq._size;    Ice::Byte* tmpData = seq._data;    seq._size = _size;    seq._data = _data;    _size = tmpSize;    _data = tmpData;}MyByteSeq::const_iteratorMyByteSeq::begin() const{    return _data;}MyByteSeq::const_iteratorMyByteSeq::end() const{    return _data + _size;}voidMyByteSeq::operator=(const MyByteSeq& rhs){    delete[] _data;    _data = 0;    _size = rhs._size;    if(_size != 0)    {        _data = new Ice::Byte[_size];        memcpy(_data, rhs._data, _size);    }}boolMyByteSeq::operator==(const MyByteSeq& rhs) const{    if(_size != rhs._size)    {        return _size == rhs._size;    }    return memcmp(_data, rhs._data, _size) == 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -