aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/utils/enum_symbols.cpp
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2020-01-14 19:36:53 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2020-01-14 20:07:47 +0300
commit0bff1d2776e0da589dd98eca69e7f04fb07dfd02 (patch)
treef7f8b905a34133d80e93d20770bdb092c04e247d /utils/enum_symbols.cpp
parentclang-format: don't BinPackArguments (diff)
downloadwinapi-debug-0bff1d2776e0da589dd98eca69e7f04fb07dfd02.tar.gz
winapi-debug-0bff1d2776e0da589dd98eca69e7f04fb07dfd02.zip
clang-format all the code
Diffstat (limited to 'utils/enum_symbols.cpp')
-rw-r--r--utils/enum_symbols.cpp94
1 files changed, 36 insertions, 58 deletions
diff --git a/utils/enum_symbols.cpp b/utils/enum_symbols.cpp
index 8fa0960..0759dd6 100644
--- a/utils/enum_symbols.cpp
+++ b/utils/enum_symbols.cpp
@@ -4,9 +4,8 @@
// Distributed under the MIT License.
#include "command_line.hpp"
-#include "pdb_descr.hpp"
-
#include "pdb/all.hpp"
+#include "pdb_descr.hpp"
#pragma warning(push, 0)
#include <boost/program_options.hpp>
@@ -17,88 +16,67 @@
#include <string>
#include <vector>
-namespace
-{
- class EnumSymbols : public SettingsParser
- {
- public:
- explicit EnumSymbols(const std::string& argv0)
- : SettingsParser{argv0}
- {
- visible.add_options()
- ("pdb",
- boost::program_options::value<std::vector<PDB>>(&pdbs)
- ->value_name("ADDR,PATH"),
- "load a PDB file")
- ("functions",
- boost::program_options::value<pdb::Symbol::Tag>(&tag)
- ->implicit_value(function_tag)
- ->zero_tokens(),
- "only list functions");
- }
+namespace {
- const char* get_short_description() const override
- {
- return "[-h|--help] [--pdb ADDR,PATH]... [--functions]";
- }
+class EnumSymbols : public SettingsParser {
+public:
+ explicit EnumSymbols(const std::string& argv0) : SettingsParser{argv0} {
+ namespace po = boost::program_options;
- std::vector<PDB> pdbs;
+ visible.add_options()(
+ "pdb", po::value<std::vector<PDB>>(&pdbs)->value_name("ADDR,PATH"), "load a PDB file");
+ visible.add_options()(
+ "functions",
+ po::value<pdb::Symbol::Tag>(&tag)->implicit_value(function_tag)->zero_tokens(),
+ "only list functions");
+ }
- bool type_specified() const
- {
- return tag != reserved_tag;
- }
+ const char* get_short_description() const override {
+ return "[-h|--help] [--pdb ADDR,PATH]... [--functions]";
+ }
- pdb::Symbol::Type get_type() const
- {
- return static_cast<pdb::Symbol::Type>(tag);
- }
+ std::vector<PDB> pdbs;
- private:
- static const auto reserved_tag = static_cast<pdb::Symbol::Tag>(pdb::Symbol::Type::RESERVED);
- static const auto function_tag = static_cast<pdb::Symbol::Tag>(pdb::Symbol::Type::Function);
+ bool type_specified() const { return tag != reserved_tag; }
- pdb::Symbol::Tag tag = reserved_tag;
- };
-}
+ pdb::Symbol::Type get_type() const { return static_cast<pdb::Symbol::Type>(tag); }
+
+private:
+ static const auto reserved_tag = static_cast<pdb::Symbol::Tag>(pdb::Symbol::Type::RESERVED);
+ static const auto function_tag = static_cast<pdb::Symbol::Tag>(pdb::Symbol::Type::Function);
+
+ pdb::Symbol::Tag tag = reserved_tag;
+};
-int main(int argc, char* argv[])
-{
- try
- {
+} // namespace
+
+int main(int argc, char* argv[]) {
+ try {
EnumSymbols settings{argv[0]};
- try
- {
+ try {
settings.parse(argc, argv);
- }
- catch (const boost::program_options::error& e)
- {
+ } catch (const boost::program_options::error& e) {
settings.usage_error(e);
return 1;
}
- if (settings.exit_with_usage)
- {
+ if (settings.exit_with_usage) {
settings.usage();
return 0;
}
pdb::Repo repo;
- for (const auto& pdb : settings.pdbs)
- {
+ for (const auto& pdb : settings.pdbs) {
const auto id = repo.add_pdb(pdb.online_base, pdb.path);
- repo.enum_symbols(id, [&] (const pdb::Symbol& symbol)
- {
+ repo.enum_symbols(id, [&](const pdb::Symbol& symbol) {
if (!settings.type_specified() || settings.get_type() == symbol.get_type())
std::cout << symbol.get_name() << '\n';
});
}
- }
- catch (const std::exception& e)
- {
+ } catch (const std::exception& e) {
std::cerr << "error: " << e.what() << '\n';
return 1;
}