载入中...
搜索中...
未找到

Non-negative integral quantity used by resource accounts. 更多...

#include <ResourceAccount.h>

Public 成员函数

constexpr Amount () noexcept=default
 Construct zero.
 
constexpr Amount (std::int64_t value) noexcept
 Construct an amount from a validated native value.
 
constexpr std::int64_t value () const noexcept
 Return the native quantity at an explicit adapter boundary.
 
constexpr bool isZero () const noexcept
 Whether the quantity is zero.
 
eve::Result< Amount > checkedAdd (Amount other) const
 Add two quantities with overflow checking.
 

静态 Public 成员函数

static eve::Result< Amount > from (std::int64_t value)
 Validate and construct an amount.
 
static constexpr Amount zero () noexcept
 Return zero.
 

友元

constexpr bool operator== (const Amount &, const Amount &) noexcept=default
 
constexpr auto operator<=> (const Amount &, const Amount &) noexcept=default
 Operator <=>.
 

详细描述

Non-negative integral quantity used by resource accounts.

The raw constructor is explicit so an adapter can construct a value after validating a native balance. External input should use from(), which rejects negative values.

在文件 ResourceAccount.h 第 75 行定义.

构造及析构函数说明

◆ Amount() [1/2]

constexpr eve::resource::Amount::Amount ( )
constexprdefaultnoexcept

Construct zero.

被这些函数引用 checkedAdd(), from() , 以及 zero().

◆ Amount() [2/2]

constexpr eve::resource::Amount::Amount ( std::int64_t  value)
inlineexplicitconstexprnoexcept

Construct an amount from a validated native value.

参数
valueNon-negative quantity; callers handling untrusted input should use from() instead.

在文件 ResourceAccount.h 第 85 行定义.

成员函数说明

◆ checkedAdd()

eve::Result< Amount > eve::resource::Amount::checkedAdd ( Amount  other) const

Add two quantities with overflow checking.

返回
The sum, or a failed Result when int64_t would overflow.

在文件 ResourceAccount.cpp 第 57 行定义.

引用了 Amount(), eve::Result< T >::failure() , 以及 eve::Result< T >::success().

◆ from()

eve::Result< Amount > eve::resource::Amount::from ( std::int64_t  value)
static

Validate and construct an amount.

参数
valueNative quantity, which must be non-negative.
返回
A validated amount or a rejected Result.

在文件 ResourceAccount.cpp 第 51 行定义.

引用了 Amount(), eve::Result< T >::failure(), eve::Result< T >::success() , 以及 value().

被这些函数引用 eve::resource::ResourceCost::create().

◆ isZero()

constexpr bool eve::resource::Amount::isZero ( ) const
inlineconstexprnoexcept

Whether the quantity is zero.

在文件 ResourceAccount.h 第 101 行定义.

◆ value()

constexpr std::int64_t eve::resource::Amount::value ( ) const
inlineconstexprnoexcept

Return the native quantity at an explicit adapter boundary.

在文件 ResourceAccount.h 第 98 行定义.

被这些函数引用 eve::resource::ResourceCost::create() , 以及 from().

◆ zero()

static constexpr Amount eve::resource::Amount::zero ( )
inlinestaticconstexprnoexcept

Return zero.

在文件 ResourceAccount.h 第 95 行定义.

引用了 Amount().

友元及相关函数文档

◆ operator<=>

constexpr auto operator<=> ( const Amount &  ,
const Amount &   
)
friend

Operator <=>.

◆ operator==

constexpr bool operator== ( const Amount &  ,
const Amount &   
)
friend

该类的文档由以下文件生成: