array_mapper.h Source File - 0.9.5 |RTTR
array_mapper.h
Go to the documentation of this file.
1 /************************************************************************************
2 * *
3 * Copyright (c) 2014, 2015 - 2016 Axel Menzel <info@rttr.org> *
4 * *
5 * This file is part of RTTR (Run Time Type Reflection) *
6 * License: MIT License *
7 * *
8 * Permission is hereby granted, free of charge, to any person obtaining *
9 * a copy of this software and associated documentation files (the "Software"), *
10 * to deal in the Software without restriction, including without limitation *
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense, *
12 * and/or sell copies of the Software, and to permit persons to whom the *
13 * Software is furnished to do so, subject to the following conditions: *
14 * *
15 * The above copyright notice and this permission notice shall be included in *
16 * all copies or substantial portions of the Software. *
17 * *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, *
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE *
24 * SOFTWARE. *
25 * *
26 *************************************************************************************/
27 
28 #ifndef RTTR_ARRAY_MAPPER_H_
29 #define RTTR_ARRAY_MAPPER_H_
30 
31 #include "rttr/detail/base/core_prerequisites.h"
32 
33 #include <cstddef>
34 #include <vector>
35 #include <list>
36 #include <array>
37 
38 namespace rttr
39 {
40 namespace detail
41 {
42 struct invalid_array_type {};
43 }
44 
46 
132 template <typename T>
134 {
135 #ifndef DOXYGEN
136  using no_array_type = detail::invalid_array_type;
137  using raw_type = T;
138  using sub_type = T;
139 #else
140  using array_type = T;
142  using sub_type = T;
143 
144  static bool is_dynamic()
145  {
146  }
147 
148  static std::size_t get_size(const array_type&)
149  {
150  }
151 
152  static bool set_size(array_type& arr, std::size_t new_size)
153  {
154  }
155 
156  static const T& get_value(const array_type& arr, std::size_t index)
157  {
158  }
159 
160  static T& get_value(array_type& arr, std::size_t index)
161  {
162  }
163 
164  static bool insert_value(array_type&, const T& value, std::size_t,)
165  {
166  }
167 
168  static bool remove_value(array_type&, std::size_t)
169  {
170  }
171 #endif
172 };
173 
175 
176 } // end namespace rttr
177 
178 #include "rttr/detail/array/array_mapper_impl.h"
179 
180 #endif // RTTR_ARRAY_MAPPER_H_
Definition: access_levels.h:33
static std::size_t get_size(const array_type &)
Definition: array_mapper.h:148
static bool set_size(array_type &arr, std::size_t new_size)
Definition: array_mapper.h:152
T sub_type
Definition: array_mapper.h:142
detail::enum_data< Enum_Type > value(const char *name, Enum_Type value)
The value function should be used to add a mapping from enum name to value during the registration pr...
The array_mapper class is a class template to access different array types via one common interface...
Definition: array_mapper.h:133
static bool remove_value(array_type &, std::size_t)
Definition: array_mapper.h:168
static bool insert_value(array_type &, const T &value, std::size_t,)
Definition: array_mapper.h:164
static T & get_value(array_type &arr, std::size_t index)
Definition: array_mapper.h:160
static const T & get_value(const array_type &arr, std::size_t index)
Definition: array_mapper.h:156
typename array_mapper< T >::raw_type raw_type
Definition: array_mapper.h:141
static bool is_dynamic()
Definition: array_mapper.h:144
T array_type
Definition: array_mapper.h:140