AcDbAssocValueProviderPE.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. //
  12. // CREATED BY: Jiri Kripac April 2007
  13. //
  14. // DESCRIPTION:
  15. //
  16. // AcDbAssocValueProviderPE AcRx protocol extension pure virtual base class.
  17. //
  18. //////////////////////////////////////////////////////////////////////////////
  19. #pragma once
  20. #include "acdb.h"
  21. #include "dbeval.h"
  22. #include "AcDbAssocGlobal.h"
  23. #pragma pack (push, 8)
  24. /// <summary> <para>
  25. /// AcRx protocol extension pure virtual base class that defines protocol to
  26. /// get and set arbitrary simple scalar values of AcDbObjects. The values are
  27. /// identified by string names (needed if there is more than one of them for
  28. /// the same object) and their meaning is up to the implementor of the concrete
  29. /// protocol extension derived classes.
  30. /// </para> <para>
  31. /// The derived concrete classes implement this protocol for the individual
  32. /// AcDbObject classes that want to offer some named values. The immediate
  33. /// clients of this protocol are AcDbAssocVariable class that exposes this
  34. /// interface to provide the value of the variable and AcDbAssocValueDependency
  35. /// class that uses this interface to obtain the value from the dependent-on
  36. /// object.
  37. /// </para> </summary>
  38. ///
  39. class ACDB_PORT AcDbAssocValueProviderPE : public AcRxObject
  40. {
  41. public:
  42. ACRX_DECLARE_MEMBERS(AcDbAssocValueProviderPE);
  43. /// <summary>
  44. /// Checks whether it is possible to get the value identified by valueName.
  45. /// The default implementation always returns true for any valueName.
  46. /// </summary>
  47. /// <param name="pObject"> The object must be open for read. </param>
  48. /// <param name="valueName"> The name of the queried value. </param>
  49. /// <returns>
  50. /// True iff a value with the given name can be obtained. The default
  51. /// implementation always returns true.
  52. /// </returns>
  53. ///
  54. virtual bool canGetValue(const AcDbObject* pObject, const AcString& valueName) {
  55. UNREFERENCED_PARAMETER(pObject);
  56. UNREFERENCED_PARAMETER(valueName);
  57. return true;
  58. }
  59. /// <summary>
  60. /// Checks whether it is possible to set the value identified by valueName.
  61. /// The default implementation always returns false for any valueName.
  62. /// </summary>
  63. /// <param name="pObject"> The object must be open for read. </param>
  64. /// <param name="valueName"> The name of the queried value. </param>
  65. /// <returns>
  66. /// True iff a value with the given name can be changed. The default
  67. /// implementation always returns false.
  68. /// </returns>
  69. ///
  70. virtual bool canSetValue(const AcDbObject* pObject, const AcString& valueName) {
  71. UNREFERENCED_PARAMETER(pObject);
  72. UNREFERENCED_PARAMETER(valueName);
  73. return false;
  74. }
  75. /// <summary>
  76. /// Gets the value identified by valueName. This method must always be
  77. /// overridden by concrete derived classes.
  78. /// </summary>
  79. /// <param name="pObject"> The object must be open for read. </param>
  80. /// <param name="valueName"> The name of the queried value. </param>
  81. /// <param name="value"> The returned value. </param>
  82. /// <returns> Acad::ErrorStatus. </returns>
  83. ///
  84. virtual Acad::ErrorStatus getValue(const AcDbObject* pObject,
  85. const AcString& valueName,
  86. AcDbEvalVariant& value) = NULL;
  87. /// <summary>
  88. /// Sets the value identified by valueName. The default implementation always
  89. /// returns Acad::eNotHandled for any valueName.
  90. /// </summary>
  91. /// <param name="pObject"> The object must be open for write. </param>
  92. /// <param name="valueName"> The name of the value to be set. </param>
  93. /// <param name="newValue"> The new value. </param>
  94. /// <returns> Acad::ErrorStatus. </returns>
  95. ///
  96. virtual Acad::ErrorStatus setValue(AcDbObject* pObject,
  97. const AcString& valueName,
  98. const AcDbEvalVariant& newValue)
  99. {
  100. UNREFERENCED_PARAMETER(pObject);
  101. UNREFERENCED_PARAMETER(valueName);
  102. UNREFERENCED_PARAMETER(newValue);
  103. return Acad::eNotHandled;
  104. }
  105. /// <summary>
  106. /// Simple utility methods that open the object, query for its AcDbAssocValueProviderPE
  107. /// and get/set the value with the given name.
  108. /// </summary>
  109. ///
  110. static Acad::ErrorStatus getObjectValue(const AcDbObjectId&, const AcString& valueName, AcDbEvalVariant& value);
  111. static Acad::ErrorStatus setObjectValue(const AcDbObjectId&, const AcString& valueName, const AcDbEvalVariant& value);
  112. }; // class AcDbAssocValueProviderPE
  113. #pragma pack (pop)