CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
MvdXmlCommon.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2022, 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 Open Design Alliance software pursuant to a license
16// agreement with Open Design Alliance.
17// Open Design Alliance Copyright (C) 2002-2022 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#if !defined(ODA_ODMVDXMLCOMMON_H_INCLUDED_)
25#define ODA_ODMVDXMLCOMMON_H_INCLUDED_
26
27#if _MSC_VER > 1000
28#pragma once
29#endif // _MSC_VER > 1000
30
31#include "OdaCommon.h"
32#include "IfcCommon.h"
33#include "RxObject.h"
34#include "RxObjectImpl.h"
35#include "OdArray.h"
36#include "OdAnsiString.h"
37
38// Generate error if item more than one.
39// #define MORE_THAN_ONE_ERROR
40
41#ifdef MVDXM_MORE_THAN_ONE_ERROR
42#define MVDXM_MORE_THAN_ONE(parent, text, caption) appendXmlErrorMessage(parent, text, caption); return eSyntaxError;
43#else
44#define MVDXM_MORE_THAN_ONE(parent, text, caption) appendXmlWarningMessage(parent, text, caption)
45#endif
46
47#define RETURNNOTOK(expr) {OdResult odResult;if (odResult=expr) return odResult;};
48#define RETURNNOTCHECK(expr) {OdResult odResult;if (odResult=expr) return odResult;};
49
50namespace OdMvdXml
51{
53 {
61 };
62
64 {
65 public:
67 {
68 kUnset = -1,
69 kAND = 0,
75 kNXOR
76 };
78 :m_operator(kUnset)
79 {
80 }
81 const Operator get() const
82 {
83 return m_operator;
84 }
85 const bool IsUnset() const
86 {
87 return (m_operator == kUnset);
88 }
89 const bool performBoolean(const bool first, const bool second) const
90 {
91 switch (m_operator) {
92 case kAND: return first && second;
93 case kOR: return first || second;
94 case kNOT: return !first;
95 case kNAND: return !(first && second);
96 case kNOR: return !(first || second);
97 case kXOR: return first != second;
98 case kNXOR: return first == second;
99 default: return false;
100 }
101 }
102 OdAnsiString toString()
103 {
104 switch (m_operator) {
105 case kAND: return "AND";
106 case kOR: return "OR";
107 case kNOT: return "NOT";
108 case kNAND: return "NAND";
109 case kNOR: return "NOR";
110 case kXOR: return "XOR";
111 case kNXOR: return "NXOR";
112 default: return "";
113 }
114 }
115 bool operator==(const OdMvdOperator& other) const
116 {
117 return (*this).m_operator == other.m_operator;
118 }
119 bool operator==(const Operator other) const
120 {
121 return (*this).m_operator == other;
122 }
124 {
125 m_operator = other.m_operator;
126 return (*this);
127 }
128 OdMvdOperator& operator=(const OdAnsiString& other)
129 {
130 return (*this) = other.c_str();
131 }
132 OdMvdOperator& operator=(const char* other)
133 {
134 m_operator = kUnset;
135 if (other)
136 {
137 OdAnsiString str(other);
138 str.makeUpper();
139 if (str.iCompare("AND") == 0)
140 m_operator = kAND;
141 else if (str.iCompare("OR") == 0)
142 m_operator = kOR;
143 else if (str.iCompare("NOT") == 0)
144 m_operator = kNOT;
145 else if (str.iCompare("NAND") == 0)
146 m_operator = kNAND;
147 else if (str.iCompare("NOR") == 0)
148 m_operator = kNOR;
149 else if (str.iCompare("XOR") == 0)
150 m_operator = kXOR;
151 else if (str.iCompare("NXOR") == 0)
152 m_operator = kNXOR;
153 }
154 return (*this);
155 }
156
157 private:
158 Operator m_operator;
159 };
160
162 {
163 public:
165 {
166 kUnset = -1,
169 kBoth
170 };
171
173 : m_applicability(kUnset)
174 {}
175 const Applicability get() const
176 {
177 return m_applicability;
178 }
179 const bool IsUnset() const
180 {
181 return (m_applicability == kUnset);
182 }
183 OdAnsiString toString()
184 {
185 switch (m_applicability) {
186 case kImport: return "import";
187 case kExport: return "export";
188 case kBoth: return "both";
189 default: return "";
190 }
191 }
192 bool operator==(const OdMvdApplicability& other) const
193 {
194 return (*this).m_applicability == other.m_applicability;
195 }
196 bool operator==(const Applicability other) const
197 {
198 return (*this).m_applicability == other;
199 }
201 {
202 m_applicability = other.m_applicability;
203 return (*this);
204 }
205 OdMvdApplicability& operator=(const OdAnsiString& other)
206 {
207 return (*this) = other.c_str();
208 }
209 OdMvdApplicability& operator=(const char* other)
210 {
211 m_applicability = kUnset;
212 if (other)
213 {
214 OdAnsiString str(other);
215 str.makeLower();
216 if (str.iCompare("import") == 0)
217 m_applicability = kImport;
218 else if (str.iCompare("export") == 0)
219 m_applicability = kExport;
220 else if (str.iCompare("both") == 0)
221 m_applicability = kBoth;
222 }
223 return (*this);
224 }
225
226 private:
227 Applicability m_applicability;
228 };
229
231 {
232 public:
234 {
235 kUnset = -1,
241 };
243 : m_requirement(kUnset)
244 {}
245 const Requirement get() const
246 {
247 return m_requirement;
248 }
249 const bool IsUnset() const
250 {
251 return (m_requirement == kUnset);
252 }
253 OdAnsiString toString()
254 {
255 switch (m_requirement) {
256 case kMandatory: return "mandatory";
257 case kRecommended: return "recommended";
258 case kNotRelevant: return "not-relevant";
259 case kNotRecommended: return "not-recommended";
260 case kExcluded: return "excluded";
261 default: return "";
262 }
263 }
264 bool operator==(const OdMvdRequirement& other) const
265 {
266 return (*this).m_requirement == other.m_requirement;
267 }
268 bool operator==(const Requirement other) const
269 {
270 return (*this).m_requirement == other;
271 }
273 {
274 m_requirement = other.m_requirement;
275 return (*this);
276 }
277 OdMvdRequirement& operator=(const OdAnsiString& other)
278 {
279 return (*this) = other.c_str();
280 }
281 OdMvdRequirement& operator=(const char* other)
282 {
283 m_requirement = kUnset;
284 if (other)
285 {
286 OdAnsiString str(other);
287 str.makeLower();
288 if (str.iCompare("mandatory") == 0)
289 m_requirement = kMandatory;
290 else if (str.iCompare("recommended") == 0)
291 m_requirement = kRecommended;
292 else if ((str.iCompare("not-relevant") == 0) || (str.iCompare("not relevant") == 0))
293 m_requirement = kNotRelevant;
294 else if ((str.iCompare("not-recommended") == 0) || (str.iCompare("not recommended") == 0))
295 m_requirement = kNotRecommended;
296 else if (str.iCompare("excluded") == 0)
297 m_requirement = kExcluded;
298 }
299 return (*this);
300 }
301 private:
302 Requirement m_requirement;
303 };
304} // namespace OdMvdXml
305
306#endif // !defined(ODA_ODMVDXMLCOMMON_H_INCLUDED_)
307
bool operator==(const Applicability other) const
Definition: MvdXmlCommon.h:196
const bool IsUnset() const
Definition: MvdXmlCommon.h:179
OdMvdApplicability & operator=(const OdMvdApplicability &other)
Definition: MvdXmlCommon.h:200
bool operator==(const OdMvdApplicability &other) const
Definition: MvdXmlCommon.h:192
OdMvdApplicability & operator=(const char *other)
Definition: MvdXmlCommon.h:209
OdMvdApplicability & operator=(const OdAnsiString &other)
Definition: MvdXmlCommon.h:205
const Applicability get() const
Definition: MvdXmlCommon.h:175
OdMvdOperator & operator=(const OdAnsiString &other)
Definition: MvdXmlCommon.h:128
OdMvdOperator & operator=(const char *other)
Definition: MvdXmlCommon.h:132
bool operator==(const OdMvdOperator &other) const
Definition: MvdXmlCommon.h:115
OdMvdOperator & operator=(const OdMvdOperator &other)
Definition: MvdXmlCommon.h:123
const Operator get() const
Definition: MvdXmlCommon.h:81
OdAnsiString toString()
Definition: MvdXmlCommon.h:102
const bool performBoolean(const bool first, const bool second) const
Definition: MvdXmlCommon.h:89
const bool IsUnset() const
Definition: MvdXmlCommon.h:85
bool operator==(const Operator other) const
Definition: MvdXmlCommon.h:119
bool operator==(const Requirement other) const
Definition: MvdXmlCommon.h:268
OdMvdRequirement & operator=(const OdMvdRequirement &other)
Definition: MvdXmlCommon.h:272
const Requirement get() const
Definition: MvdXmlCommon.h:245
const bool IsUnset() const
Definition: MvdXmlCommon.h:249
bool operator==(const OdMvdRequirement &other) const
Definition: MvdXmlCommon.h:264
OdMvdRequirement & operator=(const OdAnsiString &other)
Definition: MvdXmlCommon.h:277
OdMvdRequirement & operator=(const char *other)
Definition: MvdXmlCommon.h:281
@ OdMvdStatusUnset
Definition: MvdXmlCommon.h:54
@ OdMvdCandidate
Definition: MvdXmlCommon.h:58
@ OdMvdProposal
Definition: MvdXmlCommon.h:56
@ OdMvdDeprecated
Definition: MvdXmlCommon.h:60