13 #include <hilti/rt/exception.h> 14 #include <hilti/rt/fmt.h> 15 #include <hilti/rt/types/address.h> 16 #include <hilti/rt/types/bool.h> 17 #include <hilti/rt/types/bytes.h> 18 #include <hilti/rt/types/map.h> 19 #include <hilti/rt/types/network.h> 20 #include <hilti/rt/types/port.h> 21 #include <hilti/rt/types/reference.h> 22 #include <hilti/rt/types/set.h> 23 #include <hilti/rt/types/stream.h> 24 #include <hilti/rt/types/vector.h> 58 std::weak_ptr<bool> handle()
const {
60 throw InvalidValue(
"type-info traversal not tied to value");
65 std::shared_ptr<bool> _handle;
66 std::optional<hilti::rt::StrongReferenceGeneric> _value;
92 : _ptr(ptr), _ti(ti), _parent_handle(parent.handle()) {
104 : _ptr(ptr), _ti(ti), _parent_handle(parent._parent_handle) {
121 throw InvalidValue(
"value not set");
131 operator bool()
const {
return _ptr !=
nullptr; }
136 if ( _parent_handle.expired() )
137 throw InvalidValue(
"type info value expired");
142 std::weak_ptr<bool> _parent_handle;
155 const T&
get(
const Value& v)
const {
return *
static_cast<const T*
>(v.pointer()); }
195 namespace iterable_type {
226 Value operator*()
const;
239 return _cur.has_value() == other._cur.has_value();
248 std::optional<hilti::rt::any> _cur;
301 using Accessor = std::tuple<std::optional<hilti::rt::any> (*)(
const Value&),
302 std::optional<hilti::rt::any> (*)(
const hilti::rt::any&),
303 const void* (*)(
const hilti::rt::any&)>;
332 namespace iterable_type {
335 _value = std::move(v);
336 _cur = std::get<0>(_type->_accessor)(_value);
340 if ( _cur.has_value() )
341 _cur = std::get<1>(_type->_accessor)(*_cur);
349 if ( _cur.has_value() )
350 _cur = std::get<1>(_type->_accessor)(*_cur);
356 if ( ! _cur.has_value() )
357 throw InvalidValue(
"type info iterator invalid");
359 return Value(std::get<2>(_type->_accessor)(*_cur), _type->_etype, _value);
402 Label(std::string name, int64_t value) : name(
std::move(name)), value(value) {}
418 Enum(std::vector<enum_::Label> labels) : _labels(
std::move(labels)) {}
421 const auto&
labels()
const {
return _labels; }
429 auto n = *
static_cast<const int64_t*
>(v.pointer());
431 for (
const auto& l : _labels ) {
440 const std::vector<enum_::Label> _labels;
496 std::pair<Value, Value>
operator*()
const;
509 return _cur.has_value() == other._cur.has_value();
516 const Map* _type =
nullptr;
518 std::optional<hilti::rt::any> _cur;
553 using Accessor = std::tuple<std::optional<hilti::rt::any> (*)(
const Value&),
554 std::optional<hilti::rt::any> (*)(
const hilti::rt::any&),
555 std::pair<const void*, const void*> (*)(
const hilti::rt::any&)>;
566 : _ktype(ktype), _vtype(vtype), _accessor(
std::move(accessor)) {}
582 template<
typename K,
typename V>
583 using iterator_pair =
584 std::pair<typename hilti::rt::Map<K, V>::const_iterator,
typename hilti::rt::Map<K, V>::const_iterator>;
586 template<
typename K,
typename V>
588 return std::make_tuple(
589 [](
const Value& v_) -> std::optional<hilti::rt::any> {
591 if ( v->cbegin() != v->cend() )
592 return std::make_pair(v->cbegin(), v->cend());
596 [](
const hilti::rt::any& i_) -> std::optional<hilti::rt::any> {
597 auto i = hilti::rt::any_cast<iterator_pair<K, V>>(i_);
598 auto n = std::make_pair(++i.first, i.second);
599 if ( n.first != n.second )
604 [](
const hilti::rt::any& i_) -> std::pair<const void*, const void*> {
605 auto i = hilti::rt::any_cast<iterator_pair<K, V>>(i_);
606 return std::make_pair(&(*i.first).first, &(*i.first).second);
621 _value = std::move(v);
622 _cur = std::get<0>(_type->_accessor)(_value);
626 if ( _cur.has_value() )
627 _cur = std::get<1>(_type->_accessor)(*_cur);
635 if ( _cur.has_value() )
636 _cur = std::get<1>(_type->_accessor)(*_cur);
642 if ( ! _cur.has_value() )
643 throw InvalidValue(
"type info iterator invalid");
645 auto x = std::get<2>(_type->_accessor)(*_cur);
646 return std::make_pair(
Value(x.first, _type->_ktype, _value),
Value(x.second, _type->_vtype, _value));
668 : _ktype(ktype), _vtype(vtype), _accessor(accessor) {}
674 auto x = _accessor(v);
675 return std::make_pair(
Value(x.first, _ktype, v),
Value(x.second, _vtype, v));
689 template<
typename K,
typename V>
690 static auto accessor() {
691 return [](
const Value& v) -> std::pair<const void*, const void*> {
693 const auto& x = **
static_cast<iterator_type*
>(v.pointer());
694 return std::make_pair(&x.first, &x.second);
713 static auto accessor() {
714 return [](
const Value& v) ->
const void* {
715 auto x =
static_cast<const std::optional<T>*
>(v.pointer());
716 return x->has_value() ? &*x :
nullptr;
736 static auto accessor() {
737 return [](
const Value& v) ->
const void* {
739 return x->
hasValue() ? &*x :
nullptr;
752 using iterator_pair =
753 std::pair<typename hilti::rt::Set<T>::const_iterator,
typename hilti::rt::Set<T>::const_iterator>;
757 return std::make_tuple(
758 [](
const Value& v_) -> std::optional<hilti::rt::any> {
760 if ( v->begin() != v->end() )
761 return std::make_pair(v->begin(), v->end());
765 [](
const hilti::rt::any& i_) -> std::optional<hilti::rt::any> {
766 auto i = hilti::rt::any_cast<iterator_pair<T>>(i_);
767 auto n = std::make_pair(++i.first, i.second);
768 if ( n.first != n.second )
773 [](
const hilti::rt::any& i_) ->
const void* {
774 auto i = hilti::rt::any_cast<iterator_pair<T>>(i_);
786 static auto accessor() {
787 return [](
const Value& v) ->
const void* {
794 template<
typename W
idth>
815 static auto accessor() {
816 return [](
const Value& v) ->
const void* {
843 Field(
const char* name,
const TypeInfo* type, std::ptrdiff_t offset,
bool internal,
844 Accessor accessor = accessor_default)
845 : name(name), type(type), offset(offset), accessor(
std::move(accessor)), internal(internal) {}
853 return [](
const Value& v) ->
const void* {
854 auto x =
static_cast<const std::optional<T>*
>(v.pointer());
855 if ( x->has_value() ) {
864 bool isInternal()
const {
return internal; }
873 Value value(
const Value& v)
const {
return Value(accessor(v), type, v); }
875 const std::ptrdiff_t offset;
890 Struct(std::vector<struct_::Field> fields) : _fields(
std::move(fields)) {}
898 auto fields(
bool include_internal =
false)
const {
899 std::vector<std::reference_wrapper<const struct_::Field>> fields;
900 std::copy_if(_fields.begin(), _fields.end(), std::back_inserter(fields),
901 [=](
const struct_::Field& f) {
return include_internal || ! f.isInternal(); });
915 std::vector<std::pair<const struct_::Field&, Value>> values;
917 for (
const auto& f : fields(include_internal) ) {
918 auto x =
Value(static_cast<const char*>(v.
pointer()) + f.get().offset, f.get().type, v);
919 values.emplace_back(f.get(), f.get().value(x));
926 const std::vector<struct_::Field> _fields;
946 Element(
const char* name,
const TypeInfo* type, std::ptrdiff_t offset) : name(name), type(type), offset(offset) {}
954 const std::ptrdiff_t offset;
967 Tuple(std::vector<tuple::Element> elements) : _elements(
std::move(elements)) {}
981 std::vector<std::pair<const tuple::Element&, Value>> values;
983 for (
const auto& f : _elements )
984 values.emplace_back(f,
Value(static_cast<const char*>(v.
pointer()) + f.offset, f.type, v));
990 const std::vector<tuple::Element> _elements;
1019 const size_t npos = std::variant_npos;
1028 : _fields(
std::move(fields)), _accessor(
std::move(accessor)) {}
1031 const auto&
fields()
const {
return _fields; }
1038 if (
auto idx = _accessor(v); idx > 0 )
1044 template<
typename T>
1045 static auto accessor() {
1046 return [](
const Value& v) -> std::size_t {
return static_cast<const T*
>(v.pointer())->index(); };
1050 const std::vector<union_::Field> _fields;
1055 template<
typename W
idth>
1063 template<
typename T>
1064 static auto accessor() {
1065 return [](
const Value& v) ->
const void* {
1076 template<
typename T,
typename Allocator>
1077 using iterator_pair = std::pair<typename hilti::rt::Vector<T, Allocator>::const_iterator,
1080 template<
typename T,
typename Allocator = std::allocator<T>>
1082 return std::make_tuple(
1083 [](
const Value& v_) -> std::optional<hilti::rt::any> {
1085 if ( v->begin() != v->end() )
1086 return std::make_pair(v->begin(), v->end());
1088 return std::nullopt;
1090 [](
const hilti::rt::any& i_) -> std::optional<hilti::rt::any> {
1091 auto i = hilti::rt::any_cast<iterator_pair<T, Allocator>>(i_);
1092 auto n = std::make_pair(++i.first, i.second);
1093 if ( n.first != n.second )
1094 return std::move(n);
1096 return std::nullopt;
1098 [](
const hilti::rt::any& i_) ->
const void* {
1099 auto i = hilti::rt::any_cast<iterator_pair<T, Allocator>>(i_);
1110 template<
typename T,
typename Allocator = std::allocator<T>>
1111 static auto accessor() {
1112 return [](
const Value& v) ->
const void* {
1126 template<
typename T>
1127 static auto accessor() {
1128 return [](
const Value& v) ->
const void* {
1147 std::optional<const char*>
id;
1174 SignedInteger_int16,
1175 SignedInteger_int32,
1176 SignedInteger_int64,
1186 UnsignedInteger_uint8,
1187 UnsignedInteger_uint16,
1188 UnsignedInteger_uint32,
1189 UnsignedInteger_uint64,
1198 std::unique_ptr<char, void (*)(char*)> _storage = {
nullptr, [](
char*) {}};
1200 Tag tag = Tag::Undefined;
1249 template<
typename Type>
1250 TypeInfo(std::optional<const char*> _id,
const char* _display, Type* value)
1251 : id(std::move(_id)),
1253 _storage(reinterpret_cast<char*>(value), [](
char* p) {
delete reinterpret_cast<Type*
>(p); }) {
1254 if constexpr ( std::is_same_v<Type, type_info::Address> ) {
1258 else if constexpr ( std::is_same_v<Type, type_info::Any> ) {
1262 else if constexpr ( std::is_same_v<Type, type_info::Bool> ) {
1266 else if constexpr ( std::is_same_v<Type, type_info::Bytes> ) {
1270 else if constexpr ( std::is_same_v<Type, type_info::BytesIterator> ) {
1271 tag = BytesIterator;
1272 bytes_iterator = value;
1274 else if constexpr ( std::is_same_v<Type, type_info::Enum> ) {
1278 else if constexpr ( std::is_same_v<Type, type_info::Error> ) {
1282 else if constexpr ( std::is_same_v<Type, type_info::Exception> ) {
1286 else if constexpr ( std::is_same_v<Type, type_info::Function> ) {
1290 else if constexpr ( std::is_same_v<Type, type_info::Interval> ) {
1294 else if constexpr ( std::is_same_v<Type, type_info::Library> ) {
1298 else if constexpr ( std::is_same_v<Type, type_info::Map> ) {
1302 else if constexpr ( std::is_same_v<Type, type_info::MapIterator> ) {
1304 map_iterator = value;
1306 else if constexpr ( std::is_same_v<Type, type_info::Network> ) {
1310 else if constexpr ( std::is_same_v<Type, type_info::Optional> ) {
1314 else if constexpr ( std::is_same_v<Type, type_info::Port> ) {
1318 else if constexpr ( std::is_same_v<Type, type_info::Real> ) {
1322 else if constexpr ( std::is_same_v<Type, type_info::RegExp> ) {
1326 else if constexpr ( std::is_same_v<Type, type_info::Result> ) {
1330 else if constexpr ( std::is_same_v<Type, type_info::Set> ) {
1334 else if constexpr ( std::is_same_v<Type, type_info::SetIterator> ) {
1336 set_iterator = value;
1339 tag = SignedInteger_int8;
1340 signed_integer_int8 = value;
1343 tag = SignedInteger_int16;
1344 signed_integer_int16 = value;
1347 tag = SignedInteger_int32;
1348 signed_integer_int32 = value;
1351 tag = SignedInteger_int64;
1352 signed_integer_int64 = value;
1354 else if constexpr ( std::is_same_v<Type, type_info::Stream> ) {
1358 else if constexpr ( std::is_same_v<Type, type_info::StreamIterator> ) {
1359 tag = StreamIterator;
1360 stream_iterator = value;
1362 else if constexpr ( std::is_same_v<Type, type_info::StreamView> ) {
1364 stream_view = value;
1366 else if constexpr ( std::is_same_v<Type, type_info::String> ) {
1370 else if constexpr ( std::is_same_v<Type, type_info::StrongReference> ) {
1372 strong_reference = value;
1374 else if constexpr ( std::is_same_v<Type, type_info::Struct> ) {
1378 else if constexpr ( std::is_same_v<Type, type_info::Time> ) {
1382 else if constexpr ( std::is_same_v<Type, type_info::Tuple> ) {
1386 else if constexpr ( std::is_same_v<Type, type_info::Union> ) {
1391 tag = UnsignedInteger_uint8;
1392 unsigned_integer_uint8 = value;
1395 tag = UnsignedInteger_uint16;
1396 unsigned_integer_uint16 = value;
1399 tag = UnsignedInteger_uint32;
1400 unsigned_integer_uint32 = value;
1403 tag = UnsignedInteger_uint64;
1404 unsigned_integer_uint64 = value;
1406 else if constexpr ( std::is_same_v<Type, type_info::ValueReference> ) {
1408 value_reference = value;
1410 else if constexpr ( std::is_same_v<Type, type_info::Vector> ) {
1414 else if constexpr ( std::is_same_v<Type, type_info::VectorIterator> ) {
1415 tag = VectorIterator;
1416 vector_iterator = value;
1418 else if constexpr ( std::is_same_v<Type, type_info::Void> ) {
1422 else if constexpr ( std::is_same_v<Type, type_info::WeakReference> ) {
1423 tag = WeakReference;
1424 weak_reference = value;
1427 throw RuntimeError(
"unhandled type");
1432 namespace type_info {
1444 template<
typename Type>
1446 const auto& type = v.
type();
1448 if constexpr ( std::is_same_v<Type, type_info::Address> ) {
1449 assert(type.tag == TypeInfo::Address);
1450 return type.address;
1452 else if constexpr ( std::is_same_v<Type, type_info::Any> ) {
1453 assert(type.tag == TypeInfo::Any);
1456 else if constexpr ( std::is_same_v<Type, type_info::Bool> ) {
1457 assert(type.tag == TypeInfo::Bool);
1460 else if constexpr ( std::is_same_v<Type, type_info::Bytes> ) {
1461 assert(type.tag == TypeInfo::Bytes);
1464 else if constexpr ( std::is_same_v<Type, type_info::BytesIterator> ) {
1465 assert(type.tag == TypeInfo::BytesIterator);
1466 return type.bytes_iterator;
1468 else if constexpr ( std::is_same_v<Type, type_info::Enum> ) {
1469 assert(type.tag == TypeInfo::Enum);
1472 else if constexpr ( std::is_same_v<Type, type_info::Error> ) {
1473 assert(type.tag == TypeInfo::Error);
1476 else if constexpr ( std::is_same_v<Type, type_info::Exception> ) {
1477 assert(type.tag == TypeInfo::Exception);
1478 return type.exception;
1480 else if constexpr ( std::is_same_v<Type, type_info::Function> ) {
1481 assert(type.tag == TypeInfo::Function);
1482 return type.function;
1484 else if constexpr ( std::is_same_v<Type, type_info::Interval> ) {
1485 assert(type.tag == TypeInfo::Interval);
1486 return type.interval;
1488 else if constexpr ( std::is_same_v<Type, type_info::Library> ) {
1489 assert(type.tag == TypeInfo::Library);
1490 return type.library;
1492 else if constexpr ( std::is_same_v<Type, type_info::Map> ) {
1493 assert(type.tag == TypeInfo::Map);
1496 else if constexpr ( std::is_same_v<Type, type_info::MapIterator> ) {
1497 assert(type.tag == TypeInfo::MapIterator);
1498 return type.map_iterator;
1500 else if constexpr ( std::is_same_v<Type, type_info::Network> ) {
1501 assert(type.tag == TypeInfo::Network);
1502 return type.network;
1504 else if constexpr ( std::is_same_v<Type, type_info::Optional> ) {
1505 assert(type.tag == TypeInfo::Optional);
1506 return type.optional;
1508 else if constexpr ( std::is_same_v<Type, type_info::Port> ) {
1509 assert(type.tag == TypeInfo::Port);
1512 else if constexpr ( std::is_same_v<Type, type_info::Real> ) {
1513 assert(type.tag == TypeInfo::Real);
1516 else if constexpr ( std::is_same_v<Type, type_info::RegExp> ) {
1517 assert(type.tag == TypeInfo::RegExp);
1520 else if constexpr ( std::is_same_v<Type, type_info::Result> ) {
1521 assert(type.tag == TypeInfo::Result);
1524 else if constexpr ( std::is_same_v<Type, type_info::Set> ) {
1525 assert(type.tag == TypeInfo::Set);
1528 else if constexpr ( std::is_same_v<Type, type_info::SetIterator> ) {
1529 assert(type.tag == TypeInfo::SetIterator);
1530 return type.set_iterator;
1533 assert(type.tag == TypeInfo::SignedInteger_int8);
1534 return type.signed_integer_int8;
1537 assert(type.tag == TypeInfo::SignedInteger_int16);
1538 return type.signed_integer_int16;
1541 assert(type.tag == TypeInfo::SignedInteger_int32);
1542 return type.signed_integer_int32;
1545 assert(type.tag == TypeInfo::SignedInteger_int64);
1546 return type.signed_integer_int64;
1548 else if constexpr ( std::is_same_v<Type, type_info::Stream> ) {
1549 assert(type.tag == TypeInfo::Stream);
1552 else if constexpr ( std::is_same_v<Type, type_info::StreamIterator> ) {
1553 assert(type.tag == TypeInfo::StreamIterator);
1554 return type.stream_iterator;
1556 else if constexpr ( std::is_same_v<Type, type_info::StreamView> ) {
1557 assert(type.tag == TypeInfo::StreamView);
1558 return type.stream_view;
1560 else if constexpr ( std::is_same_v<Type, type_info::String> ) {
1561 assert(type.tag == TypeInfo::String);
1564 else if constexpr ( std::is_same_v<Type, type_info::StrongReference> ) {
1565 assert(type.tag == TypeInfo::StrongReference);
1566 return type.strong_reference;
1568 else if constexpr ( std::is_same_v<Type, type_info::Struct> ) {
1569 assert(type.tag == TypeInfo::Struct);
1570 return type.struct_;
1572 else if constexpr ( std::is_same_v<Type, type_info::Time> ) {
1573 assert(type.tag == TypeInfo::Time);
1576 else if constexpr ( std::is_same_v<Type, type_info::Tuple> ) {
1577 assert(type.tag == TypeInfo::Tuple);
1580 else if constexpr ( std::is_same_v<Type, type_info::Union> ) {
1581 assert(type.tag == TypeInfo::Union);
1585 assert(type.tag == TypeInfo::UnsignedInteger_uint8);
1586 return type.unsigned_integer_uint8;
1589 assert(type.tag == TypeInfo::UnsignedInteger_uint16);
1590 return type.unsigned_integer_uint16;
1593 assert(type.tag == TypeInfo::UnsignedInteger_uint32);
1594 return type.unsigned_integer_uint32;
1597 assert(type.tag == TypeInfo::UnsignedInteger_uint64);
1598 return type.unsigned_integer_uint64;
1600 else if constexpr ( std::is_same_v<Type, type_info::ValueReference> ) {
1601 assert(type.tag == TypeInfo::ValueReference);
1602 return type.value_reference;
1604 else if constexpr ( std::is_same_v<Type, type_info::Vector> ) {
1605 assert(type.tag == TypeInfo::Vector);
1608 else if constexpr ( std::is_same_v<Type, type_info::VectorIterator> ) {
1609 assert(type.tag == TypeInfo::VectorIterator);
1610 return type.vector_iterator;
1612 else if constexpr ( std::is_same_v<Type, type_info::Void> ) {
1613 assert(type.tag == TypeInfo::Void);
1616 else if constexpr ( std::is_same_v<Type, type_info::WeakReference> ) {
1617 assert(type.tag == TypeInfo::WeakReference);
1618 return type.weak_reference;
1621 throw RuntimeError(
"unhandled type");
Definition: type-info.h:445
MapIterator(const TypeInfo *ktype, const TypeInfo *vtype, Accessor accessor)
Definition: type-info.h:667
Enum(std::vector< enum_::Label > labels)
Definition: type-info.h:418
std::size_t(*)(const Value &v) Accessor
Definition: type-info.h:1018
Definition: type-info.h:384
Definition: type-info.h:731
Definition: type-info.h:705
Definition: type-info.h:448
Element(const char *name, const TypeInfo *type, std::ptrdiff_t offset)
Definition: type-info.h:946
Definition: type-info.h:960
const TypeInfo * type
Definition: type-info.h:1006
Definition: type-info.h:461
Definition: type-info.h:937
const char * display
Definition: type-info.h:1148
Definition: reference.h:633
bool operator!=(const Iterator &other) const
Definition: type-info.h:243
Definition: reference.h:470
Definition: type-info.h:722
Struct(std::vector< struct_::Field > fields)
Definition: type-info.h:890
Definition: type-info.h:996
Definition: type-info.h:1122
Iterator end() const
Definition: type-info.h:269
const TypeInfo * keyType() const
Definition: type-info.h:682
Definition: type-info.h:747
Sequence(const Map *type, Value v)
Definition: type-info.h:533
Definition: type-info.h:930
auto iterate(const Value &v, bool include_internal=false) const
Definition: type-info.h:914
Value value(const Value &v) const
Definition: type-info.h:1037
const TypeInfo * keyType() const
Definition: type-info.h:575
Definition: interval.h:22
std::pair< const void *, const void * >(*)(const Value &v) Accessor
Definition: type-info.h:658
Definition: type-info.h:798
const TypeInfo & type() const
Definition: type-info.h:128
std::optional< const char * > id
Definition: type-info.h:1147
Definition: optional.h:79
Value operator*() const
Definition: type-info.h:355
Union(std::vector< union_::Field > fields, Accessor accessor)
Definition: type-info.h:1027
Definition: type-info.h:255
Iterator begin() const
Definition: type-info.h:536
const TypeInfo * type
Definition: type-info.h:949
Definition: type-info.h:525
Definition: type-info.h:652
Value(const void *ptr, const TypeInfo *ti, const value::Parent &parent)
Definition: type-info.h:91
Definition: type-info.h:162
Definition: type-info.h:43
map::Sequence iterate(const Value &value) const
Definition: type-info.h:569
Tuple(std::vector< tuple::Element > elements)
Definition: type-info.h:967
const auto & labels() const
Definition: type-info.h:421
const TypeInfo * valueType() const
Definition: type-info.h:580
const void *(*)(const Value &v) Accessor
Definition: type-info.h:833
Definition: function.h:44
Label(std::string name, int64_t value)
Definition: type-info.h:402
const void *(*)(const Value &v) Accessor
Definition: type-info.h:168
Definition: type-info.h:365
Parent()
Definition: type-info.h:50
Definition: type-info.h:1072
const std::string name
Definition: type-info.h:404
Definition: type-info.h:1012
Definition: type-info.h:458
Field(const char *name, const TypeInfo *type, std::ptrdiff_t offset, bool internal, Accessor accessor=accessor_default)
Definition: type-info.h:843
Definition: type-info.h:728
Definition: type-info.h:804
std::pair< Value, Value > operator*() const
Definition: type-info.h:641
Iterator & operator++()
Definition: type-info.h:625
static const void * accessor_default(const Value &v)
Definition: type-info.h:848
Definition: type-info.h:387
bool hasValue() const
Definition: result.h:148
Iterator()
Definition: type-info.h:482
const std::string name
Definition: type-info.h:948
std::tuple< std::optional< hilti::rt::any >(*)(const Value &), std::optional< hilti::rt::any >(*)(const hilti::rt::any &), const void *(*)(const hilti::rt::any &)> Accessor
Definition: type-info.h:303
Iterator()
Definition: type-info.h:212
Definition: type-info.h:781
Definition: type-info.h:725
Definition: reference.h:321
DereferencableType(const TypeInfo *vtype, Accessor accessor)
Definition: type-info.h:176
auto fields(bool include_internal=false) const
Definition: type-info.h:898
Definition: type-info.h:395
Definition: stream.h:1379
Definition: type-info.h:1059
iterable_type::Sequence iterate(const Value &value) const
Definition: type-info.h:315
Definition: type-info.h:82
bool operator==(const Iterator &other) const
Definition: type-info.h:237
const auto & fields() const
Definition: type-info.h:1031
static Accessor accessor_optional()
Definition: type-info.h:852
Iterator & operator++()
Definition: type-info.h:339
Definition: type-info.h:795
Definition: reference.h:47
Definition: type-info.h:381
Definition: type-info.h:1106
Map(const TypeInfo *ktype, const TypeInfo *vtype, Accessor accessor)
Definition: type-info.h:565
Parent(const StrongReference< T > &value)
Definition: type-info.h:47
std::tuple< std::optional< hilti::rt::any >(*)(const Value &), std::optional< hilti::rt::any >(*)(const hilti::rt::any &), std::pair< const void *, const void * >(*)(const hilti::rt::any &)> Accessor
Definition: type-info.h:555
IterableType(const TypeInfo *etype, Accessor accessor)
Definition: type-info.h:312
Definition: type-info.h:468
Definition: type-info.h:411
Definition: type-info.h:1056
Sequence(const IterableType *type, Value v)
Definition: type-info.h:263
Definition: type-info.h:378
Value(const void *ptr, const TypeInfo *ti, const Value &parent)
Definition: type-info.h:103
const TypeInfo * valueType() const
Definition: type-info.h:687
Definition: exception.h:21
const std::string name
Definition: type-info.h:1005
bool operator==(const Iterator &other) const
Definition: type-info.h:507
const TypeInfo * valueType() const
Definition: type-info.h:186
Definition: type-info.h:390
Definition: type-info.h:547
Iterator begin() const
Definition: type-info.h:266
Iterator end() const
Definition: type-info.h:539
Value value(const Value &v) const
Definition: type-info.h:181
Definition: type-info.h:828
bool operator!=(const Iterator &other) const
Definition: type-info.h:513
auto iterate(const Value &v) const
Definition: type-info.h:980
Field(const char *name, const TypeInfo *type)
Definition: type-info.h:1003
Definition: type-info.h:801
const int64_t value
Definition: type-info.h:405
Definition: type-info.h:708
Definition: type-info.h:281
Definition: type-info.h:883
Definition: type-info.h:1146
Definition: type-info.h:455
Definition: type-info.h:152
const void * pointer() const
Definition: type-info.h:119
Definition: type-info.h:810
std::pair< Value, Value > value(const Value &v) const
Definition: type-info.h:673
const TypeInfo * dereferencedType() const
Definition: type-info.h:323
std::string fmt(const char *fmt, const Args &... args)
Definition: fmt.h:13
const std::string name
Definition: type-info.h:866
Definition: type-info.h:198
Definition: type-info.h:1119
Definition: type-info.h:371
void tie(hilti::rt::StrongReferenceGeneric value)
Definition: type-info.h:53
const auto & elements() const
Definition: type-info.h:970
Definition: type-info.h:807