CFx SDK Documentation  2022 SP0
ResBuf.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 
26 
27 #if !defined(_ODRESBUF_H___INCLUDED_)
28 #define _ODRESBUF_H___INCLUDED_
29 
30 #include "TD_PackPush.h"
31 
32 #include "DbExport.h"
33 #include "RxObject.h"
34 #include "OdString.h"
35 #include "DbHandle.h"
36 #include "OdError.h"
37 
38 class OdBinaryData;
39 class OdGePoint2d;
40 class OdGePoint3d;
41 class OdGeVector2d;
42 class OdGeVector3d;
43 class OdDbObjectId;
44 class OdDbDatabase;
45 class OdCmColor;
46 class OdResBuf;
47 class OdDbSelectionSet;
48 
53 
54 
70 {
71 public:
72  OdError_InvalidResBuf() : OdError(eInvalidResBuf){}
73 };
74 
83 
112 {
113 public:
114 
116 
121 
134  void copyFrom( const OdRxObject* pRb );
135 
136 
149  bool operator==( const OdResBuf& Rb ) const;
150 
151 
164  bool operator!=( const OdResBuf& Rb ) const;
165 
166 
171  {
172  //FELIX_CHANGE_BEGIN
173  kRtNorm = 5100, // Normal termination
174  kRtMemErr = -5000, // Global memory error
175  kRtError = -5001, // Some other error
176  kRtCan = -5002, // User cancelled request -- Ctl-C
177  kRtRej = -5003, // Rejected request -- invalid
178  kRtFail = -5004, // Link failure -- Lisp probably died
179  kRtKword = -5005, // Keyword returned from getxxx() routine
180  kRtInputTruncated = -5008, // Input didn't all fit in the buffer
181  //FELIX_CHANGE_END
182 
183  kRtNone = 5000,
184  kRtDouble = 5001,
185  kRtPoint2d = 5002,
186  kRtInt16 = 5003,
187  kRtAngle = 5004,
188  kRtString = 5005,
189 
190  kRtEntName = 5006, // setObjectId()/getEntName()/getObjectId(0)
191  kRtPickSet = 5007,
192 
193  kRtOrient = 5008,
194 
195  kRtPoint3d = 5009,
196  kRtInt32 = 5010,
197  kRtColor = 5011,
198 
199  kRtVoid = 5014,
200  kRtListBeg = 5016, // list begin
201  kRtListEnd = 5017, // list end
202  kRtDote = 5018, // dot
203  kRtNil = 5019, // nil
204 
205 
206 
207  kRtDXF0 = 5020,
208  kRtT = 5021,
209  kRtResBuf = 5023,
210 // kRtModeless = 5027,
211 
212  kRtBool = 290,
213  kRtInt8 = 280,
214  kRtVector2d = kRtPoint2d,
215  kRtVector3d = kRtPoint3d,
216  kRtBinaryChunk = 310,
217  kRtHandle = 320,
218  kRtObjectId = 330,
219  kRtSoftPointerId = 330,
220  kRtHardPointerId = 340,
221  kRtSoftOwnershipId = 350,
222  kRtHardOwnershipId = 360,
223 
224  kDxfInvalid = -9999,
225 
226  kDxfXDictionary = -6,
227  kDxfPReactors = -5,
228  kDxfOperator = -4,
229  kDxfXDataStart = -3,
230  kDxfHeaderId = -2,
231  kDxfFirstEntId = -2,
232  kDxfEnd = -1,
233  kDxfStart = 0,
234  kDxfText = 1,
235  kDxfXRefPath = 1,
236  kDxfShapeName = 2,
237  kDxfBlockName = 2,
238  kDxfAttributeTag = 2,
239  kDxfSymbolTableName = 2,
240  kDxfMstyleName = 2,
241  kDxfSymTableRecName = 2,
242  kDxfAttributePrompt = 3,
243  kDxfDimStyleName = 3,
244  kDxfLinetypeProse = 3,
245  kDxfTextFontFile = 3,
246  kDxfDescription = 3,
247  kDxfDimPostStr = 3,
248  kDxfTextBigFontFile = 4,
249  kDxfDimAPostStr = 4,
250  kDxfCLShapeName = 4,
251  kDxfSymTableRecComments = 4,
252  kDxfHandle = 5,
253  kDxfDimBlk = 5,
254  kDxfDimBlk1 = 6,
255  kDxfLinetypeName = 6,
256  kDxfDimBlk2 = 7,
257  kDxfTextStyleName = 7,
258  kDxfLayerName = 8,
259  kDxfCLShapeText = 9,
260  kDxfXCoord = 10,
261  kDxfYCoord = 20,
262  kDxfZCoord = 30,
263  kDxfElevation = 38,
264  kDxfThickness = 39,
265  kDxfReal = 40,
266  kDxfViewportHeight = 40,
267  kDxfTxtSize = 40,
268  kDxfTxtStyleXScale = 41,
269  kDxfViewWidth = 41,
270  kDxfViewportAspect = 41,
271  kDxfTxtStylePSize = 42,
272  kDxfViewLensLength = 42,
273  kDxfViewFrontClip = 43,
274  kDxfViewBackClip = 44,
275  kDxfShapeXOffset = 44,
276  kDxfShapeYOffset = 45,
277  kDxfViewHeight = 45,
278  kDxfShapeScale = 46,
279  kDxfPixelScale = 47,
280  kDxfLinetypeScale = 48,
281  kDxfDashLength = 49,
282  kDxfMlineOffset = 49,
283  kDxfLinetypeElement = 49,
284  kDxfAngle = 50,
285  kDxfViewportSnapAngle = 50,
286  kDxfViewportTwist = 51,
287  kDxfVisibility = 60,
288  kDxfLayerLinetype = 61,
289  kDxfColor = 62,
290  kDxfHasSubentities = 66,
291  kDxfViewportVisibility = 67,
292  kDxfViewportActive = 68,
293  kDxfViewportNumber = 69,
294  kDxfInt16 = 70,
295  kDxfViewMode = 71,
296  kDxfCircleSides = 72,
297  kDxfViewportZoom = 73,
298  kDxfViewportIcon = 74,
299  kDxfViewportSnap = 75,
300  kDxfViewportGrid = 76,
301  kDxfViewportSnapStyle = 77,
302  kDxfViewportSnapPair = 78,
303  kDxfRegAppFlags = 71,
304  kDxfTxtStyleFlags = 71,
305  kDxfLinetypeAlign = 72,
306  kDxfLinetypePDC = 73,
307  kDxfInt32 = 90,
308  kDxfSubclass = 100,
309  kDxfEmbeddedObjectStart = 101,
310  kDxfControlString = 102,
311  kDxfDimVarHandle = 105,
312  kDxfUCSOrg = 110,
313  kDxfUCSOriX = 111,
314  kDxfUCSOriY = 112,
315  kDxfXReal = 140,
316  // 64-bit integers can only be used with version R24 and higher
317  kDxfInt64 = 160,
318 
319  kDxfXInt16 = 170,
320  kDxfNormalX = 210,
321  kDxfNormalY = 220,
322  kDxfNormalZ = 230,
323  kDxfXXInt16 = 270,
324  kDxfInt8 = 280,
325  kDxfRenderMode = 281,
326  kDxfBool = 290,
327  kDxfXTextString = 300,
328  kDxfBinaryChunk = 310,
329  kDxfArbHandle = 320,
330  kDxfSoftPointerId = 330,
331  kDxfHardPointerId = 340,
332  kDxfSoftOwnershipId = 350,
333  kDxfHardOwnershipId = 360,
334  kDxfLineWeight = 370,
335  kDxfPlotStyleNameType = 380,
336  kDxfPlotStyleNameId = 390,
337  kDxfXXXInt16 = 400,
338  kDxfLayoutName = 410,
339  kDxfComment = 999,
340  kDxfXdAsciiString = 1000,
341  kDxfRegAppName = 1001,
342  kDxfXdControlString = 1002,
343  kDxfXdLayerName = 1003,
344  kDxfXdBinaryChunk = 1004,
345  kDxfXdHandle = 1005,
346  kDxfXdXCoord = 1010,
347  kDxfXdYCoord = 1020,
348  kDxfXdZCoord = 1030,
349  kDxfXdWorldXCoord = 1011,
350  kDxfXdWorldYCoord = 1021,
351  kDxfXdWorldZCoord = 1031,
352  kDxfXdWorldXDisp = 1012,
353  kDxfXdWorldYDisp = 1022,
354  kDxfXdWorldZDisp = 1032,
355  kDxfXdWorldXDir = 1013,
356  kDxfXdWorldYDir = 1023,
357  kDxfXdWorldZDir = 1033,
358  kDxfXdReal = 1040,
359  kDxfXdDist = 1041,
360  kDxfXdScale = 1042,
361  kDxfXdInteger16 = 1070,
362  kDxfXdInteger32 = 1071
363  };
364 
365 
386  int restype() const;
387 
388 
406  void setRestype( int resType );
407 
408 
420  OdResBufPtr next() const;
421 
422 
434  OdResBufPtr last() const;
435 
436 
455 
456 
475 
476 
495 
496 
517  void setString( const OdString& sValue );
518 
519 
539  bool getBool() const;
540 
541 
562  void setBool( bool bValue );
563 
564 
582  OdInt8 getInt8() const;
583 
584 
606  void setInt8( OdInt8 iValue );
607 
608 
626  OdInt16 getInt16() const;
627 
628 
650  void setInt16( OdInt16 iValue );
651 
652 
653 
671  OdInt32 getInt32() const;
672 
673 
695  void setInt32( OdInt32 iValue );
696 
697 
715  OdInt64 getInt64() const;
716 
717 
739  void setInt64( OdInt64 iValue );
740 
741 
760  double getDouble() const;
761 
762 
784  void setDouble( double realValue );
785 
786 
805  const OdGePoint2d& getPoint2d() const;
806 
807 
828  void setPoint2d( const OdGePoint2d& gePoint );
829 
830 
849  const OdGePoint3d& getPoint3d() const;
850 
851 
872  void setPoint3d( const OdGePoint3d& gePoint );
873 
874 
893  const OdGeVector2d& getVector2d() const;
894 
895 
916  void setVector2d( const OdGeVector2d& geVector );
917 
918 
937  const OdGeVector3d& getVector3d() const;
938 
939 
960  void setVector3d(const OdGeVector3d& val);
961 
962 
982  const OdBinaryData& getBinaryChunk() const;
983 
984 
1007  void setBinaryChunk( const OdBinaryData& bChunk );
1008 
1009 
1029  const OdCmColor& getColor() const;
1030 
1031 
1055  void setColor( const OdCmColor& cmColor );
1056 
1057 
1074 
1075 
1094  void setResBuf( const OdResBuf* pResBuf );
1095 
1096 
1117 
1118 
1142  void setHandle( const OdDbHandle& vHandle );
1143 
1144 
1166  const OdDbObjectId& getEntName() const;
1167 
1168 
1194  void setObjectId( const OdDbObjectId& idObject );
1195 
1196 
1212 
1213 
1218 
1227  void setPickSet(const OdDbSelectionSet* pSSet);
1228 
1229 
1246  static OdResBufPtr newRb(int resType = OdResBuf::kRtNone);
1247 
1265  static OdResBufPtr newRb(int resType, bool resVal)
1266  {
1267  OdResBufPtr pRes = newRb(resType);
1268  pRes->setBool(resVal);
1269  return pRes;
1270  }
1271 
1289  static OdResBufPtr newRb(int resType, OdInt8 resVal)
1290  {
1291  OdResBufPtr pRes = newRb(resType);
1292  pRes->setInt8(resVal);
1293  return pRes;
1294  }
1295 
1313  static OdResBufPtr newRb(int resType, OdUInt8 resVal)
1314  {
1315  OdResBufPtr pRes = newRb(resType);
1316  pRes->setInt8(resVal);
1317  return pRes;
1318  }
1319 
1337  static OdResBufPtr newRb(int resType, OdInt16 resVal)
1338  {
1339  OdResBufPtr pRes = newRb(resType);
1340  pRes->setInt16(resVal);
1341  return pRes;
1342  }
1343 
1361  static OdResBufPtr newRb(int resType, OdUInt16 resVal)
1362  {
1363  OdResBufPtr pRes = newRb(resType);
1364  pRes->setInt16(resVal);
1365  return pRes;
1366  }
1367 
1385  static OdResBufPtr newRb(int resType, OdInt32 resVal)
1386  {
1387  OdResBufPtr pRes = newRb(resType);
1388  pRes->setInt32(resVal);
1389  return pRes;
1390  }
1391 
1409  static OdResBufPtr newRb(int resType, OdUInt32 resVal)
1410  {
1411  OdResBufPtr pRes = newRb(resType);
1412  pRes->setInt32(resVal);
1413  return pRes;
1414  }
1415 
1433  static OdResBufPtr newRb(int resType, OdInt64 resVal)
1434  {
1435  OdResBufPtr pRes = newRb(resType);
1436  pRes->setInt64(resVal);
1437  return pRes;
1438  }
1439 
1457  static OdResBufPtr newRb(int resType, OdUInt64 resVal)
1458  {
1459  OdResBufPtr pRes = newRb(resType);
1460  pRes->setInt64(resVal);
1461  return pRes;
1462  }
1463 
1481  static OdResBufPtr newRb(int resType, double resVal)
1482  {
1483  OdResBufPtr pRes = newRb(resType);
1484  pRes->setDouble(resVal);
1485  return pRes;
1486  }
1487 
1505  static OdResBufPtr newRb(int resType, const OdGePoint2d& resVal)
1506  {
1507  OdResBufPtr pRes = newRb(resType);
1508  pRes->setPoint2d(resVal);
1509  return pRes;
1510  }
1511 
1529  static OdResBufPtr newRb(int resType, const OdGePoint3d& resVal)
1530  {
1531  OdResBufPtr pRes = newRb(resType);
1532  pRes->setPoint3d(resVal);
1533  return pRes;
1534  }
1535 
1553  static OdResBufPtr newRb(int resType, const OdGeVector2d& resVal)
1554  {
1555  OdResBufPtr pRes = newRb(resType);
1556  pRes->setVector2d(resVal);
1557  return pRes;
1558  }
1559 
1577  static OdResBufPtr newRb(int resType, const OdGeVector3d& resVal)
1578  {
1579  OdResBufPtr pRes = newRb(resType);
1580  pRes->setVector3d(resVal);
1581  return pRes;
1582  }
1583 
1601  static OdResBufPtr newRb(int resType, const OdString& resVal)
1602  {
1603  OdResBufPtr pRes = newRb(resType);
1604  pRes->setString(resVal);
1605  return pRes;
1606  }
1607 
1625  static OdResBufPtr newRb(int resType, const OdChar* resVal)
1626  {
1627  OdResBufPtr pRes = newRb(resType);
1628  pRes->setString(resVal);
1629  return pRes;
1630  }
1631 
1632 #if defined(OD_WINDOWS_DESKTOP) && defined(_MSC_VER)
1650  static OdResBufPtr newRb(int resType, const __wchar_t* resVal)
1651  {
1652  OdResBufPtr pRes = newRb(resType);
1653  pRes->setString(resVal);
1654  return pRes;
1655  }
1656 #endif
1657 
1675  static OdResBufPtr newRb(int resType, const OdCmColor& resVal)
1676  {
1677  OdResBufPtr pRes = newRb(resType);
1678  pRes->setColor(resVal);
1679  return pRes;
1680  }
1681 
1699  static OdResBufPtr newRb(int resType, const OdDbObjectId& id)
1700  {
1701  OdResBufPtr pRes = newRb(resType);
1702  pRes->setObjectId(id);
1703  return pRes;
1704  }
1705 
1723  static OdResBufPtr newRb(int resType, const OdDbSelectionSet* pSSet)
1724  {
1725  OdResBufPtr pRes = newRb(resType);
1726  pRes->setPickSet(pSSet);
1727  return pRes;
1728  }
1729 
1747  static OdResBufPtr newRb(int resType, const OdResBuf* pNestedRb)
1748  {
1749  OdResBufPtr pRes = newRb(resType);
1750  pRes->setResBuf(pNestedRb);
1751  return pRes;
1752  }
1753  // is used to get assertion with needed call stack only
1755  static void setAssertIndexByNewRb(int index);
1756 
1760  union Data
1761  {
1762  bool Bool; // Boolean content
1763  OdInt16 Int16; // 8-bit or 16-bit Integer content
1764  OdInt32 Int32; // 32-bit Integer or Color content
1765  OdInt64 Int64; // 64-bit Integer or Handle content
1766  double Double; // double-precision floating-point content
1767  void* Pointer; // pointer to an object
1768  OdUInt8 Bytes[sizeof(OdInt64)]; // Content as an array of bytes
1769  };
1770 
1771 protected:
1780 
1781  int m_nCode; // Group code that defines the data type
1782  Data m_data; // Value that defines the content
1783  OdResBufPtr m_pNext; // Smart pointer to another instance for attaching in a sequence
1784 };
1785 
1786 inline bool
1787 OdResBuf::operator!=( const OdResBuf& other ) const
1788 {
1789  return !operator==( other );
1790 }
1791 
1792 #include "TD_PackPop.h"
1793 
1794 #endif //_ODRESBUF_H___INCLUDED_
1795 
#define TOOLKIT_EXPORT
Definition: DbExport.h:40
unsigned int OdUInt32
short OdInt16
signed char OdInt8
unsigned short OdUInt16
int OdInt32
unsigned char OdUInt8
wchar_t OdChar
OdSmartPtr< OdResBuf > OdResBufPtr
Definition: ResBuf.h:82
OdSmartPtr< OdDbSelectionSet > OdDbSelectionSetPtr
Definition: ResBuf.h:47
Definition: Int64.h:43
static void setAssertIndexByNewRb(int index)
static OdResBufPtr newRb(int resType, double resVal)
Definition: ResBuf.h:1481
void setVector2d(const OdGeVector2d &geVector)
static OdResBufPtr newRb(int resType, OdUInt16 resVal)
Definition: ResBuf.h:1361
const OdGeVector3d & getVector3d() const
void setBinaryChunk(const OdBinaryData &bChunk)
void setRestype(int resType)
OdInt32 getInt32() const
const OdDbObjectId & getEntName() const
static OdResBufPtr newRb(int resType, OdInt16 resVal)
Definition: ResBuf.h:1337
OdInt8 getInt8() const
ODRX_DECLARE_MEMBERS(OdResBuf)
const OdCmColor & getColor() const
void setObjectId(const OdDbObjectId &idObject)
OdDbSelectionSetPtr getPickSet() const
static OdResBufPtr newRb(int resType, OdUInt8 resVal)
Definition: ResBuf.h:1313
double getDouble() const
OdDbHandle getHandle() const
void setInt16(OdInt16 iValue)
static OdResBufPtr newRb(int resType, const OdGePoint3d &resVal)
Definition: ResBuf.h:1529
int m_nCode
Definition: ResBuf.h:1781
static OdResBufPtr newRb(int resType, bool resVal)
Definition: ResBuf.h:1265
OdResBufPtr m_pNext
Definition: ResBuf.h:1783
static OdResBufPtr newRb(int resType, const OdDbObjectId &id)
Definition: ResBuf.h:1699
static OdResBufPtr newRb(int resType, const OdGeVector2d &resVal)
Definition: ResBuf.h:1553
OdResBufPtr last() const
const OdGePoint2d & getPoint2d() const
bool operator==(const OdResBuf &Rb) const
static OdResBufPtr newRb(int resType, const OdString &resVal)
Definition: ResBuf.h:1601
static OdResBufPtr newRb(int resType, OdInt32 resVal)
Definition: ResBuf.h:1385
static OdResBufPtr newRb(int resType, const OdGeVector3d &resVal)
Definition: ResBuf.h:1577
OdResBufPtr next() const
void setBool(bool bValue)
static OdResBufPtr newRb(int resType, const OdCmColor &resVal)
Definition: ResBuf.h:1675
void setDouble(double realValue)
void setPoint2d(const OdGePoint2d &gePoint)
OdDbObjectId getObjectId(const OdDbDatabase *pDb) const
static OdResBufPtr newRb(int resType, const OdChar *resVal)
Definition: ResBuf.h:1625
bool getBool() const
Data m_data
Definition: ResBuf.h:1782
void setResBuf(const OdResBuf *pResBuf)
const OdGePoint3d & getPoint3d() const
void setHandle(const OdDbHandle &vHandle)
void setVector3d(const OdGeVector3d &val)
static OdResBufPtr newRb(int resType, const OdDbSelectionSet *pSSet)
Definition: ResBuf.h:1723
OdResBufPtr insert(OdResBuf *pRb)
static OdResBufPtr newRb(int resType=OdResBuf::kRtNone)
void setPickSet(const OdDbSelectionSet *pSSet)
bool operator!=(const OdResBuf &Rb) const
Definition: ResBuf.h:1787
int restype() const
static OdResBufPtr newRb(int resType, OdInt8 resVal)
Definition: ResBuf.h:1289
void copyFrom(const OdRxObject *pRb)
void setInt64(OdInt64 iValue)
OdInt16 getInt16() const
OdInt64 getInt64() const
static OdResBufPtr newRb(int resType, OdUInt32 resVal)
Definition: ResBuf.h:1409
ValueType
Definition: ResBuf.h:171
@ kRtNone
Definition: ResBuf.h:183
void setInt8(OdInt8 iValue)
OdString getString() const
const OdBinaryData & getBinaryChunk() const
void setColor(const OdCmColor &cmColor)
OdResBufPtr getResBuf() const
static OdResBufPtr newRb(int resType, OdInt64 resVal)
Definition: ResBuf.h:1433
void setInt32(OdInt32 iValue)
static OdResBufPtr newRb(int resType, const OdGePoint2d &resVal)
Definition: ResBuf.h:1505
void setPoint3d(const OdGePoint3d &gePoint)
static OdResBufPtr newRb(int resType, OdUInt64 resVal)
Definition: ResBuf.h:1457
const OdGeVector2d & getVector2d() const
static OdResBufPtr newRb(int resType, const OdResBuf *pNestedRb)
Definition: ResBuf.h:1747
void setString(const OdString &sValue)
OdResBufPtr setNext(OdResBuf *pRb)
GLuint index
Definition: gles2_ext.h:265
bool DAI_EXPORT operator!=(const OdDAI::OdSelect &left, const OdDAI::OdSelect &right)
OdInt32 Int32
Definition: ResBuf.h:1764
OdInt64 Int64
Definition: ResBuf.h:1765
double Double
Definition: ResBuf.h:1766
OdInt16 Int16
Definition: ResBuf.h:1763
void * Pointer
Definition: ResBuf.h:1767