当前位置: 首页>>代码示例>>C++>>正文


C++ data_buffer::read_uint8方法代码示例

本文整理汇总了C++中data_buffer::read_uint8方法的典型用法代码示例。如果您正苦于以下问题:C++ data_buffer::read_uint8方法的具体用法?C++ data_buffer::read_uint8怎么用?C++ data_buffer::read_uint8使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在data_buffer的用法示例。


在下文中一共展示了data_buffer::read_uint8方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: decode

void transaction_wallet::decode(data_buffer & buffer)
{
    /**
     * Initialize
     */
    initialize(0);
    
    auto is_spent = false;

    /**
     * Decode the base class.
     */
    transaction_merkle::decode(buffer);
    
    auto len = buffer.read_var_int();
    
    for (auto i = 0; i < len; i++)
    {
        transaction_merkle tx_merkle;
        
        tx_merkle.decode(buffer);
        
        m_previous_transactions.push_back(tx_merkle);
    }
    
    auto len_values = buffer.read_var_int();
    
    for (auto i = 0; i < len_values; i++)
    {
        std::string first(buffer.read_var_int(), 0);
        
        buffer.read_bytes(const_cast<char *> (first.data()), first.size());
        
        std::string second(buffer.read_var_int(), 0);
        
        buffer.read_bytes(const_cast<char *> (second.data()), second.size());
        
        m_values[first] = second;
    }
    
    m_order_form.resize(buffer.read_var_int());
    
    for (auto i = 0; i < m_order_form.size(); i++)
    {
        std::string first(buffer.read_var_int(), 0);
        
        buffer.read_bytes(const_cast<char *> (first.data()), first.size());
        
        std::string second(buffer.read_var_int(), 0);
        
        buffer.read_bytes(const_cast<char *> (second.data()), second.size());
        
        m_order_form[i] = std::make_pair(first, second);
    }

    m_time_received_is_tx_time = buffer.read_uint32();

    m_time_received = buffer.read_uint32();
    
    m_is_from_me = buffer.read_uint8();
    
    is_spent = buffer.read_uint8();
    
    m_from_account = m_values["fromaccount"];

    if (m_values.count("spent") > 0)
    {
        for (auto & i : m_values["spent"])
        {
            m_spent.push_back(i != '0');
        }
    }
    else
    {
        m_spent.assign(transaction_out().size(), is_spent);
    }
    
    /**
     * If we are an (SPV) client set the block height from the value.
     */
    if (globals::instance().is_client_spv() == true)
    {
        if (m_values.count("spv_block_height") > 0)
        {
            auto block_height = std::stoi(m_values["spv_block_height"]);
            
            set_spv_block_height(block_height);
        }
    }
    
    /**
     * Read the order position.
     */
    wallet::read_order_position(m_order_position, m_values);

    m_time_smart =
        m_values.count("timesmart") ?
        boost::lexical_cast<std::uint32_t> (m_values["timesmart"]) : 0
    ;

//.........这里部分代码省略.........
开发者ID:xCoreDev,项目名称:vcash,代码行数:101,代码来源:transaction_wallet.cpp


注:本文中的data_buffer::read_uint8方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。