Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
duckdb_re2::StringPiece Class Reference

Public Types

typedef std::char_traits< char > traits_type
typedef char value_type
typedef char * pointer
typedef const char * const_pointer
typedef char & reference
typedef const char & const_reference
typedef const char * const_iterator
typedef const_iterator iterator
typedef std::reverse_iterator< const_iterator > const_reverse_iterator
typedef const_reverse_iterator reverse_iterator
typedef size_t size_type
typedef ptrdiff_t difference_type

Public Member Functions

 StringPiece (const std::string &str)
 StringPiece (const char *str)
 StringPiece (const char *str, size_type len)
const_iterator begin () const
const_iterator end () const
const_reverse_iterator rbegin () const
const_reverse_iterator rend () const
size_type size () const
size_type length () const
bool empty () const
const_reference operator[] (size_type i) const
const_pointer data () const
void remove_prefix (size_type n)
void remove_suffix (size_type n)
void set (const char *str)
void set (const char *str, size_type len)
template<typename A>
 operator std::basic_string< char, traits_type, A > () const
std::string as_string () const
std::string ToString () const
void CopyToString (std::string *target) const
void AppendToString (std::string *target) const
size_type copy (char *buf, size_type n, size_type pos=0) const
StringPiece substr (size_type pos=0, size_type n=npos) const
int compare (const StringPiece &x) const
bool starts_with (const StringPiece &x) const
bool ends_with (const StringPiece &x) const
bool contains (const StringPiece &s) const
size_type find (const StringPiece &s, size_type pos=0) const
size_type find (char c, size_type pos=0) const
size_type rfind (const StringPiece &s, size_type pos=npos) const
size_type rfind (char c, size_type pos=npos) const

Static Public Attributes

static const size_type npos = static_cast<size_type>(-1)

Private Attributes

const_pointer data_
size_type size_

Constructor & Destructor Documentation

◆ StringPiece() [1/4]

duckdb_re2::StringPiece::StringPiece ( )
inline
97803 : data_(NULL), size_(0) {}

◆ StringPiece() [2/4]

duckdb_re2::StringPiece::StringPiece ( const std::string & str)
inline
97809 : data_(str.data()), size_(str.size()) {}

◆ StringPiece() [3/4]

duckdb_re2::StringPiece::StringPiece ( const char * str)
inline
97811 : data_(str), size_(str == NULL ? 0 : strlen(str)) {}

◆ StringPiece() [4/4]

duckdb_re2::StringPiece::StringPiece ( const char * str,
size_type len )
inline
97813 : data_(str), size_(len) {}

Member Function Documentation

◆ begin()

const_iterator duckdb_re2::StringPiece::begin ( ) const
inline
97815{ return data_; }

◆ end()

const_iterator duckdb_re2::StringPiece::end ( ) const
inline
97816{ return data_ + size_; }

◆ rbegin()

const_reverse_iterator duckdb_re2::StringPiece::rbegin ( ) const
inline
97817 {
97818 return const_reverse_iterator(data_ + size_);
97819 }

◆ rend()

const_reverse_iterator duckdb_re2::StringPiece::rend ( ) const
inline
97820 {
97821 return const_reverse_iterator(data_);
97822 }

◆ size()

size_type duckdb_re2::StringPiece::size ( ) const
inline
97824{ return size_; }

◆ length()

size_type duckdb_re2::StringPiece::length ( ) const
inline
97825{ return size_; }

◆ empty()

bool duckdb_re2::StringPiece::empty ( ) const
inline
97826{ return size_ == 0; }

◆ operator[]()

const_reference duckdb_re2::StringPiece::operator[] ( size_type i) const
inline
97828{ return data_[i]; }

◆ data()

const_pointer duckdb_re2::StringPiece::data ( ) const
inline
97829{ return data_; }

◆ remove_prefix()

void duckdb_re2::StringPiece::remove_prefix ( size_type n)
inline
97831 {
97832 data_ += n;
97833 size_ -= n;
97834 }

◆ remove_suffix()

void duckdb_re2::StringPiece::remove_suffix ( size_type n)
inline
97836 {
97837 size_ -= n;
97838 }

◆ set() [1/2]

void duckdb_re2::StringPiece::set ( const char * str)
inline
97840 {
97841 data_ = str;
97842 size_ = str == NULL ? 0 : strlen(str);
97843 }

◆ set() [2/2]

void duckdb_re2::StringPiece::set ( const char * str,
size_type len )
inline
97845 {
97846 data_ = str;
97847 size_ = len;
97848 }

◆ operator std::basic_string< char, traits_type, A >()

template<typename A>
duckdb_re2::StringPiece::operator std::basic_string< char, traits_type, A > ( ) const
inlineexplicit
97860 {
97861 if (!data_) return {};
97862 return std::basic_string<char, traits_type, A>(data_, size_);
97863 }

◆ as_string()

std::string duckdb_re2::StringPiece::as_string ( ) const
inline
97865 {
97866 return std::string(data_, size_);
97867 }

◆ ToString()

std::string duckdb_re2::StringPiece::ToString ( ) const
inline
97874 {
97875 return std::string(data_, size_);
97876 }

◆ CopyToString()

void duckdb_re2::StringPiece::CopyToString ( std::string * target) const
inline
97878 {
97879 target->assign(data_, size_);
97880 }

◆ AppendToString()

void duckdb_re2::StringPiece::AppendToString ( std::string * target) const
inline
97882 {
97883 target->append(data_, size_);
97884 }

◆ copy()

StringPiece::size_type duckdb_re2::StringPiece::copy ( char * buf,
size_type n,
size_type pos = 0 ) const
474923 {
474924 size_type ret = std::min(size_ - pos, n);
474925 memcpy(buf, data_ + pos, ret);
474926 return ret;
474927}

◆ substr()

StringPiece duckdb_re2::StringPiece::substr ( size_type pos = 0,
size_type n = npos ) const
474929 {
474930 if (pos > size_) pos = size_;
474931 if (n > size_ - pos) n = size_ - pos;
474932 return StringPiece(data_ + pos, n);
474933}

◆ compare()

int duckdb_re2::StringPiece::compare ( const StringPiece & x) const
inline
97889 {
97890 size_type min_size = std::min(size(), x.size());
97891 if (min_size > 0) {
97892 int r = memcmp(data(), x.data(), min_size);
97893 if (r < 0) return -1;
97894 if (r > 0) return 1;
97895 }
97896 if (size() < x.size()) return -1;
97897 if (size() > x.size()) return 1;
97898 return 0;
97899 }

◆ starts_with()

bool duckdb_re2::StringPiece::starts_with ( const StringPiece & x) const
inline
97902 {
97903 return x.empty() ||
97904 (size() >= x.size() && memcmp(data(), x.data(), x.size()) == 0);
97905 }

◆ ends_with()

bool duckdb_re2::StringPiece::ends_with ( const StringPiece & x) const
inline
97908 {
97909 return x.empty() ||
97910 (size() >= x.size() &&
97911 memcmp(data() + (size() - x.size()), x.data(), x.size()) == 0);
97912 }

◆ contains()

bool duckdb_re2::StringPiece::contains ( const StringPiece & s) const
inline
97914 {
97915 return find(s) != npos;
97916 }

◆ find() [1/2]

StringPiece::size_type duckdb_re2::StringPiece::find ( const StringPiece & s,
size_type pos = 0 ) const
474936 {
474937 if (pos > size_) return npos;
474938 const_pointer result = std::search(data_ + pos, data_ + size_,
474939 s.data_, s.data_ + s.size_);
474940 size_type xpos = result - data_;
474941 return xpos + s.size_ <= size_ ? xpos : npos;
474942}

◆ find() [2/2]

StringPiece::size_type duckdb_re2::StringPiece::find ( char c,
size_type pos = 0 ) const
474944 {
474945 if (size_ <= 0 || pos >= size_) return npos;
474946 const_pointer result = std::find(data_ + pos, data_ + size_, c);
474947 return result != data_ + size_ ? result - data_ : npos;
474948}

◆ rfind() [1/2]

StringPiece::size_type duckdb_re2::StringPiece::rfind ( const StringPiece & s,
size_type pos = npos ) const
474951 {
474952 if (size_ < s.size_) return npos;
474953 if (s.size_ == 0) return std::min(size_, pos);
474954 const_pointer last = data_ + std::min(size_ - s.size_, pos) + s.size_;
474955 const_pointer result = std::find_end(data_, last, s.data_, s.data_ + s.size_);
474956 return result != last ? result - data_ : npos;
474957}

◆ rfind() [2/2]

StringPiece::size_type duckdb_re2::StringPiece::rfind ( char c,
size_type pos = npos ) const
474959 {
474960 if (size_ <= 0) return npos;
474961 for (size_t i = std::min(pos + 1, size_); i != 0;) {
474962 if (data_[--i] == c) return i;
474963 }
474964 return npos;
474965}

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