embedding: cef_string_multimap_value()

This commit is contained in:
Mike Blumenkrantz 2014-11-10 18:19:14 -05:00
parent ce3e9fb511
commit ef288f1195

View file

@ -114,3 +114,22 @@ pub extern "C" fn cef_string_multimap_key(smm: *mut cef_string_multimap_t, index
}
0
}
#[no_mangle]
pub extern "C" fn cef_string_multimap_value(smm: *mut cef_string_multimap_t, index: c_int, value: *mut cef_string_t) -> c_int {
unsafe {
if index < 0 || smm.is_null() { return 0; }
let v = string_multimap_to_treemap(smm);
let mut rem = index as uint;
for (_, val) in (*v).values().enumerate() {
if rem < (*val).len() {
let cs = (*val)[rem as uint];
return cef_string_utf8_set((*cs).str as *const u8, (*cs).length, value, 1);
} else {
rem = rem - (*val).len();
}
}
}
0
}