Merge branch 'master' of ssh://gitlab.mmo.to:42420/qwc/network-packet-composer

This commit is contained in:
Marcel Otte 2017-10-26 20:50:22 +02:00
commit 778aec7994
3 changed files with 25 additions and 26 deletions

View File

@ -380,10 +380,10 @@
<data key="d5"><![CDATA[Contains the known structures.]]></data> <data key="d5"><![CDATA[Contains the known structures.]]></data>
<data key="d6"> <data key="d6">
<y:UMLNoteNode> <y:UMLNoteNode>
<y:Geometry height="28.0" width="217.0" x="20.083333333333485" y="1086.2739543726254"/> <y:Geometry height="28.0" width="231.7005405405405" x="12.733063063063241" y="1086.2739543726254"/>
<y:Fill color="#FFCC00" transparent="false"/> <y:Fill color="#FFCC00" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/> <y:BorderStyle color="#000000" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="17.96875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="191.81640625" x="12.591796875" y="5.015625">Contains the known structures.<y:LabelModel> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="17.96875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="191.81640625" x="19.942067145270244" y="5.015625">Contains the known structures.<y:LabelModel>
<y:SmartNodeLabelModel distance="4.0"/> <y:SmartNodeLabelModel distance="4.0"/>
</y:LabelModel> </y:LabelModel>
<y:ModelParameter> <y:ModelParameter>

View File

@ -142,12 +142,12 @@ void RandomAccessBinary::set_double(uint position, const double &data)
this->set_uint64(position, *conv); this->set_uint64(position, *conv);
} }
const uint8_t RandomAccessBinary::getByte(uint position) uint8_t RandomAccessBinary::getByte(uint position)
{ {
return (*this->ptr_data)[position]; return (*this->ptr_data)[position];
} }
const std::vector<const uint8_t> RandomAccessBinary::getBytes(uint position, uint length) const std::vector<uint8_t> RandomAccessBinary::getBytes(uint position, uint length)
{ {
std::vector<const uint8_t> vec; std::vector<const uint8_t> vec;
for(uint i = position; i< position+length; ++i) for(uint i = position; i< position+length; ++i)
@ -155,50 +155,50 @@ const std::vector<const uint8_t> RandomAccessBinary::getBytes(uint position, uin
return vec; return vec;
} }
const bool RandomAccessBinary::getBit(uint byteOffset, uint bitOffset) bool RandomAccessBinary::getBit(uint byteOffset, uint bitOffset)
{ {
uint8_t byte = (*this->ptr_data)[byteOffset]; uint8_t byte = (*this->ptr_data)[byteOffset];
return (byte & (1 << (7-bitOffset)) > 0; return (byte & (1 << (7-bitOffset)) > 0;
} }
const bool RandomAccessBinary::getBit(uint64_t position) bool RandomAccessBinary::getBit(uint64_t position)
{ {
uint64_t byteOffset = position>>3; uint64_t byteOffset = position>>3;
uint bitOffset = position%8; uint bitOffset = position%8;
return this->getbit(byteOffset, bitOffset); return this->getbit(byteOffset, bitOffset);
} }
const std::vector<const uint8_t> RandomAccessBinary::getBits(uint byteOffset, uint8_t bitOffset, uint64_t length) const std::vector<uint8_t> RandomAccessBinary::getBits(uint byteOffset, uint8_t bitOffset, uint64_t length)
{ {
} }
const std::vector<const uint8_t> RandomAccessBinary::getBits(uint64_t position, uint64_t length) const std::vector<uint8_t> RandomAccessBinary::getBits(uint64_t position, uint64_t length)
{ {
} }
const uint16_t RandomAccessBinary::get_uint16(uint position) uint16_t RandomAccessBinary::get_uint16(uint position)
{ {
} }
const uint32_t RandomAccessBinary::get_uint32(uint position) uint32_t RandomAccessBinary::get_uint32(uint position)
{ {
} }
const uint64_t RandomAccessBinary::get_uint64(uint position) uint64_t RandomAccessBinary::get_uint64(uint position)
{ {
} }
const float RandomAccessBinary::get_float(uint position) float RandomAccessBinary::get_float(uint position)
{ {
} }
const double RandomAccessBinary::get_double(uint position) double RandomAccessBinary::get_double(uint position)
{ {
} }

View File

@ -14,13 +14,12 @@ public:
MIDDLE MIDDLE
}; };
RandomAccessBinary(); RandomAccessBinary();
RandomAccessBinary(uint possible_packetsize); RandomAccessBinary(uint possible_packetsize);
explicit ~RandomAccessBinary(); explicit ~RandomAccessBinary();
void setEndianness(Endianness endianess); void setEndianness(Endianness endianess);
const Endianness getEndianness(); Endianness getEndianness();
void setBytes(uint position, const std::vector<uint8_t>& data); void setBytes(uint position, const std::vector<uint8_t>& data);
void setByte(uint position, const uint8_t& data); void setByte(uint position, const uint8_t& data);
@ -37,26 +36,26 @@ public:
void set_float(uint position, const float& data); void set_float(uint position, const float& data);
void set_double(uint position, const double& data); void set_double(uint position, const double& data);
const uint8_t uint8_t
getByte(uint position); getByte(uint position);
const std::vector<const uint8_t> const std::vector<uint8_t>
getBytes(uint position, uint length); getBytes(uint position, uint length);
const bool getBit(uint byteOffset, uint bitOffset); bool getBit(uint byteOffset, uint bitOffset);
const bool getBit(uint64_t position); bool getBit(uint64_t position);
const std::vector<const uint8_t> const std::vector<uint8_t>
getBits(uint byteOffset, uint8_t bitOffset, uint64_t length); getBits(uint byteOffset, uint8_t bitOffset, uint64_t length);
const std::vector<const uint8_t> const std::vector<uint8_t>
getBits(uint64_t position, uint64_t length); getBits(uint64_t position, uint64_t length);
const uint16_t get_uint16(uint position); uint16_t get_uint16(uint position);
const uint32_t get_uint32(uint position); uint32_t get_uint32(uint position);
const uint64_t get_uint64(uint position); uint64_t get_uint64(uint position);
const float get_float(uint position); float get_float(uint position);
const double get_double(uint position); double get_double(uint position);
std::string get_string(uint position, uint length); std::string get_string(uint position, uint length);