Ardour  9.0-pre0-582-g084a23a80d
TypeList.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 /*
3  https://github.com/vinniefalco/LuaBridge
4 
5  Copyright 2012, Vinnie Falco <vinnie.falco@gmail.com>
6  Copyright 2007, Nathan Reed
7 
8  License: The MIT License (http://www.opensource.org/licenses/mit-license.php)
9 
10  Permission is hereby granted, free of charge, to any person obtaining a copy
11  of this software and associated documentation files (the "Software"), to deal
12  in the Software without restriction, including without limitation the rights
13  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14  copies of the Software, and to permit persons to whom the Software is
15  furnished to do so, subject to the following conditions:
16 
17  The above copyright notice and this permission notice shall be included in all
18  copies or substantial portions of the Software.
19 
20  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26  SOFTWARE.
27 
28  This file incorporates work covered by the following copyright and
29  permission notice:
30 
31  The Loki Library
32  Copyright (c) 2001 by Andrei Alexandrescu
33  This code accompanies the book:
34  Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design
35  Patterns Applied". Copyright (c) 2001. Addison-Wesley.
36  Permission to use, copy, modify, distribute and sell this software for any
37  purpose is hereby granted without fee, provided that the above copyright
38  notice appear in all copies and that both that copyright notice and this
39  permission notice appear in supporting documentation.
40  The author or Addison-Welsey Longman make no representations about the
41  suitability of this software for any purpose. It is provided "as is"
42  without express or implied warranty.
43 */
44 //==============================================================================
45 
49 typedef void None;
50 
51 template <typename Head, typename Tail = None>
52 struct TypeList
53 {
54 };
55 
59 template <typename List>
61 {
62  static std::string const tostring (bool)
63  {
64  return "";
65  }
66 };
67 
79 template <typename Head, typename Tail>
80 struct TypeListValues <TypeList <Head, Tail> >
81 {
82  Head hd;
84 
85  TypeListValues (Head hd_, TypeListValues <Tail> const& tl_)
86  : hd (hd_), tl (tl_)
87  {
88  }
89 
90  static std::string const tostring (bool comma = false)
91  {
92  std::string s;
93 
94  if (comma)
95  s = ", ";
96 
97  s = s + typeid (Head).name ();
98 
99  return s + TypeListValues <Tail>::tostring (true);
100  }
101 };
102 
103 //==============================================================================
108 template <typename List, int Start = 1>
109 struct ArgList
110 {
111 };
112 
113 template <int Start>
114 struct ArgList <None, Start> : public TypeListValues <None>
115 {
117  {
118  }
119 };
120 
121 template <typename Head, typename Tail, int Start>
122 struct ArgList <TypeList <Head, Tail>, Start>
123  : public TypeListValues <TypeList <Head, Tail> >
124 {
126  : TypeListValues <TypeList <Head, Tail> > (Stack <Head>::get (L, Start),
127  ArgList <Tail, Start + 1> (L))
128  {
129  }
130 };
void None
Definition: TypeList.h:49
GtkImageIconNameData name
Definition: gtkimage.h:6
ArgList(lua_State *)
Definition: TypeList.h:116
TypeListValues(Head hd_, TypeListValues< Tail > const &tl_)
Definition: TypeList.h:85
static std::string const tostring(bool comma=false)
Definition: TypeList.h:90
static std::string const tostring(bool)
Definition: TypeList.h:62