MRPT  1.9.9
typemeta_TEnumType/test.cpp
/* +------------------------------------------------------------------------+
| Mobile Robot Programming Toolkit (MRPT) |
| http://www.mrpt.org/ |
| |
| Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
| See: http://www.mrpt.org/Authors - All rights reserved. |
| Released under BSD License. See details in http://www.mrpt.org/License |
+------------------------------------------------------------------------+ */
/** \example typemeta_TEnumType/test.cpp */
//! [example]
#include <iostream>
#include <string>
// Example declaration of "enum class"
enum class TestColors
{
Black = 0,
Gray = 7,
White = 15
};
// Example declaration of plain enum
{
};
// Example declaration of "enum class"
{
using namespace std;
using namespace mrpt::typemeta;
cout << "White => " << (int)TEnumType<TestColors>::name2value("White")
<< endl;
cout << "Black => " << (int)TEnumType<TestColors>::name2value("Black")
<< endl;
cout << "Gray => " << (int)TEnumType<TestColors>::name2value("Gray")
<< endl;
cout << "7 <= " << TEnumType<TestColors>::value2name(TestColors(7))
<< endl;
}
//! [example]
int main(int argc, char** argv)
{
try
{
return 0;
}
catch (std::exception& e)
{
std::cout << "Exception: " << e.what() << std::endl;
return -1;
}
}
#define MRPT_ENUM_TYPE_END()
Definition: TEnumType.h:78
#define MRPT_FILL_ENUM_MEMBER(_CLASS, _VALUE)
Definition: TEnumType.h:88
#define MRPT_FILL_ENUM(_X)
For use in specializations of TEnumTypeFiller.
Definition: TEnumType.h:86
#define MRPT_ENUM_TYPE_BEGIN(_ENUM_TYPE_WITH_NS)
Definition: TEnumType.h:62
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
void Test_EnumType()



Page generated by Doxygen 1.9.1 for MRPT 1.9.9 Git: 814d80880 Fri Aug 24 01:51:28 2018 +0200 at mar 26 may 2026 12:30:59 CEST