Files
assert/include/boost/assert/source_location.hpp
2019-11-25 03:25:57 +02:00

70 lines
1.6 KiB
C++

#ifndef BOOST_ASSERT_SOURCE_LOCATION_HPP_INCLUDED
#define BOOST_ASSERT_SOURCE_LOCATION_HPP_INCLUDED
// http://www.boost.org/libs/assert
//
// Copyright 2019 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// http://www.boost.org/LICENSE_1_0.txt
#include <boost/current_function.hpp>
#include <boost/config.hpp>
#include <boost/cstdint.hpp>
namespace boost
{
struct source_location
{
private:
char const * file_;
char const * function_;
boost::uint_least32_t line_;
boost::uint_least32_t column_;
public:
BOOST_CONSTEXPR source_location() BOOST_NOEXCEPT: file_( "(unknown)" ), function_( file_ ), line_( 0 ), column_( 0 )
{
}
BOOST_CONSTEXPR source_location( char const * file, boost::uint_least32_t line, char const * function, boost::uint_least32_t column = 0 ) BOOST_NOEXCEPT: file_( file ), function_( function ), line_( line ), column_( column )
{
}
BOOST_CONSTEXPR char const * file_name() const BOOST_NOEXCEPT
{
return file_;
}
BOOST_CONSTEXPR char const * function_name() const BOOST_NOEXCEPT
{
return function_;
}
BOOST_CONSTEXPR boost::uint_least32_t line() const BOOST_NOEXCEPT
{
return line_;
}
BOOST_CONSTEXPR boost::uint_least32_t column() const BOOST_NOEXCEPT
{
return column_;
}
};
} // namespace boost
#if defined( BOOST_DISABLE_CURRENT_LOCATION )
# define BOOST_CURRENT_LOCATION ::boost::source_location()
#else
# define BOOST_CURRENT_LOCATION ::boost::source_location(__FILE__, __LINE__, BOOST_CURRENT_FUNCTION)
#endif
#endif // #ifndef BOOST_ASSERT_SOURCE_LOCATION_HPP_INCLUDED