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

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

Issue 29613616: Issue 6064 - Put C++ code into a configurable namespace (Closed) Base URL: https://github.com/adblockplus/adblockpluscore.git
Patch Set: Fix debug.h to be aligned with assert2 (define vs function) and get rid of a warning in generator.cpp Created Nov. 21, 2017, 2:53 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 #include <cstdio> 18 #include <cstdio>
19 19
20 #include "generator.h" 20 #include "generator.h"
21 #include "library.h" 21 #include "library.h"
22 22
23 ABP_NS_USING
24
23 namespace 25 namespace
24 { 26 {
25 std::vector<bindings_internal::ClassInfo> classes; 27 std::vector<bindings_internal::ClassInfo> classes;
26 } 28 }
27 29 ABP_NS_BEGIN
hub 2017/11/21 16:48:39 the anonymous namespace above should be within thi
sergei 2017/11/22 09:39:26 Here this anonymous namespace can be in ABP_NS nam
28 namespace bindings_internal 30 namespace bindings_internal
29 { 31 {
30 FunctionInfo::FunctionInfo() 32 FunctionInfo::FunctionInfo()
31 { 33 {
32 } 34 }
33 35
34 FunctionInfo::FunctionInfo(TypeCategory returnType, TYPEID pointerType, 36 FunctionInfo::FunctionInfo(TypeCategory returnType, TYPEID pointerType,
35 std::initializer_list<TypeCategory> argTypes, bool instance_function, 37 std::initializer_list<TypeCategory> argTypes, bool instance_function,
36 void* function) 38 void* function)
37 : returnType(returnType), pointerType(pointerType), 39 : returnType(returnType), pointerType(pointerType),
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 DifferentiatorInfo differentiator = cls.subclass_differentiator; 472 DifferentiatorInfo differentiator = cls.subclass_differentiator;
471 if (differentiator.offset == SIZE_MAX) 473 if (differentiator.offset == SIZE_MAX)
472 return; 474 return;
473 475
474 printf("var %s_mapping = \n", cls.name.c_str()); 476 printf("var %s_mapping = \n", cls.name.c_str());
475 puts("{"); 477 puts("{");
476 for (const auto& item : differentiator.mapping) 478 for (const auto& item : differentiator.mapping)
477 printf(" %i: exports.%s,\n", item.first, item.second.c_str()); 479 printf(" %i: exports.%s,\n", item.first, item.second.c_str());
478 puts("};"); 480 puts("};");
479 } 481 }
480 } 482 } // namespace bindings_internal
481 483
482 void printBindings() 484 void printBindings()
483 { 485 {
484 bindings_internal::printHelpers(); 486 bindings_internal::printHelpers();
485 487
486 for (const auto& cls : classes) 488 for (const auto& cls : classes)
487 bindings_internal::printClass(cls); 489 bindings_internal::printClass(cls);
488 for (const auto& cls : classes) 490 for (const auto& cls : classes)
489 bindings_internal::printClassMapping(cls); 491 bindings_internal::printClassMapping(cls);
490 } 492 }
493
494 ABP_NS_END
OLDNEW

Powered by Google App Engine
This is Rietveld