CFx SDK Documentation  2022 SP0
NextCodeDefs.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 #ifndef ODA_NEXT_CODE_H_
25 #define ODA_NEXT_CODE_H_
26 
27 #define NEXT_CODE(code) \
28  if (pFiler->nextItem() != code) \
29  { \
30  ODA_FAIL_ONCE(); \
31  return eMakeMeProxy; \
32  }
33 
34 #define NEXT_UINT64(code, ref64) \
35  switch (pFiler->nextItem()) \
36  { \
37  case code: \
38  ref64 = pFiler->rdUInt64(); \
39  break; \
40  case (91 + code - 160): /* hi */ \
41  ref64 = pFiler->rdUInt32(); \
42  ref64 <<= 32; \
43  if (pFiler->nextItem() != (91 + code - 160)) \
44  { /* low */ \
45  ref64 += pFiler->rdUInt32(); \
46  break; \
47  } \
48  default: \
49  ODA_FAIL_ONCE(); \
50  return eMakeMeProxy; \
51  }
52 
53 #define DXF_OUT_UINT64(code, ref64) \
54  if (pFiler->dwgVersion() > OdDb::vAC21) \
55  pFiler->wrUInt64(code, ref64); \
56  else \
57  { \
58  pFiler->wrUInt32(91 + code - 160, (OdUInt32) (ref64 >> 32)); /* hi */ \
59  pFiler->wrUInt32(92 + code - 160, (OdInt32) ref64); /* low */ \
60  }
61 
62 #define DWG_IN_UINT64(ref64) \
63  if (pFiler->dwgVersion() > OdDb::vAC21) \
64  ref64 = pFiler->rdInt64(); \
65  else \
66  { \
67  ref64 = pFiler->rdInt32(); /* hi */ \
68  ref64 <<= 32; \
69  ref64 += (OdUInt32) pFiler->rdInt32(); /* low */ \
70  }
71 
72 #define DWG_OUT_UINT64(ref64) \
73  if (pFiler->dwgVersion() > OdDb::vAC21) \
74  pFiler->wrInt64(ref64); \
75  else \
76  { \
77  pFiler->wrInt32((OdInt32) (ref64 >> 32)); /* hi */ \
78  pFiler->wrInt32((OdInt32) ref64); /* low */ \
79  }
80 
81 #endif // ODA_NEXT_CODE_H_