rxmethod.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. //
  2. //////////////////////////////////////////////////////////////////////////////
  3. //
  4. // Copyright 2015 Autodesk, Inc. All rights reserved.
  5. //
  6. // Use of this software is subject to the terms of the Autodesk license
  7. // agreement provided at the time of installation or download, or which
  8. // otherwise accompanies this software in either electronic or hard copy form.
  9. //
  10. //////////////////////////////////////////////////////////////////////////////
  11. #pragma once
  12. #include "acbasedefs.h"
  13. #include "adesk.h"
  14. #include "acadstrc.h"
  15. #include "rxmember.h"
  16. class AcRxValue;
  17. class AcRxMethodImp;
  18. class AcRxMethodIteratorImp;
  19. //*************************************************************************
  20. // AcRxMemberQueryEngine
  21. //*************************************************************************
  22. /// <summary>
  23. /// This class defines a method.
  24. /// </summary>
  25. ///
  26. class AcRxMethod : public AcRxMember
  27. {
  28. public:
  29. ACRX_DECLARE_MEMBERS_EXPIMP(AcRxMethod, ACBASE_PORT);
  30. /// <summary>
  31. /// This method is called to execute a method.
  32. ///
  33. /// </summary>
  34. ///
  35. /// <param name="pO">
  36. /// Input object that the method is applicable.
  37. /// </param>
  38. ///
  39. /// <param name="param">
  40. /// Reference to AcRxValue object that the method can set.
  41. /// </param>
  42. ///
  43. /// <returns> Returns Acad::eOk if successful; otherwise, returns an AutoCAD error status. </returns>
  44. ///
  45. ACBASE_PORT Acad::ErrorStatus invoke(AcRxObject* pO, AcRxValue& param) const;
  46. /// <summary>
  47. /// This method is called to check if the method can be executed.
  48. ///
  49. /// </summary>
  50. ///
  51. /// <param name="pO">
  52. /// Input object that the method is applicable.
  53. /// </param>
  54. ///
  55. /// <param name="param">
  56. /// Input reference to AcRxValue object that the method can use.
  57. /// </param>
  58. ///
  59. /// <returns> Returns Acad::eOk if successful; otherwise, returns an AutoCAD error status. </returns>
  60. ///
  61. ACBASE_PORT Acad::ErrorStatus isExecutable(const AcRxObject* pO, const AcRxValue& param) const;
  62. protected:
  63. /// <summary>
  64. /// Destructor
  65. /// </summary>
  66. ///
  67. ACBASE_PORT ~AcRxMethod();
  68. /// <summary>
  69. /// Constructor
  70. /// </summary>
  71. ///
  72. /// <param name="name">
  73. /// Input name of the method.
  74. /// </param>
  75. ///
  76. /// <param name="type">
  77. /// Input reference to type of the member.
  78. /// </param>
  79. ///
  80. ACBASE_PORT AcRxMethod(const ACHAR* name, const AcRxValueType& type);
  81. /// <summary>
  82. /// Derived classes can override this method to execute the method.
  83. /// </summary>
  84. ///
  85. /// <param name="pO">
  86. /// Input object that the method is applicable.
  87. /// </param>
  88. ///
  89. /// <param name="param">
  90. /// Reference to AcRxValue object that the method can set.
  91. /// </param>
  92. ///
  93. /// <returns> Returns Acad::eOk if successful; otherwise, returns an AutoCAD error status. </returns>
  94. ///
  95. virtual Acad::ErrorStatus subInvoke(AcRxObject* pO, AcRxValue& param) const;
  96. /// <summary>
  97. /// Derived classes can override this method to return a status, if the method can executed
  98. /// in its current state.
  99. /// </summary>
  100. ///
  101. /// <param name="pO">
  102. /// Input object that the method is applicable.
  103. /// </param>
  104. ///
  105. /// <param name="param">
  106. /// Input reference to AcRxValue object that the method can use.
  107. /// </param>
  108. ///
  109. /// <returns> Returns Acad::eOk if successful; otherwise, returns an AutoCAD error status. </returns>
  110. ///
  111. virtual Acad::ErrorStatus subIsExecutable(const AcRxObject* pO, const AcRxValue& param) const;
  112. protected:
  113. friend class AcRxMethodImp;
  114. ACBASE_PORT AcRxMethod(AcRxMethodImp*);
  115. };