OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 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 18 matching lines...) Expand all Loading... |
29 namespace | 29 namespace |
30 { | 30 { |
31 void Add(CommandMap& commands, Command* command) | 31 void Add(CommandMap& commands, Command* command) |
32 { | 32 { |
33 commands[command->name] = command; | 33 commands[command->name] = command; |
34 } | 34 } |
35 | 35 |
36 bool ReadCommandLine(std::string& commandLine) | 36 bool ReadCommandLine(std::string& commandLine) |
37 { | 37 { |
38 std::cout << "> "; | 38 std::cout << "> "; |
39 const bool success = std::getline(std::cin, commandLine); | 39 const bool success = std::getline(std::cin, commandLine).good(); |
40 if (!success) | 40 if (!success) |
41 std::cout << std::endl; | 41 std::cout << std::endl; |
42 return success; | 42 return success; |
43 } | 43 } |
44 | 44 |
45 void ParseCommandLine(const std::string& commandLine, std::string& name, | 45 void ParseCommandLine(const std::string& commandLine, std::string& name, |
46 std::string& arguments) | 46 std::string& arguments) |
47 { | 47 { |
48 std::istringstream lineStream(commandLine); | 48 std::istringstream lineStream(commandLine); |
49 lineStream >> name; | 49 lineStream >> name; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 std::cout << error.what() << std::endl; | 91 std::cout << error.what() << std::endl; |
92 } | 92 } |
93 } | 93 } |
94 } | 94 } |
95 catch (const std::exception& e) | 95 catch (const std::exception& e) |
96 { | 96 { |
97 std::cerr << "Exception: " << e.what() << std::endl; | 97 std::cerr << "Exception: " << e.what() << std::endl; |
98 } | 98 } |
99 return 0; | 99 return 0; |
100 } | 100 } |
OLD | NEW |