libcef.string_map.cs 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. //
  2. // This file manually written from cef/include/internal/cef_string_map.h
  3. //
  4. namespace Xilium.CefGlue.Interop
  5. {
  6. using System;
  7. using System.Runtime.InteropServices;
  8. using System.Security;
  9. internal static unsafe partial class libcef
  10. {
  11. // Allocate a new string map.
  12. [DllImport(DllName, EntryPoint = "cef_string_map_alloc", CallingConvention = CEF_CALL)]
  13. public static extern cef_string_map* string_map_alloc();
  14. // Return the number of elements in the string map.
  15. [DllImport(DllName, EntryPoint = "cef_string_map_size", CallingConvention = CEF_CALL)]
  16. private static extern UIntPtr string_map_size_core(cef_string_map* map);
  17. public static int string_map_size(cef_string_map* map)
  18. {
  19. return checked((int)string_map_size_core(map));
  20. }
  21. // Return the value assigned to the specified key.
  22. [DllImport(DllName, EntryPoint = "cef_string_map_find", CallingConvention = CEF_CALL)]
  23. public static extern int string_map_find(cef_string_map* map, cef_string_t* key, cef_string_t* value);
  24. // Return the key at the specified zero-based string map index.
  25. [DllImport(DllName, EntryPoint = "cef_string_map_key", CallingConvention = CEF_CALL)]
  26. private static extern int string_map_key_core(cef_string_map* map, UIntPtr index, cef_string_t* key);
  27. public static int string_map_key(cef_string_map* map, int index, cef_string_t* key)
  28. {
  29. return string_map_key_core(map, checked((UIntPtr)index), key);
  30. }
  31. // Return the value at the specified zero-based string map index.
  32. [DllImport(DllName, EntryPoint = "cef_string_map_value", CallingConvention = CEF_CALL)]
  33. private static extern int string_map_value_core(cef_string_map* map, UIntPtr index, cef_string_t* value);
  34. public static int string_map_value(cef_string_map* map, int index, cef_string_t* value)
  35. {
  36. return string_map_value_core(map, checked((UIntPtr)index), value);
  37. }
  38. // Append a new key/value pair at the end of the string map.
  39. [DllImport(DllName, EntryPoint = "cef_string_map_append", CallingConvention = CEF_CALL)]
  40. public static extern int string_map_append(cef_string_map* map, cef_string_t* key, cef_string_t* value);
  41. // Clear the string map.
  42. [DllImport(DllName, EntryPoint = "cef_string_map_clear", CallingConvention = CEF_CALL)]
  43. public static extern void string_map_clear(cef_string_map* map);
  44. // Free the string map.
  45. [DllImport(DllName, EntryPoint = "cef_string_map_free", CallingConvention = CEF_CALL)]
  46. public static extern void string_map_free(cef_string_map* map);
  47. }
  48. }