mutable
A Database System for Research and Fast Prototyping
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | Friends
m::StringView Struct Reference

#include <StringView.hpp>

Collaboration diagram for m::StringView:
[legend]

Public Member Functions

 StringView (const char *start, std::size_t length)
 
 StringView (const char *start, const char *end)
 
 StringView (const char *start)
 
 StringView (const std::string &str)
 
 StringView (const StringView *left, const StringView *right)
 Compose a StringView of two string_views.
 
bool is_flat () const
 
bool is_composed () const
 
const char * data () const
 
std::size_t length () const
 
const StringViewleft () const
 
const StringViewright () const
 
int compare (StringView other) const
 
bool operator== (StringView other) const
 
bool operator!= (StringView other) const
 
bool operator< (StringView other) const
 
bool operator> (StringView other) const
 
bool operator<= (StringView other) const
 
bool operator>= (StringView other) const
 
std::string str () const
 

Private Attributes

uintptr_t left_
 
uintptr_t right_
 if the LSB is set, this value denotes the length of the string, appended with a 1-bit
 

Friends

std::ostream & operator<< (std::ostream &out, StringView sv)
 
std::string to_string (StringView sv)
 

Detailed Description

Definition at line 16 of file StringView.hpp.

Constructor & Destructor Documentation

◆ StringView() [1/5]

m::StringView::StringView ( const char *  start,
std::size_t  length 
)
inline

Definition at line 23 of file StringView.hpp.

References is_flat(), and M_insist.

◆ StringView() [2/5]

m::StringView::StringView ( const char *  start,
const char *  end 
)
inline

Definition at line 31 of file StringView.hpp.

References M_insist.

◆ StringView() [3/5]

m::StringView::StringView ( const char *  start)
inline

Definition at line 32 of file StringView.hpp.

◆ StringView() [4/5]

m::StringView::StringView ( const std::string &  str)
inline

Definition at line 33 of file StringView.hpp.

◆ StringView() [5/5]

m::StringView::StringView ( const StringView left,
const StringView right 
)
inline

Compose a StringView of two string_views.

Definition at line 36 of file StringView.hpp.

References is_composed(), left(), M_insist, and right().

Member Function Documentation

◆ compare()

int m::StringView::compare ( StringView  other) const
inline

Definition at line 53 of file StringView.hpp.

References str().

Referenced by operator!=(), operator<(), operator<=(), operator==(), operator>(), and operator>=().

◆ data()

const char * m::StringView::data ( ) const
inline

Definition at line 47 of file StringView.hpp.

References is_flat(), left_, and M_insist.

◆ is_composed()

bool m::StringView::is_composed ( ) const
inline

Definition at line 45 of file StringView.hpp.

References is_flat().

Referenced by left(), right(), and StringView().

◆ is_flat()

bool m::StringView::is_flat ( ) const
inline

Definition at line 44 of file StringView.hpp.

References right_.

Referenced by data(), is_composed(), length(), and StringView().

◆ left()

const StringView & m::StringView::left ( ) const
inline

Definition at line 50 of file StringView.hpp.

References is_composed(), left_, and M_insist.

Referenced by StringView().

◆ length()

std::size_t m::StringView::length ( ) const
inline

Definition at line 48 of file StringView.hpp.

References is_flat(), M_insist, and right_.

◆ operator!=()

bool m::StringView::operator!= ( StringView  other) const
inline

Definition at line 56 of file StringView.hpp.

References compare().

◆ operator<()

bool m::StringView::operator< ( StringView  other) const
inline

Definition at line 57 of file StringView.hpp.

References compare().

◆ operator<=()

bool m::StringView::operator<= ( StringView  other) const
inline

Definition at line 59 of file StringView.hpp.

References compare().

◆ operator==()

bool m::StringView::operator== ( StringView  other) const
inline

Definition at line 55 of file StringView.hpp.

References compare().

◆ operator>()

bool m::StringView::operator> ( StringView  other) const
inline

Definition at line 58 of file StringView.hpp.

References compare().

◆ operator>=()

bool m::StringView::operator>= ( StringView  other) const
inline

Definition at line 60 of file StringView.hpp.

References compare().

◆ right()

const StringView & m::StringView::right ( ) const
inline

Definition at line 51 of file StringView.hpp.

References is_composed(), M_insist, and right_.

Referenced by StringView().

◆ str()

std::string m::StringView::str ( ) const
inline

Definition at line 75 of file StringView.hpp.

References to_string.

Referenced by compare().

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  out,
StringView  sv 
)
friend

Definition at line 62 of file StringView.hpp.

◆ to_string

std::string to_string ( StringView  sv)
friend

Definition at line 69 of file StringView.hpp.

Referenced by str().

Field Documentation

◆ left_

uintptr_t m::StringView::left_
private

Definition at line 19 of file StringView.hpp.

Referenced by data(), and left().

◆ right_

uintptr_t m::StringView::right_
private

if the LSB is set, this value denotes the length of the string, appended with a 1-bit

Definition at line 20 of file StringView.hpp.

Referenced by is_flat(), length(), and right().


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