Clingo
Loading...
Searching...
No Matches
Clingo::Location Class Reference

Class representing a range in a file. More...

#include <core.hh>

Public Member Functions

 Location (clingo_location_t const *loc)
 Constructs a location from an existing C representation.
 
 Location (Position const &begin, Position const &end)
 Constructs a location from a begin and end position.
 
auto begin () const -> Position
 Get the position marking the beginning of the location.
 
auto end () const -> Position
 Get the position marking the end of the location.
 
auto to_string () const -> std::string
 Convert the location to a string representation.
 
auto hash () const noexcept -> size_t
 Get a hash value for the location.
 

Friends

auto c_cast (Location const &x) -> clingo_location_t const *
 Cast the location to its C representation.
 
auto operator== (Location const &a, Location const &b) noexcept -> bool
 Compare two locations for equality.
 
auto operator<=> (Location const &a, Location const &b) noexcept -> std::strong_ordering
 Compare two locations.
 

Detailed Description

Class representing a range in a file.

Locations implement value semantics supporting ordering and hashing.

Constructor & Destructor Documentation

◆ Location()

Clingo::Location::Location ( Position const begin,
Position const end 
)
inlineexplicit

Constructs a location from a begin and end position.

Parameters
beginthe position marking the beginning of the location
endthe position marking the end of the location

Member Function Documentation

◆ begin()

auto Clingo::Location::begin ( ) const -> Position
inline

Get the position marking the beginning of the location.

Returns
the position marking the beginning of the location

◆ end()

auto Clingo::Location::end ( ) const -> Position
inline

Get the position marking the end of the location.

Returns
the position marking the end of the location

◆ to_string()

auto Clingo::Location::to_string ( ) const -> std::string
inline

Convert the location to a string representation.

Returns
the string representation of the location

Friends And Related Symbol Documentation

◆ c_cast

auto c_cast ( Location const x) -> clingo_location_t const *
friend

Cast the location to its C representation.

Returns
the C representation of the location

◆ operator<=>

auto operator<=> ( Location const a,
Location const b 
) -> std::strong_ordering
friend

Compare two locations.

Parameters
athe first location to compare
bthe second location to compare
Returns
the comparison result

◆ operator==

auto operator== ( Location const a,
Location const b 
) -> bool
friend

Compare two locations for equality.

Parameters
athe first location to compare
bthe second location to compare
Returns
whether the two positions are equal

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