v8 14.1.146 (node 25.0.0)
V8 is Google's open source JavaScript engine
Loading...
Searching...
No Matches
SourceLocation Class Referencefinal

#include <v8-source-location.h>

Public Member Functions

constexpr SourceLocation ()=default
 
constexpr const char * Function () const
 
constexpr const char * FileName () const
 
constexpr size_t Line () const
 
std::string ToString () const
 

Static Public Member Functions

static constexpr SourceLocation Current (const std::source_location &loc=std::source_location::current())
 
static constexpr SourceLocation CurrentIfDebug ()
 

Detailed Description

Encapsulates source location information. Mimics C++20's std::source_location.

Definition at line 22 of file v8-source-location.h.

Constructor & Destructor Documentation

◆ SourceLocation()

constexpr SourceLocation ( )
constexprdefault

Constructs unspecified source location information.

Member Function Documentation

◆ Current()

static constexpr SourceLocation Current ( const std::source_location &  loc = std::source_location::current())
inlinestaticconstexpr

Construct source location information corresponding to the location of the call site.

Definition at line 28 of file v8-source-location.h.

◆ CurrentIfDebug()

static constexpr SourceLocation CurrentIfDebug ( )
inlinestaticconstexpr

Definition at line 38 of file v8-source-location.h.

◆ FileName()

constexpr const char * FileName ( ) const
inlineconstexpr

Returns the name of the current source file represented by this object.

Returns
the file name as cstring.

Definition at line 59 of file v8-source-location.h.

◆ Function()

constexpr const char * Function ( ) const
inlineconstexpr

Returns the name of the function associated with the position represented by this object, if any.

Returns
the function name as cstring.

Definition at line 52 of file v8-source-location.h.

◆ Line()

constexpr size_t Line ( ) const
inlineconstexpr

Returns the line number represented by this object.

Returns
the line number.

Definition at line 66 of file v8-source-location.h.

◆ ToString()

std::string ToString ( ) const
inline

Returns a human-readable string representing this object.

Returns
a human-readable string representing source location information.

Definition at line 73 of file v8-source-location.h.


The documentation for this class was generated from the following file: