| OLD | NEW |
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-present eyeo GmbH | 3 * Copyright (C) 2006-present eyeo GmbH |
| 4 * | 4 * |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
| 7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
| 8 * | 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 { | 37 { |
| 38 UNKNOWN, | 38 UNKNOWN, |
| 39 VOID, | 39 VOID, |
| 40 INT, | 40 INT, |
| 41 INT64, | 41 INT64, |
| 42 FLOAT, | 42 FLOAT, |
| 43 DOUBLE, | 43 DOUBLE, |
| 44 DEPENDENT_STRING, | 44 DEPENDENT_STRING, |
| 45 OWNED_STRING, | 45 OWNED_STRING, |
| 46 STRING_REF, | 46 STRING_REF, |
| 47 CLASS_PTR | 47 CLASS_PTR, |
| 48 CLASS_REF |
| 48 }; | 49 }; |
| 49 | 50 |
| 50 template<typename T> | 51 template<typename T> |
| 51 struct TypeInfo | 52 struct TypeInfo |
| 52 { | 53 { |
| 53 /* | 54 /* |
| 54 * Since TypeInfo is a templated type, in practice the compiler will define | 55 * Since TypeInfo is a templated type, in practice the compiler will define |
| 55 * a new type for each possible template parameter value. We use that fact | 56 * a new type for each possible template parameter value. We use that fact |
| 56 * to generate type identifiers: each of these TypeInfo types has a | 57 * to generate type identifiers: each of these TypeInfo types has a |
| 57 * different s_typeIDHelper member, so we use a pointer to that static | 58 * different s_typeIDHelper member, so we use a pointer to that static |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 90 |
| 90 if (std::is_same<String&, T>() || std::is_same<const String&, T>() || | 91 if (std::is_same<String&, T>() || std::is_same<const String&, T>() || |
| 91 std::is_same<DependentString&, T>()) | 92 std::is_same<DependentString&, T>()) |
| 92 { | 93 { |
| 93 return TypeCategory::STRING_REF; | 94 return TypeCategory::STRING_REF; |
| 94 } | 95 } |
| 95 | 96 |
| 96 if (std::is_pointer<T>() && std::is_class<typename std::remove_pointer<T>:
:type>()) | 97 if (std::is_pointer<T>() && std::is_class<typename std::remove_pointer<T>:
:type>()) |
| 97 return TypeCategory::CLASS_PTR; | 98 return TypeCategory::CLASS_PTR; |
| 98 | 99 |
| 100 if (std::is_reference<T>() && std::is_class<typename std::remove_reference
<T>::type>()) |
| 101 return TypeCategory::CLASS_REF; |
| 102 |
| 99 return TypeCategory::UNKNOWN; | 103 return TypeCategory::UNKNOWN; |
| 100 } | 104 } |
| 101 | 105 |
| 102 constexpr TYPEID pointer_type() const | 106 constexpr TYPEID pointer_type() const |
| 103 { | 107 { |
| 104 if (std::is_pointer<T>()) | 108 if (std::is_pointer<T>()) |
| 105 return TypeInfo<typename std::remove_pointer<T>::type>(); | 109 return TypeInfo<typename std::remove_pointer<T>::type>(); |
| 106 else | 110 else |
| 107 return nullptr; | 111 return nullptr; |
| 108 } | 112 } |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 template<typename ReturnType, typename... Args> | 333 template<typename ReturnType, typename... Args> |
| 330 const singleton& function(const char* name, ReturnType (ClassType::*method)(Ar
gs...) const) const | 334 const singleton& function(const char* name, ReturnType (ClassType::*method)(Ar
gs...) const) const |
| 331 { | 335 { |
| 332 bindings_internal::register_method( | 336 bindings_internal::register_method( |
| 333 bindings_internal::TypeInfo<ClassType>(), name, method); | 337 bindings_internal::TypeInfo<ClassType>(), name, method); |
| 334 return *this; | 338 return *this; |
| 335 } | 339 } |
| 336 }; | 340 }; |
| 337 | 341 |
| 338 void printBindings(); | 342 void printBindings(); |
| OLD | NEW |