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&)>;
330 namespace iterable_type {
333 _value = std::move(v);
334 _cur = std::get<0>(_type->_accessor)(_value);
338 if ( _cur.has_value() )
339 _cur = std::get<1>(_type->_accessor)(*_cur);
347 if ( _cur.has_value() )
348 _cur = std::get<1>(_type->_accessor)(*_cur);
354 if ( ! _cur.has_value() )
355 throw InvalidValue(
"type info iterator invalid");
357 return Value(std::get<2>(_type->_accessor)(*_cur), _type->_etype, _value);
400 Label(std::string name, int64_t value) : name(
std::move(name)), value(value) {}
416 Enum(std::vector<enum_::Label> labels) : _labels(
std::move(labels)) {}
419 const auto&
labels()
const {
return _labels; }
427 auto n = *
static_cast<const int64_t*
>(v.pointer());
429 for (
const auto& l : _labels ) {
438 const std::vector<enum_::Label> _labels;
494 std::pair<Value, Value>
operator*()
const;
507 return _cur.has_value() == other._cur.has_value();
514 const Map* _type =
nullptr;
516 std::optional<hilti::rt::any> _cur;
551 using Accessor = std::tuple<std::optional<hilti::rt::any> (*)(
const Value&),
552 std::optional<hilti::rt::any> (*)(
const hilti::rt::any&),
553 std::pair<const void*, const void*> (*)(
const hilti::rt::any&)>;
564 : _ktype(ktype), _vtype(vtype), _accessor(
std::move(accessor)) {}
580 template<
typename K,
typename V>
581 using iterator_pair =
582 std::pair<typename hilti::rt::Map<K, V>::const_iterator,
typename hilti::rt::Map<K, V>::const_iterator>;
584 template<
typename K,
typename V>
586 return std::make_tuple(
587 [](
const Value& v_) -> std::optional<hilti::rt::any> {
589 if ( v->cbegin() != v->cend() )
590 return std::make_pair(v->cbegin(), v->cend());
594 [](
const hilti::rt::any& i_) -> std::optional<hilti::rt::any> {
595 auto i = hilti::rt::any_cast<iterator_pair<K, V>>(i_);
596 auto n = std::make_pair(++i.first, i.second);
597 if ( n.first != n.second )
602 [](
const hilti::rt::any& i_) -> std::pair<const void*, const void*> {
603 auto i = hilti::rt::any_cast<iterator_pair<K, V>>(i_);
604 return std::make_pair(&(*i.first).first, &(*i.first).second);
619 _value = std::move(v);
620 _cur = std::get<0>(_type->_accessor)(_value);
624 if ( _cur.has_value() )
625 _cur = std::get<1>(_type->_accessor)(*_cur);
633 if ( _cur.has_value() )
634 _cur = std::get<1>(_type->_accessor)(*_cur);
640 if ( ! _cur.has_value() )
641 throw InvalidValue(
"type info iterator invalid");
643 auto x = std::get<2>(_type->_accessor)(*_cur);
644 return std::make_pair(
Value(x.first, _type->_ktype, _value),
Value(x.second, _type->_vtype, _value));
666 : _ktype(ktype), _vtype(vtype), _accessor(accessor) {}
672 auto x = _accessor(v);
673 return std::make_pair(
Value(x.first, _ktype, v),
Value(x.second, _vtype, v));
687 template<
typename K,
typename V>
688 static auto accessor() {
689 return [](
const Value& v) -> std::pair<const void*, const void*> {
691 const auto& x = **
static_cast<iterator_type*
>(v.pointer());
692 return std::make_pair(&x.first, &x.second);
711 static auto accessor() {
712 return [](
const Value& v) ->
const void* {
713 auto x =
static_cast<const std::optional<T>*
>(v.pointer());
714 return x->has_value() ? &*x :
nullptr;
734 static auto accessor() {
735 return [](
const Value& v) ->
const void* {
737 return x->
hasValue() ? &*x :
nullptr;
750 using iterator_pair =
751 std::pair<typename hilti::rt::Set<T>::const_iterator,
typename hilti::rt::Set<T>::const_iterator>;
755 return std::make_tuple(
756 [](
const Value& v_) -> std::optional<hilti::rt::any> {
758 if ( v->begin() != v->end() )
759 return std::make_pair(v->begin(), v->end());
763 [](
const hilti::rt::any& i_) -> std::optional<hilti::rt::any> {
764 auto i = hilti::rt::any_cast<iterator_pair<T>>(i_);
765 auto n = std::make_pair(++i.first, i.second);
766 if ( n.first != n.second )
771 [](
const hilti::rt::any& i_) ->
const void* {
772 auto i = hilti::rt::any_cast<iterator_pair<T>>(i_);
784 static auto accessor() {
785 return [](
const Value& v) ->
const void* {
792 template<
typename W
idth>
813 static auto accessor() {
814 return [](
const Value& v) ->
const void* {
841 Field(
const char* name,
const TypeInfo* type, std::ptrdiff_t offset,
bool internal,
842 Accessor accessor = accessor_default)
843 : name(name), type(type), offset(offset), accessor(accessor), internal(internal) {}
851 return [](
const Value& v) ->
const void* {
852 auto x =
static_cast<const std::optional<T>*
>(v.pointer());
853 if ( x->has_value() ) {
862 bool isInternal()
const {
return internal; }
871 Value value(
const Value& v)
const {
return Value(accessor(v), type, v); }
873 const std::ptrdiff_t offset;
888 Struct(std::vector<struct_::Field> fields) : _fields(
std::move(fields)) {}
896 auto fields(
bool include_internal =
false)
const {
897 std::vector<std::reference_wrapper<const struct_::Field>> fields;
898 std::copy_if(_fields.begin(), _fields.end(), std::back_inserter(fields),
899 [=](
const struct_::Field& f) {
return include_internal || ! f.isInternal(); });
913 std::vector<std::pair<const struct_::Field&, Value>> values;
915 for (
const auto& f : fields(include_internal) ) {
916 auto x =
Value(static_cast<const char*>(v.
pointer()) + f.get().offset, f.get().type, v);
917 values.emplace_back(f.get(), f.get().value(x));
924 const std::vector<struct_::Field> _fields;
944 Element(
const char* name,
const TypeInfo* type, std::ptrdiff_t offset) : name(name), type(type), offset(offset) {}
952 const std::ptrdiff_t offset;
965 Tuple(std::vector<tuple::Element> elements) : _elements(
std::move(elements)) {}
979 std::vector<std::pair<const tuple::Element&, Value>> values;
981 for (
const auto& f : _elements )
982 values.emplace_back(f,
Value(static_cast<const char*>(v.
pointer()) + f.offset, f.type, v));
988 const std::vector<tuple::Element> _elements;
1017 const size_t npos = std::variant_npos;
1025 Union(std::vector<union_::Field> fields,
Accessor accessor) : _fields(
std::move(fields)), _accessor(accessor) {}
1028 const auto&
fields()
const {
return _fields; }
1035 if (
auto idx = _accessor(v); idx > 0 )
1041 template<
typename T>
1042 static auto accessor() {
1043 return [](
const Value& v) -> std::size_t {
return static_cast<const T*
>(v.pointer())->index(); };
1047 const std::vector<union_::Field> _fields;
1052 template<
typename W
idth>
1060 template<
typename T>
1061 static auto accessor() {
1062 return [](
const Value& v) ->
const void* {
1073 template<
typename T,
typename Allocator>
1074 using iterator_pair = std::pair<typename hilti::rt::Vector<T, Allocator>::const_iterator,
1077 template<
typename T,
typename Allocator = std::allocator<T>>
1079 return std::make_tuple(
1080 [](
const Value& v_) -> std::optional<hilti::rt::any> {
1082 if ( v->begin() != v->end() )
1083 return std::make_pair(v->begin(), v->end());
1085 return std::nullopt;
1087 [](
const hilti::rt::any& i_) -> std::optional<hilti::rt::any> {
1088 auto i = hilti::rt::any_cast<iterator_pair<T, Allocator>>(i_);
1089 auto n = std::make_pair(++i.first, i.second);
1090 if ( n.first != n.second )
1091 return std::move(n);
1093 return std::nullopt;
1095 [](
const hilti::rt::any& i_) ->
const void* {
1096 auto i = hilti::rt::any_cast<iterator_pair<T, Allocator>>(i_);
1107 template<
typename T,
typename Allocator = std::allocator<T>>
1108 static auto accessor() {
1109 return [](
const Value& v) ->
const void* {
1123 template<
typename T>
1124 static auto accessor() {
1125 return [](
const Value& v) ->
const void* {
1144 std::optional<const char*>
id;
1171 SignedInteger_int16,
1172 SignedInteger_int32,
1173 SignedInteger_int64,
1183 UnsignedInteger_uint8,
1184 UnsignedInteger_uint16,
1185 UnsignedInteger_uint32,
1186 UnsignedInteger_uint64,
1195 std::unique_ptr<const char, void (*)(const char*)> _storage = {
nullptr, [](
const char*) {}};
1197 Tag tag = Tag::Undefined;
1246 template<
typename Type>
1247 TypeInfo(std::optional<const char*> _id,
const char* _display,
Type* value)
1248 : id(_id), display(_display), _storage(reinterpret_cast<const char*>(value), [](
const char* p) {
1249 delete reinterpret_cast<const Type*
>(p);
1251 if constexpr ( std::is_same_v<Type, type_info::Address> ) {
1255 else if constexpr ( std::is_same_v<Type, type_info::Any> ) {
1259 else if constexpr ( std::is_same_v<Type, type_info::Bool> ) {
1263 else if constexpr ( std::is_same_v<Type, type_info::Bytes> ) {
1267 else if constexpr ( std::is_same_v<Type, type_info::BytesIterator> ) {
1268 tag = BytesIterator;
1269 bytes_iterator = value;
1271 else if constexpr ( std::is_same_v<Type, type_info::Enum> ) {
1275 else if constexpr ( std::is_same_v<Type, type_info::Error> ) {
1279 else if constexpr ( std::is_same_v<Type, type_info::Exception> ) {
1283 else if constexpr ( std::is_same_v<Type, type_info::Function> ) {
1287 else if constexpr ( std::is_same_v<Type, type_info::Interval> ) {
1291 else if constexpr ( std::is_same_v<Type, type_info::Library> ) {
1295 else if constexpr ( std::is_same_v<Type, type_info::Map> ) {
1299 else if constexpr ( std::is_same_v<Type, type_info::MapIterator> ) {
1301 map_iterator = value;
1303 else if constexpr ( std::is_same_v<Type, type_info::Network> ) {
1307 else if constexpr ( std::is_same_v<Type, type_info::Optional> ) {
1311 else if constexpr ( std::is_same_v<Type, type_info::Port> ) {
1315 else if constexpr ( std::is_same_v<Type, type_info::Real> ) {
1319 else if constexpr ( std::is_same_v<Type, type_info::RegExp> ) {
1323 else if constexpr ( std::is_same_v<Type, type_info::Result> ) {
1327 else if constexpr ( std::is_same_v<Type, type_info::Set> ) {
1331 else if constexpr ( std::is_same_v<Type, type_info::SetIterator> ) {
1333 set_iterator = value;
1336 tag = SignedInteger_int8;
1337 signed_integer_int8 = value;
1340 tag = SignedInteger_int16;
1341 signed_integer_int16 = value;
1344 tag = SignedInteger_int32;
1345 signed_integer_int32 = value;
1348 tag = SignedInteger_int64;
1349 signed_integer_int64 = value;
1351 else if constexpr ( std::is_same_v<Type, type_info::Stream> ) {
1355 else if constexpr ( std::is_same_v<Type, type_info::StreamIterator> ) {
1356 tag = StreamIterator;
1357 stream_iterator = value;
1359 else if constexpr ( std::is_same_v<Type, type_info::StreamView> ) {
1361 stream_view = value;
1363 else if constexpr ( std::is_same_v<Type, type_info::String> ) {
1367 else if constexpr ( std::is_same_v<Type, type_info::StrongReference> ) {
1369 strong_reference = value;
1371 else if constexpr ( std::is_same_v<Type, type_info::Struct> ) {
1375 else if constexpr ( std::is_same_v<Type, type_info::Time> ) {
1379 else if constexpr ( std::is_same_v<Type, type_info::Tuple> ) {
1383 else if constexpr ( std::is_same_v<Type, type_info::Union> ) {
1388 tag = UnsignedInteger_uint8;
1389 unsigned_integer_uint8 = value;
1392 tag = UnsignedInteger_uint16;
1393 unsigned_integer_uint16 = value;
1396 tag = UnsignedInteger_uint32;
1397 unsigned_integer_uint32 = value;
1400 tag = UnsignedInteger_uint64;
1401 unsigned_integer_uint64 = value;
1403 else if constexpr ( std::is_same_v<Type, type_info::ValueReference> ) {
1405 value_reference = value;
1407 else if constexpr ( std::is_same_v<Type, type_info::Vector> ) {
1411 else if constexpr ( std::is_same_v<Type, type_info::VectorIterator> ) {
1412 tag = VectorIterator;
1413 vector_iterator = value;
1415 else if constexpr ( std::is_same_v<Type, type_info::Void> ) {
1419 else if constexpr ( std::is_same_v<Type, type_info::WeakReference> ) {
1420 tag = WeakReference;
1421 weak_reference = value;
1424 throw RuntimeError(
"unhandled type");
1429 namespace type_info {
1441 template<
typename Type>
1443 const auto& type = v.
type();
1445 if constexpr ( std::is_same_v<Type, type_info::Address> ) {
1446 assert(type.tag == TypeInfo::Address);
1447 return type.address;
1449 else if constexpr ( std::is_same_v<Type, type_info::Any> ) {
1450 assert(type.tag == TypeInfo::Any);
1453 else if constexpr ( std::is_same_v<Type, type_info::Bool> ) {
1454 assert(type.tag == TypeInfo::Bool);
1457 else if constexpr ( std::is_same_v<Type, type_info::Bytes> ) {
1458 assert(type.tag == TypeInfo::Bytes);
1461 else if constexpr ( std::is_same_v<Type, type_info::BytesIterator> ) {
1462 assert(type.tag == TypeInfo::BytesIterator);
1463 return type.bytes_iterator;
1465 else if constexpr ( std::is_same_v<Type, type_info::Enum> ) {
1466 assert(type.tag == TypeInfo::Enum);
1469 else if constexpr ( std::is_same_v<Type, type_info::Error> ) {
1470 assert(type.tag == TypeInfo::Error);
1473 else if constexpr ( std::is_same_v<Type, type_info::Exception> ) {
1474 assert(type.tag == TypeInfo::Exception);
1475 return type.exception;
1477 else if constexpr ( std::is_same_v<Type, type_info::Function> ) {
1478 assert(type.tag == TypeInfo::Function);
1479 return type.function;
1481 else if constexpr ( std::is_same_v<Type, type_info::Interval> ) {
1482 assert(type.tag == TypeInfo::Interval);
1483 return type.interval;
1485 else if constexpr ( std::is_same_v<Type, type_info::Library> ) {
1486 assert(type.tag == TypeInfo::Library);
1487 return type.library;
1489 else if constexpr ( std::is_same_v<Type, type_info::Map> ) {
1490 assert(type.tag == TypeInfo::Map);
1493 else if constexpr ( std::is_same_v<Type, type_info::MapIterator> ) {
1494 assert(type.tag == TypeInfo::MapIterator);
1495 return type.map_iterator;
1497 else if constexpr ( std::is_same_v<Type, type_info::Network> ) {
1498 assert(type.tag == TypeInfo::Network);
1499 return type.network;
1501 else if constexpr ( std::is_same_v<Type, type_info::Optional> ) {
1502 assert(type.tag == TypeInfo::Optional);
1503 return type.optional;
1505 else if constexpr ( std::is_same_v<Type, type_info::Port> ) {
1506 assert(type.tag == TypeInfo::Port);
1509 else if constexpr ( std::is_same_v<Type, type_info::Real> ) {
1510 assert(type.tag == TypeInfo::Real);
1513 else if constexpr ( std::is_same_v<Type, type_info::RegExp> ) {
1514 assert(type.tag == TypeInfo::RegExp);
1517 else if constexpr ( std::is_same_v<Type, type_info::Result> ) {
1518 assert(type.tag == TypeInfo::Result);
1521 else if constexpr ( std::is_same_v<Type, type_info::Set> ) {
1522 assert(type.tag == TypeInfo::Set);
1525 else if constexpr ( std::is_same_v<Type, type_info::SetIterator> ) {
1526 assert(type.tag == TypeInfo::SetIterator);
1527 return type.set_iterator;
1530 assert(type.tag == TypeInfo::SignedInteger_int8);
1531 return type.signed_integer_int8;
1534 assert(type.tag == TypeInfo::SignedInteger_int16);
1535 return type.signed_integer_int16;
1538 assert(type.tag == TypeInfo::SignedInteger_int32);
1539 return type.signed_integer_int32;
1542 assert(type.tag == TypeInfo::SignedInteger_int64);
1543 return type.signed_integer_int64;
1545 else if constexpr ( std::is_same_v<Type, type_info::Stream> ) {
1546 assert(type.tag == TypeInfo::Stream);
1549 else if constexpr ( std::is_same_v<Type, type_info::StreamIterator> ) {
1550 assert(type.tag == TypeInfo::StreamIterator);
1551 return type.stream_iterator;
1553 else if constexpr ( std::is_same_v<Type, type_info::StreamView> ) {
1554 assert(type.tag == TypeInfo::StreamView);
1555 return type.stream_view;
1557 else if constexpr ( std::is_same_v<Type, type_info::String> ) {
1558 assert(type.tag == TypeInfo::String);
1561 else if constexpr ( std::is_same_v<Type, type_info::StrongReference> ) {
1562 assert(type.tag == TypeInfo::StrongReference);
1563 return type.strong_reference;
1565 else if constexpr ( std::is_same_v<Type, type_info::Struct> ) {
1566 assert(type.tag == TypeInfo::Struct);
1567 return type.struct_;
1569 else if constexpr ( std::is_same_v<Type, type_info::Time> ) {
1570 assert(type.tag == TypeInfo::Time);
1573 else if constexpr ( std::is_same_v<Type, type_info::Tuple> ) {
1574 assert(type.tag == TypeInfo::Tuple);
1577 else if constexpr ( std::is_same_v<Type, type_info::Union> ) {
1578 assert(type.tag == TypeInfo::Union);
1582 assert(type.tag == TypeInfo::UnsignedInteger_uint8);
1583 return type.unsigned_integer_uint8;
1586 assert(type.tag == TypeInfo::UnsignedInteger_uint16);
1587 return type.unsigned_integer_uint16;
1590 assert(type.tag == TypeInfo::UnsignedInteger_uint32);
1591 return type.unsigned_integer_uint32;
1594 assert(type.tag == TypeInfo::UnsignedInteger_uint64);
1595 return type.unsigned_integer_uint64;
1597 else if constexpr ( std::is_same_v<Type, type_info::ValueReference> ) {
1598 assert(type.tag == TypeInfo::ValueReference);
1599 return type.value_reference;
1601 else if constexpr ( std::is_same_v<Type, type_info::Vector> ) {
1602 assert(type.tag == TypeInfo::Vector);
1605 else if constexpr ( std::is_same_v<Type, type_info::VectorIterator> ) {
1606 assert(type.tag == TypeInfo::VectorIterator);
1607 return type.vector_iterator;
1609 else if constexpr ( std::is_same_v<Type, type_info::Void> ) {
1610 assert(type.tag == TypeInfo::Void);
1613 else if constexpr ( std::is_same_v<Type, type_info::WeakReference> ) {
1614 assert(type.tag == TypeInfo::WeakReference);
1615 return type.weak_reference;
1618 throw RuntimeError(
"unhandled type");
Definition: type-info.h:443
MapIterator(const TypeInfo *ktype, const TypeInfo *vtype, Accessor accessor)
Definition: type-info.h:665
Enum(std::vector< enum_::Label > labels)
Definition: type-info.h:416
std::size_t(*)(const Value &v) Accessor
Definition: type-info.h:1016
Definition: type-info.h:382
Definition: type-info.h:729
Definition: type-info.h:703
Definition: type-info.h:446
Element(const char *name, const TypeInfo *type, std::ptrdiff_t offset)
Definition: type-info.h:944
const TypeInfo * valueType() const
Definition: type-info.h:186
Definition: type-info.h:958
const TypeInfo * type
Definition: type-info.h:1004
Definition: type-info.h:459
Definition: type-info.h:935
const char * display
Definition: type-info.h:1145
Definition: reference.h:663
bool operator!=(const Iterator &other) const
Definition: type-info.h:243
Definition: reference.h:497
Definition: type-info.h:720
Struct(std::vector< struct_::Field > fields)
Definition: type-info.h:888
Definition: type-info.h:994
Definition: type-info.h:1119
Iterator end() const
Definition: type-info.h:269
const TypeInfo * keyType() const
Definition: type-info.h:680
Definition: type-info.h:745
Sequence(const Map *type, Value v)
Definition: type-info.h:531
Definition: type-info.h:928
auto iterate(const Value &v, bool include_internal=false) const
Definition: type-info.h:912
Value value(const Value &v) const
Definition: type-info.h:1034
const TypeInfo * keyType() const
Definition: type-info.h:573
Definition: interval.h:22
std::pair< const void *, const void * >(*)(const Value &v) Accessor
Definition: type-info.h:656
Definition: type-info.h:796
const TypeInfo & type() const
Definition: type-info.h:128
std::optional< const char * > id
Definition: type-info.h:1144
Definition: optional.h:79
Value operator*() const
Definition: type-info.h:353
Union(std::vector< union_::Field > fields, Accessor accessor)
Definition: type-info.h:1025
Definition: type-info.h:255
Iterator begin() const
Definition: type-info.h:534
const TypeInfo * type
Definition: type-info.h:947
Definition: type-info.h:523
Definition: type-info.h:650
Value(const void *ptr, const TypeInfo *ti, const value::Parent &parent)
Definition: type-info.h:91
Definition: type-info.h:43
map::Sequence iterate(const Value &value) const
Definition: type-info.h:567
Tuple(std::vector< tuple::Element > elements)
Definition: type-info.h:965
const auto & labels() const
Definition: type-info.h:419
const TypeInfo * valueType() const
Definition: type-info.h:578
const void *(*)(const Value &v) Accessor
Definition: type-info.h:831
Definition: function.h:44
Label(std::string name, int64_t value)
Definition: type-info.h:400
Definition: type-info.h:363
Parent()
Definition: type-info.h:50
Definition: type-info.h:1069
const std::string name
Definition: type-info.h:402
Definition: type-info.h:1010
Definition: type-info.h:456
Field(const char *name, const TypeInfo *type, std::ptrdiff_t offset, bool internal, Accessor accessor=accessor_default)
Definition: type-info.h:841
Definition: type-info.h:726
Definition: type-info.h:802
std::pair< Value, Value > operator*() const
Definition: type-info.h:639
Iterator & operator++()
Definition: type-info.h:623
static const void * accessor_default(const Value &v)
Definition: type-info.h:846
Definition: type-info.h:385
bool hasValue() const
Definition: result.h:148
Iterator()
Definition: type-info.h:480
const std::string name
Definition: type-info.h:946
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:779
Definition: type-info.h:723
Definition: reference.h:345
auto fields(bool include_internal=false) const
Definition: type-info.h:896
Definition: type-info.h:393
DereferenceableType(const TypeInfo *vtype, Accessor accessor)
Definition: type-info.h:176
Definition: stream.h:1407
Definition: type-info.h:1056
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:1028
static Accessor accessor_optional()
Definition: type-info.h:850
Iterator & operator++()
Definition: type-info.h:337
Definition: type-info.h:793
Definition: reference.h:47
Definition: type-info.h:379
Definition: type-info.h:1103
Map(const TypeInfo *ktype, const TypeInfo *vtype, Accessor accessor)
Definition: type-info.h:563
Parent(const StrongReference< T > &value)
Definition: type-info.h:47
Definition: type-info.h:162
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:553
IterableType(const TypeInfo *etype, Accessor accessor)
Definition: type-info.h:312
Definition: type-info.h:466
Definition: type-info.h:409
Definition: type-info.h:1053
Sequence(const IterableType *type, Value v)
Definition: type-info.h:263
Definition: type-info.h:376
Value(const void *ptr, const TypeInfo *ti, const Value &parent)
Definition: type-info.h:103
const TypeInfo * valueType() const
Definition: type-info.h:685
Definition: exception.h:22
const std::string name
Definition: type-info.h:1003
const void *(*)(const Value &v) Accessor
Definition: type-info.h:168
bool operator==(const Iterator &other) const
Definition: type-info.h:505
Definition: type-info.h:388
Definition: type-info.h:545
Iterator begin() const
Definition: type-info.h:266
Iterator end() const
Definition: type-info.h:537
Definition: type-info.h:826
bool operator!=(const Iterator &other) const
Definition: type-info.h:511
auto iterate(const Value &v) const
Definition: type-info.h:978
Field(const char *name, const TypeInfo *type)
Definition: type-info.h:1001
Definition: type-info.h:799
const int64_t value
Definition: type-info.h:403
Definition: type-info.h:706
Definition: type-info.h:281
Definition: type-info.h:881
Definition: type-info.h:1143
Definition: type-info.h:453
Definition: type-info.h:152
const void * pointer() const
Definition: type-info.h:119
Definition: type-info.h:808
Value value(const Value &v) const
Definition: type-info.h:181
std::pair< Value, Value > value(const Value &v) const
Definition: type-info.h:671
const TypeInfo * dereferencedType() const
Definition: type-info.h:321
std::string fmt(const char *fmt, const Args &... args)
Definition: fmt.h:13
const std::string name
Definition: type-info.h:864
Definition: type-info.h:198
Definition: type-info.h:1116
Definition: type-info.h:369
void tie(hilti::rt::StrongReferenceGeneric value)
Definition: type-info.h:53
const auto & elements() const
Definition: type-info.h:968
Definition: type-info.h:805