Add map.
This commit is contained in:
parent
9a97f81143
commit
a835d115cb
4 changed files with 429 additions and 0 deletions
|
@ -29,12 +29,14 @@
|
|||
#include "object.h"
|
||||
#include "string.h"
|
||||
#include "array.h"
|
||||
#include "map.h"
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
CFWString *s[3];
|
||||
CFWArray *a;
|
||||
CFWMap *m;
|
||||
size_t i;
|
||||
|
||||
s[0] = cfw_new(cfw_string, "Hallo");
|
||||
|
@ -62,5 +64,26 @@ main()
|
|||
|
||||
cfw_unref(s[0]);
|
||||
|
||||
s[0] = cfw_new(cfw_string, "Hallo");
|
||||
s[1] = cfw_new(cfw_string, "Welt!");
|
||||
|
||||
m = cfw_new(cfw_map, s[0], s[1], NULL);
|
||||
|
||||
cfw_unref(s[1]);
|
||||
|
||||
puts(cfw_string_c(cfw_map_get(m, s[0])));
|
||||
|
||||
s[1] = cfw_new(cfw_string, "Test");
|
||||
cfw_map_set(m, s[0], s[1]);
|
||||
cfw_unref(s[1]);
|
||||
|
||||
puts(cfw_string_c(cfw_map_get(m, s[0])));
|
||||
|
||||
cfw_map_set(m, s[0], NULL);
|
||||
printf("%p\n", cfw_map_get(m, s[0]));
|
||||
|
||||
cfw_unref(s[0]);
|
||||
cfw_unref(m);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue