1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

updated tonlib

This commit is contained in:
ton 2019-10-31 14:26:04 +04:00
parent c860ce3d1e
commit 3002321eb7
22 changed files with 576 additions and 109 deletions

View file

@ -33,6 +33,8 @@
#include "vm/cellslice.h"
#include "vm/excno.hpp"
#include "td/utils/Span.h"
namespace td {
extern template class td::Cnt<std::string>;
extern template class td::Ref<td::Cnt<std::string>>;
@ -156,7 +158,7 @@ class StackEntry {
private:
template <typename T, Type tag>
Ref<T> dynamic_as() const & {
Ref<T> dynamic_as() const& {
return tp == tag ? static_cast<Ref<T>>(ref) : td::Ref<T>{};
}
template <typename T, Type tag>
@ -168,7 +170,7 @@ class StackEntry {
return tp == tag ? static_cast<Ref<T>>(std::move(ref)) : td::Ref<T>{};
}
template <typename T, Type tag>
Ref<T> as() const & {
Ref<T> as() const& {
return tp == tag ? Ref<T>{td::static_cast_ref(), ref} : td::Ref<T>{};
}
template <typename T, Type tag>
@ -189,31 +191,31 @@ class StackEntry {
return ref;
}
}
td::RefInt256 as_int() const & {
td::RefInt256 as_int() const& {
return as<td::CntInt256, t_int>();
}
td::RefInt256 as_int() && {
return move_as<td::CntInt256, t_int>();
}
Ref<Cell> as_cell() const & {
Ref<Cell> as_cell() const& {
return as<Cell, t_cell>();
}
Ref<Cell> as_cell() && {
return move_as<Cell, t_cell>();
}
Ref<CellBuilder> as_builder() const & {
Ref<CellBuilder> as_builder() const& {
return as<CellBuilder, t_builder>();
}
Ref<CellBuilder> as_builder() && {
return move_as<CellBuilder, t_builder>();
}
Ref<CellSlice> as_slice() const & {
Ref<CellSlice> as_slice() const& {
return as<CellSlice, t_slice>();
}
Ref<CellSlice> as_slice() && {
return move_as<CellSlice, t_slice>();
}
Ref<Continuation> as_cont() const &;
Ref<Continuation> as_cont() const&;
Ref<Continuation> as_cont() &&;
Ref<Cnt<std::string>> as_string_ref() const {
return as<Cnt<std::string>, t_string>();
@ -228,16 +230,16 @@ class StackEntry {
std::string as_bytes() const {
return tp == t_bytes ? *as_bytes_ref() : "";
}
Ref<Box> as_box() const &;
Ref<Box> as_box() const&;
Ref<Box> as_box() &&;
Ref<Tuple> as_tuple() const &;
Ref<Tuple> as_tuple() const&;
Ref<Tuple> as_tuple() &&;
Ref<Tuple> as_tuple_range(unsigned max_len = 255, unsigned min_len = 0) const &;
Ref<Tuple> as_tuple_range(unsigned max_len = 255, unsigned min_len = 0) const&;
Ref<Tuple> as_tuple_range(unsigned max_len = 255, unsigned min_len = 0) &&;
Ref<Atom> as_atom() const &;
Ref<Atom> as_atom() const&;
Ref<Atom> as_atom() &&;
template <class T>
Ref<T> as_object() const & {
Ref<T> as_object() const& {
return dynamic_as<T, t_object>();
}
template <class T>
@ -361,6 +363,9 @@ class Stack : public td::CntObject {
std::vector<StackEntry>::const_iterator from_top(int offs) const {
return stack.cend() - offs;
}
td::Span<StackEntry> as_span() const {
return stack;
}
bool at_least(int req) const {
return depth() >= req;
}