From aff892356f8d85dd6a0e5ac67a07a6a0b4463e75 Mon Sep 17 00:00:00 2001 From: Antony Polukhin Date: Fri, 25 Nov 2016 21:59:30 +0300 Subject: [PATCH] Changed classname from frame_view to frame --- doc/stacktrace.qbk | 2 +- example/getting_started.cpp | 4 +- include/boost/stacktrace.hpp | 2 +- include/boost/stacktrace/const_iterator.hpp | 16 ++++---- .../stacktrace/{frame_view.hpp => frame.hpp} | 40 +++++++++---------- include/boost/stacktrace/stacktrace.hpp | 10 ++--- test/test.cpp | 8 ++-- 7 files changed, 41 insertions(+), 41 deletions(-) rename include/boost/stacktrace/{frame_view.hpp => frame.hpp} (65%) diff --git a/doc/stacktrace.qbk b/doc/stacktrace.qbk index 0c7512f..1f9283d 100644 --- a/doc/stacktrace.qbk +++ b/doc/stacktrace.qbk @@ -225,7 +225,7 @@ See [link boost_stacktrace.build_macros_and_backends section "Build, Macros and [section Saving stacktraces by specified format] -[classref boost::stacktrace::stacktrace] provides access to individual [classref boost::stacktrace::frame_view frames] of the stacktrace, +[classref boost::stacktrace::stacktrace] provides access to individual [classref boost::stacktrace::frame frames] of the stacktrace, so that you could save stacktrace information in your own format. Consider the example, that saves only function addresses of each frame: [getting_started_trace_addresses] diff --git a/example/getting_started.cpp b/example/getting_started.cpp index c8a80f1..6b26b1f 100644 --- a/example/getting_started.cpp +++ b/example/getting_started.cpp @@ -123,7 +123,7 @@ void setup_handlers() { namespace bs = boost::stacktrace; void dump_compact(const bs::stacktrace& st) { for (unsigned i = 0; i < st.size(); ++i) { - bs::frame_view frame = st[i]; + bs::frame frame = st[i]; std::cout << frame.address() << ','; } @@ -136,7 +136,7 @@ void dump_compact(const bs::stacktrace& st) { namespace bs = boost::stacktrace; void dump_compact(const bs::stacktrace& st) { - for (bs::frame_view frame: st) { + for (bs::frame frame: st) { std::cout << frame.address() << ','; } diff --git a/include/boost/stacktrace.hpp b/include/boost/stacktrace.hpp index 5903353..a69b872 100644 --- a/include/boost/stacktrace.hpp +++ b/include/boost/stacktrace.hpp @@ -12,7 +12,7 @@ # pragma once #endif -#include +#include #include #endif // BOOST_STACKTRACE_HPP diff --git a/include/boost/stacktrace/const_iterator.hpp b/include/boost/stacktrace/const_iterator.hpp index 7bcd942..919d7b0 100644 --- a/include/boost/stacktrace/const_iterator.hpp +++ b/include/boost/stacktrace/const_iterator.hpp @@ -16,26 +16,26 @@ #include #include -#include +#include namespace boost { namespace stacktrace { // Forward declarations class stacktrace; -/// Random access iterator over frames that returns `frame_view` on dereference. +/// Random access iterator over frames that returns `frame` on dereference. class const_iterator: public boost::iterator_facade< const_iterator, - frame_view, + frame, boost::random_access_traversal_tag, - frame_view> + frame> { /// @cond typedef boost::iterator_facade< const_iterator, - frame_view, + frame, boost::random_access_traversal_tag, - frame_view + frame > base_t; const boost::stacktrace::detail::backend* impl_; @@ -49,8 +49,8 @@ class const_iterator: public boost::iterator_facade< friend class ::boost::stacktrace::stacktrace; friend class ::boost::iterators::iterator_core_access; - frame_view dereference() const BOOST_NOEXCEPT { - return frame_view(impl_->get_address(frame_no_)); + frame dereference() const BOOST_NOEXCEPT { + return frame(impl_->get_address(frame_no_)); } bool equal(const const_iterator& it) const BOOST_NOEXCEPT { diff --git a/include/boost/stacktrace/frame_view.hpp b/include/boost/stacktrace/frame.hpp similarity index 65% rename from include/boost/stacktrace/frame_view.hpp rename to include/boost/stacktrace/frame.hpp index ed022fd..25e22b5 100644 --- a/include/boost/stacktrace/frame_view.hpp +++ b/include/boost/stacktrace/frame.hpp @@ -4,8 +4,8 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_STACKTRACE_FRAME_VIEW_HPP -#define BOOST_STACKTRACE_FRAME_VIEW_HPP +#ifndef BOOST_STACKTRACE_FRAME_HPP +#define BOOST_STACKTRACE_FRAME_HPP #include #ifdef BOOST_HAS_PRAGMA_ONCE @@ -23,35 +23,35 @@ namespace boost { namespace stacktrace { class const_iterator; /// Non-owning class that references the frame information stored inside the boost::stacktrace::stacktrace class. -class frame_view { +class frame { /// @cond const void* addr_; - frame_view(); // = delete + frame(); // = delete /// @endcond public: #ifdef BOOST_STACKTRACE_DOXYGEN_INVOKED - frame_view() = delete; + frame() = delete; - /// @brief Copy constructs frame_view. + /// @brief Copy constructs frame. /// @throws Nothing. /// /// @b Complexity: O(1). - frame_view(const frame_view&) = default; + frame(const frame&) = default; - /// @brief Copy assigns frame_view. + /// @brief Copy assigns frame. /// @throws Nothing. /// /// @b Complexity: O(1). - frame_view& operator=(const frame_view&) = default; + frame& operator=(const frame&) = default; #endif - /// @brief Constructs frame_view that can extract information from addr at runtime. + /// @brief Constructs frame that can extract information from addr at runtime. /// @throws Nothing. /// /// @b Complexity: O(1). - explicit frame_view(const void* addr) BOOST_NOEXCEPT + explicit frame(const void* addr) BOOST_NOEXCEPT : addr_(addr) {} @@ -82,21 +82,21 @@ public: }; /// Comparison operators that provide platform dependant ordering and have O(1) complexity. -inline bool operator< (const frame_view& lhs, const frame_view& rhs) BOOST_NOEXCEPT { return lhs.address() < rhs.address(); } -inline bool operator> (const frame_view& lhs, const frame_view& rhs) BOOST_NOEXCEPT { return rhs < lhs; } -inline bool operator<=(const frame_view& lhs, const frame_view& rhs) BOOST_NOEXCEPT { return !(lhs > rhs); } -inline bool operator>=(const frame_view& lhs, const frame_view& rhs) BOOST_NOEXCEPT { return !(lhs < rhs); } -inline bool operator==(const frame_view& lhs, const frame_view& rhs) BOOST_NOEXCEPT { return lhs.address() == rhs.address(); } -inline bool operator!=(const frame_view& lhs, const frame_view& rhs) BOOST_NOEXCEPT { return !(lhs == rhs); } +inline bool operator< (const frame& lhs, const frame& rhs) BOOST_NOEXCEPT { return lhs.address() < rhs.address(); } +inline bool operator> (const frame& lhs, const frame& rhs) BOOST_NOEXCEPT { return rhs < lhs; } +inline bool operator<=(const frame& lhs, const frame& rhs) BOOST_NOEXCEPT { return !(lhs > rhs); } +inline bool operator>=(const frame& lhs, const frame& rhs) BOOST_NOEXCEPT { return !(lhs < rhs); } +inline bool operator==(const frame& lhs, const frame& rhs) BOOST_NOEXCEPT { return lhs.address() == rhs.address(); } +inline bool operator!=(const frame& lhs, const frame& rhs) BOOST_NOEXCEPT { return !(lhs == rhs); } /// Hashing support, O(1) complexity. -inline std::size_t hash_value(const frame_view& f) BOOST_NOEXCEPT { +inline std::size_t hash_value(const frame& f) BOOST_NOEXCEPT { return reinterpret_cast(f.address()); } /// Outputs stacktrace::frame in a human readable format to output stream. template -std::basic_ostream& operator<<(std::basic_ostream& os, const frame_view& f) { +std::basic_ostream& operator<<(std::basic_ostream& os, const frame& f) { os << f.name(); if (f.source_line()) { @@ -108,4 +108,4 @@ std::basic_ostream& operator<<(std::basic_ostream #include -#include +#include #include namespace boost { namespace stacktrace { @@ -34,9 +34,9 @@ class stacktrace { /// @endcond public: - typedef frame_view reference; + typedef frame reference; - /// @brief Random access iterator that returns frame_view. + /// @brief Random access iterator that returns frame. typedef boost::stacktrace::const_iterator iterator; typedef iterator const_iterator; typedef std::reverse_iterator reverse_iterator; @@ -79,10 +79,10 @@ public: /// @param frame_no Zero based index of frame to return. 0 /// is the function index where stacktrace was constructed and /// index close to this->size() contains function `main()`. - /// @returns frame_view that references the actual frame info, stored inside *this. + /// @returns frame that references the actual frame info, stored inside *this. /// /// @b Complexity: Amortized O(1), O(1) for noop backend. - frame_view operator[](std::size_t frame_no) const BOOST_NOEXCEPT { + frame operator[](std::size_t frame_no) const BOOST_NOEXCEPT { return *(cbegin() + frame_no); } diff --git a/test/test.cpp b/test/test.cpp index abd5947..a7afc3a 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -12,7 +12,7 @@ #include using boost::stacktrace::stacktrace; -using boost::stacktrace::frame_view; +using boost::stacktrace::frame; #ifdef BOOST_STACKTRACE_DYN_LINK # define BOOST_ST_API BOOST_SYMBOL_IMPORT @@ -166,7 +166,7 @@ void test_iterators() { BOOST_TEST(it == st.begin() + 1); } -void test_frame_view() { +void test_frame() { stacktrace nst = return_from_nested_namespaces(); stacktrace st; @@ -180,7 +180,7 @@ void test_frame_view() { BOOST_TEST(st[i] <= st[i]); BOOST_TEST(st[i] >= st[i]); - frame_view fv = nst[2]; + frame fv = nst[2]; if (i >= 2 && i < min_size - 3) { // Begin and end of the trace may match, skipping them BOOST_TEST(st[i].name() != fv.name()); BOOST_TEST(st[i] != fv); @@ -199,7 +199,7 @@ int main() { test_nested(); test_comparisons(); test_iterators(); - test_frame_view(); + test_frame(); return boost::report_errors(); }