gen-class-hashtable.nut 965 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. class HashTable
  2. {
  3. /*
  4. A CursorKind describes the kind of entity that a cursor points to.
  5. */
  6. // The required BaseEnumeration declarations.
  7. _ht = null;
  8. constructor(int_size = 0)
  9. {
  10. _ht = {};
  11. }
  12. function len(int_size)
  13. {
  14. //Test if this is a declaration kind.
  15. return _ht.len();
  16. }
  17. function newSlot(str_key, value)
  18. {
  19. _ht.rawset(str_key, value);
  20. }
  21. function set(str_key, value)
  22. {
  23. _ht.rawset(str_key, value);
  24. }
  25. function get(str_key, default_value)
  26. {
  27. return _ht.rawget(str_key, default_value);
  28. }
  29. function exists(str_key)
  30. {
  31. return _ht.rawget(str_key);
  32. }
  33. function remove(key)
  34. {
  35. _ht.rawdelete(key);
  36. }
  37. function clear()
  38. {
  39. }
  40. function next()
  41. {
  42. }
  43. function tostring()
  44. {
  45. return format("HashTable.%s", name);
  46. }
  47. }
  48. dofile("generate-cpp-class-wrapper.nut");
  49. generateCppClassWrapper(HashTable, "HashTable");