JSBFunction.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. //
  2. // Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
  3. // LICENSE: Atomic Game Engine Editor and Tools EULA
  4. // Please see LICENSE_ATOMIC_EDITOR_AND_TOOLS.md in repository root for
  5. // license information: https://github.com/AtomicGameEngine/AtomicGameEngine
  6. //
  7. #include "JSBFunction.h"
  8. namespace ToolCore
  9. {
  10. void JSBFunction::Process()
  11. {
  12. if (skip_)
  13. {
  14. return;
  15. }
  16. // if not already marked as a getter
  17. if (!isGetter_)
  18. {
  19. if (!parameters_.Size() && returnType_)
  20. {
  21. if (name_.Length() > 3 && name_.StartsWith("Get") && isupper(name_[3]))
  22. {
  23. String pname = name_.Substring(3);
  24. class_->SetSkipFunction(pname);
  25. isGetter_ = true;
  26. propertyName_ = pname;
  27. }
  28. }
  29. }
  30. if (!isSetter_)
  31. {
  32. if (parameters_.Size() == 1 && !returnType_)
  33. {
  34. if (name_.Length() > 3 && name_.StartsWith("Set") && isupper(name_[3]))
  35. {
  36. String pname = name_.Substring(3);
  37. class_->SetSkipFunction(pname);
  38. isSetter_ = true;
  39. propertyName_ = pname;
  40. }
  41. }
  42. }
  43. if (isGetter_)
  44. class_->AddPropertyFunction(this);
  45. if (isSetter_)
  46. class_->AddPropertyFunction(this);
  47. }
  48. JSBClass* JSBFunction::GetReturnClass()
  49. {
  50. if (!returnType_)
  51. return 0;
  52. if (!returnType_->type_->asClassType())
  53. return 0;
  54. return returnType_->type_->asClassType()->class_;
  55. }
  56. }