CFx SDK Documentation  2020SP3
FdField.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2017, Open Design Alliance (the "Alliance").
3 // All rights reserved.
4 //
5 // This software and its documentation and related materials are owned by
6 // the Alliance. The software may only be incorporated into application
7 // programs owned by members of the Alliance, subject to a signed
8 // Membership Agreement and Supplemental Software License Agreement with the
9 // Alliance. The structure and organization of this software are the valuable
10 // trade secrets of the Alliance and its suppliers. The software is also
11 // protected by copyright law and international treaty provisions. Application
12 // programs incorporating this software must include the following statement
13 // with their copyright notices:
14 //
15 // This application incorporates Teigha(R) software pursuant to a license
16 // agreement with Open Design Alliance.
17 // Teigha(R) Copyright (C) 2002-2017 by Open Design Alliance.
18 // All rights reserved.
19 //
20 // By use of this software, its documentation or related materials, you
21 // acknowledge and accept the above terms.
23 
24 
25 #ifndef _FdField_h_Included_
26 #define _FdField_h_Included_
27 
28 #include "RxObject.h"
29 #include "RxDictionary.h"
30 #include "DbField.h"
31 
32 class OdDbField;
33 class OdDbEvalVariant;
34 class OdFieldValue;
35 class OdFdFieldEngineImpl;
36 class OdFdFieldResult;
37 class OdDbDatabase;
38 
39 #include "TD_PackPush.h"
40 
52 {
53 public:
55 
63  virtual const OdString evaluatorId() const = 0;
73  virtual const OdString evaluatorId(OdDbField* pField) const = 0;
84  virtual OdResult initialize(OdDbField* pField) const = 0;
85 
86 // The field framework calls this method to compile a field when the field code is changed.
87 
99  virtual OdResult compile(OdDbField* pField,
100  OdDbDatabase* pDb,
101  OdFdFieldResult* pResult) const = 0;
102 
103 // The field framework calls this method to evaluate a field whenever the field needs
104 // to be evaluated.
105 
133  virtual OdResult evaluate(OdDbField* pField,
134  int nContext,
135  OdDbDatabase* pDb,
136  OdFdFieldResult* pResult) const = 0;
137 
138 // The field framework calls this method when a field is queried
139 // to get the evaluated field value as a string. The evaluator can
140 
153  virtual OdResult format(OdDbField* pField, OdString& pszValue) const = 0;
154 };
155 
157 
171 {
172 public:
174 
181  const OdString& pszEvalId) = 0;
182 
189  OdDbField* pField,
190  OdString& pszEvalId) = 0;
191 };
192 
198 {
199 public:
201 
207  virtual void beginEvaluateFields(
208  int nContext,
209  OdDbDatabase* pDb);
210 
216  virtual void endEvaluateFields(
217  int nContext,
218  OdDbDatabase* pDb);
219 };
220 
222 
233 {
234 public:
236  virtual ~OdFdFieldEngine(){}
246 
256 
260  virtual int evaluatorLoaderCount() const = 0;
261 
269  virtual OdFdFieldEvaluatorLoader * getEvaluatorLoader(int inputIndex) = 0;
270 
278  const OdString& pszEvalId) = 0;
279 
291  OdDbField* pField,
292  OdString& pszEvalId) = 0;
293 
298  virtual void addFieldReactor(OdFdFieldReactor* pReactor) = 0;
299 
304  virtual void removeFieldReactor(OdFdFieldReactor* pReactor) = 0;
305 };
306 
308 #define ODFD_FIELD_ENGINE OD_T("FieldEngine")
309 
313 
316  const OdString& sValue = L"%ls"); // value to keep result of previous evaluation
317 
327 {
328 public:
331 
338  virtual void setFieldValue(const OdFieldValue* pValue) = 0;
339 
346  virtual void setEvaluationStatus(OdDbField::EvalStatus errorStatus, int errorCode = 0, const OdString& errorMessage = OdString()) = 0;
347 };
348 
355 {
356 public:
368  virtual bool getSheetSetProperty(OdString& propValue, const OdString& compName, const OdString& propName, OdDbDatabase* pDb) = 0;
369 
380  virtual bool parseObjProp(const OdString& prop, OdDbDatabase* pDb, OdDbObjectId& objId, OdString& propName) = 0;
381 
391  virtual bool getObjPropValue(const OdString& propName, const OdDbObjectId& objId, OdFdFieldResult& result) = 0;
392 
399  virtual OdDbDatabase* getCurrentDb() = 0;
400 
409  virtual OdString getFileName(OdDbDatabase* pDb) = 0;
410 
417  virtual void getLispVariable(const OdString& lispVar, OdFieldValue& fValue) = 0;
418 
426  virtual OdDbObjectId getOwnerTable(const OdDbField* field) = 0;
427 };
428 
430 
443  OdDbDatabase* pDb,
444  int nContext,
445  const OdDbObjectIdArray* objIds = 0,
446  const OdDbObjectIdArray* pFieldsToEvaluate = 0,
447  const OdString& pszEvaluatorId = OdString(),
449  int* pNumFound = 0,
450  int* pNumEvaluated = 0);
451 
452 
453 #include "TD_PackPop.h"
454 
455 #endif //_FdField_h_Included_
OdResult
OdResult
Definition: OdResult.h:29
OdString
Definition: OdString.h:95
OdDbDatabase
Definition: DbDatabase.h:421
oddbSetFieldEngineValueFormatByError
TOOLKIT_EXPORT OdString oddbSetFieldEngineValueFormatByError(const OdString &sValue=L"%ls")
OdFdFieldEvaluator::evaluate
virtual OdResult evaluate(OdDbField *pField, int nContext, OdDbDatabase *pDb, OdFdFieldResult *pResult) const =0
OdFdFieldEvaluator::format
virtual OdResult format(OdDbField *pField, OdString &pszValue) const =0
OdFdFieldEvaluator
Definition: FdField.h:52
OdFdFieldEngine::removeFieldReactor
virtual void removeFieldReactor(OdFdFieldReactor *pReactor)=0
OdFdFieldEngine::unregisterEvaluatorLoader
virtual void unregisterEvaluatorLoader(OdFdFieldEvaluatorLoader *pLoader)=0
OdDbField::EvalStatus
EvalStatus
Definition: DbField.h:115
OdFdFieldEngine::evaluatorLoaderCount
virtual int evaluatorLoaderCount() const =0
OdFdFieldEnginePE::getObjPropValue
virtual bool getObjPropValue(const OdString &propName, const OdDbObjectId &objId, OdFdFieldResult &result)=0
OdRxObject
Definition: RxObject.h:564
OdDbObjectId
Definition: DbObjectId.h:99
OdFdFieldEngine::getEvaluatorLoader
virtual OdFdFieldEvaluatorLoader * getEvaluatorLoader(int inputIndex)=0
OdFdFieldEvaluator::initialize
virtual OdResult initialize(OdDbField *pField) const =0
OdFdFieldResult
Definition: FdField.h:327
OdArray
Definition: OdArray.h:591
TD_PackPop.h
OdFdFieldEvaluatorLoader::findEvaluator
virtual OdFdFieldEvaluator * findEvaluator(OdDbField *pField, OdString &pszEvalId)=0
OdFieldValue
Definition: DbFieldValue.h:49
OdFd::EvalFields
EvalFields
Definition: DbField.h:50
RxObject.h
OdFdFieldEnginePE::ODRX_DECLARE_MEMBERS
ODRX_DECLARE_MEMBERS(OdFdFieldEnginePE)
OdFdFieldReactor::beginEvaluateFields
virtual void beginEvaluateFields(int nContext, OdDbDatabase *pDb)
OdFdFieldEngine::findEvaluator
virtual OdFdFieldEvaluator * findEvaluator(OdDbField *pField, OdString &pszEvalId)=0
OdFdFieldEnginePE::getCurrentDb
virtual OdDbDatabase * getCurrentDb()=0
OdFdFieldEvaluator::ODRX_DECLARE_MEMBERS
ODRX_DECLARE_MEMBERS(OdFdFieldEvaluator)
OdString
OdString OdString
Definition: OdString.h:1224
OdFdFieldEvaluatorLoader::getEvaluator
virtual OdFdFieldEvaluator * getEvaluator(const OdString &pszEvalId)=0
OdSmartPtr
Definition: SmartPtr.h:58
OdFdFieldEvaluator::evaluatorId
virtual const OdString evaluatorId(OdDbField *pField) const =0
OdFdFieldEnginePE::getFileName
virtual OdString getFileName(OdDbDatabase *pDb)=0
OdFdFieldReactor::ODRX_DECLARE_MEMBERS
ODRX_DECLARE_MEMBERS(OdFdFieldReactor)
DbField.h
OdFdFieldEnginePE::parseObjProp
virtual bool parseObjProp(const OdString &prop, OdDbDatabase *pDb, OdDbObjectId &objId, OdString &propName)=0
oddbGetFieldEngine
TOOLKIT_EXPORT OdFdFieldEnginePtr oddbGetFieldEngine()
OdFdFieldEngine::getEvaluator
virtual OdFdFieldEvaluator * getEvaluator(const OdString &pszEvalId)=0
OdFdFieldEngine::ODRX_DECLARE_MEMBERS
ODRX_DECLARE_MEMBERS(OdFdFieldEngine)
OdFdFieldReactor::endEvaluateFields
virtual void endEvaluateFields(int nContext, OdDbDatabase *pDb)
OdFd::kEvalRecursive
@ kEvalRecursive
Definition: DbField.h:51
OdFdFieldEngine::registerEvaluatorLoader
virtual void registerEvaluatorLoader(OdFdFieldEvaluatorLoader *pLoader)=0
OdFdFieldEvaluator::compile
virtual OdResult compile(OdDbField *pField, OdDbDatabase *pDb, OdFdFieldResult *pResult) const =0
OdFdFieldEnginePE::getLispVariable
virtual void getLispVariable(const OdString &lispVar, OdFieldValue &fValue)=0
OdFdFieldEnginePE
Definition: FdField.h:355
FieldReactors
OdArray< OdFdFieldReactor * > FieldReactors
Definition: FdField.h:221
TD_PackPush.h
OdFdFieldEvaluatorLoader::ODRX_DECLARE_MEMBERS
ODRX_DECLARE_MEMBERS(OdFdFieldEvaluatorLoader)
OdFdFieldEngine::~OdFdFieldEngine
virtual ~OdFdFieldEngine()
Definition: FdField.h:236
oddbGetFieldEngineValueByError
TOOLKIT_EXPORT OdString oddbGetFieldEngineValueByError(const OdString &sPrevValue)
OdDbField
Definition: DbField.h:79
OdFdFieldResult::setEvaluationStatus
virtual void setEvaluationStatus(OdDbField::EvalStatus errorStatus, int errorCode=0, const OdString &errorMessage=OdString())=0
OdFdFieldEvaluator::evaluatorId
virtual const OdString evaluatorId() const =0
OdFdFieldEvaluatorLoader
Definition: FdField.h:171
OdFdFieldEngine
Definition: FdField.h:233
TOOLKIT_EXPORT
#define TOOLKIT_EXPORT
Definition: DbExport.h:40
OdFdFieldReactor
Definition: FdField.h:198
RxDictionary.h
OdFdFieldEnginePE::getOwnerTable
virtual OdDbObjectId getOwnerTable(const OdDbField *field)=0
OdFdFieldResult::OdFdFieldResult
OdFdFieldResult()
oddbEvaluateFields
TOOLKIT_EXPORT OdResult oddbEvaluateFields(OdDbDatabase *pDb, int nContext, const OdDbObjectIdArray *objIds=0, const OdDbObjectIdArray *pFieldsToEvaluate=0, const OdString &pszEvaluatorId=OdString(), OdFd::EvalFields nEvalFlag=OdFd::kEvalRecursive, int *pNumFound=0, int *pNumEvaluated=0)
OdFdFieldEnginePE::getSheetSetProperty
virtual bool getSheetSetProperty(OdString &propValue, const OdString &compName, const OdString &propName, OdDbDatabase *pDb)=0
OdFdFieldResult::ODRX_DECLARE_MEMBERS
ODRX_DECLARE_MEMBERS(OdFdFieldResult)
OdFdFieldEvaluatorPtr
OdSmartPtr< OdFdFieldEvaluator > OdFdFieldEvaluatorPtr
Definition: FdField.h:156
OdFdFieldResult::setFieldValue
virtual void setFieldValue(const OdFieldValue *pValue)=0
OdFdFieldEngine::addFieldReactor
virtual void addFieldReactor(OdFdFieldReactor *pReactor)=0
OdFdFieldEnginePEPtr
OdSmartPtr< OdFdFieldEnginePE > OdFdFieldEnginePEPtr
Definition: FdField.h:429
OdFdFieldEnginePtr
OdSmartPtr< OdFdFieldEngine > OdFdFieldEnginePtr
Definition: FdField.h:307