Lumiera  0.pre.03
»edit your freedom«
type-demangling-test.cpp
Go to the documentation of this file.
1 /*
2  TypeDemangling(Test) - ensure a helper for C++ demangling works as expected
3 
4  Copyright (C) Lumiera.org
5  2014, Hermann Vosseler <Ichthyostega@web.de>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 * *****************************************************/
22 
28 #include "lib/test/run.hpp"
29 #include "lib/meta/util.hpp"
30 
31 #include <string>
32 #include <iostream>
33 
34 using std::string;
35 using std::cout;
36 using std::endl;
37 
38 
39 namespace lib {
40 namespace meta{
41 namespace test{
42 
43  template<class T>
44  struct Outer
45  {
46  struct Inner { };
47 
48  static const T*
49  cloak (Inner const&&)
50  {
51  return nullptr;
52  }
53  };
54 
55  struct Space { };
56 
57 
58 
59 
60  /**********************************************/
69  class TypeDemangling_test : public Test
70  {
71  void
72  run (Arg)
73  {
74  Outer<Space> ship;
75  auto magic = &ship.cloak;
76  auto rawType = typeid(magic).name();
77 
78  cout << rawType << endl;
79  cout << demangleCxx(rawType) << endl;
80  }
81  };
82 
83  LAUNCHER (TypeDemangling_test, "unit common");
84 
85 
86 }}} // namespace lib::meta::test
Definition: run.hpp:49
Simple and lightweight helpers for metaprogramming and type detection.
Implementation namespace for support and library code.
Simple test class runner.
string demangleCxx(Literal rawName)
Fallback type-ID:
Definition: format-obj.cpp:168
ElementBoxWidget::Config::Qualifier name(string id)
define the name-ID displayed in the caption