NodePath.cpp 1.2 KB

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