2 * Source File for Tracking IDL Versions
4 * Header File Counterpart is include/idl_version.h
7 #include "ace/OS_NS_string.h"
8 #include "idl_version.h"
11 const char * idlVersionNames
[IDL_VERSION_COUNT
] = {
18 * Values for __TAO_IDL_IDL_VERSION. Should work like __TAO_IDL does.
20 const char * idl_version_macros
[IDL_VERSION_COUNT
] = {
27 IdlVersion::IdlVersion () : version_(DEFAULT_DEFAULT_IDL_VERSION
)
31 IdlVersion::IdlVersion (SpecificIdlVersion version
)
33 this->version (version
);
36 SpecificIdlVersion
IdlVersion::version () const
41 void IdlVersion::version (SpecificIdlVersion version
)
43 version_
= version
< IDL_VERSION_COUNT
? version
: IDL_VERSION_INVALID
;
46 bool IdlVersion::is_valid () const
48 return version_
!= IDL_VERSION_INVALID
;
51 const char * IdlVersion::to_string () const
53 return idlVersionNames
[version_
];
56 void IdlVersion::from_string (const char * version
)
60 for (int i
= 0; i
< IDL_VERSION_COUNT
; i
++)
62 if (!ACE_OS::strcmp (version
, idlVersionNames
[i
]))
64 version_
= static_cast<SpecificIdlVersion
> (i
);
69 version_
= IDL_VERSION_INVALID
;
72 const char * IdlVersion::to_macro () const
74 return idl_version_macros
[version_
];
77 IdlVersion::operator SpecificIdlVersion () const
82 bool IdlVersion::operator== (SpecificIdlVersion other
) const
84 return version_
== other
;
87 bool IdlVersion::operator!= (SpecificIdlVersion other
) const
89 return version_
!= other
;
92 bool IdlVersion::operator> (SpecificIdlVersion other
) const
94 return version_
> other
;
97 bool IdlVersion::operator>= (SpecificIdlVersion other
) const
99 return version_
>= other
;
102 bool IdlVersion::operator< (SpecificIdlVersion other
) const
104 return version_
< other
;
107 bool IdlVersion::operator<= (SpecificIdlVersion other
) const
109 return version_
<= other
;