From a0d8040e939d7811affc0b459a32d20642771059 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Sun, 19 Sep 2021 03:37:51 +0300 Subject: [PATCH] Update documentation --- doc/changes.adoc | 6 +++++- doc/index.adoc | 2 +- doc/source_location.adoc | 36 ++++++++++++++++++++++------------ test/source_location_test3.cpp | 2 +- 4 files changed, 31 insertions(+), 15 deletions(-) diff --git a/doc/changes.adoc b/doc/changes.adoc index 303c291..3518c4a 100644 --- a/doc/changes.adoc +++ b/doc/changes.adoc @@ -1,5 +1,5 @@ //// -Copyright 2019 Peter Dimov +Copyright 2019, 2021 Peter Dimov Distributed under the Boost Software License, Version 1.0. http://www.boost.org/LICENSE_1_0.txt //// @@ -10,6 +10,10 @@ http://www.boost.org/LICENSE_1_0.txt :toc-title: :idprefix: +## Changes in 1.78.0 + +* Added `source_location::to_string`. + ## Changes in 1.73.0 * Added `source_location`. diff --git a/doc/index.adoc b/doc/index.adoc index 95d52c2..bf51cbd 100644 --- a/doc/index.adoc +++ b/doc/index.adoc @@ -30,7 +30,7 @@ include::changes.adoc[] This documentation is -* Copyright 2002, 2007, 2014, 2017, 2019, 2020 Peter Dimov +* Copyright 2002, 2007, 2014, 2017, 2019-2021 Peter Dimov * Copyright 2011 Beman Dawes * Copyright 2015 Ion GaztaƱaga * Distributed under the http://www.boost.org/LICENSE_1_0.txt[Boost Software License, Version 1.0]. diff --git a/doc/source_location.adoc b/doc/source_location.adoc index d3436e8..d7c11fa 100644 --- a/doc/source_location.adoc +++ b/doc/source_location.adoc @@ -1,5 +1,5 @@ //// -Copyright 2019 Peter Dimov +Copyright 2019, 2021 Peter Dimov Distributed under the Boost Software License, Version 1.0. http://www.boost.org/LICENSE_1_0.txt //// @@ -28,19 +28,21 @@ namespace boost struct source_location { - constexpr source_location() noexcept; - constexpr source_location(char const* file, uint_least32_t line, - char const* function, uint_least32_t column = 0) noexcept; + constexpr source_location() noexcept; + constexpr source_location(char const* file, uint_least32_t line, + char const* function, uint_least32_t column = 0) noexcept; - constexpr char const* file_name() const noexcept; - constexpr char const* function_name() const noexcept; - constexpr uint_least32_t line() const noexcept; - constexpr uint_least32_t column() const noexcept; + constexpr char const* file_name() const noexcept; + constexpr char const* function_name() const noexcept; + constexpr uint_least32_t line() const noexcept; + constexpr uint_least32_t column() const noexcept; + + std::string to_string() const; }; template std::basic_ostream & - operator<<( std::basic_ostream & os, source_location const & loc ); + operator<<( std::basic_ostream & os, source_location const & loc ); } // namespace boost @@ -67,16 +69,26 @@ Effects: :: Constructs a `source_location` object for which `file_name()` returns `file`, `function_name()` returns `function`, `line()` returns the `line` argument and `column()` returns the `column` argument. +## to_string + +``` +std::string to_string() const; +``` + +Returns: :: + a string representation of `*this`. + ## operator<< ``` template std::basic_ostream & - operator<<( std::basic_ostream & os, source_location const & loc ); + operator<<( std::basic_ostream & os, source_location const & loc ); ``` -Effects: :: Outputs a string representation of `loc` to `os`. -Returns: :: `os`. +Effects: :: `os << loc.to_string()`. +Returns: :: + `os`. ## BOOST_CURRENT_LOCATION diff --git a/test/source_location_test3.cpp b/test/source_location_test3.cpp index f2247cc..3bccd81 100644 --- a/test/source_location_test3.cpp +++ b/test/source_location_test3.cpp @@ -1,4 +1,4 @@ -// Copyright 2020 Peter Dimov +// Copyright 2020, 2021 Peter Dimov // Distributed under the Boost Software License, Version 1.0. // http://www.boost.org/LICENSE_1_0.txt