NodePath.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #ifndef NODEPATH_H
  2. #define NODEPATH_H
  3. #include "String.h"
  4. #include <godot/godot_node_path.h>
  5. namespace godot {
  6. class NodePath
  7. {
  8. godot_node_path _node_path;
  9. public:
  10. NodePath()
  11. {
  12. }
  13. NodePath(const String &from)
  14. {
  15. godot_node_path_new(&_node_path, (godot_string *) &from);
  16. }
  17. String get_name(const int idx) const
  18. {
  19. godot_string str = godot_node_path_get_name(&_node_path, idx);
  20. return *(String *) &str;
  21. }
  22. int get_name_count() const
  23. {
  24. return godot_node_path_get_name_count(&_node_path);
  25. }
  26. String get_property() const
  27. {
  28. godot_string str = godot_node_path_get_property(&_node_path);
  29. return *(String *) &str;
  30. }
  31. String get_subname(const int idx) const
  32. {
  33. godot_string str = godot_node_path_get_subname(&_node_path, idx);
  34. return *(String *) &str;
  35. }
  36. int get_subname_count() const
  37. {
  38. return godot_node_path_get_subname_count(&_node_path);
  39. }
  40. bool is_absolute() const
  41. {
  42. return godot_node_path_is_absolute(&_node_path);
  43. }
  44. bool is_empty() const
  45. {
  46. return godot_node_path_is_empty(&_node_path);
  47. }
  48. operator String() const
  49. {
  50. godot_string str = godot_node_path_as_string(&_node_path);
  51. return *(String *) &str;
  52. }
  53. ~NodePath()
  54. {
  55. godot_node_path_destroy(&_node_path);
  56. }
  57. };
  58. }
  59. #endif // NODEPATH_H