Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

#include <script.h>

Public Member Functions

 CScriptNum (const int64_t &n)
 Numeric opcodes (OP_1ADD, etc) are restricted to operating on 4-byte integers. More...
 
 CScriptNum (const std::vector< unsigned char > &vch, bool fRequireMinimal, const size_t nMaxNumSize=nDefaultMaxNumSize)
 
bool operator== (const int64_t &rhs) const
 
bool operator!= (const int64_t &rhs) const
 
bool operator<= (const int64_t &rhs) const
 
bool operator< (const int64_t &rhs) const
 
bool operator>= (const int64_t &rhs) const
 
bool operator> (const int64_t &rhs) const
 
bool operator== (const CScriptNum &rhs) const
 
bool operator!= (const CScriptNum &rhs) const
 
bool operator<= (const CScriptNum &rhs) const
 
bool operator< (const CScriptNum &rhs) const
 
bool operator>= (const CScriptNum &rhs) const
 
bool operator> (const CScriptNum &rhs) const
 
CScriptNum operator+ (const int64_t &rhs) const
 
CScriptNum operator- (const int64_t &rhs) const
 
CScriptNum operator+ (const CScriptNum &rhs) const
 
CScriptNum operator- (const CScriptNum &rhs) const
 
CScriptNumoperator+= (const CScriptNum &rhs)
 
CScriptNumoperator-= (const CScriptNum &rhs)
 
CScriptNum operator & (const int64_t &rhs) const
 
CScriptNum operator & (const CScriptNum &rhs) const
 
CScriptNumoperator &= (const CScriptNum &rhs)
 
CScriptNum operator- () const
 
CScriptNumoperator= (const int64_t &rhs)
 
CScriptNumoperator+= (const int64_t &rhs)
 
CScriptNumoperator-= (const int64_t &rhs)
 
CScriptNumoperator &= (const int64_t &rhs)
 
int getint () const
 
std::vector< unsigned char > getvch () const
 

Static Public Member Functions

static std::vector< unsigned char > serialize (const int64_t &value)
 

Static Public Attributes

static const size_t nDefaultMaxNumSize = 4
 

Static Private Member Functions

static int64_t set_vch (const std::vector< unsigned char > &vch)
 

Private Attributes

int64_t m_value
 

Detailed Description

Definition at line 205 of file script.h.

Constructor & Destructor Documentation

◆ CScriptNum() [1/2]

CScriptNum::CScriptNum ( const int64_t &  n)
inlineexplicit

Numeric opcodes (OP_1ADD, etc) are restricted to operating on 4-byte integers.

The semantics are subtle, though: operands must be in the range [-2^31 +1...2^31 -1], but results may overflow (and are valid as long as they are not used in a subsequent numeric operation). CScriptNum enforces those semantics by storing results as an int64 and allowing out-of-range values to be returned as a vector of bytes but throwing an exception if arithmetic is done or the result is interpreted as an integer.

Definition at line 217 of file script.h.

References m_value.

Referenced by operator &(), operator+(), and operator-().

◆ CScriptNum() [2/2]

CScriptNum::CScriptNum ( const std::vector< unsigned char > &  vch,
bool  fRequireMinimal,
const size_t  nMaxNumSize = nDefaultMaxNumSize 
)
inlineexplicit

Definition at line 224 of file script.h.

References m_value, and set_vch().

Member Function Documentation

◆ getint()

int CScriptNum::getint ( ) const
inline

Definition at line 312 of file script.h.

References m_value.

Referenced by EvalScript().

◆ getvch()

std::vector<unsigned char> CScriptNum::getvch ( ) const
inline

Definition at line 321 of file script.h.

References m_value, and serialize().

Referenced by EvalScript(), and CScript::operator<<().

◆ operator &() [1/2]

CScriptNum CScriptNum::operator& ( const int64_t &  rhs) const
inline

Definition at line 273 of file script.h.

References CScriptNum(), and m_value.

Referenced by operator &().

◆ operator &() [2/2]

CScriptNum CScriptNum::operator& ( const CScriptNum rhs) const
inline

Definition at line 274 of file script.h.

References m_value, and operator &().

◆ operator &=() [1/2]

CScriptNum& CScriptNum::operator&= ( const CScriptNum rhs)
inline

Definition at line 276 of file script.h.

References m_value.

◆ operator &=() [2/2]

CScriptNum& CScriptNum::operator&= ( const int64_t &  rhs)
inline

Definition at line 306 of file script.h.

References m_value.

◆ operator!=() [1/2]

bool CScriptNum::operator!= ( const int64_t &  rhs) const
inline

Definition at line 252 of file script.h.

References m_value.

◆ operator!=() [2/2]

bool CScriptNum::operator!= ( const CScriptNum rhs) const
inline

Definition at line 259 of file script.h.

References m_value, and operator!=().

Referenced by operator!=().

◆ operator+() [1/2]

CScriptNum CScriptNum::operator+ ( const int64_t &  rhs) const
inline

Definition at line 265 of file script.h.

References CScriptNum(), and m_value.

◆ operator+() [2/2]

CScriptNum CScriptNum::operator+ ( const CScriptNum rhs) const
inline

Definition at line 267 of file script.h.

References m_value, and operator+().

Referenced by operator+().

◆ operator+=() [1/2]

CScriptNum& CScriptNum::operator+= ( const CScriptNum rhs)
inline

Definition at line 270 of file script.h.

References m_value, and operator+=().

Referenced by operator+=().

◆ operator+=() [2/2]

CScriptNum& CScriptNum::operator+= ( const int64_t &  rhs)
inline

Definition at line 290 of file script.h.

References m_value.

◆ operator-() [1/3]

CScriptNum CScriptNum::operator- ( const int64_t &  rhs) const
inline

Definition at line 266 of file script.h.

References CScriptNum(), and m_value.

◆ operator-() [2/3]

CScriptNum CScriptNum::operator- ( const CScriptNum rhs) const
inline

Definition at line 268 of file script.h.

References m_value, and operator-().

Referenced by operator-().

◆ operator-() [3/3]

CScriptNum CScriptNum::operator- ( ) const
inline

Definition at line 278 of file script.h.

References CScriptNum(), and m_value.

◆ operator-=() [1/2]

CScriptNum& CScriptNum::operator-= ( const CScriptNum rhs)
inline

Definition at line 271 of file script.h.

References m_value, and operator-=().

Referenced by operator-=().

◆ operator-=() [2/2]

CScriptNum& CScriptNum::operator-= ( const int64_t &  rhs)
inline

Definition at line 298 of file script.h.

References m_value.

◆ operator<() [1/2]

bool CScriptNum::operator< ( const int64_t &  rhs) const
inline

Definition at line 254 of file script.h.

References m_value.

Referenced by operator<().

◆ operator<() [2/2]

bool CScriptNum::operator< ( const CScriptNum rhs) const
inline

Definition at line 261 of file script.h.

References m_value, and operator<().

◆ operator<=() [1/2]

bool CScriptNum::operator<= ( const int64_t &  rhs) const
inline

Definition at line 253 of file script.h.

References m_value.

◆ operator<=() [2/2]

bool CScriptNum::operator<= ( const CScriptNum rhs) const
inline

Definition at line 260 of file script.h.

References m_value, and operator<=().

Referenced by operator<=().

◆ operator=()

CScriptNum& CScriptNum::operator= ( const int64_t &  rhs)
inline

Definition at line 284 of file script.h.

References m_value.

◆ operator==() [1/2]

bool CScriptNum::operator== ( const int64_t &  rhs) const
inline

Definition at line 251 of file script.h.

References m_value.

◆ operator==() [2/2]

bool CScriptNum::operator== ( const CScriptNum rhs) const
inline

Definition at line 258 of file script.h.

References m_value, and operator==().

Referenced by operator==().

◆ operator>() [1/2]

bool CScriptNum::operator> ( const int64_t &  rhs) const
inline

Definition at line 256 of file script.h.

References m_value.

Referenced by operator>().

◆ operator>() [2/2]

bool CScriptNum::operator> ( const CScriptNum rhs) const
inline

Definition at line 263 of file script.h.

References m_value, and operator>().

◆ operator>=() [1/2]

bool CScriptNum::operator>= ( const int64_t &  rhs) const
inline

Definition at line 255 of file script.h.

References m_value.

◆ operator>=() [2/2]

bool CScriptNum::operator>= ( const CScriptNum rhs) const
inline

Definition at line 262 of file script.h.

References m_value, and operator>=().

Referenced by operator>=().

◆ serialize()

static std::vector<unsigned char> CScriptNum::serialize ( const int64_t &  value)
inlinestatic

Definition at line 326 of file script.h.

Referenced by getvch(), and CScript::push_int64().

◆ set_vch()

static int64_t CScriptNum::set_vch ( const std::vector< unsigned char > &  vch)
inlinestaticprivate

Definition at line 360 of file script.h.

Referenced by CScriptNum().

Member Data Documentation

◆ m_value

◆ nDefaultMaxNumSize

const size_t CScriptNum::nDefaultMaxNumSize = 4
static

Definition at line 222 of file script.h.


The documentation for this class was generated from the following file:
Released under the MIT license