CFx SDK Documentation  2022 SP0
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 // FELIX_CHANGE_BEGIN
32 // required for backported odfdGetSubStrings()
33 #include "StringArray.h"
34 // FELIX_CHANGE_END
35 
36 class OdDbField;
37 class OdDbEvalVariant;
38 class OdFieldValue;
39 class OdFdFieldEngineImpl;
40 class OdFdFieldResult;
41 class OdDbDatabase;
42 
43 #include "TD_PackPush.h"
44 
56 {
57 public:
59 
67  virtual const OdString evaluatorId() const = 0;
77  virtual const OdString evaluatorId(OdDbField* pField) const = 0;
88  virtual OdResult initialize(OdDbField* pField) const = 0;
89 
90 // The field framework calls this method to compile a field when the field code is changed.
91 
103  virtual OdResult compile(OdDbField* pField,
104  OdDbDatabase* pDb,
105  OdFdFieldResult* pResult) const = 0;
106 
107 // The field framework calls this method to evaluate a field whenever the field needs
108 // to be evaluated.
109 
137  virtual OdResult evaluate(OdDbField* pField,
138  int nContext,
139  OdDbDatabase* pDb,
140  OdFdFieldResult* pResult) const = 0;
141 
142 // The field framework calls this method when a field is queried
143 // to get the evaluated field value as a string. The evaluator can
144 
157  virtual OdResult format(OdDbField* pField, OdString& pszValue) const = 0;
158 };
159 
161 
175 {
176 public:
178 
185  const OdString& pszEvalId) = 0;
186 
193  OdDbField* pField,
194  OdString& pszEvalId) = 0;
195 };
196 
202 {
203 public:
205 
211  virtual void beginEvaluateFields(
212  int nContext,
213  OdDbDatabase* pDb);
214 
220  virtual void endEvaluateFields(
221  int nContext,
222  OdDbDatabase* pDb);
223 };
224 
226 
237 {
238 public:
240  virtual ~OdFdFieldEngine(){}
250 
260 
264  virtual int evaluatorLoaderCount() const = 0;
265 
273  virtual OdFdFieldEvaluatorLoader * getEvaluatorLoader(int inputIndex) = 0;
274 
282  const OdString& pszEvalId) = 0;
283 
295  OdDbField* pField,
296  OdString& pszEvalId) = 0;
297 
302  virtual void addFieldReactor(OdFdFieldReactor* pReactor) = 0;
303 
308  virtual void removeFieldReactor(OdFdFieldReactor* pReactor) = 0;
309 };
310 
312 #define ODFD_FIELD_ENGINE OD_T("FieldEngine")
317 
320  const OdString& sValue = L"%ls"); // value to keep result of previous evaluation
321 
331 {
332 public:
335 
342  virtual void setFieldValue(const OdFieldValue* pValue) = 0;
343 
350  virtual void setEvaluationStatus(OdDbField::EvalStatus errorStatus, int errorCode = 0, const OdString& errorMessage = OdString()) = 0;
351 };
352 
359 {
360 public:
372  virtual bool getSheetSetProperty(OdString& propValue, const OdString& compName, const OdString& propName, OdDbDatabase* pDb) = 0;
373 
384  virtual bool parseObjProp(const OdString& prop, OdDbDatabase* pDb, OdDbObjectId& objId, OdString& propName) = 0;
385 
395  virtual bool getObjPropValue(const OdString& propName, const OdDbObjectId& objId, OdFdFieldResult& result) = 0;
396 
403  virtual OdDbDatabase* getCurrentDb() = 0;
404 
413  virtual OdString getFileName(OdDbDatabase* pDb) = 0;
414 
421  virtual void getLispVariable(const OdString& lispVar, OdFieldValue& fValue) = 0;
422 
430  virtual OdDbObjectId getOwnerTable(const OdDbField* field) = 0;
431 };
432 
434 
447  OdDbDatabase* pDb,
448  int nContext,
449  const OdDbObjectIdArray* objIds = 0,
450  const OdDbObjectIdArray* pFieldsToEvaluate = 0,
451  const OdString& pszEvaluatorId = OdString(),
453  int* pNumFound = 0,
454  int* pNumEvaluated = 0);
455 
456 // FELIX_CHANGE_BEGIN
457 // Backorted from ODA 21.11 - required for building ODA Mechanical
465  const OdString& sString,
466  OdStringArray& aSubStrings);
467 
477  const OdString& sString,
478  OdString& sName,
479  OdString& sFormat);
480 // FELIX_CHANGE_END
481 
482 
483 #include "TD_PackPop.h"
484 
485 #endif //_FdField_h_Included_
#define TOOLKIT_EXPORT
Definition: DbExport.h:40
TOOLKIT_EXPORT bool odfdGetAcVarData(const OdString &sString, OdString &sName, OdString &sFormat)
OdSmartPtr< OdFdFieldEvaluator > OdFdFieldEvaluatorPtr
Definition: FdField.h:160
TOOLKIT_EXPORT void odfdGetSubStrings(const OdString &sString, OdStringArray &aSubStrings)
TOOLKIT_EXPORT OdFdFieldEnginePtr oddbGetFieldEngine()
TOOLKIT_EXPORT OdString oddbSetFieldEngineValueFormatByError(const OdString &sValue=L"%ls")
OdSmartPtr< OdFdFieldEnginePE > OdFdFieldEnginePEPtr
Definition: FdField.h:433
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)
OdSmartPtr< OdFdFieldEngine > OdFdFieldEnginePtr
Definition: FdField.h:311
OdArray< OdFdFieldReactor * > FieldReactors
Definition: FdField.h:225
TOOLKIT_EXPORT OdString oddbGetFieldEngineValueByError(const OdString &sPrevValue)
OdResult
Definition: OdResult.h:29
OdString OdString
Definition: OdString.h:1224
virtual int evaluatorLoaderCount() const =0
virtual void addFieldReactor(OdFdFieldReactor *pReactor)=0
virtual ~OdFdFieldEngine()
Definition: FdField.h:240
virtual void removeFieldReactor(OdFdFieldReactor *pReactor)=0
virtual OdFdFieldEvaluator * getEvaluator(const OdString &pszEvalId)=0
virtual void registerEvaluatorLoader(OdFdFieldEvaluatorLoader *pLoader)=0
virtual OdFdFieldEvaluator * findEvaluator(OdDbField *pField, OdString &pszEvalId)=0
virtual OdFdFieldEvaluatorLoader * getEvaluatorLoader(int inputIndex)=0
virtual void unregisterEvaluatorLoader(OdFdFieldEvaluatorLoader *pLoader)=0
ODRX_DECLARE_MEMBERS(OdFdFieldEngine)
virtual OdString getFileName(OdDbDatabase *pDb)=0
virtual OdDbObjectId getOwnerTable(const OdDbField *field)=0
ODRX_DECLARE_MEMBERS(OdFdFieldEnginePE)
virtual bool parseObjProp(const OdString &prop, OdDbDatabase *pDb, OdDbObjectId &objId, OdString &propName)=0
virtual void getLispVariable(const OdString &lispVar, OdFieldValue &fValue)=0
virtual bool getObjPropValue(const OdString &propName, const OdDbObjectId &objId, OdFdFieldResult &result)=0
virtual OdDbDatabase * getCurrentDb()=0
virtual bool getSheetSetProperty(OdString &propValue, const OdString &compName, const OdString &propName, OdDbDatabase *pDb)=0
virtual OdResult evaluate(OdDbField *pField, int nContext, OdDbDatabase *pDb, OdFdFieldResult *pResult) const =0
virtual OdResult initialize(OdDbField *pField) const =0
virtual const OdString evaluatorId(OdDbField *pField) const =0
virtual OdResult compile(OdDbField *pField, OdDbDatabase *pDb, OdFdFieldResult *pResult) const =0
virtual OdResult format(OdDbField *pField, OdString &pszValue) const =0
virtual const OdString evaluatorId() const =0
ODRX_DECLARE_MEMBERS(OdFdFieldEvaluator)
ODRX_DECLARE_MEMBERS(OdFdFieldEvaluatorLoader)
virtual OdFdFieldEvaluator * findEvaluator(OdDbField *pField, OdString &pszEvalId)=0
virtual OdFdFieldEvaluator * getEvaluator(const OdString &pszEvalId)=0
virtual void beginEvaluateFields(int nContext, OdDbDatabase *pDb)
ODRX_DECLARE_MEMBERS(OdFdFieldReactor)
virtual void endEvaluateFields(int nContext, OdDbDatabase *pDb)
virtual void setFieldValue(const OdFieldValue *pValue)=0
virtual void setEvaluationStatus(OdDbField::EvalStatus errorStatus, int errorCode=0, const OdString &errorMessage=OdString())=0
ODRX_DECLARE_MEMBERS(OdFdFieldResult)
EvalFields
Definition: DbField.h:50
@ kEvalRecursive
Definition: DbField.h:51