|
@ -38,8 +38,8 @@ void generator( |
|
|
tstring* hash_decl = tstring_n_compose("ctctctctc", |
|
|
tstring* hash_decl = tstring_n_compose("ctctctctc", |
|
|
"size_t ",K_hash_func,"(void*);\n" |
|
|
"size_t ",K_hash_func,"(void*);\n" |
|
|
"struct ",prefix,"_hashtype{\n" |
|
|
"struct ",prefix,"_hashtype{\n" |
|
|
"size_t operator()(",key_type," key) {\n" |
|
|
|
|
|
"return ", K_hash_func, "(key);\n" |
|
|
|
|
|
|
|
|
"size_t operator()(const ",key_type,"& key) {\n" |
|
|
|
|
|
"return ", K_hash_func, "((void*)&key);\n" |
|
|
"}\n" |
|
|
"}\n" |
|
|
"};\n" |
|
|
"};\n" |
|
|
); |
|
|
); |
|
@ -71,7 +71,7 @@ void generator( |
|
|
tstring* hashmap_get_decl = tstring_n_compose("tctctctc", |
|
|
tstring* hashmap_get_decl = tstring_n_compose("tctctctc", |
|
|
accessor_type, " ", prefix, "_hm_get(",hashmap_ptr_type," ptr, ",key_type,"* k);\n" |
|
|
accessor_type, " ", prefix, "_hm_get(",hashmap_ptr_type," ptr, ",key_type,"* k);\n" |
|
|
); |
|
|
); |
|
|
tstring* hashmap_endget_decl = tstring_n_compose("ctctctc", |
|
|
|
|
|
|
|
|
tstring* hashmap_endget_decl = tstring_n_compose("ctctc", |
|
|
"void ", prefix, "_hm_endget(",accessor_type," acc);\n" |
|
|
"void ", prefix, "_hm_endget(",accessor_type," acc);\n" |
|
|
); |
|
|
); |
|
|
tstring* hashmap_remove_decl = tstring_n_compose("ctctctc", |
|
|
tstring* hashmap_remove_decl = tstring_n_compose("ctctctc", |
|
@ -134,7 +134,7 @@ void generator( |
|
|
accessor_type, " acc;\n" |
|
|
accessor_type, " acc;\n" |
|
|
" auto obtained = (",to_cpp_hashmap_cast,"ptr)->get(*k);\n" |
|
|
" auto obtained = (",to_cpp_hashmap_cast,"ptr)->get(*k);\n" |
|
|
" if(obtained) {\n" |
|
|
" if(obtained) {\n" |
|
|
" acc.value = (void*)new accessor<",value_type,">(obtained.value());\n" |
|
|
|
|
|
|
|
|
" acc.value = (void*)new mct20::accessor<",value_type,">(obtained.value());\n" |
|
|
" } else {\n" |
|
|
" } else {\n" |
|
|
" acc.value = nullptr;\n" |
|
|
" acc.value = nullptr;\n" |
|
|
" }\n" |
|
|
" }\n" |
|
@ -142,7 +142,7 @@ void generator( |
|
|
); |
|
|
); |
|
|
tstring* hashmap_endget_impl = tstring_n_compose("ctctctc", |
|
|
tstring* hashmap_endget_impl = tstring_n_compose("ctctctc", |
|
|
"void ", prefix, "_hm_endget(",accessor_type," acc) {\n" |
|
|
"void ", prefix, "_hm_endget(",accessor_type," acc) {\n" |
|
|
" delete (accessor<",value_type,">*)acc.value;\n" |
|
|
|
|
|
|
|
|
" delete (mct20::accessor<",value_type,">*)acc.value;\n" |
|
|
"}\n" |
|
|
"}\n" |
|
|
); |
|
|
); |
|
|
tstring* hashmap_remove_impl = tstring_n_compose("ctctctctc", |
|
|
tstring* hashmap_remove_impl = tstring_n_compose("ctctctctc", |
|
@ -195,7 +195,7 @@ void generator( |
|
|
} |
|
|
} |
|
|
if( |
|
|
if( |
|
|
tstring_n_write( |
|
|
tstring_n_write( |
|
|
source,21, |
|
|
|
|
|
|
|
|
source,22, |
|
|
top_guard, |
|
|
top_guard, |
|
|
cpp_header_include, |
|
|
cpp_header_include, |
|
|
extc_top_guard, |
|
|
extc_top_guard, |
|
|