CFx SDK Documentation  2022 SP0
DbField.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 OD_DBFIELD_H
26 #define OD_DBFIELD_H
27 
28 #include "TD_PackPush.h"
29 
30 #include "DbObject.h"
31 #include "DbFieldValue.h"
32 #include "OdValue.h"
33 
34 class OdDbField;
36 
41 
42 
47  typedef struct OdFd
48 {
50  {
51  kEvalRecursive = 1
52  };
53 
54 } OdFd;
55 
56 class OdDbField;
57 
62 
63 //*************************************************************************
64 // OdDbField
65 //*************************************************************************
66 
79 {
80 public:
81  enum State
82  {
83  kInitialized = 0x01, // Field was initialized by the evaluator.
84  kCompiled = 0x02, // Field was compiled.
85  kModified = 0x04, // Field was modified, but not evaluated.
86  kEvaluated = 0x08, // Field was evaluated.
87  kHasCache = 0x10, // Field has evaluated cache.
88  kHasFormattedString = 0x20 // Internal use only.
89  };
90 
92  {
93  kDisable = 0, // Do not evaluate field.
94  kOnOpen = 0x01, // Evaluate field when a drawing is opened.
95  kOnSave = 0x02, // Evaluate field when a drawing is saved.
96  kOnPlot = 0x04, // Evaluate field when a drawing is printed.
97  kOnEtransmit = 0x08, // Evaluate field when a drawing is etransmitted.
98  kOnRegen = 0x10, // Evaluate field when a drawing is regenerated.
99  kOnDemand = 0x20, // Evaluate field when demanded.
100  kAutomatic = (kOnOpen | kOnSave | kOnPlot | kOnEtransmit | kOnRegen | kOnDemand) // Evaluate automatically.
101  };
102 
104  {
105  kOpen = 0x01, // Field is being evaluated when a drawing is opened.
106  kSave = 0x02, // Field is being evaluated when a drawing is saved.
107  kPlot = 0x04, // Field is being evaluated when a drawing is printed.
108  kEtransmit = 0x08, // Field is being evaluated when a drawing is etransmitted.
109  kRegen = 0x10, // Field is being evaluated when a drawing is regenerated.
110  kDemand = 0x20, // Field is being evaluated when demanded.
111  kPreview = 0x40 // Field is being evaluated when a drawing is previewed.
112  };
113 
115  {
116  kNotYetEvaluated = 0x01, // Evaluation not performed.
117  kSuccess = 0x02, // Evaluation complete: Successful.
118  kEvaluatorNotFound = 0x04, // Evaluator for the field not found.
119  kSyntaxError = 0x08, // Evaluation complete: Syntax error in field code.
120  kInvalidCode = 0x10, // Evaluation complete: Invalid field code.
121  kInvalidContext = 0x20, // Evaluation complete: Invalid context to evaluate field.
122  kOtherError = 0x40 // Evaluation complete: Other evaluation error.
123  };
124 
126  {
127  kRawCode = 0x00, // Returns the raw main field code. Ignored by setFieldCode().
128  kFieldCode = 0x01, // Returns the raw field code with child codes substituted. Ignored by setFieldCode().
129  kEvaluatedText = 0x02, // Returns the evaluated text. Ignored by setFieldCode().
130  kEvaluatedChildren = 0x04, // Returns the field code with evaluated text for child fields. Ignored by setFieldCode().
131  kObjectReference = 0x08, // Returns embedded text as references to child fields. Ignored by setFieldCode().
132  kAddMarkers = 0x10, // Returns embedded text as field codes enclosed in field markers. Ignored by setFieldCode().
133  kEscapeBackslash = 0x20, // Converts single backslashes to double backslashes. Ignored by setFieldCode().
134  kStripOptions = 0x40, // Strips the standard options from the field code. Ignored by setFieldCode().
135  kPreserveFields = 0x80, // Internal use only. Ignored by getFieldCode().
136  kTextField = 0x100, // Treats the field as text with embedded fields. Ignored by getFieldCode().
137  kPreserveOptions = 0x200, // Ignored by getFieldCode(). For internal use.
138  kDetachChildren = 0x400, // Ignored by getFieldCode(). For internal use.
139  kChildObjectReference = 0x800, // Get child fields as object references. For internal use.
140  kForExpression = 0x1000 // Get the value in a format used in arithmatic expressions (e.g. vector child values are put in square brackets). For internal use. Ignored by setFieldCode().
141  };
142 
144  {
145  kSkipFilingResult = 0x01 // Don't file field value.
146  };
147 
148 public:
150 
152 
153  // OdDbField(const OdString& fieldCode, bool bTextField = false);
154  // ~OdDbField(void);
155 
167  OdDbObject* pOwner,
168  const OdString& propertyName);
169 
176  OdDbDatabase* pDb);
177 
195 
214  // OdUInt32* errCode = 0,
215  // OdString* errMsg = 0) const;
216 
236 
258  OdDbField::EvalOption evaluationOption);
259 
272 
285  OdDbField::FilingOption filingOption);
286 
295 
302  const OdString& evaluatorId);
303 
307  bool isTextField() const;
308 
309  // OdResult convertToTextField (void);
310 
311  // OdString getFieldCode (OdDbField::FieldCodeFlag nFlag, OdArray<OdDbField*>* pChildFields = 0,
312  // OdDb::OpenMode mode = OdDb::kForRead) const;
313 
337 
338  // OdArray<OdDbField*>* pChildFields = 0,
339  // OdDb::OpenMode mode = OdDb::kForRead) const;
340 
341 
369  const OdString& fieldCode,
371  OdDbFieldArray* pChildFields = 0);
372 
377 
385  OdUInt32 childIndex,
386  OdDb::OpenMode openMode);
387 
392 
402  const OdString& format);
403 
404 
422  int nContext,
423  OdDbDatabase* pDb = 0,
424  int* pNumFound = 0,
425  int* pNumEvaluated = 0);
426 
427 
452 
460 
473  OdFieldValue& pValue) const;
474 
475  bool hasHyperlink() const;
476 
478  OdString& psDescription,
479  OdString& psSubLocation,
480  OdString& psDisplayString) const;
481 
483  const OdString& psDescription,
484  const OdString& psSubLocation = OdString::kEmpty);
485 
487 
494  const OdString& key) const;
495 
503  const OdString& key,
504  const OdFieldValue& pData);
505 
506 public:
507  // Base class overrides
508 
510  OdDbDwgFiler* pFiler);
511  virtual void dwgOutFields(
512  OdDbDwgFiler* pFiler) const;
514  OdDbDxfFiler* pFiler);
515  virtual void dxfOutFields(
516  OdDbDxfFiler* pFiler) const;
517 
518  virtual void subClose();
519 };
520 
521 #define TEXT_FIELD_NAME OD_T("TEXT")
522 
525 
526 #include "TD_PackPop.h"
527 #endif // OD_DBFIELD_H
#define TOOLKIT_EXPORT
Definition: DbExport.h:40
OdSmartPtr< OdDbField > OdDbFieldPtr
Definition: DbField.h:34
TOOLKIT_EXPORT OdDbFieldPtr copyFieldWithChild(OdDbFieldPtr srcField)
OdArray< OdDbFieldPtr > OdDbFieldArray
Definition: DbField.h:40
TOOLKIT_EXPORT OdDbFieldPtr copyTextFieldToObject(OdDbFieldPtr srcField, OdDbObject *pObj)
struct OdFd OdFd
unsigned int OdUInt32
OdResult
Definition: OdResult.h:29
OdResult setData(const OdString &key, const OdFieldValue &pData)
OdResult setFieldCode(const OdString &fieldCode, OdDbField::FieldCodeFlag flags=(OdDbField::FieldCodeFlag) 0, OdDbFieldArray *pChildFields=0)
OdResult setInObject(OdDbObject *pOwner, const OdString &propertyName)
bool hasHyperlink() const
OdString getFormat() const
OdResult setHyperlink(const OdString &psName, const OdString &psDescription, const OdString &psSubLocation=OdString::kEmpty)
OdString evaluatorId() const
OdResult evaluate(int nContext, OdDbDatabase *pDb=0, int *pNumFound=0, int *pNumEvaluated=0)
OdDbField::FilingOption filingOption() const
OdDbField::State state() const
OdResult getHyperlink(OdString &psName, OdString &psDescription, OdString &psSubLocation, OdString &psDisplayString) const
OdDbFieldPtr getChild(OdUInt32 childIndex, OdDb::OpenMode openMode)
OdUInt32 childCount() const
OdDbField::EvalOption evaluationOption() const
virtual void dwgOutFields(OdDbDwgFiler *pFiler) const
OdResult setFormat(const OdString &format)
OdValue::DataType dataType() const
OdResult postInDatabase(OdDbDatabase *pDb)
EvalOption
Definition: DbField.h:92
FieldCodeFlag
Definition: DbField.h:126
OdResult getValue(OdFieldValue &pValue) const
ODDB_DECLARE_MEMBERS(OdDbField)
OdResult setEvaluationOption(OdDbField::EvalOption evaluationOption)
virtual void subClose()
virtual OdResult dxfInFields(OdDbDxfFiler *pFiler)
OdResult removeHyperlink()
OdResult setEvaluatorId(const OdString &evaluatorId)
OdFieldValue getData(const OdString &key) const
virtual OdResult dwgInFields(OdDbDwgFiler *pFiler)
FilingOption
Definition: DbField.h:144
OdString getValue() const
virtual void dxfOutFields(OdDbDxfFiler *pFiler) const
bool isTextField() const
OdResult setFilingOption(OdDbField::FilingOption filingOption)
OdDbField::EvalStatus evaluationStatus() const
OdString getFieldCode(OdDbField::FieldCodeFlag flags)
FIRSTDLL_EXPORT_STATIC static const OdString kEmpty
Definition: OdString.h:98
DataType
Definition: OdValue.h:45
GLint GLint GLint GLsizei GLsizei GLenum format
Definition: gles2_ext.h:111
OpenMode
Definition: DbObjectId.h:54
Definition: DbField.h:48
EvalFields
Definition: DbField.h:50
@ kEvalRecursive
Definition: DbField.h:51