AcField.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright 2015 Autodesk, Inc. All rights reserved.
  4. //
  5. // Use of this software is subject to the terms of the Autodesk license
  6. // agreement provided at the time of installation or download, or which
  7. // otherwise accompanies this software in either electronic or hard copy form.
  8. //
  9. //////////////////////////////////////////////////////////////////////////////
  10. //
  11. // Name: AcField.h
  12. //
  13. // Description: AcRxObject derived API classes for fields. Contains
  14. // the following classes:
  15. // AcFdFieldEvaluator
  16. // AcFdFieldEvaluatorLoader
  17. // AcFdFieldEngine
  18. // AcFdFieldResult
  19. // AcFdFieldValue
  20. // AcFdFieldReactor
  21. //////////////////////////////////////////////////////////////////////////////
  22. #pragma once
  23. #include "adesk.h"
  24. #include "AdAChar.h"
  25. #include "AcValue.h"
  26. class AcDbField;
  27. class AcDbFieldCache;
  28. class AcFdFieldResult;
  29. class AcFdFieldEvaluator;
  30. class AcFdFieldEvaluatorLoader;
  31. class AcFdFieldEngine;
  32. class AcFdFieldValue;
  33. class AcFdImpFieldFormat;
  34. class AcDbEvalVariant;
  35. //*************************************************************************
  36. // AcFdFieldEvaluator
  37. //*************************************************************************
  38. class AcFdFieldEvaluator : public AcRxObject
  39. {
  40. public:
  41. ACRX_DECLARE_MEMBERS(AcFdFieldEvaluator);
  42. ACDB_PORT AcFdFieldEvaluator(void);
  43. ACDB_PORT virtual ~AcFdFieldEvaluator(void);
  44. ACDB_PORT virtual const ACHAR * evaluatorId(void) const;
  45. ACDB_PORT virtual const ACHAR * evaluatorId(AcDbField* pField);
  46. ACDB_PORT virtual Acad::ErrorStatus initialize(AcDbField* pField);
  47. ACDB_PORT virtual Acad::ErrorStatus compile(AcDbField* pField,
  48. AcDbDatabase* pDb,
  49. AcFdFieldResult* pResult);
  50. ACDB_PORT virtual Acad::ErrorStatus evaluate(AcDbField* pField,
  51. int nContext,
  52. AcDbDatabase* pDb,
  53. AcFdFieldResult* pResult);
  54. ACDB_PORT virtual Acad::ErrorStatus format(AcDbField* pField,
  55. ACHAR *& pszValue);
  56. protected:
  57. AcFdFieldEvaluator(void*);
  58. protected:
  59. void * mpImpObj;
  60. private:
  61. friend class AcFdSystemInternals;
  62. };
  63. //*************************************************************************
  64. // AcFdFieldEvaluatorLoader
  65. //*************************************************************************
  66. class AcFdFieldEvaluatorLoader : public AcRxObject
  67. {
  68. public:
  69. ACRX_DECLARE_MEMBERS(AcFdFieldEvaluatorLoader);
  70. ACDB_PORT AcFdFieldEvaluatorLoader(void);
  71. ACDB_PORT AcFdFieldEvaluatorLoader(void*);
  72. ACDB_PORT ~AcFdFieldEvaluatorLoader(void);
  73. ACDB_PORT virtual AcFdFieldEvaluator* getEvaluator(
  74. const ACHAR * pszEvalId);
  75. ACDB_PORT virtual AcFdFieldEvaluator * findEvaluator(AcDbField* pField,
  76. const ACHAR *& pszEvalId);
  77. protected:
  78. void * mpImpObj;
  79. private:
  80. friend class AcFdSystemInternals;
  81. };
  82. //*************************************************************************
  83. // AcFdFieldEngine
  84. //*************************************************************************
  85. class AcFdFieldEngine : public AcRxObject
  86. {
  87. public:
  88. ACRX_DECLARE_MEMBERS(AcFdFieldEngine);
  89. ACDB_PORT AcFdFieldEngine();
  90. ACDB_PORT virtual ~AcFdFieldEngine();
  91. ACDB_PORT Acad::ErrorStatus registerEvaluatorLoader(AcFdFieldEvaluatorLoader* pLoader);
  92. ACDB_PORT Acad::ErrorStatus unregisterEvaluatorLoader(AcFdFieldEvaluatorLoader* pLoader);
  93. ACDB_PORT int evaluatorLoaderCount (void) const;
  94. ACDB_PORT AcFdFieldEvaluatorLoader * getEvaluatorLoader(int iIndex);
  95. ACDB_PORT AcFdFieldEvaluator * getEvaluator (const ACHAR * pszEvalId);
  96. ACDB_PORT AcFdFieldEvaluator * findEvaluator(AcDbField* pField,
  97. const ACHAR *& pszEvalId);
  98. protected:
  99. void * mpImpObj;
  100. private:
  101. friend class AcFdSystemInternals;
  102. };
  103. //*************************************************************************
  104. // AcFdFieldResult
  105. //*************************************************************************
  106. class AcFdFieldResult : public AcRxObject
  107. {
  108. public:
  109. ACRX_DECLARE_MEMBERS(AcFdFieldResult);
  110. AcFdFieldResult(void);
  111. ACDB_PORT virtual Acad::ErrorStatus setFieldValue(const AcValue* pValue);
  112. ACDB_PORT virtual Acad::ErrorStatus setEvaluationStatus(int nStatus,
  113. int dwErrCode = 0,
  114. const ACHAR * pszMsg = NULL);
  115. };
  116. //*************************************************************************
  117. // AcFdFieldValue
  118. //*************************************************************************
  119. class AcFdFieldValue : public AcValue
  120. {
  121. public:
  122. ACRX_DECLARE_MEMBERS(AcFdFieldValue);
  123. ACDB_PORT AcFdFieldValue(void);
  124. ACDB_PORT AcFdFieldValue(AcFdFieldValue::DataType nDataType);
  125. ACDB_PORT AcFdFieldValue(const AcFdFieldValue& value);
  126. ACDB_PORT AcFdFieldValue(const ACHAR * pszValue);
  127. ACDB_PORT AcFdFieldValue(Adesk::Int32 lValue);
  128. ACDB_PORT AcFdFieldValue(double fValue);
  129. #if _ADESK_WINDOWS_
  130. ACDB_PORT AcFdFieldValue(const __time64_t& date);
  131. ACDB_PORT AcFdFieldValue(const SYSTEMTIME& date);
  132. #endif
  133. ACDB_PORT AcFdFieldValue(const AcGePoint2d& pt);
  134. ACDB_PORT AcFdFieldValue(double x, double y);
  135. ACDB_PORT AcFdFieldValue(const AcGePoint3d& pt);
  136. ACDB_PORT AcFdFieldValue(double x, double y, double z);
  137. ACDB_PORT AcFdFieldValue(const AcDbObjectId& id);
  138. ACDB_PORT AcFdFieldValue(const resbuf& rb);
  139. ACDB_PORT AcFdFieldValue(const AcDbEvalVariant& evalVar);
  140. ACDB_PORT AcFdFieldValue(const VARIANT& var);
  141. ACDB_PORT AcFdFieldValue(const void* pBuf, DWORD dwBufSize);
  142. };
  143. //*************************************************************************
  144. // AcFdFieldReactor
  145. //*************************************************************************
  146. class AcFdFieldReactor : public AcRxObject
  147. {
  148. public:
  149. ACRX_DECLARE_MEMBERS(AcFdFieldReactor);
  150. ACDB_PORT virtual Acad::ErrorStatus beginEvaluateFields(int nContext,
  151. AcDbDatabase* pDb);
  152. ACDB_PORT virtual Acad::ErrorStatus endEvaluateFields(int nContext,
  153. AcDbDatabase* pDb);
  154. };
  155. typedef AcArray<AcFdFieldReactor*> FieldReactors;
  156. //*************************************************************************
  157. // Global exported functions
  158. //*************************************************************************
  159. ACDB_PORT Acad::ErrorStatus acdbAddFieldReactor (AcFdFieldReactor* pReactor);
  160. ACDB_PORT Acad::ErrorStatus acdbRemoveFieldReactor (AcFdFieldReactor* pReactor);