Spicy
Public Types | Public Member Functions | Friends | List of all members
hilti::rt::String Class Reference

#include <string.h>

Inheritance diagram for hilti::rt::String:

Public Types

using S = std::string
 

Public Member Functions

 String ()=default
 
 String (std::string_view s)
 
 String (const String &)=default
 
 String (String &&)=default
 
Stringoperator= (std::string_view sv)
 
Stringoperator= (const String &)=default
 
Stringoperator= (String &&)=default
 
auto str () const
 
 operator std::string_view () const
 
Stringoperator+= (const String &b)
 
Stringoperator+= (std::string_view b)
 

Friends

bool operator== (const String &a, const String &b)
 
bool operator== (const String &a, std::string_view b)
 
bool operator== (const String &a, const char *b)
 
bool operator< (const String &a, const String &b)
 
bool operator< (const String &a, std::string_view b)
 
bool operator< (const String &a, const char *b)
 
String operator+ (const String &a, const String &b)
 
String operator+ (const String &a, std::string_view b)
 

Detailed Description

HILTI's string is a std::string-like type for wrapping raw bytes with additional safety guarantees.

If not otherwise specified, member functions have the semantics of std::string member functions. Note, however, that by design this type does not convert to/from std::string to avoid mixing up the two accidentally in runtime code. Instead, std::string_view can serve as a go-between type for conversions.

Constructor & Destructor Documentation

◆ String() [1/2]

hilti::rt::String::String ( )
default

Creates an empty string.

◆ String() [2/2]

hilti::rt::String::String ( std::string_view  s)
inline

Creates a string from a standard string view.

Member Function Documentation

◆ operator std::string_view()

hilti::rt::String::operator std::string_view ( ) const
inline

Implicitly converts the string to a standard string view.

◆ operator+=()

String& hilti::rt::String::operator+= ( const String b)
inline

Returns a substring of the string.

Parameters
posthe position of the first character to include in the substring
countthe number of characters to include in the substring, or npos to include all characters until the end of the string

◆ str()

auto hilti::rt::String::str ( ) const
inline

Returns the string's data as a standard string view.


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