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-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 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 <AdblockPlus.h> | 18 #include <AdblockPlus.h> |
| 19 #include <AdblockPlus/Platform.h> |
19 #include <iostream> | 20 #include <iostream> |
20 #include <sstream> | 21 #include <sstream> |
21 | 22 |
22 #include "GcCommand.h" | 23 #include "GcCommand.h" |
23 #include "HelpCommand.h" | 24 #include "HelpCommand.h" |
24 #include "FiltersCommand.h" | 25 #include "FiltersCommand.h" |
25 #include "MatchesCommand.h" | 26 #include "MatchesCommand.h" |
26 #include "PrefsCommand.h" | 27 #include "PrefsCommand.h" |
27 #include "SubscriptionsCommand.h" | 28 #include "SubscriptionsCommand.h" |
28 | 29 |
(...skipping 25 matching lines...) Expand all Loading... |
54 int main() | 55 int main() |
55 { | 56 { |
56 try | 57 try |
57 { | 58 { |
58 AdblockPlus::AppInfo appInfo; | 59 AdblockPlus::AppInfo appInfo; |
59 appInfo.version = "1.0"; | 60 appInfo.version = "1.0"; |
60 appInfo.name = "abpshell"; | 61 appInfo.name = "abpshell"; |
61 appInfo.application = "standalone"; | 62 appInfo.application = "standalone"; |
62 appInfo.applicationVersion = "1.0"; | 63 appInfo.applicationVersion = "1.0"; |
63 appInfo.locale = "en-US"; | 64 appInfo.locale = "en-US"; |
64 AdblockPlus::JsEnginePtr jsEngine(AdblockPlus::JsEngine::New(appInfo)); | 65 |
| 66 AdblockPlus::Platform platform; |
| 67 platform.SetUpJsEngine(appInfo); |
| 68 AdblockPlus::JsEnginePtr jsEngine = platform.GetJsEngine(); |
65 auto filterEngine = AdblockPlus::FilterEngine::Create(jsEngine); | 69 auto filterEngine = AdblockPlus::FilterEngine::Create(jsEngine); |
66 | 70 |
67 CommandMap commands; | 71 CommandMap commands; |
68 Add(commands, new GcCommand(jsEngine)); | 72 Add(commands, new GcCommand(jsEngine)); |
69 Add(commands, new HelpCommand(commands)); | 73 Add(commands, new HelpCommand(commands)); |
70 Add(commands, new FiltersCommand(*filterEngine)); | 74 Add(commands, new FiltersCommand(*filterEngine)); |
71 Add(commands, new SubscriptionsCommand(*filterEngine)); | 75 Add(commands, new SubscriptionsCommand(*filterEngine)); |
72 Add(commands, new MatchesCommand(*filterEngine)); | 76 Add(commands, new MatchesCommand(*filterEngine)); |
73 Add(commands, new PrefsCommand(*filterEngine)); | 77 Add(commands, new PrefsCommand(*filterEngine)); |
74 | 78 |
(...skipping 16 matching lines...) Expand all Loading... |
91 std::cout << error.what() << std::endl; | 95 std::cout << error.what() << std::endl; |
92 } | 96 } |
93 } | 97 } |
94 } | 98 } |
95 catch (const std::exception& e) | 99 catch (const std::exception& e) |
96 { | 100 { |
97 std::cerr << "Exception: " << e.what() << std::endl; | 101 std::cerr << "Exception: " << e.what() << std::endl; |
98 } | 102 } |
99 return 0; | 103 return 0; |
100 } | 104 } |
OLD | NEW |