diff options
| author | Egor Tensin <egor@tensin.name> | 2026-06-05 17:47:31 +0200 |
|---|---|---|
| committer | Egor Tensin <egor@tensin.name> | 2026-06-05 17:47:31 +0200 |
| commit | dfcebbeae9d982b8e2a42197b2892334b665de2d (patch) | |
| tree | 182339f03eae894aad97f0fc55b0d8438c4ef62d /include/winapi/debug | |
| parent | upgrade to std::optional (diff) | |
| download | winapi-debug-dfcebbeae9d982b8e2a42197b2892334b665de2d.tar.gz winapi-debug-dfcebbeae9d982b8e2a42197b2892334b665de2d.zip | |
upgrade to std::string_view
Diffstat (limited to '')
| -rw-r--r-- | include/winapi/debug/address.hpp | 5 | ||||
| -rw-r--r-- | include/winapi/debug/dbghelp.hpp | 10 | ||||
| -rw-r--r-- | include/winapi/debug/post_mortem.hpp | 6 |
3 files changed, 11 insertions, 10 deletions
diff --git a/include/winapi/debug/address.hpp b/include/winapi/debug/address.hpp index a5f186e..9fe6e2b 100644 --- a/include/winapi/debug/address.hpp +++ b/include/winapi/debug/address.hpp @@ -10,6 +10,7 @@ #include <charconv> #include <format> #include <string> +#include <string_view> namespace winapi { @@ -25,9 +26,9 @@ inline std::string format(void* address) { return format(reinterpret_cast<Address>(address)); } -inline bool parse(Address& dest, const std::string& src) { +inline bool parse(Address& dest, std::string_view src) { Address result; - const auto [ptr, ec] = std::from_chars(src.c_str(), src.c_str() + src.length(), result, 16); + const auto [ptr, ec] = std::from_chars(src.data(), src.data() + src.length(), result, 16); if (ec == std::errc()) { dest = result; return true; diff --git a/include/winapi/debug/dbghelp.hpp b/include/winapi/debug/dbghelp.hpp index fb179f3..29e56e7 100644 --- a/include/winapi/debug/dbghelp.hpp +++ b/include/winapi/debug/dbghelp.hpp @@ -12,7 +12,7 @@ #include <windows.h> #include <functional> -#include <string> +#include <string_view> namespace winapi { @@ -27,7 +27,7 @@ public: DbgHelp& operator=(DbgHelp) noexcept; ~DbgHelp(); - ModuleInfo load_pdb(const std::string& path) const; + ModuleInfo load_pdb(std::string_view path) const; typedef std::function<void(const ModuleInfo&)> OnModule; void enum_modules(const OnModule&) const; @@ -36,13 +36,13 @@ public: typedef std::function<void(const SymbolInfo&)> OnSymbol; static constexpr auto all_symbols = "*!*"; - void enum_symbols(const ModuleInfo&, const std::string& mask, const OnSymbol&) const; + void enum_symbols(const ModuleInfo&, std::string_view mask, const OnSymbol&) const; void enum_symbols(const ModuleInfo&, const OnSymbol&) const; - void enum_symbols(const std::string& mask, const OnSymbol&) const; + void enum_symbols(std::string_view mask, const OnSymbol&) const; void enum_symbols(const OnSymbol&) const; SymbolInfo resolve_symbol(Address) const; - SymbolInfo resolve_symbol(const std::string&) const; + SymbolInfo resolve_symbol(std::string_view) const; LineInfo resolve_line(Address) const; diff --git a/include/winapi/debug/post_mortem.hpp b/include/winapi/debug/post_mortem.hpp index bf4ad83..5ddc85e 100644 --- a/include/winapi/debug/post_mortem.hpp +++ b/include/winapi/debug/post_mortem.hpp @@ -14,7 +14,7 @@ #include <functional> #include <map> -#include <string> +#include <string_view> #include <unordered_set> namespace winapi { @@ -23,7 +23,7 @@ class PostMortem { public: PostMortem() = default; - Address add_pdb(Address online_base, const std::string& path); + Address add_pdb(Address online_base, std::string_view path); typedef std::function<void(const Symbol&)> OnSymbol; void enum_symbols(const OnSymbol&) const; @@ -31,7 +31,7 @@ public: void enum_symbols(const Module&, const OnSymbol&) const; Symbol resolve_symbol(Address) const; - Symbol resolve_symbol(const std::string&) const; + Symbol resolve_symbol(std::string_view) const; LineInfo resolve_line(Address) const; |
