diff options
Diffstat (limited to 'libraries/eina/src/examples/eina_array_02.c')
-rw-r--r-- | libraries/eina/src/examples/eina_array_02.c | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/libraries/eina/src/examples/eina_array_02.c b/libraries/eina/src/examples/eina_array_02.c deleted file mode 100644 index 6b2903b..0000000 --- a/libraries/eina/src/examples/eina_array_02.c +++ /dev/null | |||
@@ -1,57 +0,0 @@ | |||
1 | //Compile with: | ||
2 | //gcc -g eina_array_02.c -o eina_array_02 `pkg-config --cflags --libs eina` | ||
3 | |||
4 | #include <stdio.h> | ||
5 | #include <string.h> | ||
6 | |||
7 | #include <Eina.h> | ||
8 | |||
9 | Eina_Bool keep(void *data, void *gdata) | ||
10 | { | ||
11 | if (strlen((const char*)data) <= 5) | ||
12 | return EINA_TRUE; | ||
13 | return EINA_FALSE; | ||
14 | } | ||
15 | |||
16 | int | ||
17 | main(int argc, char **argv) | ||
18 | { | ||
19 | const char* strs[] = { | ||
20 | "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", | ||
21 | "ten", "eleven", "twelve", "thirteen", "fourtenn", "fifteen", "sixteen", | ||
22 | "seventeen", "eighteen", "nineteen", "twenty" | ||
23 | }; | ||
24 | const char* strings[] = { | ||
25 | "helo", "hera", "starbuck", "kat", "boomer", | ||
26 | "hotdog", "longshot", "jammer", "crashdown", "hardball", | ||
27 | "duck", "racetrack", "apolo", "husker", "freaker", | ||
28 | "skulls", "bulldog", "flat top", "hammerhead", "gonzo" | ||
29 | }; | ||
30 | Eina_Array *array; | ||
31 | Eina_Array_Iterator iterator; | ||
32 | const char *item; | ||
33 | unsigned int i; | ||
34 | |||
35 | eina_init(); | ||
36 | |||
37 | array = eina_array_new(10); | ||
38 | |||
39 | for (i = 0; i < 20; i++) | ||
40 | eina_array_push(array, strs[i]); | ||
41 | |||
42 | eina_array_clean(array); | ||
43 | for (i = 0; i < 20; i++) | ||
44 | eina_array_push(array, strings[i]); | ||
45 | |||
46 | eina_array_data_set(array, 17, "flattop"); | ||
47 | |||
48 | eina_array_remove(array, keep, NULL); | ||
49 | EINA_ARRAY_ITER_NEXT(array, i, item, iterator) | ||
50 | printf("item #%d: %s\n", i, item); | ||
51 | |||
52 | eina_array_free(array); | ||
53 | |||
54 | eina_shutdown(); | ||
55 | |||
56 | return 0; | ||
57 | } | ||