aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/eina/src/examples/eina_value_01.c
diff options
context:
space:
mode:
authorDavid Walter Seikel2013-01-13 17:29:19 +1000
committerDavid Walter Seikel2013-01-13 17:29:19 +1000
commit07274513e984f0b5544586c74508ccd16e7dcafa (patch)
treeb32ff2a9136fbc1a4a6a0ed1e4d79cde0f5f16d9 /libraries/eina/src/examples/eina_value_01.c
parentAdded Irrlicht 1.8, but without all the Windows binaries. (diff)
downloadSledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.zip
SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.gz
SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.bz2
SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.xz
Remove EFL, since it's been released now.
Diffstat (limited to 'libraries/eina/src/examples/eina_value_01.c')
-rw-r--r--libraries/eina/src/examples/eina_value_01.c53
1 files changed, 0 insertions, 53 deletions
diff --git a/libraries/eina/src/examples/eina_value_01.c b/libraries/eina/src/examples/eina_value_01.c
deleted file mode 100644
index 8a20828..0000000
--- a/libraries/eina/src/examples/eina_value_01.c
+++ /dev/null
@@ -1,53 +0,0 @@
1//Compile with:
2//gcc eina_value_01.c -o eina_value_01 `pkg-config --cflags --libs eina`
3
4#include <Eina.h>
5
6int main(int argc, char **argv)
7{
8 Eina_Value v;
9 int i;
10 char *newstr;
11
12 eina_init();
13
14 eina_value_setup(&v, EINA_VALUE_TYPE_INT);
15 eina_value_set(&v, 123);
16 eina_value_get(&v, &i);
17 printf("v=%d\n", i);
18
19 newstr = eina_value_to_string(&v);
20 printf("v as string: %s\n", newstr);
21 free(newstr); // it was allocated by eina_value_to_string()
22 eina_value_flush(&v); // destroy v contents, will not use anymore
23
24 const char *s;
25 eina_value_setup(&v, EINA_VALUE_TYPE_STRING);
26 eina_value_set(&v, "My string");
27 eina_value_get(&v, &s);
28 printf("v=%s (pointer: %p)\n", s, s);
29
30 newstr = eina_value_to_string(&v);
31 printf("v as string: %s (pointer: %p)\n", newstr, newstr);
32 free(newstr); // it was allocated by eina_value_to_string()
33 eina_value_flush(&v); // destroy v contents, string 's' is not valid anymore!
34
35 Eina_Value otherv;
36 eina_value_setup(&otherv, EINA_VALUE_TYPE_STRING);
37 eina_value_setup(&v, EINA_VALUE_TYPE_INT);
38
39 // convert from int to string:
40 eina_value_set(&v, 123);
41 eina_value_convert(&v, &otherv);
42 eina_value_get(&otherv, &s);
43 printf("otherv=%s\n", s);
44
45 // and the other way around!
46 eina_value_set(&otherv, "33");
47 eina_value_convert(&otherv, &v);
48 eina_value_get(&v, &i);
49 printf("v=%d\n", i);
50
51 eina_value_flush(&otherv);
52 eina_value_flush(&v);
53}