All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
as_list.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008-2015 Aerospike, Inc.
3  *
4  * Portions may be licensed to Aerospike, Inc. under one or more contributor
5  * license agreements.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
8  * use this file except in compliance with the License. You may obtain a copy of
9  * the License at http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14  * License for the specific language governing permissions and limitations under
15  * the License.
16  */
17 #pragma once
18 
19 #include <aerospike/as_bytes.h>
20 #include <aerospike/as_double.h>
21 #include <aerospike/as_integer.h>
22 #include <aerospike/as_iterator.h>
23 #include <aerospike/as_string.h>
24 #include <aerospike/as_util.h>
25 #include <aerospike/as_val.h>
26 
27 #include <stdbool.h>
28 #include <stdint.h>
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 /******************************************************************************
35  * TYPES
36  *****************************************************************************/
37 
38 union as_list_iterator_u;
39 
40 struct as_list_hooks_s;
41 
42 /**
43  * Callback function for `as_list_foreach()`. Called for each element in the
44  * list.
45  *
46  * @param value The value of the current element.
47  * @param udata The user-data provided to the `as_list_foreach()`.
48  *
49  * @return true to continue iterating through the list.
50  * false to stop iterating.
51  */
52 typedef bool (* as_list_foreach_callback) (as_val * value, void * udata);
53 
54 /**
55  * as_list is an interface for List based data types.
56  *
57  * Implementations:
58  * - as_arraylist
59  *
60  * @extends as_val
61  * @ingroup aerospike_t
62  */
63 typedef struct as_list_s {
64 
65  /**
66  * @private
67  * as_list is a subtype of as_val.
68  * You can cast as_list to as_val.
69  */
71 
72  /**
73  * Pointer to the data for this list.
74  */
75  void * data;
76 
77  /**
78  * Hooks for subtypes of as_list to implement.
79  */
80  const struct as_list_hooks_s * hooks;
81 
82 } as_list;
83 
84 /**
85  * List Function Hooks
86  */
87 typedef struct as_list_hooks_s {
88 
89  /***************************************************************************
90  * instance hooks
91  **************************************************************************/
92 
93  /**
94  * Releases the subtype of as_list.
95  *
96  * @param map The map instance to destroy.
97  *
98  * @return true on success. Otherwise false.
99  */
100  bool (* destroy)(as_list * list);
101 
102  /***************************************************************************
103  * info hooks
104  **************************************************************************/
105 
106  /**
107  * The hash value of an as_list.
108  *
109  * @param list The list to get the hashcode value for.
110  *
111  * @return The hashcode value.
112  */
113  uint32_t (* hashcode)(const as_list * list);
114 
115  /**
116  * The size of the as_list.
117  *
118  * @param map The map to get the size of.
119  *
120  * @return The number of entries in the map.
121  */
122  uint32_t (* size)(const as_list * list);
123 
124  /***************************************************************************
125  * get hooks
126  **************************************************************************/
127 
128  /**
129  * Get the value at a given index of the list.
130  *
131  * @param list The list to get the value from.
132  * @param index The index of the value.
133  *
134  * @return The value at the given index on success. Otherwie NULL.
135  */
136  as_val * (* get)(const as_list * list, uint32_t index);
137 
138  /**
139  * Get the int64_t value at a given index of the list.
140  *
141  * @param list The list to get the value from.
142  * @param index The index of the value.
143  *
144  * @return The value at the given index on success. Otherwie NULL.
145  */
146  int64_t (* get_int64)(const as_list * list, uint32_t index);
147 
148  /**
149  * Get the double value at a given index of the list.
150  *
151  * @param list The list to get the value from.
152  * @param index The index of the value.
153  *
154  * @return The value at the given index on success. Otherwie NULL.
155  */
156  double (* get_double)(const as_list * list, uint32_t index);
157 
158  /**
159  * Get the NULL-terminated string value at a given index of the list.
160  *
161  * @param list The list to get the value from.
162  * @param index The index of the value.
163  *
164  * @return The value at the given index on success. Otherwie NULL.
165  */
166  char * (* get_str)(const as_list * list, uint32_t index);
167 
168  /***************************************************************************
169  * set hooks
170  **************************************************************************/
171 
172  /**
173  * Set a value at the given index of the list.
174  *
175  * @param list The list to get the value from.
176  * @param index The index of the value.
177  * @param value The value for the given index.
178  *
179  * @return The value at the given index on success. Otherwie NULL.
180  */
181  int (* set)(as_list * list, uint32_t index, as_val * value);
182 
183  /**
184  * Set an int64_t value at the given index of the list.
185  *
186  * @param list The list to get the value from.
187  * @param index The index of the value.
188  * @param value The value for the given index.
189  *
190  * @return The value at the given index on success. Otherwie NULL.
191  */
192  int (* set_int64)(as_list * list, uint32_t index, int64_t value);
193 
194  /**
195  * Set a double value at the given index of the list.
196  *
197  * @param list The list to get the value from.
198  * @param index The index of the value.
199  * @param value The value for the given index.
200  *
201  * @return The value at the given index on success. Otherwie NULL.
202  */
203  int (* set_double)(as_list * list, uint32_t index, double value);
204 
205  /**
206  * Set a NULL-terminated string value at the given index of the list.
207  *
208  * @param list The list to get the value from.
209  * @param index The index of the value.
210  * @param value The value for the given index.
211  *
212  * @return The value at the given index on success. Otherwie NULL.
213  */
214  int (* set_str)(as_list * list, uint32_t index, const char * value);
215 
216  /***************************************************************************
217  * insert hooks
218  **************************************************************************/
219 
220  /**
221  * Insert a value at the given index of the list.
222  *
223  * @param list The list to insert the value into.
224  * @param index The index of the value.
225  * @param value The value for the given index.
226  *
227  * @return AS_ARRAYLIST_OK on success. Otherwise an error occurred.
228  */
229  int (* insert)(as_list * list, uint32_t index, as_val * value);
230 
231  /**
232  * Insert an int64_t value at the given index of the list.
233  *
234  * @param list The list to insert the value into.
235  * @param index The index of the value.
236  * @param value The value for the given index.
237  *
238  * @return AS_ARRAYLIST_OK on success. Otherwise an error occurred.
239  */
240  int (* insert_int64)(as_list * list, uint32_t index, int64_t value);
241 
242  /**
243  * Insert a double value at the given index of the list.
244  *
245  * @param list The list to insert the value into.
246  * @param index The index of the value.
247  * @param value The value for the given index.
248  *
249  * @return AS_ARRAYLIST_OK on success. Otherwise an error occurred.
250  */
251  int (* insert_double)(as_list * list, uint32_t index, double value);
252 
253  /**
254  * Insert a NULL-terminated string value at the given index of the list.
255  *
256  * @param list The list to insert the value into.
257  * @param index The index of the value.
258  * @param value The value for the given index.
259  *
260  * @return AS_ARRAYLIST_OK on success. Otherwise an error occurred.
261  */
262  int (* insert_str)(as_list * list, uint32_t index, const char * value);
263 
264  /***************************************************************************
265  * append hooks
266  **************************************************************************/
267 
268  /**
269  * Append a value to the list.
270  *
271  * @param list The list to append to.
272  * @param value The value to append to the list.
273  *
274  * @return 0 on success. Otherwise an error occurred.
275  */
276  int (* append)(as_list * list, as_val * value);
277 
278  /**
279  * Append an int64_t value to the list.
280  *
281  * @param list The list to append to.
282  * @param value The value to append to the list.
283  *
284  * @return 0 on success. Otherwise an error occurred.
285  */
286  int (* append_int64)(as_list * list, int64_t value);
287 
288  /**
289  * Append a double value to the list.
290  *
291  * @param list The list to append to.
292  * @param value The value to append to the list.
293  *
294  * @return 0 on success. Otherwise an error occurred.
295  */
296  int (* append_double)(as_list * list, double value);
297 
298  /**
299  * Append a NULL-terminates string value to the list.
300  *
301  * @param list The list to append to.
302  * @param value The value to append to the list.
303  *
304  * @return 0 on success. Otherwise an error occurred.
305  */
306  int (* append_str)(as_list * list, const char * value);
307 
308  /***************************************************************************
309  * prepend hooks
310  **************************************************************************/
311 
312  /**
313  * Prepend the value to the list.
314  *
315  * @param list The list to prepend to.
316  * @param value The value to prepend to the list.
317  *
318  * @return 0 on success. Otherwise an error occurred.
319  */
320  int (* prepend)(as_list * list, as_val * value);
321 
322  /**
323  * Prepend an int64_t value to the list.
324  *
325  * @param list The list to prepend to.
326  * @param value The value to prepend to the list.
327  *
328  * @return 0 on success. Otherwise an error occurred.
329  */
330  int (* prepend_int64)(as_list * list, int64_t value);
331 
332  /**
333  * Prepend a double value to the list.
334  *
335  * @param list The list to prepend to.
336  * @param value The value to prepend to the list.
337  *
338  * @return 0 on success. Otherwise an error occurred.
339  */
340  int (* prepend_double)(as_list * list, double value);
341 
342  /**
343  * Prepend a NULL-terminates string value to the list.
344  *
345  * @param list The list to prepend to.
346  * @param value The value to prepend to the list.
347  *
348  * @return 0 on success. Otherwise an error occurred.
349  */
350  int (* prepend_str)(as_list * list, const char * value);
351 
352  /***************************************************************************
353  * remove hook
354  **************************************************************************/
355 
356  /**
357  * Remove element at specified index.
358  *
359  * Any elements beyond specified index will be shifted so their indexes
360  * decrease by 1. The element at specified index will be destroyed.
361  *
362  * @param list The list.
363  * @param index The index of the element to remove.
364  *
365  * @return 0 on success. Otherwise an error occurred.
366  */
367  int (* remove)(as_list * list, uint32_t index);
368 
369  /***************************************************************************
370  * accessor and modifier hooks
371  **************************************************************************/
372 
373  /**
374  * Append all elements of list2, in order, to list. No new list object is
375  * created.
376  *
377  * @param list The list to append to.
378  * @param list2 The list from which to append.
379  *
380  * @return 0 on success. Otherwise an error occurred.
381  */
382  int (* concat)(as_list * list, const as_list * list2);
383 
384  /**
385  * Delete (and destroy) all elements at and beyond specified index. Capacity is
386  * not reduced.
387  *
388  * @param list The list to trim.
389  * @param index The index from which to trim.
390  *
391  * @return 0 on success. Otherwise an error occurred.
392  */
393  int (* trim)(as_list * list, uint32_t index);
394 
395  /**
396  * Return the first element in the list.
397  *
398  * @param list The list to get the value from.
399  *
400  * @return The first value in the list. Otherwise NULL.
401  */
402  as_val * (* head)(const as_list * list);
403 
404  /**
405  * Return all but the first element of the list, returning a new list.
406  *
407  * @param list The list to get the list from.
408  *
409  * @return The tail of the list. Otherwise NULL.
410  */
411  as_list * (* tail)(const as_list * list);
412 
413  /**
414  * Drop the first n element of the list, returning a new list.
415  *
416  * @param list The list.
417  * @param n The number of element to drop.
418  *
419  * @return A new list containing the remaining elements. Otherwise NULL.
420  */
421  as_list * (* drop)(const as_list * list, uint32_t n);
422 
423  /**
424  * Take the first n element of the list, returning a new list.
425  *
426  * @param list The list.
427  * @param n The number of element to take.
428  *
429  * @return A new list containing the remaining elements. Otherwise NULL.
430  */
431  as_list * (* take)(const as_list * list, uint32_t n);
432 
433  /***************************************************************************
434  * iteration hooks
435  **************************************************************************/
436 
437  /**
438  * Iterate over each element in the list can call the callback function.
439  *
440  * @param map The map to iterate.
441  * @param callback The function to call for each element in the list.
442  * @param udata User-data to be passed to the callback.
443  *
444  * @return true on success. Otherwise false.
445  */
446  bool (* foreach)(const as_list * list, as_list_foreach_callback callback, void * udata);
447 
448  /**
449  * Create and initialize a new heap allocated iterator to traverse over the list.
450  *
451  * @param list The list to iterate.
452  *
453  * @return true on success. Otherwise false.
454  */
455  union as_list_iterator_u * (* iterator_new)(const as_list * list);
456 
457  /**
458  * Initializes a stack allocated iterator to traverse over the list.
459  *
460  * @param list The list to iterate.
461  *
462  * @return true on success. Otherwise false.
463  */
464  union as_list_iterator_u * (* iterator_init)(const as_list * list, union as_list_iterator_u * it);
465 
466 } as_list_hooks;
467 
468 /*******************************************************************************
469  * INSTANCE FUNCTIONS
470  ******************************************************************************/
471 
472 /**
473  * @private
474  * Utilized by subtypes of as_list to initialize the parent.
475  *
476  * @param list The list to initialize.
477  * @param free If true, then as_list_destroy() will free the list.
478  * @param data Data for the list.
479  * @param hooks Implementaton for the list interface.
480  *
481  * @return On success, the initialized list. Otherwise NULL.
482  * @relatesalso as_list
483  */
484 as_list * as_list_cons(as_list * list, bool free, void * data, const as_list_hooks * hooks);
485 
486 /**
487  * Initialize a stack allocated list.
488  *
489  * @param list Stack allocated list to initialize.
490  * @param data Data for the list.
491  * @param hooks Implementaton for the list interface.
492  *
493  * @return On succes, the initialized list. Otherwise NULL.
494  * @relatesalso as_list
495  */
496 as_list * as_list_init(as_list * list, void * data, const as_list_hooks * hooks);
497 
498 /**
499  * Create and initialize a new heap allocated list.
500  *
501  * @param data Data for the list.
502  * @param hooks Implementaton for the list interface.
503  *
504  * @return On succes, a new list. Otherwise NULL.
505  * @relatesalso as_list
506  */
507 as_list * as_list_new(void * data, const as_list_hooks * hooks);
508 
509 /**
510  * Destroy the list and associated resources.
511  *
512  * @param list The list to destroy.
513  * @relatesalso as_list
514  */
515 static inline void as_list_destroy(as_list * list)
516 {
517  as_val_destroy((as_val *) list);
518 }
519 
520 /******************************************************************************
521  * INFO FUNCTIONS
522  *****************************************************************************/
523 
524 /**
525  * Get the hashcode value for the list.
526  *
527  * @param list The list.
528  *
529  * @return The hashcode of the list.
530  * @relatesalso as_list
531  */
532 static inline uint32_t as_list_hashcode(as_list * list)
533 {
534  return as_util_hook(hashcode, 0, list);
535 }
536 
537 /**
538  * Number of elements in the list.
539  *
540  * @param list The list.
541  *
542  * @return The size of the list.
543  * @relatesalso as_list
544  */
545 static inline uint32_t as_list_size(as_list * list)
546 {
547  return as_util_hook(size, 0, list);
548 }
549 
550 /******************************************************************************
551  * ACCESSOR AND MODIFIER FUNCTIONS
552  *****************************************************************************/
553 
554 /**
555  * Append all elements of list2, in order, to list. No new list object is
556  * created.
557  *
558  * @param list The list to append to.
559  * @param list2 The list from which to append.
560  *
561  * @return 0 on success. Otherwise an error occurred.
562  * @relatesalso as_list
563  */
564 static inline int as_list_concat(as_list * list, const as_list * list2)
565 {
566  return as_util_hook(concat, 1, list, list2);
567 }
568 
569 /**
570  * Delete (and destroy) all elements at and beyond specified index. Capacity is
571  * not reduced.
572  *
573  * @param list The list to trim.
574  * @param index The index from which to trim.
575  *
576  * @return 0 on success. Otherwise an error occurred.
577  * @relatesalso as_list
578  */
579 static inline int as_list_trim(as_list * list, uint32_t index)
580 {
581  return as_util_hook(trim, 1, list, index);
582 }
583 
584 /**
585  * The first element in the list.
586  *
587  * @param list The list to get the head value from.
588  *
589  * @return The first value of the list on success. Otherwise NULL.
590  * @relatesalso as_list
591  */
592 static inline as_val * as_list_head(const as_list * list)
593 {
594  return as_util_hook(head, NULL, list);
595 }
596 
597 /**
598  * All elements after the first element in the list.
599  *
600  * @param list The list to get the tail from.
601  *
602  * @return On success, the tail of the list. Otherwise NULL.
603  * @relatesalso as_list
604  */
605 static inline as_list * as_list_tail(const as_list * list)
606 {
607  return as_util_hook(tail, NULL, list);
608 }
609 
610 /**
611  * Create a new list containing all elements, except the first n elements, of the list.
612  *
613  * @param list The list to drop elements from.
614  * @param n The number of elements to drop.
615  *
616  * @return On success, a new list containing the remaining elements. Otherwise NULL.
617  * @relatesalso as_list
618  */
619 static inline as_list * as_list_drop(const as_list * list, uint32_t n)
620 {
621  return as_util_hook(drop, NULL, list, n);
622 }
623 
624 /**
625  * Creates a new list containing the first n elements of the list.
626  *
627  * @param list The list to drop elements from.
628  * @param n The number of elements to take.
629  *
630  * @return On success, a new list containing the selected elements. Otherwise NULL.
631  * @relatesalso as_list
632  */
633 static inline as_list * as_list_take(const as_list * list, uint32_t n)
634 {
635  return as_util_hook(take, NULL, list, n);
636 }
637 
638 /******************************************************************************
639  * GET FUNCTIONS
640  *****************************************************************************/
641 
642 /**
643  * Get the value at specified index as an as_val.
644  *
645  * @param list The list to get the value from.
646  * @param i The index of the value to get from the list.
647  *
648  * @return On success, the value at the given index. Otherwise NULL.
649  * @relatesalso as_list
650  */
651 static inline as_val * as_list_get(const as_list * list, uint32_t i)
652 {
653  return as_util_hook(get, NULL, list, i);
654 }
655 
656 /**
657  * Get the value at specified index as an int64_t.
658  *
659  * @param list The list to get the value from.
660  * @param i The index of the value to get from the list.
661  *
662  * @return On success, the value at the given index. Otherwise NULL.
663  * @relatesalso as_list
664  */
665 static inline int64_t as_list_get_int64(const as_list * list, uint32_t i)
666 {
667  return as_util_hook(get_int64, 0, list, i);
668 }
669 
670 /**
671  * Get the value at specified index as a double.
672  *
673  * @param list The list to get the value from.
674  * @param i The index of the value to get from the list.
675  *
676  * @return On success, the value at the given index. Otherwise NULL.
677  * @relatesalso as_list
678  */
679 static inline double as_list_get_double(const as_list * list, uint32_t i)
680 {
681  return as_util_hook(get_double, 0.0, list, i);
682 }
683 
684 /**
685  * Get the value at specified index as an NULL terminated string.
686  *
687  * @param list The list to get the value from.
688  * @param i The index of the value to get from the list.
689  *
690  * @return On success, the value at the given index. Otherwise NULL.
691  * @relatesalso as_list
692  */
693 static inline char * as_list_get_str(const as_list * list, uint32_t i)
694 {
695  return as_util_hook(get_str, NULL, list, i);
696 }
697 
698 /**
699  * Get the value at specified index as an as_integer.
700  *
701  * @param list The list to get the value from.
702  * @param i The index of the value to get from the list.
703  *
704  * @return On success, the value at the given index. Otherwise NULL.
705  * @relatesalso as_list
706  */
707 static inline as_integer * as_list_get_integer(const as_list * list, uint32_t i)
708 {
709  return as_integer_fromval(as_list_get(list, i));
710 }
711 
712 /**
713  * Get the value at specified index as an as_double.
714  *
715  * @param list The list to get the value from.
716  * @param i The index of the value to get from the list.
717  *
718  * @return On success, the value at the given index. Otherwise NULL.
719  * @relatesalso as_list
720  */
721 static inline as_double * as_list_get_as_double(const as_list * list, uint32_t i)
722 {
723  return as_double_fromval(as_list_get(list, i));
724 }
725 
726 /**
727  * Get the value at specified index as an as_val.
728  *
729  * @param list The list to get the value from.
730  * @param i The index of the value to get from the list.
731  *
732  * @return On success, the value at the given index. Otherwise NULL.
733  * @relatesalso as_list
734  */
735 static inline as_string * as_list_get_string(const as_list * list, uint32_t i)
736 {
737  return as_string_fromval(as_list_get(list, i));
738 }
739 
740 /**
741  * Get the value at specified index as an as_val.
742  *
743  * @param list The list to get the value from.
744  * @param i The index of the value to get from the list.
745  *
746  * @return On success, the value at the given index. Otherwise NULL.
747  * @relatesalso as_list
748  */
749 static inline as_bytes * as_list_get_bytes(const as_list * list, uint32_t i)
750 {
751  return as_bytes_fromval(as_list_get(list, i));
752 }
753 
754 /**
755  * Get the value at specified index as an as_val.
756  *
757  * @param list The list to get the value from.
758  * @param i The index of the value to get from the list.
759  *
760  * @return On success, the value at the given index. Otherwise NULL.
761  * @relatesalso as_list
762  */
763 static inline as_list * as_list_get_list(const as_list * list, uint32_t i)
764 {
765  as_val * v = as_list_get(list, i);
766  return (as_list *) (v && v->type == AS_LIST ? v : NULL);
767 }
768 
769 /**
770  * Get the value at specified index as an as_val.
771  *
772  * @param list The list to get the value from.
773  * @param i The index of the value to get from the list.
774  *
775  * @return On success, the value at the given index. Otherwise NULL.
776  * @relatesalso as_list
777  */
778 static inline struct as_map_s * as_list_get_map(const as_list * list, uint32_t i)
779 {
780  as_val * v = as_list_get(list, i);
781  return (struct as_map_s *) (v && v->type == AS_MAP ? v : NULL);
782 }
783 
784 /******************************************************************************
785  * SET FUNCTIONS
786  *****************************************************************************/
787 
788 /**
789  * Set the value at specified index as an as_val.
790  *
791  * @param list The list.
792  * @param i The index of the value to set in the list.
793  * @param value The value to set at the given index.
794  *
795  * @return 0 on success. Otherwise an error occurred.
796  * @relatesalso as_list
797  */
798 static inline int as_list_set(as_list * list, uint32_t i, as_val * value)
799 {
800  return as_util_hook(set, 1, list, i, value);
801 }
802 
803 /**
804  * Set an int64_t at specified index as an as_val.
805  *
806  * @param list The list.
807  * @param i The index of the value to set in the list.
808  * @param value The value to set at the given index.
809  *
810  * @return 0 on success. Otherwise an error occurred.
811  * @relatesalso as_list
812  */
813 static inline int as_list_set_int64(as_list * list, uint32_t i, int64_t value)
814 {
815  return as_util_hook(set_int64, 1, list, i, value);
816 }
817 
818 /**
819  * Set a double at specified index as an as_val.
820  *
821  * @param list The list.
822  * @param i The index of the value to set in the list.
823  * @param value The value to set at the given index.
824  *
825  * @return 0 on success. Otherwise an error occurred.
826  * @relatesalso as_list
827  */
828 static inline int as_list_set_double(as_list * list, uint32_t i, double value)
829 {
830  return as_util_hook(set_double, 1, list, i, value);
831 }
832 
833 /**
834  * Set a NULL-terminated string at specified index as an as_val.
835  *
836  * @param list The list.
837  * @param i The index of the value to set in the list.
838  * @param value The value to set at the given index.
839  *
840  * @return 0 on success. Otherwise an error occurred.
841  * @relatesalso as_list
842  */
843 static inline int as_list_set_str(as_list * list, uint32_t i, const char * value)
844 {
845  return as_util_hook(set_str, 1, list, i, value);
846 }
847 
848 /**
849  * Set an as_integer at specified index as an as_val.
850  *
851  * @param list The list.
852  * @param i The index of the value to set in the list.
853  * @param value The value to set at the given index.
854  *
855  * @return 0 on success. Otherwise an error ocucrred.
856  * @relatesalso as_list
857  */
858 static inline int as_list_set_integer(as_list * list, uint32_t i, as_integer * value)
859 {
860  return as_list_set(list, i, (as_val *) value);
861 }
862 
863 /**
864  * Set an as_double at specified index as an as_val.
865  *
866  * @param list The list.
867  * @param i The index of the value to set in the list.
868  * @param value The value to set at the given index.
869  *
870  * @return 0 on success. Otherwise an error ocucrred.
871  * @relatesalso as_list
872  */
873 static inline int as_list_set_as_double(as_list * list, uint32_t i, as_double * value)
874 {
875  return as_list_set(list, i, (as_val *) value);
876 }
877 
878 /**
879  * Set an as_string at specified index as an as_val.
880  *
881  * @param list The list.
882  * @param i The index of the value to set in the list.
883  * @param value The value to set at the given index.
884  *
885  * @return 0 on success. Otherwise an error occurred.
886  * @relatesalso as_list
887  */
888 static inline int as_list_set_string(as_list * list, uint32_t i, as_string * value)
889 {
890  return as_list_set(list, i, (as_val *) value);
891 }
892 
893 /**
894  * Set an as_bytes at specified index as an as_val.
895  *
896  * @param list The list.
897  * @param i The index of the value to set in the list.
898  * @param value The value to set at the given index.
899  *
900  * @return 0 on success. Otherwise an error occurred.
901  * @relatesalso as_list
902  */
903 static inline int as_list_set_bytes(as_list * list, uint32_t i, as_bytes * value)
904 {
905  return as_list_set(list, i, (as_val *) value);
906 }
907 
908 /**
909  * Set an as_list at specified index as an as_val.
910  *
911  * @param list The list.
912  * @param i The index of the value to set in the list.
913  * @param value The value to set at the given index.
914  *
915  * @return 0 on success. Otherwise an error occurred.
916  * @relatesalso as_list
917  */
918 static inline int as_list_set_list(as_list * list, uint32_t i, as_list * value)
919 {
920  return as_list_set(list, i, (as_val *) value);
921 }
922 
923 /**
924  * Set an as_map at specified index as an as_val.
925  *
926  * @param list The list.
927  * @param i The index of the value to set in the list.
928  * @param value The value to set at the given index.
929  *
930  * @return 0 on success. Otherwise an error occurred.
931  * @relatesalso as_list
932  */
933 static inline int as_list_set_map(as_list * list, uint32_t i, struct as_map_s * value)
934 {
935  return as_list_set(list, i, (as_val *) value);
936 }
937 
938 /******************************************************************************
939  * INSERT FUNCTIONS
940  *****************************************************************************/
941 
942 /**
943  * Insert a value at the specified index of the list.
944  *
945  * Any elements at and beyond specified index will be shifted so their indexes
946  * increase by 1. It's ok to insert beyond the current end of the list.
947  *
948  * @param list The list.
949  * @param i The index at which to insert.
950  * @param value The value to insert at the given index.
951  *
952  * @return 0 on success. Otherwise an error occurred.
953  * @relatesalso as_list
954  */
955 static inline int as_list_insert(as_list * list, uint32_t i, as_val * value)
956 {
957  return as_util_hook(insert, 1, list, i, value);
958 }
959 
960 /**
961  * Insert an int64_t at specified index as an as_val.
962  *
963  * @param list The list.
964  * @param i The index at which to insert.
965  * @param value The value to insert at the given index.
966  *
967  * @return 0 on success. Otherwise an error occurred.
968  * @relatesalso as_list
969  */
970 static inline int as_list_insert_int64(as_list * list, uint32_t i, int64_t value)
971 {
972  return as_util_hook(insert_int64, 1, list, i, value);
973 }
974 
975 /**
976  * Insert a double at specified index as an as_val.
977  *
978  * @param list The list.
979  * @param i The index at which to insert.
980  * @param value The value to insert at the given index.
981  *
982  * @return 0 on success. Otherwise an error occurred.
983  * @relatesalso as_list
984  */
985 static inline int as_list_insert_double(as_list * list, uint32_t i, double value)
986 {
987  return as_util_hook(insert_double, 1, list, i, value);
988 }
989 
990 /**
991  * Insert a NULL-terminated string at specified index as an as_val.
992  *
993  * @param list The list.
994  * @param i The index at which to insert.
995  * @param value The value to insert at the given index.
996  *
997  * @return 0 on success. Otherwise an error occurred.
998  * @relatesalso as_list
999  */
1000 static inline int as_list_insert_str(as_list * list, uint32_t i, const char * value)
1001 {
1002  return as_util_hook(insert_str, 1, list, i, value);
1003 }
1004 
1005 /**
1006  * Insert an as_integer at specified index as an as_val.
1007  *
1008  * @param list The list.
1009  * @param i The index at which to insert.
1010  * @param value The value to insert at the given index.
1011  *
1012  * @return 0 on success. Otherwise an error ocucrred.
1013  * @relatesalso as_list
1014  */
1015 static inline int as_list_insert_integer(as_list * list, uint32_t i, as_integer * value)
1016 {
1017  return as_list_insert(list, i, (as_val *) value);
1018 }
1019 
1020 /**
1021  * Insert an as_double at specified index as an as_val.
1022  *
1023  * @param list The list.
1024  * @param i The index at which to insert.
1025  * @param value The value to insert at the given index.
1026  *
1027  * @return 0 on success. Otherwise an error ocucrred.
1028  * @relatesalso as_list
1029  */
1030 static inline int as_list_insert_as_double(as_list * list, uint32_t i, as_double * value)
1031 {
1032  return as_list_insert(list, i, (as_val *) value);
1033 }
1034 
1035 /**
1036  * Insert an as_string at specified index as an as_val.
1037  *
1038  * @param list The list.
1039  * @param i The index at which to insert.
1040  * @param value The value to insert at the given index.
1041  *
1042  * @return 0 on success. Otherwise an error occurred.
1043  * @relatesalso as_list
1044  */
1045 static inline int as_list_insert_string(as_list * list, uint32_t i, as_string * value)
1046 {
1047  return as_list_insert(list, i, (as_val *) value);
1048 }
1049 
1050 /**
1051  * Insert an as_bytes at specified index as an as_val.
1052  *
1053  * @param list The list.
1054  * @param i The index at which to insert.
1055  * @param value The value to insert at the given index.
1056  *
1057  * @return 0 on success. Otherwise an error occurred.
1058  * @relatesalso as_list
1059  */
1060 static inline int as_list_insert_bytes(as_list * list, uint32_t i, as_bytes * value)
1061 {
1062  return as_list_insert(list, i, (as_val *) value);
1063 }
1064 
1065 /**
1066  * Insert an as_list at specified index as an as_val.
1067  *
1068  * @param list The list.
1069  * @param i The index at which to insert.
1070  * @param value The value to insert at the given index.
1071  *
1072  * @return 0 on success. Otherwise an error occurred.
1073  * @relatesalso as_list
1074  */
1075 static inline int as_list_insert_list(as_list * list, uint32_t i, as_list * value)
1076 {
1077  return as_list_insert(list, i, (as_val *) value);
1078 }
1079 
1080 /**
1081  * Insert an as_map at specified index as an as_val.
1082  *
1083  * @param list The list.
1084  * @param i The index at which to insert.
1085  * @param value The value to insert at the given index.
1086  *
1087  * @return 0 on success. Otherwise an error occurred.
1088  * @relatesalso as_list
1089  */
1090 static inline int as_list_insert_map(as_list * list, uint32_t i, struct as_map_s * value)
1091 {
1092  return as_list_insert(list, i, (as_val *) value);
1093 }
1094 
1095 /******************************************************************************
1096  * APPEND FUNCTIONS
1097  *****************************************************************************/
1098 
1099 /**
1100  * Append a value to the list.
1101  *
1102  * @param list The list.
1103  * @param value The value to append to the list.
1104  *
1105  * @return 0 on success. Otherwise an error occurred.
1106  * @relatesalso as_list
1107  */
1108 static inline int as_list_append(as_list * list, as_val * value)
1109 {
1110  return as_util_hook(append, 1, list, value);
1111 }
1112 
1113 /**
1114  * Append an int64_t to the list.
1115  *
1116  * @param list The list.
1117  * @param value The value to append to the list.
1118  *
1119  * @return 0 on success. Otherwise an error occurred.
1120  * @relatesalso as_list
1121  */
1122 static inline int as_list_append_int64(as_list * list, int64_t value)
1123 {
1124  return as_util_hook(append_int64, 1, list, value);
1125 }
1126 
1127 /**
1128  * Append a double to the list.
1129  *
1130  * @param list The list.
1131  * @param value The value to append to the list.
1132  *
1133  * @return 0 on success. Otherwise an error occurred.
1134  * @relatesalso as_list
1135  */
1136 static inline int as_list_append_double(as_list * list, double value)
1137 {
1138  return as_util_hook(append_double, 1, list, value);
1139 }
1140 
1141 /**
1142  * Append a NULL-terminated string to the list.
1143  *
1144  * @param list The list.
1145  * @param value The value to append to the list.
1146  *
1147  * @return 0 on success. Otherwise an error occurred.
1148  * @relatesalso as_list
1149  */
1150 static inline int as_list_append_str(as_list * list, const char * value)
1151 {
1152  return as_util_hook(append_str, 1, list, value);
1153 }
1154 
1155 /**
1156  * Append an as_integer to the list.
1157  *
1158  * @param list The list.
1159  * @param value The value to append to the list.
1160  *
1161  * @return 0 on success. Otherwise an error occurred.
1162  * @relatesalso as_list
1163  */
1164 static inline int as_list_append_integer(as_list * list, as_integer * value)
1165 {
1166  return as_list_append(list, (as_val *) value);
1167 }
1168 
1169 /**
1170  * Append an as_double to the list.
1171  *
1172  * @param list The list.
1173  * @param value The value to append to the list.
1174  *
1175  * @return 0 on success. Otherwise an error occurred.
1176  * @relatesalso as_list
1177  */
1178 static inline int as_list_append_as_double(as_list * list, as_double * value)
1179 {
1180  return as_list_append(list, (as_val *) value);
1181 }
1182 
1183 /**
1184  * Append an as_string to the list.
1185  *
1186  * @param list The list.
1187  * @param value The value to append to the list.
1188  *
1189  * @return 0 on success. Otherwise an error occurred.
1190  * @relatesalso as_list
1191  */
1192 static inline int as_list_append_string(as_list * list, as_string * value)
1193 {
1194  return as_list_append(list, (as_val *) value);
1195 }
1196 
1197 /**
1198  * Append an as_bytes to the list.
1199  *
1200  * @param list The list.
1201  * @param value The value to append to the list.
1202  *
1203  * @return 0 on success. Otherwise an error occurred.
1204  * @relatesalso as_list
1205  */
1206 static inline int as_list_append_bytes(as_list * list, as_bytes * value)
1207 {
1208  return as_list_append(list, (as_val *) value);
1209 }
1210 
1211 /**
1212  * Append an as_list to the list.
1213  *
1214  * @param list The list.
1215  * @param value The value to append to the list.
1216  *
1217  * @return 0 on success. Otherwise an error occurred.
1218  * @relatesalso as_list
1219  */
1220 static inline int as_list_append_list(as_list * list, as_list * value)
1221 {
1222  return as_list_append(list, (as_val *) value);
1223 }
1224 
1225 /**
1226  * Append an as_map to the list.
1227  *
1228  * @param list The list.
1229  * @param value The value to append to the list.
1230  *
1231  * @return 0 on success. Otherwise an error occurred.
1232  * @relatesalso as_list
1233  */
1234 static inline int as_list_append_map(as_list * list, struct as_map_s * value)
1235 {
1236  return as_list_append(list, (as_val *) value);
1237 }
1238 
1239 /******************************************************************************
1240  * PREPEND FUNCTIONS
1241  *****************************************************************************/
1242 
1243 /**
1244  * Prepend a value to the list.
1245  *
1246  * @param list The list.
1247  * @param value The value to prepend to the list.
1248  *
1249  * @return 0 on success. Otherwise an error occurred.
1250  * @relatesalso as_list
1251  */
1252 static inline int as_list_prepend(as_list * list, as_val * value)
1253 {
1254  return as_util_hook(prepend, 1, list, value);
1255 }
1256 
1257 /**
1258  * Prepend an int64_t value to the list.
1259  *
1260  * @param list The list.
1261  * @param value The value to prepend to the list.
1262  *
1263  * @return 0 on success. Otherwise an error occurred.
1264  * @relatesalso as_list
1265  */
1266 static inline int as_list_prepend_int64(as_list * list, int64_t value)
1267 {
1268  return as_util_hook(prepend_int64, 1, list, value);
1269 }
1270 
1271 /**
1272  * Prepend a double value to the list.
1273  *
1274  * @param list The list.
1275  * @param value The value to prepend to the list.
1276  *
1277  * @return 0 on success. Otherwise an error occurred.
1278  * @relatesalso as_list
1279  */
1280 static inline int as_list_prepend_double(as_list * list, double value)
1281 {
1282  return as_util_hook(prepend_double, 1, list, value);
1283 }
1284 
1285 /**
1286  * Prepend a NULL-terminated string to the list.
1287  *
1288  * @param list The list.
1289  * @param value The value to prepend to the list.
1290  *
1291  * @return 0 on success. Otherwise an error occurred.
1292  * @relatesalso as_list
1293  */
1294 static inline int as_list_prepend_str(as_list * list, const char * value)
1295 {
1296  return as_util_hook(prepend_str, 1, list, value);
1297 }
1298 
1299 /**
1300  * Prepend an as_integer to the list.
1301  *
1302  * @param list The list.
1303  * @param value The value to prepend to the list.
1304  *
1305  * @return 0 on success. Otherwise an error occurred.
1306  * @relatesalso as_list
1307  */
1308 static inline int as_list_prepend_integer(as_list * list, as_integer * value)
1309 {
1310  return as_list_prepend(list, (as_val *) value);
1311 }
1312 
1313 /**
1314  * Prepend an as_double to the list.
1315  *
1316  * @param list The list.
1317  * @param value The value to prepend to the list.
1318  *
1319  * @return 0 on success. Otherwise an error occurred.
1320  * @relatesalso as_list
1321  */
1322 static inline int as_list_prepend_as_double(as_list * list, as_double * value)
1323 {
1324  return as_list_prepend(list, (as_val *) value);
1325 }
1326 
1327 /**
1328  * Prepend an as_string to the list.
1329  *
1330  * @param list The list.
1331  * @param value The value to prepend to the list.
1332  *
1333  * @return 0 on success. Otherwise an error occurred.
1334  * @relatesalso as_list
1335  */
1336 static inline int as_list_prepend_string(as_list * list, as_string * value)
1337 {
1338  return as_list_prepend(list, (as_val *) value);
1339 }
1340 
1341 /**
1342  * Prepend an as_bytes to the list.
1343  *
1344  * @param list The list.
1345  * @param value The value to prepend to the list.
1346  *
1347  * @return 0 on success. Otherwise an error occurred.
1348  * @relatesalso as_list
1349  */
1350 static inline int as_list_prepend_bytes(as_list * list, as_bytes * value)
1351 {
1352  return as_list_prepend(list, (as_val *) value);
1353 }
1354 
1355 /**
1356  * Prepend an as_list to the list.
1357  *
1358  * @param list The list.
1359  * @param value The value to prepend to the list.
1360  *
1361  * @return 0 on success. Otherwise an error occurred.
1362  * @relatesalso as_list
1363  */
1364 static inline int as_list_prepend_list(as_list * list, as_list * value)
1365 {
1366  return as_list_prepend(list, (as_val *) value);
1367 }
1368 
1369 /**
1370  * Prepend an as_map to the list.
1371  *
1372  * @param list The list.
1373  * @param value The value to prepend to the list.
1374  *
1375  * @return 0 on success. Otherwise an error occurred.
1376  * @relatesalso as_list
1377  */
1378 static inline int as_list_prepend_map(as_list * list, struct as_map_s * value)
1379 {
1380  return as_list_prepend(list, (as_val *) value);
1381 }
1382 
1383 /******************************************************************************
1384  * REMOVE FUNCTION
1385  *****************************************************************************/
1386 
1387 /**
1388  * Remove element at specified index.
1389  *
1390  * Any elements beyond specified index will be shifted so their indexes
1391  * decrease by 1. The element at specified index will be destroyed.
1392  *
1393  * @param list The list.
1394  * @param index The index of the element to remove.
1395  *
1396  * @return 0 on success. Otherwise an error occurred.
1397  * @relatesalso as_list
1398  */
1399 static inline int as_list_remove(as_list * list, uint32_t index)
1400 {
1401  return as_util_hook(remove, 1, list, index);
1402 }
1403 
1404 /******************************************************************************
1405  * ITERATION FUNCTIONS
1406  *****************************************************************************/
1407 
1408 /**
1409  * Call the callback function for each element in the list..
1410  *
1411  * @param list The list to iterate over.
1412  * @param callback The callback function call for each element.
1413  * @param udata User-data to send to the callback.
1414  *
1415  * @return true if iteration completes fully. false if iteration was aborted.
1416  *
1417  * @relatesalso as_list
1418  */
1419 static inline bool as_list_foreach(const as_list * list, as_list_foreach_callback callback, void * udata)
1420 {
1421  return as_util_hook(foreach, false, list, callback, udata);
1422 }
1423 
1424 /**
1425  * Creates and initializes a new heap allocated iterator over the given list.
1426  *
1427  * @param list The list to iterate.
1428  *
1429  * @return On success, a new as_iterator. Otherwise NULL.
1430  * @relatesalso as_list
1431  */
1432 static inline union as_list_iterator_u * as_list_iterator_new(const as_list * list)
1433 {
1434  return as_util_hook(iterator_new, NULL, list);
1435 }
1436 
1437 
1438 /**
1439  * Initializes a stack allocated iterator over the given list.
1440  *
1441  * @param list The list to iterate.
1442  * @param it The iterator to initialize.
1443  *
1444  * @return On success, the initializes as_iterator. Otherwise NULL.
1445  * @relatesalso as_list
1446  */
1447 static inline union as_list_iterator_u * as_list_iterator_init(union as_list_iterator_u * it, const as_list * list)
1448 {
1449  return as_util_hook(iterator_init, NULL, list, it);
1450 }
1451 
1452 /******************************************************************************
1453  * CONVERSION FUNCTIONS
1454  *****************************************************************************/
1455 
1456 /**
1457  * Convert to an as_val.
1458  * @relatesalso as_list
1459  */
1460 static inline as_val * as_list_toval(as_list * list)
1461 {
1462  return (as_val *) list;
1463 }
1464 
1465 /**
1466  * Convert from an as_val.
1467  * @relatesalso as_list
1468  */
1469 static inline as_list * as_list_fromval(as_val * v)
1470 {
1471  return as_util_fromval(v, AS_LIST, as_list);
1472 }
1473 
1474 /******************************************************************************
1475  * as_val FUNCTIONS
1476  *****************************************************************************/
1477 
1478 /**
1479  * @private
1480  * Internal helper function for destroying an as_val.
1481  */
1482 void as_list_val_destroy(as_val * v);
1483 
1484 /**
1485  * @private
1486  * Internal helper function for getting the hashcode of an as_val.
1487  */
1488 uint32_t as_list_val_hashcode(const as_val * v);
1489 
1490 /**
1491  * @private
1492  * Internal helper function for getting the string representation of an as_val.
1493  */
1494 char * as_list_val_tostring(const as_val * v);
1495 
1496 #ifdef __cplusplus
1497 } // end extern "C"
1498 #endif
static void as_list_destroy(as_list *list)
Definition: as_list.h:515
static as_integer * as_integer_fromval(const as_val *v)
Definition: as_integer.h:234
static int as_list_set_string(as_list *list, uint32_t i, as_string *value)
Definition: as_list.h:888
static int as_list_append_string(as_list *list, as_string *value)
Definition: as_list.h:1192
static int as_list_set_integer(as_list *list, uint32_t i, as_integer *value)
Definition: as_list.h:858
static int as_list_set(as_list *list, uint32_t i, as_val *value)
Definition: as_list.h:798
static int as_list_insert_int64(as_list *list, uint32_t i, int64_t value)
Definition: as_list.h:970
static bool as_list_foreach(const as_list *list, as_list_foreach_callback callback, void *udata)
Definition: as_list.h:1419
static char * as_list_get_str(const as_list *list, uint32_t i)
Definition: as_list.h:693
static int as_list_set_bytes(as_list *list, uint32_t i, as_bytes *value)
Definition: as_list.h:903
static int as_list_insert(as_list *list, uint32_t i, as_val *value)
Definition: as_list.h:955
static int as_list_append_as_double(as_list *list, as_double *value)
Definition: as_list.h:1178
static int as_list_concat(as_list *list, const as_list *list2)
Definition: as_list.h:564
static int as_list_insert_bytes(as_list *list, uint32_t i, as_bytes *value)
Definition: as_list.h:1060
static int as_list_prepend_string(as_list *list, as_string *value)
Definition: as_list.h:1336
static int as_list_insert_double(as_list *list, uint32_t i, double value)
Definition: as_list.h:985
static int as_list_insert_map(as_list *list, uint32_t i, struct as_map_s *value)
Definition: as_list.h:1090
static as_double * as_list_get_as_double(const as_list *list, uint32_t i)
Definition: as_list.h:721
static as_double * as_double_fromval(const as_val *value)
Definition: as_double.h:229
static int as_list_prepend_list(as_list *list, as_list *value)
Definition: as_list.h:1364
#define as_util_fromval(object, type_id, type)
Definition: as_util.h:42
static as_bytes * as_list_get_bytes(const as_list *list, uint32_t i)
Definition: as_list.h:749
static int64_t as_list_get_int64(const as_list *list, uint32_t i)
Definition: as_list.h:665
struct as_list_hooks_s * hooks
Definition: as_list.h:80
static int as_list_insert_str(as_list *list, uint32_t i, const char *value)
Definition: as_list.h:1000
static union as_list_iterator_u * as_list_iterator_init(union as_list_iterator_u *it, const as_list *list)
Definition: as_list.h:1447
Definition: as_val.h:57
bool(* as_list_foreach_callback)(as_val *value, void *udata)
Definition: as_list.h:52
static int as_list_insert_as_double(as_list *list, uint32_t i, as_double *value)
Definition: as_list.h:1030
static as_integer * as_list_get_integer(const as_list *list, uint32_t i)
Definition: as_list.h:707
static int as_list_append(as_list *list, as_val *value)
Definition: as_list.h:1108
static int as_list_set_map(as_list *list, uint32_t i, struct as_map_s *value)
Definition: as_list.h:933
static int as_list_prepend(as_list *list, as_val *value)
Definition: as_list.h:1252
static int as_list_prepend_as_double(as_list *list, as_double *value)
Definition: as_list.h:1322
static as_list * as_list_tail(const as_list *list)
Definition: as_list.h:605
static as_string * as_list_get_string(const as_list *list, uint32_t i)
Definition: as_list.h:735
static int as_list_insert_integer(as_list *list, uint32_t i, as_integer *value)
Definition: as_list.h:1015
#define as_util_hook(hook, default, object, args...)
Definition: as_util.h:36
AS_MAP
Definition: as_val.h:212
as_list * as_list_init(as_list *list, void *data, const as_list_hooks *hooks)
as_list * as_list_cons(as_list *list, bool free, void *data, const as_list_hooks *hooks)
static as_val * as_list_toval(as_list *list)
Definition: as_list.h:1460
static int as_list_append_int64(as_list *list, int64_t value)
Definition: as_list.h:1122
static int as_list_append_str(as_list *list, const char *value)
Definition: as_list.h:1150
static as_val * as_list_get(const as_list *list, uint32_t i)
Definition: as_list.h:651
static int as_list_append_list(as_list *list, as_list *value)
Definition: as_list.h:1220
static union as_list_iterator_u * as_list_iterator_new(const as_list *list)
Definition: as_list.h:1432
static int as_list_set_double(as_list *list, uint32_t i, double value)
Definition: as_list.h:828
enum as_val_t type
Definition: as_val.h:62
static as_val * as_list_head(const as_list *list)
Definition: as_list.h:592
as_val _
Definition: as_list.h:70
static uint32_t as_list_size(as_list *list)
Definition: as_list.h:545
static struct as_map_s * as_list_get_map(const as_list *list, uint32_t i)
Definition: as_list.h:778
static int as_list_prepend_bytes(as_list *list, as_bytes *value)
Definition: as_list.h:1350
static int as_list_prepend_map(as_list *list, struct as_map_s *value)
Definition: as_list.h:1378
static as_bytes * as_bytes_fromval(const as_val *v)
Definition: as_bytes.h:970
static int as_list_remove(as_list *list, uint32_t index)
Definition: as_list.h:1399
static int as_list_insert_string(as_list *list, uint32_t i, as_string *value)
Definition: as_list.h:1045
void * data
Definition: as_list.h:75
static int as_list_append_bytes(as_list *list, as_bytes *value)
Definition: as_list.h:1206
static int as_list_set_as_double(as_list *list, uint32_t i, as_double *value)
Definition: as_list.h:873
static int as_list_append_integer(as_list *list, as_integer *value)
Definition: as_list.h:1164
static uint32_t as_list_hashcode(as_list *list)
Definition: as_list.h:532
static int as_list_prepend_str(as_list *list, const char *value)
Definition: as_list.h:1294
static as_list * as_list_get_list(const as_list *list, uint32_t i)
Definition: as_list.h:763
static as_string * as_string_fromval(const as_val *v)
Definition: as_string.h:294
static int as_list_set_int64(as_list *list, uint32_t i, int64_t value)
Definition: as_list.h:813
static int as_list_insert_list(as_list *list, uint32_t i, as_list *value)
Definition: as_list.h:1075
static as_list * as_list_fromval(as_val *v)
Definition: as_list.h:1469
static int as_list_prepend_double(as_list *list, double value)
Definition: as_list.h:1280
static int as_list_prepend_int64(as_list *list, int64_t value)
Definition: as_list.h:1266
uint8_t data[]
Definition: as_proto.h:842
static double as_list_get_double(const as_list *list, uint32_t i)
Definition: as_list.h:679
static as_list * as_list_drop(const as_list *list, uint32_t n)
Definition: as_list.h:619
as_list * as_list_new(void *data, const as_list_hooks *hooks)
AS_LIST
Definition: as_val.h:211
#define as_val_destroy(__v)
Definition: as_val.h:110
static int as_list_append_double(as_list *list, double value)
Definition: as_list.h:1136
static int as_list_trim(as_list *list, uint32_t index)
Definition: as_list.h:579
uint32_t as_list_val_hashcode(const as_val *v)
static int as_list_append_map(as_list *list, struct as_map_s *value)
Definition: as_list.h:1234
static int as_list_set_str(as_list *list, uint32_t i, const char *value)
Definition: as_list.h:843
char * as_list_val_tostring(const as_val *v)
static int as_list_set_list(as_list *list, uint32_t i, as_list *value)
Definition: as_list.h:918
void as_list_val_destroy(as_val *v)
static as_list * as_list_take(const as_list *list, uint32_t n)
Definition: as_list.h:633
static int as_list_prepend_integer(as_list *list, as_integer *value)
Definition: as_list.h:1308