NodePath.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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(const String &from)
  11. {
  12. godot_node_path_new(&_node_path, (godot_string *) &from);
  13. }
  14. String get_name(const int idx) const
  15. {
  16. godot_string str = godot_node_path_get_name(&_node_path, idx);
  17. return *(String *) &str;
  18. }
  19. int get_name_count() const
  20. {
  21. return godot_node_path_get_name_count(&_node_path);
  22. }
  23. String get_property() const
  24. {
  25. godot_string str = godot_node_path_get_property(&_node_path);
  26. return *(String *) &str;
  27. }
  28. String get_subname(const int idx) const
  29. {
  30. godot_string str = godot_node_path_get_subname(&_node_path, idx);
  31. return *(String *) &str;
  32. }
  33. int get_subname_count() const
  34. {
  35. return godot_node_path_get_subname_count(&_node_path);
  36. }
  37. bool is_absolute() const
  38. {
  39. return godot_node_path_is_absolute(&_node_path);
  40. }
  41. bool is_empty() const
  42. {
  43. return godot_node_path_is_empty(&_node_path);
  44. }
  45. operator String() const
  46. {
  47. godot_string str = godot_node_path_as_string(&_node_path);
  48. return *(String *) &str;
  49. }
  50. ~NodePath()
  51. {
  52. godot_node_path_destroy(&_node_path);
  53. }
  54. };
  55. }
  56. #endif // NODEPATH_H