rttr  0.9.0
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
method.h
Go to the documentation of this file.
1 /************************************************************************************
2 * *
3 * Copyright (c) 2014 Axel Menzel <info@axelmenzel.de> *
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_METHOD_H__
29 #define __RTTR_METHOD_H__
30 
32 
33 #include <string>
34 #include <vector>
35 
36 namespace rttr
37 {
38 
39 class variant;
40 class type;
41 
42 namespace detail
43 {
44 class method_container_base;
45 class instance;
46 class argument;
47 }
48 
113 {
114  public:
120  bool is_valid() const;
121 
127  operator bool() const;
128 
134  std::string get_name() const;
135 
144  bool is_static() const;
145 
151  type get_return_type() const;
152 
161  type get_declaring_type() const;
162 
168  std::vector<type> get_parameter_types() const;
169 
175  std::string get_signature() const;
176 
185  variant get_metadata(int key) const;
186 
195  variant get_metadata(const std::string& key) const;
196 
204  variant invoke(detail::instance object) const;
205 
213  variant invoke(detail::instance object, detail::argument arg1) const;
214 
222  variant invoke(detail::instance object, detail::argument arg1, detail::argument arg2) const;
223 
231  variant invoke(detail::instance object, detail::argument arg1, detail::argument arg2, detail::argument arg3) const;
232 
240  variant invoke(detail::instance object, detail::argument arg1, detail::argument arg2, detail::argument arg3, detail::argument arg4) const;
241 
249  variant invoke(detail::instance object, detail::argument arg1, detail::argument arg2, detail::argument arg3, detail::argument arg4,
250  detail::argument arg5) const;
251 
259  variant invoke(detail::instance object, detail::argument arg1, detail::argument arg2, detail::argument arg3, detail::argument arg4,
260  detail::argument arg5, detail::argument arg6) const;
261 
271  variant invoke_variadic(detail::instance object, std::vector<detail::argument> args) const;
272 
278  bool operator==(const method& other) const;
279 
285  bool operator!=(const method& other) const;
286 
287  private:
288  friend class type; // to prevent creation of this class
289  method(const detail::method_container_base* container = nullptr);
290  private:
291  const detail::method_container_base* _container;
292 };
293 
294 } // end namespace rttr
295 
296 #endif // __RTTR_METHOD_H__
This class holds the type information for any arbitrary object.
Definition: type.h:165
The method class provides several meta information about a method and can be invoked.
Definition: method.h:112
The variant class allows to store data of any type and convert between these types transparently...
Definition: variant.h:125
#define RTTR_API
Definition: core_prerequisites.h:124