apt  2.2.4
About: Apt (Advanced Package Tool) is a management system for software packages (Debian/Ubuntu). Release series 2.2.
  Fossies Dox: apt-2.2.4.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

StringView Class Reference

Simple subset of std::string_view from C++17. More...

#include <string_view.h>

Public Member Functions

constexpr StringView ()
 
constexpr StringView (const char *data, size_t size)
 
 StringView (const char *data)
 
 StringView (std::string const &str)
 
void remove_prefix (size_t n)
 
void remove_suffix (size_t n)
 
void clear ()
 
constexpr StringView substr (size_t pos, size_t n=npos) const
 
size_t find (int c, size_t pos) const
 
size_t find (int c) const
 
size_t rfind (int c, size_t pos) const
 
size_t rfind (int c) const
 
size_t find (APT::StringView const needle) const
 
size_t find (APT::StringView const needle, size_t pos) const
 
std::string to_string () const
 
int compare (size_t pos, size_t n, StringView other) const
 
int compare (StringView other) const
 
bool operator== (StringView other) const
 
bool operator!= (StringView other) const
 
constexpr bool empty () const
 
constexpr const char * data () const
 
constexpr const char * begin () const
 
constexpr const char * end () const
 
constexpr char operator[] (size_t i) const
 
constexpr size_t size () const
 
constexpr size_t length () const
 

Static Public Attributes

static constexpr size_t npos = static_cast<size_t>(-1)
 

Private Attributes

const char * data_
 
size_t size_
 

Detailed Description

Simple subset of std::string_view from C++17.

This is an internal implementation of the subset of std::string_view used by APT. It is not meant to be used in programs, only inside the library for performance critical paths.

Definition at line 27 of file string_view.h.

Constructor & Destructor Documentation

◆ StringView() [1/4]

constexpr StringView ( )
inlineconstexpr

Definition at line 36 of file string_view.h.

Referenced by StringView::substr().

◆ StringView() [2/4]

constexpr StringView ( const char *  data,
size_t  size 
)
inlineconstexpr

Definition at line 37 of file string_view.h.

◆ StringView() [3/4]

StringView ( const char *  data)
inline

Definition at line 39 of file string_view.h.

◆ StringView() [4/4]

StringView ( std::string const &  str)
inline

Definition at line 40 of file string_view.h.

Member Function Documentation

◆ begin()

constexpr const char* begin ( ) const
inlineconstexpr

Definition at line 134 of file string_view.h.

References StringView::data_.

Referenced by Hex2Num(), and pkgCache< Str, Itr >::sHash().

◆ clear()

void clear ( )
inline

Definition at line 45 of file string_view.h.

References StringView::size_.

◆ compare() [1/2]

int compare ( size_t  pos,
size_t  n,
StringView  other 
) const
inline

◆ compare() [2/2]

int compare ( StringView  other) const
inline

Definition at line 115 of file string_view.h.

References StringView::data_, and StringView::size_.

◆ data()

◆ empty()

◆ end()

constexpr const char* end ( ) const
inlineconstexpr

◆ find() [1/4]

size_t find ( APT::StringView const  needle) const
inline

◆ find() [2/4]

size_t find ( APT::StringView const  needle,
size_t  pos 
) const
inline

Definition at line 96 of file string_view.h.

References StringView::find(), StringView::npos, and StringView::substr().

◆ find() [3/4]

size_t find ( int  c) const
inline

Definition at line 60 of file string_view.h.

References StringView::data_, StringView::npos, and StringView::size_.

◆ find() [4/4]

size_t find ( int  c,
size_t  pos 
) const
inline

◆ length()

◆ operator!=()

bool operator!= ( StringView  other) const
inline

Definition at line 129 of file string_view.h.

◆ operator==()

bool operator== ( StringView  other) const
inline

Definition at line 128 of file string_view.h.

References StringView::compare(), and StringView::size_.

◆ operator[]()

constexpr char operator[] ( size_t  i) const
inlineconstexpr

Definition at line 136 of file string_view.h.

References StringView::data_.

◆ remove_prefix()

void remove_prefix ( size_t  n)
inline

Definition at line 43 of file string_view.h.

References StringView::data_, and StringView::size_.

◆ remove_suffix()

void remove_suffix ( size_t  n)
inline

Definition at line 44 of file string_view.h.

References StringView::size_.

◆ rfind() [1/2]

size_t rfind ( int  c) const
inline

Definition at line 74 of file string_view.h.

References StringView::data_, StringView::npos, and StringView::size_.

◆ rfind() [2/2]

size_t rfind ( int  c,
size_t  pos 
) const
inline

◆ size()

◆ substr()

◆ to_string()

Member Data Documentation

◆ data_

◆ npos

constexpr size_t npos = static_cast<size_t>(-1)
staticconstexpr

◆ size_


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