parameter_info.h Source File - 0.9.5 |RTTR
parameter_info.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 #ifndef RTTR_PARAMETER_INFO_H_
28 #define RTTR_PARAMETER_INFO_H_
29 
30 #include "rttr/detail/base/core_prerequisites.h"
31 
32 #include <string>
33 #include <vector>
34 #include <cstdint>
35 
36 namespace rttr
37 {
38 
39 class variant;
40 class type;
41 class parameter_info;
42 
43 namespace detail
44 {
45  class parameter_info_wrapper_base;
46  template<typename...T>
47  struct parameter_infos;
48  template<typename...T>
49  static std::vector<parameter_info> convert_to_parameter_info_list(const parameter_infos<T...>&);
50 
51  template<typename T>
52  static parameter_info create_param_info(const T&);
53 }
54 
111 class RTTR_API parameter_info
112 {
113  public:
119  type get_type() const;
120 
126  bool has_default_value() const;
127 
134  variant get_default_value() const;
135 
143  std::string get_name() const;
144 
150  uint32_t get_index() const;
151 
157  bool operator==(const parameter_info& other) const;
158 
164  bool operator!=(const parameter_info& other) const;
165 
166  private:
167  template<typename... T>
168  friend std::vector<parameter_info> detail::convert_to_parameter_info_list(const detail::parameter_infos<T...>&);
169 
170  template<typename T>
171  friend parameter_info detail::create_param_info(const T&);
172 
173  parameter_info(const detail::parameter_info_wrapper_base* wrapper = nullptr);
174  private:
175  const detail::parameter_info_wrapper_base* m_wrapper;
176 };
177 
178 } // end namespace rttr
179 
180 #endif // RTTR_PARAMETER_INFO_H_
Definition: access_levels.h:33
The type class holds the type information for any arbitrary object.
Definition: type.h:153
The parameter_info class provides several meta information about a parameter.
Definition: parameter_info.h:111
The variant class allows to store data of any type and convert between these types transparently...
Definition: variant.h:192