Clingo
Loading...
Searching...
No Matches
CppClingo::SharedString Class Reference

Class managing the lifetime of a String. More...

#include <symbol.hh>

Public Member Functions

constexpr SharedString ()=default
 Construct an empty string.
 
 SharedString (String ref, bool acquire=true) noexcept
 Take ownership of the string reference.
 
 ~SharedString ()
 Release ownership of the held string reference.
 
 SharedString (SharedString const &other) noexcept
 Copy constructor.
 
 SharedString (SharedString &&other) noexcept
 Move constructor.
 
auto operator= (SharedString const &other) noexcept -> SharedString &
 Copy assignment.
 
auto operator= (SharedString &&other) noexcept -> SharedString &
 Move assignment.
 
auto get () const -> String const &
 Get the contained string reference.
 
auto operator* () const -> String const &
 Get the contained string reference.
 
auto operator-> () const -> String const *
 Get the contained string reference.
 
auto hash () const -> size_t
 Compute the hash of the string.
 

Static Public Member Functions

static auto to_rep (SharedString sym) -> uint64_t
 Get an integer representation of the string.
 
static auto from_rep (uint64_t repr) -> SharedString
 Construct a string from its representation.
 

Friends

auto operator== (SharedString const &a, SharedString const &b) -> bool
 Equality compare two strings.
 
auto operator== (SharedString const &a, String const &b) -> bool
 Equality compare two strings.
 
auto operator== (String const &a, SharedString const &b) -> bool
 Equality compare two strings.
 
auto operator== (std::string_view a, SharedString const &b) -> bool
 Equality compare two strings.
 
auto operator== (SharedString const &a, std::string_view b) -> bool
 Equality compare two strings.
 
auto operator<=> (SharedString const &a, SharedString const &b) -> std::strong_ordering
 Compare two strings.
 
auto operator<=> (SharedString const &a, String const &b) -> std::strong_ordering
 Compare two strings.
 
auto operator<=> (String const &a, SharedString const &b) -> std::strong_ordering
 Compare two strings.
 
auto operator<=> (std::string_view a, SharedString const &b) -> std::strong_ordering
 Equality compare two strings.
 
auto operator<=> (SharedString const &a, std::string_view b) -> std::strong_ordering
 Equality compare two strings.
 

Detailed Description

Class managing the lifetime of a String.

References held by this class are not collected by the gc method of the symbol store.

Member Function Documentation

◆ to_rep()

static auto CppClingo::SharedString::to_rep ( SharedString  sym) -> uint64_t
inlinestatic

Get an integer representation of the string.

To correctly free the string, it has to passed to from_rep again.


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