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