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

Reference to a string stored in a symbol store. More...

#include <symbol.hh>

Public Member Functions

constexpr String ()=default
 Construct an empty string.
 
void acquire () const noexcept
 Manually increment the reference count of the string.
 
void release () const noexcept
 Manually decrement the reference count of the string.
 
auto c_str () const -> const char *
 Get the underlying C string.
 
auto view () const -> std::string_view
 Get a string view.
 
auto data () const -> const char *
 Get the underlying character array.
 
auto empty () const -> bool
 Test if the string is empty.
 
auto size () const -> size_t
 Get the length of the string.
 
auto starts_with (std::string_view prefix) const -> bool
 Check if the string starts with the given string.
 
auto hash () const -> size_t
 Compute the hash of the string.
 

Static Public Member Functions

static auto to_rep (String str) noexcept -> uint64_t
 Convert a string to its integer representation.
 
static auto from_rep (uint64_t rep) noexcept -> String
 Construct a string from its integer representation.
 

Friends

auto operator== (String a, String b) -> bool
 Equality compare two strings.
 
auto operator== (String a, std::string_view b) -> bool
 Equality compare a string and a string view.
 
auto operator== (std::string_view a, String b) -> bool
 Equality compare a string view and a string.
 
auto operator<=> (String a, String b) -> std::strong_ordering
 Less than compare two strings.
 
auto operator<=> (std::string_view a, String b) -> std::strong_ordering
 Less than compare two strings.
 
auto operator<=> (String a, std::string_view b) -> std::strong_ordering
 Less than compare two strings.
 
auto operator<< (std::ostream &out, String const &str) -> std::ostream &
 Output the given string.
 
auto operator<< (Util::OutputBuffer &out, String const &str) -> Util::OutputBuffer &
 Append the given string to the buffer.
 

Detailed Description

Reference to a string stored in a symbol store.

Constructor & Destructor Documentation

◆ String()

constexpr CppClingo::String::String ( )
constexprdefault

Construct an empty string.

Empty strings exist independently of symbol stores.

Member Function Documentation

◆ c_str()

auto CppClingo::String::c_str ( ) const -> const char *

Get the underlying C string.

The lifetime is tied to that of the reference.

◆ data()

auto CppClingo::String::data ( ) const -> const char *

Get the underlying character array.

The lifetime is tied to that of the reference.

◆ view()

auto CppClingo::String::view ( ) const -> std::string_view

Get a string view.

The lifetime is tied to that of the reference.


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