veriblock-pop-cpp
C++11 Libraries for leveraging VeriBlock Proof-Of-Proof blockchain technology.
altintegration::btc::LimitedString< Limit > Class Template Reference

Detailed Description

template<size_t Limit>
class altintegration::btc::LimitedString< Limit >

Definition at line 611 of file serialize.hpp.

+ Collaboration diagram for altintegration::btc::LimitedString< Limit >:

Public Member Functions

 LimitedString (std::string &_string)
 
template<typename Stream >
void Unserialize (Stream &s)
 
template<typename Stream >
void Serialize (Stream &s) const
 

Protected Attributes

std::string & string
 

Constructor & Destructor Documentation

◆ LimitedString()

template<size_t Limit>
altintegration::btc::LimitedString< Limit >::LimitedString ( std::string &  _string)
inlineexplicit

Definition at line 616 of file serialize.hpp.

616: string(_string) {}

Member Function Documentation

◆ Serialize()

template<size_t Limit>
template<typename Stream >
void altintegration::btc::LimitedString< Limit >::Serialize ( Stream &  s) const
inline

Definition at line 634 of file serialize.hpp.

634 {
635 WriteCompactSize(s, string.size());
636 if (!string.empty()) s.write((char*)string.data(), string.size());
637 }

◆ Unserialize()

template<size_t Limit>
template<typename Stream >
void altintegration::btc::LimitedString< Limit >::Unserialize ( Stream &  s)
inline

Definition at line 619 of file serialize.hpp.

619 {
620 size_t size = ReadCompactSize(s);
621 if (size > Limit) {
622 throw std::ios_base::failure("String length limit exceeded");
623 }
624 string.resize(size);
626 if (size != 0) {
627 if (!s.read(size, (uint8_t*)string.data(), state)) {
628 throw std::ios_base::failure(state.toString());
629 }
630 }
631 }
Class that is used for storing validation state.

Member Data Documentation

◆ string

template<size_t Limit>
std::string& altintegration::btc::LimitedString< Limit >::string
protected

Definition at line 613 of file serialize.hpp.


The documentation for this class was generated from the following file: