CFx SDK Documentation  2020SP3
daiPrimitive.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2019, 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-2019 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 _DAI_PRIMITIVE_H_
25 #define _DAI_PRIMITIVE_H_
26 
27 #include "OdAnsiString.h"
28 
29 #include "daiConsts.h"
30 
34 namespace OdDAI {
35 
36  class OdSpfEnum {
37 
38  };
39 
40  enum OdLogical_ {
41  k_F,
42  k_T,
44  k_U
45  };
46 
47  class OdLogical {
48  OdLogical_ m_val;
49  public:
50 
51  OdLogical() : m_val(k_unset) {};
52  OdLogical(const OdLogical &other) : m_val(other.m_val) {};
53  OdLogical(OdLogical_ val) : m_val(val) {};
54  int exists() const { return m_val != k_unset ? 1 : 0; };
55  void nullify() { m_val = k_unset; };
56  operator OdLogical_() const { return m_val; };
57  //operator int() const { return m_val; };
58  OdLogical& operator = (const OdLogical_ val) { m_val = val; return *this; };
59  OdLogical& operator = (const long val) { m_val = (OdLogical_)val; return *this; };
60  OdLogical& operator = (const OdAnsiString &val) {
61  if (val == "F")
62  m_val = k_F;
63  else
64  if (val == "T")
65  m_val = k_T;
66  else
67  if (val == "U")
68  m_val = k_U;
69  else
70  m_val = k_unset;
71  return *this;
72  };
73 
74  bool operator == (const OdLogical &other)
75  {
76  return m_val == other.m_val;
77  };
78 
79  operator OdAnsiString () {
80  switch (m_val)
81  {
82  case k_F:
83  return "F";
84  case k_T:
85  return "T";
86  case k_U:
87  return "U";
88  }
89  return OdDAI::Consts::OdStringUnset;
90  };
91 
92  };
93 
94  typedef OdAnsiString BINARY;
95 
96 }
97 
98 #endif // _DAI_PRIMITIVE_H_
OdDAI::OdSpfEnum
Definition: daiPrimitive.h:36
OdDAI::k_T
@ k_T
Definition: daiPrimitive.h:42
OdDAI::OdLogical::exists
int exists() const
Definition: daiPrimitive.h:54
OdDAI::OdLogical
Definition: daiPrimitive.h:47
OdDAI::BINARY
OdAnsiString BINARY
Definition: daiPrimitive.h:94
OdDAI::OdLogical::nullify
void nullify()
Definition: daiPrimitive.h:55
OdDAI::OdLogical::OdLogical
OdLogical()
Definition: daiPrimitive.h:51
OdDAI::k_F
@ k_F
Definition: daiPrimitive.h:41
OdDAI
Definition: daiAccessDefines.h:31
OdAnsiString.h
daiConsts.h
OdDAI::k_U
@ k_U
Definition: daiPrimitive.h:44
OdDAI::OdLogical::operator=
OdLogical & operator=(const OdLogical_ val)
Definition: daiPrimitive.h:58
OdDAI::OdLogical::operator==
bool operator==(const OdLogical &other)
Definition: daiPrimitive.h:74
OdDAI::OdLogical::OdLogical
OdLogical(OdLogical_ val)
Definition: daiPrimitive.h:53
OdDAI::OdLogical::OdLogical
OdLogical(const OdLogical &other)
Definition: daiPrimitive.h:52
OdDAI::OdLogical_
OdLogical_
Definition: daiPrimitive.h:40
OdDAI::k_unset
@ k_unset
Definition: daiPrimitive.h:43