A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/stringpiece_8h_source.html below:

ICU 77.1: common/unicode/stringpiece.h Source File

22 #ifndef __STRINGPIECE_H__ 23 #define __STRINGPIECE_H__ 32 #if U_SHOW_CPLUSPLUS_API 35 #include <string_view> 36 #include <type_traits> 79 #if defined(__cpp_char8_t) || defined(U_IN_DOXYGEN) 100

: ptr_(str.data()), length_(static_cast<int32_t>(str.size())) { }

101 #if defined(__cpp_lib_char8_t) || defined(U_IN_DOXYGEN) 107

: ptr_(reinterpret_cast<const char*>(str.data())),

108

length_(static_cast<int32_t>(str.size())) { }

133  template

<

typename

T,

134  typename

= std::enable_if_t<

135

(std::is_same_v<decltype(T().data()),

const char

*>

136 #if defined(__cpp_char8_t) 137

|| std::is_same_v<decltype(T().data()),

const

char8_t*>

140

std::is_same_v<decltype(T().size()),

size_t

>>>

142

: ptr_(

reinterpret_cast<const char

*

>

(str.data())),

143

length_(

static_cast<

int32_t

>

(str.size())) {}

151  StringPiece

(

const char

* offset, int32_t len) : ptr_(offset), length_(len) { }

152 #if defined(__cpp_char8_t) || defined(U_IN_DOXYGEN) 160  StringPiece

(reinterpret_cast<const char*>(str), len) {}

180 #ifndef U_HIDE_INTERNAL_API 185  inline operator

std::string_view()

const

{

186  return

{data(),

static_cast<

std::string_view::size_type

>

(size())};

200  const char

*

data

()

const

{

return

ptr_; }

206

int32_t

size

()

const

{

return

length_; }

212

int32_t

length

()

const

{

return

length_; }

224  void clear

() { ptr_ =

nullptr

; length_ = 0; }

232  void set

(

const char

* xdata, int32_t len) { ptr_ = xdata; length_ = len; }

239  void set

(

const char

* str);

241 #if defined(__cpp_char8_t) || defined(U_IN_DOXYGEN) 248  inline void set

(

const

char8_t* xdata, int32_t len) {

249

set(

reinterpret_cast<const char

*

>

(xdata), len);

257  inline void set

(

const

char8_t* str) {

258

set(

reinterpret_cast<const char

*

>

(str));

A string-like object that points to a sized piece of memory.

StringPiece substr(int32_t pos, int32_t len=npos) const

Returns a substring of this StringPiece.

UBool empty() const

Returns whether the string is empty.

StringPiece(const char *str)

Constructs from a NUL-terminated const char * pointer.

void set(const char *str)

Reset the stringpiece to refer to new data.

StringPiece(const StringPiece &x, int32_t pos, int32_t len)

Substring of another StringPiece.

const char * data() const

Returns the string pointer.

StringPiece(T str)

Constructs from some other implementation of a string piece class, from any C++ record type that has ...

StringPiece(const char8_t *str)

Constructs from a NUL-terminated const char8_t * pointer.

StringPiece(const std::u8string &str)

Constructs from a std::u8string.

int32_t find(StringPiece needle, int32_t offset)

Searches the StringPiece for the given search string (needle);.

static const int32_t npos

Maximum integer, used as a default value for substring methods.

void clear()

Sets to an empty string.

void set(const char8_t *xdata, int32_t len)

Resets the stringpiece to refer to new data.

StringPiece()

Default constructor, creates an empty StringPiece.

StringPiece(std::nullptr_t p)

Constructs an empty StringPiece.

void set(const char8_t *str)

Resets the stringpiece to refer to new data.

void set(const char *xdata, int32_t len)

Reset the stringpiece to refer to new data.

int32_t size() const

Returns the string length.

void remove_prefix(int32_t n)

Removes the first n string units.

int32_t compare(StringPiece other)

Compares this StringPiece with the other StringPiece, with semantics similar to std::string::compare(...

void remove_suffix(int32_t n)

Removes the last n string units.

StringPiece(const char8_t *str, int32_t len)

Constructs from a const char8_t * pointer and a specified length.

int32_t length() const

Returns the string length.

StringPiece(const StringPiece &x, int32_t pos)

Substring of another StringPiece.

StringPiece(const std::string &str)

Constructs from a std::string.

StringPiece(const char *offset, int32_t len)

Constructs from a const char * pointer and a specified length.

UMemory is the common ICU base class.

U_EXPORT UBool operator==(const StringPiece &x, const StringPiece &y)

Global operator == for StringPiece.

bool operator!=(const StringPiece &x, const StringPiece &y)

Global operator != for StringPiece.

C++ API: Central ICU header for including the C++ standard <string> header and for related definition...

int8_t UBool

The ICU boolean type, a signed-byte integer.

C++ API: Common ICU base class UObject.

Basic definitions for ICU, for both C and C++ APIs.

#define U_COMMON_API

Set to export library symbols from inside the common library, and to import them from outside.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4