Lines Matching defs:map

956  * use these for map/packed fields instead of UPB_LABEL_REPEATED. */
1126 /* Size of key and val, based on the map type. Strings are represented as '0'
1135 * parsing, it helps a lot if all map entry messages have the same layout.
1136 * The compiler and def.c must ensure that all map entries have this layout. */
1149 /* Creates a new map on the given arena with this key/value type. */
1158 * from other types when stored in a map.
1201 UPB_INLINE size_t _upb_map_size(const upb_map *map) {
1202 return map->table.t.count;
1205 UPB_INLINE bool _upb_map_get(const upb_map *map, const void *key,
1209 bool ret = upb_strtable_lookup2(&map->table, k.data, k.size, &tabval);
1216 UPB_INLINE void* _upb_map_next(const upb_map *map, size_t *iter) {
1218 it.t = &map->table;
1226 UPB_INLINE bool _upb_map_set(upb_map *map, const void *key, size_t key_size,
1233 upb_strtable_remove3(&map->table, strkey.data, strkey.size, NULL, a);
1234 return upb_strtable_insert3(&map->table, strkey.data, strkey.size, tabval, a);
1237 UPB_INLINE bool _upb_map_delete(upb_map *map, const void *key, size_t key_size) {
1239 return upb_strtable_remove3(&map->table, k.data, k.size, NULL, NULL);
1242 UPB_INLINE void _upb_map_clear(upb_map *map) {
1243 upb_strtable_clear(&map->table);
1246 /* Message map operations, these get the map from the message first. */
1249 upb_map *map = *UPB_PTR_AT(msg, ofs, upb_map *);
1250 return map ? _upb_map_size(map) : 0;
1256 upb_map *map = *UPB_PTR_AT(msg, ofs, upb_map *);
1257 if (!map) return false;
1258 return _upb_map_get(map, key, key_size, val, val_size);
1263 upb_map *map = *UPB_PTR_AT(msg, ofs, upb_map *);
1264 if (!map) return NULL;
1265 return _upb_map_next(map, iter);
1271 upb_map **map = PTR_AT(msg, ofs, upb_map *);
1272 if (!*map) {
1273 *map = _upb_map_new(arena, key_size, val_size);
1275 return _upb_map_set(*map, key, key_size, val, val_size, arena);
1280 upb_map *map = *UPB_PTR_AT(msg, ofs, upb_map *);
1281 if (!map) return false;
1282 return _upb_map_delete(map, key, key_size);
1286 upb_map *map = *UPB_PTR_AT(msg, ofs, upb_map *);
1287 if (!map) return;
1288 _upb_map_clear(map);
1291 /* Accessing map key/value from a pointer, used by generated code only. */
3228 /* Well-known field tag numbers for map-entry messages. */
3422 upb_map* map;
3435 /* Returns a mutable pointer to a map, array, or submessage value. If the given
3446 /* Sets the given field to the given value. For a msg/array/map/string, the
3504 /* Creates a new map on the given arena with the given key/value size. */
3508 /* Returns the number of entries in the map. */
3509 size_t upb_map_size(const upb_map *map);
3514 bool upb_map_get(const upb_map *map, upb_msgval key, upb_msgval *val);
3516 /* Removes all entries in the map. */
3517 void upb_map_clear(upb_map *map);
3520 * the map, or false if an existing key was replaced. */
3521 bool upb_map_set(upb_map *map, upb_msgval key, upb_msgval val,
3525 bool upb_map_delete(upb_map *map, upb_msgval key);
3530 * while (upb_mapiter_next(map, &iter)) {
3531 * upb_msgval key = upb_mapiter_key(map, iter);
3532 * upb_msgval val = upb_mapiter_value(map, iter);
3535 * upb_mapiter_setvalue(map, iter, value2);
3540 bool upb_mapiter_next(const upb_map *map, size_t *iter);
3542 /* Returns the key and value for this entry of the map. */
3543 upb_msgval upb_mapiter_key(const upb_map *map, size_t iter);
3544 upb_msgval upb_mapiter_value(const upb_map *map, size_t iter);
3548 void upb_mapiter_setvalue(upb_map *map, size_t iter, upb_msgval value);
4145 * message on-demand, and the cache maintains a map of msgdef->handlers. */