Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: compiled/bindings/generator.h

Issue 29714558: Noissue - use static_assert for SFINAE for better error messaging (Closed) Base URL: github.com:adblockplus/adblockpluscore
Patch Set: Created March 5, 2018, 11:41 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « compiled/StringMap.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 const FunctionInfo& call); 214 const FunctionInfo& call);
215 215
216 void register_differentiator(TYPEID classID, size_t offset, 216 void register_differentiator(TYPEID classID, size_t offset,
217 std::vector<std::pair<int, std::string>>& mapping); 217 std::vector<std::pair<int, std::string>>& mapping);
218 218
219 std::string wrapCall(const FunctionInfo& call, bool isFunction = true, 219 std::string wrapCall(const FunctionInfo& call, bool isFunction = true,
220 const FunctionInfo& instanceGetter = FunctionInfo()); 220 const FunctionInfo& instanceGetter = FunctionInfo());
221 } 221 }
222 222
223 template<typename ClassType, 223 template<typename ClassType,
224 typename BaseClass = bindings_internal::NoBaseClass, 224 typename BaseClass = bindings_internal::NoBaseClass>
225 typename std::enable_if<std::is_base_of<ref_counted, ClassType>::value>::typ e* = nullptr>
226 class class_ 225 class class_
227 { 226 {
227 static_assert(std::is_base_of<ref_counted, ClassType>::value, "ClassType shoul d be based on ref_counted");
228 public: 228 public:
229 class_(const char* name) 229 class_(const char* name)
230 { 230 {
231 ClassType* ptr = reinterpret_cast<ClassType*>(0x10000000); 231 ClassType* ptr = reinterpret_cast<ClassType*>(0x10000000);
232 ptrdiff_t ref_counted_offset = 232 ptrdiff_t ref_counted_offset =
233 reinterpret_cast<char*>(static_cast<ref_counted*>(ptr)) - 233 reinterpret_cast<char*>(static_cast<ref_counted*>(ptr)) -
234 reinterpret_cast<char*>(ptr); 234 reinterpret_cast<char*>(ptr);
235 bindings_internal::register_class(name, 235 bindings_internal::register_class(name,
236 bindings_internal::TypeInfo<ClassType>(), 236 bindings_internal::TypeInfo<ClassType>(),
237 bindings_internal::TypeInfo<BaseClass>(), 237 bindings_internal::TypeInfo<BaseClass>(),
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 { 338 {
339 bindings_internal::register_method( 339 bindings_internal::register_method(
340 bindings_internal::TypeInfo<ClassType>(), name, method); 340 bindings_internal::TypeInfo<ClassType>(), name, method);
341 return *this; 341 return *this;
342 } 342 }
343 }; 343 };
344 344
345 void printBindings(); 345 void printBindings();
346 346
347 ABP_NS_END 347 ABP_NS_END
OLDNEW
« no previous file with comments | « compiled/StringMap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld