libcollection  0.6.1
collection.h
1 /*
2  COLLECTION LIBRARY
3 
4  Header file for collection interface.
5 
6  Copyright (C) Dmitri Pal <dpal@redhat.com> 2009
7 
8  Collection Library is free software: you can redistribute it and/or modify
9  it under the terms of the GNU Lesser General Public License as published by
10  the Free Software Foundation, either version 3 of the License, or
11  (at your option) any later version.
12 
13  Collection Library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public License
19  along with Collection Library. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
22 #ifndef COLLECTION_H
23 #define COLLECTION_H
24 
25 #include <stdint.h>
26 
108 #ifndef EOK
109 #define EOK 0
110 #endif
111 
120 #define COL_CLASS_DEFAULT 0
121 
127 #define COL_NOMATCH 0
133 #define COL_MATCH 1
134 
135 
145 #define COL_TYPE_STRING 0x00000001
147 #define COL_TYPE_BINARY 0x00000002
149 #define COL_TYPE_INTEGER 0x00000004
151 #define COL_TYPE_UNSIGNED 0x00000008
153 #define COL_TYPE_LONG 0x00000010
155 #define COL_TYPE_ULONG 0x00000020
157 #define COL_TYPE_DOUBLE 0x00000040
159 #define COL_TYPE_BOOL 0x00000080
166 #define COL_TYPE_COLLECTION 0x00000100
173 #define COL_TYPE_COLLECTIONREF 0x00000200
179 #define COL_TYPE_END 0x10000000
186 #define COL_TYPE_ANY 0x0FFFFFFF
200 #define COL_ADD_MODE_REFERENCE 0
211 #define COL_ADD_MODE_EMBED 1
217 #define COL_ADD_MODE_CLONE 2
225 #define COL_ADD_MODE_FLAT 3
238 #define COL_ADD_MODE_FLATDOT 4
261 #define COL_TRAVERSE_DEFAULT 0x00000000
269 #define COL_TRAVERSE_ONELEVEL 0x00000001
280 #define COL_TRAVERSE_END 0x00000002
282 #define COL_TRAVERSE_IGNORE 0x00000004
296 #define COL_TRAVERSE_FLAT 0x00000008
322 #define COL_TRAVERSE_SHOWSUB 0x00010000
330 #define COL_TRAVERSE_ONLYSUB 0x00020000
353 #define COL_COPY_NORMAL 0
359 #define COL_COPY_FLAT 1
365 #define COL_COPY_FLATDOT 2
367 #define COL_COPY_KEEPREF 3
369 #define COL_COPY_TOP 4
385 #define COL_SORT_ASC 0x00000000
387 #define COL_SORT_DESC 0x00000001
389 #define COL_SORT_SUB 0x00000002
395 #define COL_SORT_MYSUB 0x00000004
401 /* Public declaration of the private data */
402 #ifndef COLLECTION_PRIV_H
418 struct collection_item;
431 struct collection_iterator;
432 
433 #endif /* COLLECTION_PRIV_H */
434 
435 
472 int col_create_collection(struct collection_item **ci,
473  const char *name,
474  unsigned cclass);
475 
484 void col_destroy_collection(struct collection_item *ci);
485 
507 typedef void (*col_item_cleanup_fn)(const char *property,
508  int property_len,
509  int type,
510  void *data,
511  int length,
512  void *custom_data);
513 
537  void *custom_data);
538 
563 typedef int (*col_copy_cb)(struct collection_item *item,
564  void *ext_data,
565  int *skip);
566 
593 int col_copy_collection_with_cb(struct collection_item **col_copy,
594  struct collection_item *col_to_copy,
595  const char *name_to_use,
596  int copy_mode,
597  col_copy_cb copy_cb,
598  void *ext_data);
599 
617 int col_copy_collection(struct collection_item **col_copy,
618  struct collection_item *col_to_copy,
619  const char *name_to_use,
620  int copy_mode);
621 
654  const char *subcollection,
655  const char *as_property,
656  struct collection_item *ci_to_add,
657  int mode);
684 typedef int (*col_item_fn)(const char *property,
685  int property_len,
686  int type,
687  void *data,
688  int length,
689  void *custom_data,
690  int *stop);
691 
714  int mode_flags,
715  col_item_fn item_handler,
716  void *custom_data);
717 
752 int col_get_item_and_do(struct collection_item *ci,
753  const char *property_to_find,
754  int type,
755  int mode_flags,
756  col_item_fn item_handler,
757  void *custom_data);
758 
797 int col_get_item(struct collection_item *ci,
798  const char *property_to_find,
799  int type,
800  int mode_flags,
801  struct collection_item **item);
802 
845 int col_get_dup_item(struct collection_item *ci,
846  const char *subcollection,
847  const char *property_to_find,
848  int type,
849  int idx,
850  int exact,
851  struct collection_item **item);
852 
882 int col_sort_collection(struct collection_item *col,
883  unsigned cmp_flags,
884  unsigned sort_flags);
885 
917 int col_delete_property(struct collection_item *ci,
918  const char *property_to_find,
919  int type,
920  int mode_flags);
921 
947  const char *property_to_find,
948  int type,
949  int mode_flags,
950  int *found);
951 
974  struct collection_item **acceptor,
975  const char *col_to_find);
976 
997  struct collection_item **acceptor);
998 
999 
1000 
1030  unsigned *cclass);
1031 
1046  unsigned cclass);
1047 
1067  unsigned *count);
1068 
1069 
1083 int col_is_of_class(struct collection_item *ci,
1084  unsigned cclass);
1085 
1086 
1159 int col_add_str_property(struct collection_item *ci,
1160  const char *subcollection,
1161  const char *property,
1162  const char *string,
1163  int length);
1164 
1192  const char *subcollection,
1193  const char *property,
1194  void *binary_data,
1195  int length);
1196 
1222 int col_add_int_property(struct collection_item *ci,
1223  const char *subcollection,
1224  const char *property,
1225  int32_t number);
1226 
1253  const char *subcollection,
1254  const char *property,
1255  uint32_t number);
1256 
1282 int col_add_long_property(struct collection_item *ci,
1283  const char *subcollection,
1284  const char *property,
1285  int64_t number);
1286 
1313  const char *subcollection,
1314  const char *property,
1315  uint64_t number);
1316 
1343  const char *subcollection,
1344  const char *property,
1345  double number);
1371 int col_add_bool_property(struct collection_item *ci,
1372  const char *subcollection,
1373  const char *property,
1374  unsigned char logical);
1375 
1376 
1404 int col_add_any_property(struct collection_item *ci,
1405  const char *subcollection,
1406  const char *property,
1407  int type,
1408  void *data,
1409  int length);
1410 
1471  const char *subcollection,
1472  const char *property,
1473  char *string, int length,
1474  struct collection_item **ret_ref);
1475 
1505  const char *subcollection,
1506  const char *property,
1507  void *binary_data, int length,
1508  struct collection_item **ret_ref);
1509 
1538  const char *subcollection,
1539  const char *property, int32_t number,
1540  struct collection_item **ret_ref);
1541 
1570  const char *subcollection,
1571  const char *property, uint32_t number,
1572  struct collection_item **ret_ref);
1573 
1602  const char *subcollection,
1603  const char *property, int64_t number,
1604  struct collection_item **ret_ref);
1605 
1634  const char *subcollection,
1635  const char *property, uint64_t number,
1636  struct collection_item **ret_ref);
1637 
1666  const char *subcollection,
1667  const char *property, double number,
1668  struct collection_item **ret_ref);
1669 
1698  const char *subcollection,
1699  const char *property, unsigned char logical,
1700  struct collection_item **ret_ref);
1701 
1702 
1733  const char *subcollection,
1734  const char *property,
1735  int type, void *data, int length,
1736  struct collection_item **ret_ref);
1737 
1793  const char *subcollection,
1794  int disposition,
1795  const char *refprop,
1796  int idx,
1797  unsigned flags,
1798  const char *property,
1799  const char *string,
1800  int length);
1801 
1804  const char *subcollection,
1805  int disposition,
1806  const char *refprop,
1807  int idx,
1808  unsigned flags,
1809  const char *property,
1810  void *binary_data,
1811  int length);
1812 
1815  const char *subcollection,
1816  int disposition,
1817  const char *refprop,
1818  int idx,
1819  unsigned flags,
1820  const char *property,
1821  int32_t number);
1822 
1825  const char *subcollection,
1826  int disposition,
1827  const char *refprop,
1828  int idx,
1829  unsigned flags,
1830  const char *property,
1831  uint32_t number);
1832 
1835  const char *subcollection,
1836  int disposition,
1837  const char *refprop,
1838  int idx,
1839  unsigned flags,
1840  const char *property,
1841  int64_t number);
1842 
1845  const char *subcollection,
1846  int disposition,
1847  const char *refprop,
1848  int idx,
1849  unsigned flags,
1850  const char *property,
1851  uint64_t number);
1852 
1855  const char *subcollection,
1856  int disposition,
1857  const char *refprop,
1858  int idx,
1859  unsigned flags,
1860  const char *property,
1861  double number);
1862 
1865  const char *subcollection,
1866  int disposition,
1867  const char *refprop,
1868  int idx,
1869  unsigned flags,
1870  const char *property,
1871  unsigned char logical);
1872 
1875  const char *subcollection,
1876  int disposition,
1877  const char *refprop,
1878  int idx,
1879  unsigned flags,
1880  const char *property,
1881  const char *string,
1882  int length,
1883  struct collection_item **ret_ref);
1884 
1887  const char *subcollection,
1888  int disposition,
1889  const char *refprop,
1890  int idx,
1891  unsigned flags,
1892  const char *property,
1893  void *binary_data,
1894  int length,
1895  struct collection_item **ret_ref);
1896 
1899  const char *subcollection,
1900  int disposition,
1901  const char *refprop,
1902  int idx,
1903  unsigned flags,
1904  const char *property,
1905  int32_t number,
1906  struct collection_item **ret_ref);
1907 
1910  const char *subcollection,
1911  int disposition,
1912  const char *refprop,
1913  int idx,
1914  unsigned flags,
1915  const char *property,
1916  uint32_t number,
1917  struct collection_item **ret_ref);
1918 
1921  const char *subcollection,
1922  int disposition,
1923  const char *refprop,
1924  int idx,
1925  unsigned flags,
1926  const char *property,
1927  int64_t number,
1928  struct collection_item **ret_ref);
1929 
1932  const char *subcollection,
1933  int disposition,
1934  const char *refprop,
1935  int idx,
1936  unsigned flags,
1937  const char *property,
1938  uint64_t number,
1939  struct collection_item **ret_ref);
1940 
1946  const char *subcollection,
1947  int disposition,
1948  const char *refprop,
1949  int idx,
1950  unsigned flags,
1951  const char *property,
1952  double number,
1953  struct collection_item **ret_ref);
1954 
1957  const char *subcollection,
1958  int disposition,
1959  const char *refprop,
1960  int idx,
1961  unsigned flags,
1962  const char *property,
1963  unsigned char logical,
1964  struct collection_item **ret_ref);
1965 
1968  const char *subcollection,
1969  int disposition,
1970  const char *refprop,
1971  int idx,
1972  unsigned flags,
1973  const char *property,
1974  int type,
1975  const void *data,
1976  int length,
1977  struct collection_item **ret_ref);
1978 
1979 
2029  const char *property,
2030  int mode_flags,
2031  char *string,
2032  int length);
2037  const char *property,
2038  int mode_flags,
2039  void *binary_data,
2040  int length);
2045  const char *property,
2046  int mode_flags,
2047  int32_t number);
2052  const char *property,
2053  int mode_flags,
2054  uint32_t number);
2059  const char *property,
2060  int mode_flags,
2061  int64_t number);
2066  const char *property,
2067  int mode_flags,
2068  uint64_t number);
2073  const char *property,
2074  int mode_flags,
2075  double number);
2080  const char *property,
2081  int mode_flags,
2082  unsigned char logical);
2083 
2091 int col_update_property(struct collection_item *ci,
2092  const char *property,
2093  int type,
2094  void *new_data,
2095  int length,
2096  int mode_flags);
2097 
2098 
2130 #define COL_CMPIN_PROP_EQU 0x000000004
2132 #define COL_CMPIN_PROP_BEG 0x000000005
2134 #define COL_CMPIN_PROP_MID 0x000000006
2136 #define COL_CMPIN_PROP_END 0x000000007
2137 
2149 #define COL_CMPIN_PROP_DOT 0x000000008
2150 
2152 #define COL_CMPIN_PROP_LEN 0x000000010
2153 
2155 #define COL_CMPIN_TYPE 0x000000020
2156 
2158 #define COL_CMPIN_DATA_LEN 0x000000040
2159 
2168 #define COL_CMPIN_DATA 0x000000080
2169 
2190 #define COL_CMPOUT_PROP_STR 0x00000001
2191 
2198 #define COL_CMPOUT_PROP_LEN 0x00000002
2205 #define COL_CMPOUT_DATA_LEN 0x00000004
2214 #define COL_CMPOUT_DATA 0x00000008
2215 
2241 #define COL_DSP_END 0
2252 #define COL_DSP_FRONT 1
2265 #define COL_DSP_BEFORE 2
2278 #define COL_DSP_AFTER 3
2297 #define COL_DSP_INDEX 4
2315 #define COL_DSP_FIRSTDUP 5
2335 #define COL_DSP_LASTDUP 6
2365 #define COL_DSP_NDUP 7
2385 #define COL_DSP_LASTDUPNS 8
2415 #define COL_DSP_NDUPNS 9
2435 #define COL_INSERT_NOCHECK 0
2440 #define COL_INSERT_DUPOVER 1
2445 #define COL_INSERT_DUPOVERT 2
2447 #define COL_INSERT_DUPERROR 3
2452 #define COL_INSERT_DUPERRORT 4
2456 #define COL_INSERT_DUPMOVE 5
2460 #define COL_INSERT_DUPMOVET 6
2461 
2488 const char *col_get_item_property(struct collection_item *ci,
2489  int *property_len);
2490 
2503 int col_get_item_type(struct collection_item *ci);
2504 
2518 int col_get_item_length(struct collection_item *ci);
2519 
2532 void *col_get_item_data(struct collection_item *ci);
2533 
2553 uint64_t col_get_item_hash(struct collection_item *ci);
2554 
2578 uint64_t col_make_hash(const char *string, int sub_len, int *length);
2579 
2580 
2607 int col_compare_items(struct collection_item *first,
2608  struct collection_item *second,
2609  unsigned in_flags,
2610  unsigned *out_flags);
2611 
2612 
2613 
2650 int col_modify_item(struct collection_item *item,
2651  const char *property,
2652  int type,
2653  const void *data,
2654  int length);
2655 
2673 int col_modify_item_property(struct collection_item *item,
2674  const char *property);
2675 
2689 int col_modify_str_item(struct collection_item *item,
2690  const char *property,
2691  const char *string,
2692  int length);
2703 int col_modify_binary_item(struct collection_item *item,
2704  const char *property,
2705  void *binary_data,
2706  int length);
2717 int col_modify_bool_item(struct collection_item *item,
2718  const char *property,
2719  unsigned char logical);
2730 int col_modify_int_item(struct collection_item *item,
2731  const char *property,
2732  int32_t number);
2743 int col_modify_long_item(struct collection_item *item,
2744  const char *property,
2745  int64_t number);
2756 int col_modify_ulong_item(struct collection_item *item,
2757  const char *property,
2758  uint64_t number);
2769 int col_modify_unsigned_item(struct collection_item *item,
2770  const char *property,
2771  uint32_t number);
2782 int col_modify_double_item(struct collection_item *item,
2783  const char *property,
2784  double number);
2785 
2849 int col_extract_item(struct collection_item *ci,
2850  const char *subcollection,
2851  int disposition,
2852  const char *refprop,
2853  int idx,
2854  int type,
2855  struct collection_item **ret_ref);
2856 
2898  int disposition,
2899  const char *refprop,
2900  int idx,
2901  int type,
2902  struct collection_item **ret_ref);
2903 
2951 int col_remove_item(struct collection_item *ci,
2952  const char *subcollection,
2953  int disposition,
2954  const char *refprop,
2955  int idx,
2956  int type);
2957 
3009  const char *subcollection,
3010  int disposition,
3011  const char *refprop,
3012  int idx,
3013  int type,
3015  void *custom_data);
3016 
3056  int disposition,
3057  const char *refprop,
3058  int idx,
3059  int type);
3060 
3120 int col_insert_item(struct collection_item *ci,
3121  const char *subcollection,
3122  struct collection_item *item,
3123  int disposition,
3124  const char *refprop,
3125  int idx,
3126  unsigned flags);
3127 
3169  struct collection_item *item,
3170  int disposition,
3171  const char *refprop,
3172  int idx,
3173  unsigned flags);
3174 
3175 
3176 
3190 void col_delete_item(struct collection_item *item);
3191 
3205 void col_delete_item_with_cb(struct collection_item *item,
3207  void *custom_data);
3208 
3209 
3244 int col_bind_iterator(struct collection_iterator **iterator,
3245  struct collection_item *ci,
3246  int mode_flags);
3247 
3253 void col_unbind_iterator(struct collection_iterator *iterator);
3254 
3275 int col_iterate_collection(struct collection_iterator *iterator,
3276  struct collection_item **item);
3277 
3295 int col_iterate_up(struct collection_iterator *iterator, unsigned level);
3296 
3328 int col_get_iterator_depth(struct collection_iterator *iterator, int *depth);
3329 
3344 int col_get_item_depth(struct collection_iterator *iterator, int *depth);
3345 
3391 void col_pin_iterator(struct collection_iterator *iterator);
3392 
3402 void col_rewind_iterator(struct collection_iterator *iterator);
3403 
3404 
3413 #endif
int col_add_double_property_with_ref(struct collection_item *ci, const char *subcollection, const char *property, double number, struct collection_item **ret_ref)
Add a property of type double to a collection.
Definition: collection_cnv.c:912
int col_add_ulong_property_with_ref(struct collection_item *ci, const char *subcollection, const char *property, uint64_t number, struct collection_item **ret_ref)
Add an unsigned long property to a collection.
Definition: collection_cnv.c:887
int col_add_bool_property_with_ref(struct collection_item *ci, const char *subcollection, const char *property, unsigned char logical, struct collection_item **ret_ref)
Add a Boolean property to a collection.
Definition: collection_cnv.c:937
int col_add_binary_property_with_ref(struct collection_item *ci, const char *subcollection, const char *property, void *binary_data, int length, struct collection_item **ret_ref)
Add a binary property to a collection.
Definition: collection_cnv.c:786
int col_add_str_property_with_ref(struct collection_item *ci, const char *subcollection, const char *property, char *string, int length, struct collection_item **ret_ref)
Add a string property to a collection.
Definition: collection_cnv.c:760
int col_add_long_property_with_ref(struct collection_item *ci, const char *subcollection, const char *property, int64_t number, struct collection_item **ret_ref)
Add an long property to a collection.
Definition: collection_cnv.c:862
int col_add_unsigned_property_with_ref(struct collection_item *ci, const char *subcollection, const char *property, uint32_t number, struct collection_item **ret_ref)
Add an unsigned integer property to a collection.
Definition: collection_cnv.c:837
int col_add_any_property_with_ref(struct collection_item *ci, const char *subcollection, const char *property, int type, void *data, int length, struct collection_item **ret_ref)
Add a property of a specified type to a collection.
Definition: collection_cnv.c:962
int col_add_int_property_with_ref(struct collection_item *ci, const char *subcollection, const char *property, int32_t number, struct collection_item **ret_ref)
Add an integer property to a collection.
Definition: collection_cnv.c:812
int col_add_unsigned_property(struct collection_item *ci, const char *subcollection, const char *property, uint32_t number)
Add an unsigned integer property to a collection.
Definition: collection_cnv.c:616
int col_add_binary_property(struct collection_item *ci, const char *subcollection, const char *property, void *binary_data, int length)
Add a binary property to a collection.
Definition: collection_cnv.c:568
int col_add_double_property(struct collection_item *ci, const char *subcollection, const char *property, double number)
Add a property of type double to a collection.
Definition: collection_cnv.c:686
int col_add_int_property(struct collection_item *ci, const char *subcollection, const char *property, int32_t number)
Add an integer property to a collection.
Definition: collection_cnv.c:593
int col_add_ulong_property(struct collection_item *ci, const char *subcollection, const char *property, uint64_t number)
Add an unsigned long property to a collection.
Definition: collection_cnv.c:663
int col_add_bool_property(struct collection_item *ci, const char *subcollection, const char *property, unsigned char logical)
Add a Boolean property to a collection.
Definition: collection_cnv.c:709
int col_add_str_property(struct collection_item *ci, const char *subcollection, const char *property, const char *string, int length)
Add a string property to a collection.
Definition: collection_cnv.c:543
int col_add_long_property(struct collection_item *ci, const char *subcollection, const char *property, int64_t number)
Add an long property to a collection.
Definition: collection_cnv.c:639
int col_add_any_property(struct collection_item *ci, const char *subcollection, const char *property, int type, void *data, int length)
Add a property of a specified type to a collection.
Definition: collection_cnv.c:732
int col_create_collection(struct collection_item **ci, const char *name, unsigned cclass)
Create a collection.
Definition: collection.c:2410
int col_traverse_collection(struct collection_item *ci, int mode_flags, col_item_fn item_handler, void *custom_data)
Traverse collection.
Definition: collection.c:2922
int col_get_collection_count(struct collection_item *ci, unsigned *count)
Get count of the elements.
Definition: collection.c:3185
int col_get_collection_class(struct collection_item *ci, unsigned *cclass)
Get collection class.
Definition: collection.c:3166
int col_get_reference_from_item(struct collection_item *item, struct collection_item **acceptor)
Get a reference from the item.
Definition: collection.c:2654
int col_get_dup_item(struct collection_item *ci, const char *subcollection, const char *property_to_find, int type, int idx, int exact, struct collection_item **item)
Search function to get one of the duplicate items.
Definition: collection.c:420
int col_get_collection_reference(struct collection_item *ci, struct collection_item **acceptor, const char *col_to_find)
Get a reference to a collection.
Definition: collection.c:2599
int col_delete_property(struct collection_item *ci, const char *property_to_find, int type, int mode_flags)
Delete property.
Definition: collection.c:3023
int col_copy_collection(struct collection_item **col_copy, struct collection_item *col_to_copy, const char *name_to_use, int copy_mode)
Copy collection without data modification.
Definition: collection.c:2501
int col_add_collection_to_collection(struct collection_item *ci, const char *subcollection, const char *as_property, struct collection_item *ci_to_add, int mode)
Add collection to collection.
Definition: collection.c:2685
int(* col_item_fn)(const char *property, int property_len, int type, void *data, int length, void *custom_data, int *stop)
Search Callback.
Definition: collection.h:684
int col_get_item_and_do(struct collection_item *ci, const char *property_to_find, int type, int mode_flags, col_item_fn item_handler, void *custom_data)
Search and do function.
Definition: collection.c:2978
int col_copy_collection_with_cb(struct collection_item **col_copy, struct collection_item *col_to_copy, const char *name_to_use, int copy_mode, col_copy_cb copy_cb, void *ext_data)
Copy collection with data modification.
Definition: collection.c:2522
int col_set_collection_class(struct collection_item *ci, unsigned cclass)
Set collection class.
Definition: collection.c:3147
void(* col_item_cleanup_fn)(const char *property, int property_len, int type, void *data, int length, void *custom_data)
Cleanup Callback.
Definition: collection.h:507
void col_destroy_collection_with_cb(struct collection_item *ci, col_item_cleanup_fn cb, void *custom_data)
Destroy a collection with callback.
Definition: collection.c:2451
int col_is_of_class(struct collection_item *ci, unsigned cclass)
Check the class of collection.
Definition: collection.c:3206
int(* col_copy_cb)(struct collection_item *item, void *ext_data, int *skip)
Copy item callback.
Definition: collection.h:563
int col_get_item(struct collection_item *ci, const char *property_to_find, int type, int mode_flags, struct collection_item **item)
Search function to get an item.
Definition: collection.c:3001
int col_sort_collection(struct collection_item *col, unsigned cmp_flags, unsigned sort_flags)
Sort collection.
Definition: collection_cmp.c:296
int col_is_item_in_collection(struct collection_item *ci, const char *property_to_find, int type, int mode_flags, int *found)
Is property in the collection?
Definition: collection.c:2953
void col_destroy_collection(struct collection_item *ci)
Destroy a collection.
Definition: collection.c:2489
void col_delete_item(struct collection_item *item)
Delete extracted item.
Definition: collection.c:213
const char * col_get_item_property(struct collection_item *ci, int *property_len)
Get item property.
Definition: collection.c:3221
void * col_get_item_data(struct collection_item *ci)
Get value from the item.
Definition: collection.c:3241
int col_extract_item_from_current(struct collection_item *ci, int disposition, const char *refprop, int idx, int type, struct collection_item **ret_ref)
Extract item from the current collection.
Definition: collection.c:746
int col_insert_item(struct collection_item *ci, const char *subcollection, struct collection_item *item, int disposition, const char *refprop, int idx, unsigned flags)
Insert item to the collection.
Definition: collection.c:1079
int col_extract_item(struct collection_item *ci, const char *subcollection, int disposition, const char *refprop, int idx, int type, struct collection_item **ret_ref)
Extract item from the collection.
Definition: collection.c:941
int col_remove_item(struct collection_item *ci, const char *subcollection, int disposition, const char *refprop, int idx, int type)
Remove item from the collection.
Definition: collection.c:1035
int col_remove_item_from_current(struct collection_item *ci, int disposition, const char *refprop, int idx, int type)
Remove item from the current collection.
Definition: collection.c:1055
int col_get_item_length(struct collection_item *ci)
Get value length from the item.
Definition: collection.c:3235
uint64_t col_make_hash(const char *string, int sub_len, int *length)
Calculate hash value for a string.
Definition: collection.c:3257
int col_compare_items(struct collection_item *first, struct collection_item *second, unsigned in_flags, unsigned *out_flags)
Compare two items.
Definition: collection_cmp.c:51
uint64_t col_get_item_hash(struct collection_item *ci)
Get hash value from the item.
Definition: collection.c:3247
int col_insert_item_into_current(struct collection_item *ci, struct collection_item *item, int disposition, const char *refprop, int idx, unsigned flags)
Insert item to the current collection.
Definition: collection.c:474
int col_remove_item_with_cb(struct collection_item *ci, const char *subcollection, int disposition, const char *refprop, int idx, int type, col_item_cleanup_fn cb, void *custom_data)
Remove item from the collection.
Definition: collection.c:1001
void col_delete_item_with_cb(struct collection_item *item, col_item_cleanup_fn cb, void *custom_data)
Delete extracted item with callback.
Definition: collection.c:172
int col_get_item_type(struct collection_item *ci)
Get item type.
Definition: collection.c:3229
int col_modify_item(struct collection_item *item, const char *property, int type, const void *data, int length)
Modify any item element.
Definition: collection.c:3078
int col_insert_str_property_with_ref(struct collection_item *ci, const char *subcollection, int disposition, const char *refprop, int idx, unsigned flags, const char *property, const char *string, int length, struct collection_item **ret_ref)
Insert a string property and get back a reference.
Definition: collection_cnv.c:285
int col_insert_long_property(struct collection_item *ci, const char *subcollection, int disposition, const char *refprop, int idx, unsigned flags, const char *property, int64_t number)
Insert a long property.
Definition: collection_cnv.c:164
int col_insert_unsigned_property(struct collection_item *ci, const char *subcollection, int disposition, const char *refprop, int idx, unsigned flags, const char *property, uint32_t number)
Insert an unsigned property.
Definition: collection_cnv.c:133
int col_insert_int_property_with_ref(struct collection_item *ci, const char *subcollection, int disposition, const char *refprop, int idx, unsigned flags, const char *property, int32_t number, struct collection_item **ret_ref)
Insert an integer property and get back a reference.
Definition: collection_cnv.c:355
int col_insert_bool_property_with_ref(struct collection_item *ci, const char *subcollection, int disposition, const char *refprop, int idx, unsigned flags, const char *property, unsigned char logical, struct collection_item **ret_ref)
Insert a property with a Boolean value and get back a reference.
Definition: collection_cnv.c:511
int col_insert_double_property_with_ref(struct collection_item *ci, const char *subcollection, int disposition, const char *refprop, int idx, unsigned flags, const char *property, double number, struct collection_item **ret_ref)
Insert a property with a floating point value and get back a reference.
Definition: collection_cnv.c:480
int col_insert_int_property(struct collection_item *ci, const char *subcollection, int disposition, const char *refprop, int idx, unsigned flags, const char *property, int32_t number)
Insert an integer property.
Definition: collection_cnv.c:102
int col_insert_ulong_property_with_ref(struct collection_item *ci, const char *subcollection, int disposition, const char *refprop, int idx, unsigned flags, const char *property, uint64_t number, struct collection_item **ret_ref)
Insert an unsigned long property and get back a reference.
Definition: collection_cnv.c:449
int col_insert_long_property_with_ref(struct collection_item *ci, const char *subcollection, int disposition, const char *refprop, int idx, unsigned flags, const char *property, int64_t number, struct collection_item **ret_ref)
Insert a long property and get back a reference.
Definition: collection_cnv.c:418
int col_insert_bool_property(struct collection_item *ci, const char *subcollection, int disposition, const char *refprop, int idx, unsigned flags, const char *property, unsigned char logical)
Insert a property with a Boolean value.
Definition: collection_cnv.c:254
int col_insert_binary_property_with_ref(struct collection_item *ci, const char *subcollection, int disposition, const char *refprop, int idx, unsigned flags, const char *property, void *binary_data, int length, struct collection_item **ret_ref)
Insert a binary property and get back a reference.
Definition: collection_cnv.c:323
int col_insert_property_with_ref(struct collection_item *ci, const char *subcollection, int disposition, const char *refprop, int idx, unsigned flags, const char *property, int type, const void *data, int length, struct collection_item **ret_ref)
Insert property of any type and get back a reference.
Definition: collection.c:1254
int col_insert_unsigned_property_with_ref(struct collection_item *ci, const char *subcollection, int disposition, const char *refprop, int idx, unsigned flags, const char *property, uint32_t number, struct collection_item **ret_ref)
Insert an unsigned property and get back a reference.
Definition: collection_cnv.c:387
int col_insert_ulong_property(struct collection_item *ci, const char *subcollection, int disposition, const char *refprop, int idx, unsigned flags, const char *property, uint64_t number)
Insert an unsigned long property.
Definition: collection_cnv.c:194
int col_insert_binary_property(struct collection_item *ci, const char *subcollection, int disposition, const char *refprop, int idx, unsigned flags, const char *property, void *binary_data, int length)
Insert a binary property.
Definition: collection_cnv.c:70
int col_insert_double_property(struct collection_item *ci, const char *subcollection, int disposition, const char *refprop, int idx, unsigned flags, const char *property, double number)
Insert a property with a floating point value.
Definition: collection_cnv.c:224
int col_insert_str_property(struct collection_item *ci, const char *subcollection, int disposition, const char *refprop, int idx, unsigned flags, const char *property, const char *string, int length)
Insert a string property.
Definition: collection_cnv.c:37
void col_rewind_iterator(struct collection_iterator *iterator)
Rewind iterator.
Definition: collection_iter.c:410
int col_bind_iterator(struct collection_iterator **iterator, struct collection_item *ci, int mode_flags)
Bind iterator to a collection.
Definition: collection_iter.c:62
void col_pin_iterator(struct collection_iterator *iterator)
Pin iterator.
Definition: collection_iter.c:381
int col_iterate_up(struct collection_iterator *iterator, unsigned level)
Move up.
Definition: collection_iter.c:127
int col_get_iterator_depth(struct collection_iterator *iterator, int *depth)
Get current depth.
Definition: collection_iter.c:151
int col_get_item_depth(struct collection_iterator *iterator, int *depth)
Get depth of the last returned item.
Definition: collection_iter.c:168
void col_unbind_iterator(struct collection_iterator *iterator)
Unbind the iterator from the collection.
Definition: collection_iter.c:187
int col_iterate_collection(struct collection_iterator *iterator, struct collection_item **item)
Iterate collection.
Definition: collection_iter.c:200
int col_modify_unsigned_item(struct collection_item *item, const char *property, uint32_t number)
Modify item value to be an unsigned integer.
Definition: collection_cnv.c:1244
int col_modify_ulong_item(struct collection_item *item, const char *property, uint64_t number)
Modify item value to be an unsigned long.
Definition: collection_cnv.c:1229
int col_modify_str_item(struct collection_item *item, const char *property, const char *string, int length)
Modify item value to be a string.
Definition: collection_cnv.c:1145
int col_modify_double_item(struct collection_item *item, const char *property, double number)
Modify item value to be a floating point.
Definition: collection_cnv.c:1259
int col_modify_binary_item(struct collection_item *item, const char *property, void *binary_data, int length)
Modify item value to be a binary blob.
Definition: collection_cnv.c:1166
int col_modify_bool_item(struct collection_item *item, const char *property, unsigned char logical)
Modify item value to be a Boolean.
Definition: collection_cnv.c:1182
int col_modify_long_item(struct collection_item *item, const char *property, int64_t number)
Modify item value to be a long integer.
Definition: collection_cnv.c:1213
int col_modify_int_item(struct collection_item *item, const char *property, int32_t number)
Modify item value to be an integer.
Definition: collection_cnv.c:1197
int col_modify_item_property(struct collection_item *item, const char *property)
Modify item property.
Definition: collection_cnv.c:1130
int col_update_ulong_property(struct collection_item *ci, const char *property, int mode_flags, uint64_t number)
Definition: collection_cnv.c:1079
int col_update_str_property(struct collection_item *ci, const char *property, int mode_flags, char *string, int length)
Definition: collection_cnv.c:993
int col_update_double_property(struct collection_item *ci, const char *property, int mode_flags, double number)
Definition: collection_cnv.c:1096
int col_update_property(struct collection_item *ci, const char *property, int type, void *new_data, int length, int mode_flags)
Definition: collection.c:3048
int col_update_binary_property(struct collection_item *ci, const char *property, int mode_flags, void *binary_data, int length)
Definition: collection_cnv.c:1011
int col_update_unsigned_property(struct collection_item *ci, const char *property, int mode_flags, uint32_t number)
Definition: collection_cnv.c:1044
int col_update_bool_property(struct collection_item *ci, const char *property, int mode_flags, unsigned char logical)
Definition: collection_cnv.c:1113
int col_update_long_property(struct collection_item *ci, const char *property, int mode_flags, int64_t number)
Definition: collection_cnv.c:1061
int col_update_int_property(struct collection_item *ci, const char *property, int mode_flags, int32_t number)
Definition: collection_cnv.c:1028
Opaque structure that holds one property.
Opaque iterator structure.
Definition: collection.h:418