本文整理汇总了C++中BinaryReader::readRaw方法的典型用法代码示例。如果您正苦于以下问题:C++ BinaryReader::readRaw方法的具体用法?C++ BinaryReader::readRaw怎么用?C++ BinaryReader::readRaw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BinaryReader
的用法示例。
在下文中一共展示了BinaryReader::readRaw方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: flush
void FlowWriter::flush(PacketWriter& writer,UInt64 stage,UInt8 flags,bool header,BinaryReader& reader,UInt16 size) {
if(_stageAck==0 && header)
flags |= MESSAGE_HEADER;
if(size==0)
flags |= MESSAGE_ABANDONMENT;
if(_closed && _messages.size()==1) // On LAST message
flags |= MESSAGE_END;
// TRACE("FlowWriter %u stage %u",id,stage);
writer.write8(flags);
if(header) {
writer.write7BitLongValue(id);
writer.write7BitLongValue(stage);
writer.write7BitLongValue(stage-_stageAck);
// signature
if(_stageAck==0) {
writer.writeString8(signature);
// No write this in the case where it's a new flow!
if(flowId>0) {
writer.write8(1+Util::Get7BitValueSize(flowId)); // following size
writer.write8(0x0a); // Unknown!
writer.write7BitLongValue(flowId);
}
writer.write8(0); // marker of end for this part
}
}
if(size>0) {
reader.readRaw(writer.begin()+writer.position(),size);
writer.next(size);
}
}
示例2: readFromBLOB
void DataTest::readFromBLOB(BinaryReader& reader)
{
bool b = false;
reader >> b;
assert (b);
reader >> b;
assert (!b);
char c = ' ';
reader >> c;
assert (c == 'a');
short shortv = 0;
reader >> shortv;
assert (shortv == -100);
unsigned short ushortv = 0;
reader >> ushortv;
assert (ushortv == 50000);
int intv = 0;
reader >> intv;
assert (intv == -123456);
unsigned uintv = 0;
reader >> uintv;
assert (uintv == 123456);
long longv = 0;
reader >> longv;
assert (longv == -1234567890);
unsigned long ulongv = 0;
reader >> ulongv;
assert (ulongv == 1234567890);
Int64 int64v = 0;
reader >> int64v;
assert (int64v == -1234567890);
UInt64 uint64v = 0;
reader >> uint64v;
assert (uint64v == 1234567890);
float floatv = 0.0;
reader >> floatv;
assert (floatv == 1.5);
double doublev = 0.0;
reader >> doublev;
assert (doublev == -1.5);
std::string str;
reader >> str;
assert (str == "foo");
reader >> str;
assert (str == "");
reader >> str;
assert (str == "bar");
reader >> str;
assert (str == "");
UInt32 uint32v;
reader.read7BitEncoded(uint32v);
assert (uint32v == 100);
reader.read7BitEncoded(uint32v);
assert (uint32v == 1000);
reader.read7BitEncoded(uint32v);
assert (uint32v == 10000);
reader.read7BitEncoded(uint32v);
assert (uint32v == 100000);
reader.read7BitEncoded(uint32v);
assert (uint32v == 1000000);
reader.read7BitEncoded(uint64v);
assert (uint64v == 100);
reader.read7BitEncoded(uint64v);
assert (uint64v == 1000);
reader.read7BitEncoded(uint64v);
assert (uint64v == 10000);
reader.read7BitEncoded(uint64v);
assert (uint64v == 100000);
reader.read7BitEncoded(uint64v);
assert (uint64v == 1000000);
reader.readRaw(3, str);
assert (str == "RAW");
}
示例3: read
void BinaryReaderWriterTest::read(BinaryReader& reader)
{
bool b;
reader >> b;
assert (b);
reader >> b;
assert (!b);
char c;
reader >> c;
assert (c == 'a');
short shortv;
reader >> shortv;
assert (shortv == -100);
unsigned short ushortv;
reader >> ushortv;
assert (ushortv == 50000);
int intv;
reader >> intv;
assert (intv == -123456);
unsigned uintv;
reader >> uintv;
assert (uintv == 123456);
long longv;
reader >> longv;
assert (longv == -1234567890);
unsigned long ulongv;
reader >> ulongv;
assert (ulongv == 1234567890);
#if defined(POCO_HAVE_INT64)
Int64 int64v;
reader >> int64v;
assert (int64v == -1234567890);
UInt64 uint64v;
reader >> uint64v;
assert (uint64v == 1234567890);
#endif
float floatv;
reader >> floatv;
assert (floatv == 1.5);
double doublev;
reader >> doublev;
assert (doublev == -1.5);
std::string str;
reader >> str;
assert (str == "foo");
reader >> str;
assert (str == "");
reader >> str;
assert (str == "bar");
reader >> str;
assert (str == "");
UInt32 uint32v;
reader.read7BitEncoded(uint32v);
assert (uint32v == 100);
reader.read7BitEncoded(uint32v);
assert (uint32v == 1000);
reader.read7BitEncoded(uint32v);
assert (uint32v == 10000);
reader.read7BitEncoded(uint32v);
assert (uint32v == 100000);
reader.read7BitEncoded(uint32v);
assert (uint32v == 1000000);
#if defined(POCO_HAVE_INT64)
reader.read7BitEncoded(uint64v);
assert (uint64v == 100);
reader.read7BitEncoded(uint64v);
assert (uint64v == 1000);
reader.read7BitEncoded(uint64v);
assert (uint64v == 10000);
reader.read7BitEncoded(uint64v);
assert (uint64v == 100000);
reader.read7BitEncoded(uint64v);
assert (uint64v == 1000000);
#endif
reader.readRaw(3, str);
assert (str == "RAW");
}