本文整理汇总了C++中reader::read_data方法的典型用法代码示例。如果您正苦于以下问题:C++ reader::read_data方法的具体用法?C++ reader::read_data怎么用?C++ reader::read_data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类reader
的用法示例。
在下文中一共展示了reader::read_data方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: from_data
bool alert::from_data(reader& source)
{
reset();
auto size = source.read_variable_uint_little_endian();
BITCOIN_ASSERT(size <= bc::max_size_t);
const auto payload_size = static_cast<size_t>(size);
size_t signature_size = 0;
auto result = static_cast<bool>(source);
if (result)
{
payload = source.read_data(payload_size);
result = source && (payload.size() == payload_size);
}
if (result)
{
size = source.read_variable_uint_little_endian();
BITCOIN_ASSERT(size <= bc::max_size_t);
signature_size = static_cast<size_t>(size);
result = source;
}
if (result)
{
signature = source.read_data(signature_size);
result = source && (signature.size() == signature_size);
}
if (!result)
reset();
return result;
}
示例2: from_data
bool operation::from_data(reader& source)
{
reset();
const auto byte = source.read_byte();
auto result = static_cast<bool>(source);
auto op_code = static_cast<opcode>(byte);
if (byte == 0 && op_code != opcode::zero)
return false;
code = ((0 < byte && byte <= 75) ? opcode::special : op_code);
if (operation::must_read_data(code))
{
uint32_t size;
read_opcode_data_size(size, code, byte, source);
data = source.read_data(size);
result = (source && (data.size() == size));
}
if (!result)
reset();
return result;
}
示例3: from_data
bool merkle_block::from_data(reader& source)
{
reset();
bool result = header.from_data(source, true);
uint64_t hash_count = 0;
if (result)
{
hash_count = source.read_variable_uint_little_endian();
result = source;
}
for (uint64_t i = 0; (i < hash_count) && result; ++i)
{
hashes.push_back(source.read_hash());
result = source;
}
if (result)
{
auto size = source.read_variable_uint_little_endian();
BITCOIN_ASSERT(size <= bc::max_size_t);
const auto flag_count = static_cast<size_t>(size);
flags = source.read_data(flag_count);
result = source && (flags.size() == flag_count);
}
if (!result)
reset();
return result;
}
示例4: from_data
bool filter_load::from_data(reader& source)
{
bool result = false;
reset();
uint64_t filter_size = source.read_variable_uint_little_endian();
result = source;
if (result)
{
filter = source.read_data(filter_size);
hash_functions = source.read_4_bytes_little_endian();
tweak = source.read_4_bytes_little_endian();
flags = source.read_byte();
result = source && (filter.size() == filter_size);
}
if (!result)
reset();
return result;
}