CFx SDK Documentation 2026 SP0
Loading...
Searching...
No Matches
MvdXmlCommon.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2024, 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-2024 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
53namespace OdMvdXml
54{
75
80 {
81 public:
86 {
88 kUnset = -1,
89
99 kAND = 0,
100
111
120
131
142
153
164 };
165
170 :m_operator(kUnset)
171 {
172 }
173
178 const Operator get() const
179 {
180 return m_operator;
181 }
182
187 const bool IsUnset() const
188 {
189 return (m_operator == kUnset);
190 }
191
198 const bool performBoolean(const bool first, const bool second) const
199 {
200 switch (m_operator) {
201 case kAND: return first && second;
202 case kOR: return first || second;
203 case kNOT: return !first;
204 case kNAND: return !(first && second);
205 case kNOR: return !(first || second);
206 case kXOR: return first != second;
207 case kNXOR: return first == second;
208 default: return false;
209 }
210 }
211
216 OdAnsiString toString()
217 {
218 switch (m_operator) {
219 case kAND: return "AND";
220 case kOR: return "OR";
221 case kNOT: return "NOT";
222 case kNAND: return "NAND";
223 case kNOR: return "NOR";
224 case kXOR: return "XOR";
225 case kNXOR: return "NXOR";
226 default: return "";
227 }
228 }
229
235 bool operator==(const OdMvdOperator& other) const
236 {
237 return (*this).m_operator == other.m_operator;
238 }
239
245 bool operator==(const Operator other) const
246 {
247 return (*this).m_operator == other;
248 }
249
256 {
257 m_operator = other.m_operator;
258 return (*this);
259 }
260
266 OdMvdOperator& operator=(const OdAnsiString& other)
267 {
268 return (*this) = other.c_str();
269 }
270
276 OdMvdOperator& operator=(const char* other)
277 {
278 m_operator = kUnset;
279 if (other)
280 {
281 OdAnsiString str(other);
282 str.makeUpper();
283 if (str.iCompare("AND") == 0)
284 m_operator = kAND;
285 else if (str.iCompare("OR") == 0)
286 m_operator = kOR;
287 else if (str.iCompare("NOT") == 0)
288 m_operator = kNOT;
289 else if (str.iCompare("NAND") == 0)
290 m_operator = kNAND;
291 else if (str.iCompare("NOR") == 0)
292 m_operator = kNOR;
293 else if (str.iCompare("XOR") == 0)
294 m_operator = kXOR;
295 else if (str.iCompare("NXOR") == 0)
296 m_operator = kNXOR;
297 }
298 return (*this);
299 }
300
301 private:
302 Operator m_operator;
303 };
304
309 {
310 public:
311
316 {
318 kUnset = -1,
319
322
325
328 };
329
334 : m_applicability(kUnset)
335 {}
336
341 const Applicability get() const
342 {
343 return m_applicability;
344 }
345
350 const bool IsUnset() const
351 {
352 return (m_applicability == kUnset);
353 }
354
359 OdAnsiString toString()
360 {
361 switch (m_applicability) {
362 case kImport: return "import";
363 case kExport: return "export";
364 case kBoth: return "both";
365 default: return "";
366 }
367 }
368
374 bool operator==(const OdMvdApplicability& other) const
375 {
376 return (*this).m_applicability == other.m_applicability;
377 }
378
384 bool operator==(const Applicability other) const
385 {
386 return (*this).m_applicability == other;
387 }
388
395 {
396 m_applicability = other.m_applicability;
397 return (*this);
398 }
399
405 OdMvdApplicability& operator=(const OdAnsiString& other)
406 {
407 return (*this) = other.c_str();
408 }
409
415 OdMvdApplicability& operator=(const char* other)
416 {
417 m_applicability = kUnset;
418 if (other)
419 {
420 OdAnsiString str(other);
421 str.makeLower();
422 if (str.iCompare("import") == 0)
423 m_applicability = kImport;
424 else if (str.iCompare("export") == 0)
425 m_applicability = kExport;
426 else if (str.iCompare("both") == 0)
427 m_applicability = kBoth;
428 }
429 return (*this);
430 }
431
432 private:
433 Applicability m_applicability;
434 };
435
440 {
441 public:
465
470 : m_requirement(kUnset)
471 {}
472
477 const Requirement get() const
478 {
479 return m_requirement;
480 }
481
486 const bool IsUnset() const
487 {
488 return (m_requirement == kUnset);
489 }
490
495 OdAnsiString toString()
496 {
497 switch (m_requirement) {
498 case kMandatory: return "mandatory";
499 case kRecommended: return "recommended";
500 case kNotRelevant: return "not-relevant";
501 case kNotRecommended: return "not-recommended";
502 case kExcluded: return "excluded";
503 default: return "";
504 }
505 }
506
512 bool operator==(const OdMvdRequirement& other) const
513 {
514 return (*this).m_requirement == other.m_requirement;
515 }
516
522 bool operator==(const Requirement other) const
523 {
524 return (*this).m_requirement == other;
525 }
526
533 {
534 m_requirement = other.m_requirement;
535 return (*this);
536 }
537
543 OdMvdRequirement& operator=(const OdAnsiString& other)
544 {
545 return (*this) = other.c_str();
546 }
547
553 OdMvdRequirement& operator=(const char* other)
554 {
555 m_requirement = kUnset;
556 if (other)
557 {
558 OdAnsiString str(other);
559 str.makeLower();
560 if (str.iCompare("mandatory") == 0)
561 m_requirement = kMandatory;
562 else if (str.iCompare("recommended") == 0)
563 m_requirement = kRecommended;
564 else if ((str.iCompare("not-relevant") == 0) || (str.iCompare("not relevant") == 0))
565 m_requirement = kNotRelevant;
566 else if ((str.iCompare("not-recommended") == 0) || (str.iCompare("not recommended") == 0))
567 m_requirement = kNotRecommended;
568 else if (str.iCompare("excluded") == 0)
569 m_requirement = kExcluded;
570 }
571 return (*this);
572 }
573 private:
574 Requirement m_requirement;
575 };
576} // namespace OdMvdXml
577
578#endif // !defined(ODA_ODMVDXMLCOMMON_H_INCLUDED_)
579
bool operator==(const Applicability other) const
const bool IsUnset() const
OdMvdApplicability & operator=(const OdMvdApplicability &other)
bool operator==(const OdMvdApplicability &other) const
OdMvdApplicability & operator=(const char *other)
OdMvdApplicability & operator=(const OdAnsiString &other)
const Applicability get() const
OdMvdOperator & operator=(const OdAnsiString &other)
OdMvdOperator & operator=(const char *other)
bool operator==(const OdMvdOperator &other) const
OdMvdOperator & operator=(const OdMvdOperator &other)
const Operator get() const
OdAnsiString toString()
const bool performBoolean(const bool first, const bool second) const
const bool IsUnset() const
bool operator==(const Operator other) const
bool operator==(const Requirement other) const
OdMvdRequirement & operator=(const OdMvdRequirement &other)
const Requirement get() const
const bool IsUnset() const
bool operator==(const OdMvdRequirement &other) const
OdMvdRequirement & operator=(const OdAnsiString &other)
OdMvdRequirement & operator=(const char *other)
@ OdMvdStatusUnset
@ OdMvdDeprecated