| 公有成员函数 | 公有静态成员函数 | 公有静态属性 | 所有成员列表
cudf::string_view 类参考

一种非拥有、不可变设备数据视图,表示变长 UTF-8 字符串的字符数组。更多...

#include <string_view.hpp>

class  const_iterator
 用于遍历编码字符的便捷迭代器。更多...
 

公有成员函数

CUDF_HOST_DEVICE size_type size_bytes () const
 返回此字符串中的字节数。更多...
 
size_type length () const
 返回此字符串中的字符数。更多...
 
CUDF_HOST_DEVICE char const * data () const
 返回指向内部设备数组的指针。更多...
 
CUDF_HOST_DEVICE bool empty () const
 如果字符串没有字符,返回 true。更多...
 
const_iterator begin () const
 返回指向此字符串开头的新的迭代器。更多...
 
const_iterator end () const
 返回指向此字符串末尾之外的新的迭代器。更多...
 
char_utf8 operator[] (size_type pos) const
 返回给定字符位置处的单个 UTF-8 字符。更多...
 
size_type byte_offset (size_type pos) const
 返回给定字符位置相对于 data() 的字节偏移量。更多...
 
int compare (string_view const &str) const
 将目标字符串与此字符串进行比较。每个字符都作为 UTF-8 码点值进行比较。更多...
 
int compare (char const *str, size_type bytes) const
 将目标字符串与此字符串进行比较。每个字符都作为 UTF-8 码点值进行比较。更多...
 
bool operator== (string_view const &rhs) const
 如果 rhs 与此字符串完全匹配,返回 true。更多...
 
bool operator!= (string_view const &rhs) const
 如果 rhs 与此字符串不匹配,返回 true。更多...
 
bool operator< (string_view const &rhs) const
 如果此字符串排序在 rhs 之前,返回 true。更多...
 
bool operator> (string_view const &rhs) const
 如果 rhs 排序在此字符串之前,返回 true。更多...
 
bool operator<= (string_view const &rhs) const
 如果此字符串匹配或排序在 rhs 之前,返回 true。更多...
 
bool operator>= (string_view const &rhs) const
 如果 rhs 匹配或排序在此字符串之前,返回 true。更多...
 
size_type find (string_view const &str, size_type pos=0, size_type count=-1) const
 返回参数 str 在此字符串字符范围 [pos,pos+n) 内第一次出现的字符位置。更多...
 
size_type find (char const *str, size_type bytes, size_type pos=0, size_type count=-1) const
 返回数组 str 在此字符串字符范围 [pos,pos+n) 内第一次出现的字符位置。更多...
 
size_type find (char_utf8 character, size_type pos=0, size_type count=-1) const
 返回字符 character 在此字符串字符范围 [pos,pos+n) 内第一次出现的字符位置。更多...
 
size_type rfind (string_view const &str, size_type pos=0, size_type count=-1) const
 返回参数 str 在此字符串字符范围 [pos,pos+n) 内最后一次出现的字符位置。更多...
 
size_type rfind (char const *str, size_type bytes, size_type pos=0, size_type count=-1) const
 返回数组 str 在此字符串字符范围 [pos,pos+n) 内最后一次出现的字符位置。更多...
 
size_type rfind (char_utf8 character, size_type pos=0, size_type count=-1) const
 返回字符 character 在此字符串字符范围 [pos,pos+n) 内最后一次出现的字符位置。更多...
 
string_view substr (size_type start, size_type length) const
 返回此字符串的子字符串。必须在此实例的生命周期内维护原始字符串和设备内存。更多...
 
CUDF_HOST_DEVICE string_view ()
 默认构造函数表示一个空字符串。
 
CUDF_HOST_DEVICE string_view (char const *data, size_type bytes)
 从现有设备字符数组创建实例。更多...
 
 string_view (string_view const &)=default
 复制构造函数。
 
 string_view (string_view &&)=default
 移动构造函数。
 
string_viewoperator= (string_view const &)=default
 复制赋值运算符。更多...
 
string_viewoperator= (string_view &&)=default
 移动赋值运算符。更多...
 

公有静态成员函数

static CUDF_HOST_DEVICE string_view min ()
 返回与字符串类型关联的最小值。更多...
 
static CUDF_HOST_DEVICE string_view max ()
 返回与字符串类型关联的最大值。更多...
 

公有静态属性

static cudf::size_type const npos {-1}
 无位置值。更多...
 

详细描述

一种非拥有、不可变设备数据视图,表示变长 UTF-8 字符串的字符数组。

调用者必须在此实例的生命周期内维护设备内存。

这可用于包装设备指针和大小,但任何需要访问设备内存的成员函数都必须从 kernel 调用。

定义于文件 string_view.hpp44 行。

构造函数与析构函数文档

◆ string_view()

CUDF_HOST_DEVICE cudf::string_view::string_view ( char const *  data,
size_type  bytes 
)
inline

从现有设备字符数组创建实例。

参数
data用 UTF8 编码的设备字符数组。
bytes数据数组中的字节数。

定义于文件 string_view.hpp343 行。

成员函数文档

◆ begin()

const_iterator cudf::string_view::begin ( ) const
inline

返回指向此字符串开头的新的迭代器。

返回值
指向此字符串开头的新的迭代器

◆ byte_offset()

size_type cudf::string_view::byte_offset ( size_type  pos) const
inline

返回给定字符位置相对于 data() 的字节偏移量。

参数
pos字符位置
返回值
给定字符位置相对于 data() 的字节偏移量

定义于文件 string_view.cuh308 行。

◆ compare() [1/2]

int cudf::string_view::compare ( char const *  str,
size_type  bytes 
) const
inline

将目标字符串与此字符串进行比较。每个字符都作为 UTF-8 码点值进行比较。

参数
str与此字符串比较的目标字符串。
bytesstr 中的字节数。
返回值
0 如果相等。<0 如果不匹配的第一个字符在此字符串中的值较低,或者所有比较的字符都匹配但参数字符串较短。>0 如果不匹配的第一个字符在此字符串中的值较高,或者所有比较的字符都匹配但参数字符串较长。

定义于文件 string_view.cuh319 行。

◆ compare() [2/2]

int cudf::string_view::compare ( string_view const &  str) const
inline

将目标字符串与此字符串进行比较。每个字符都作为 UTF-8 码点值进行比较。

参数
str与此字符串比较的目标字符串。
返回值
0 如果相等。<0 如果不匹配的第一个字符在此字符串中的值较低,或者所有比较的字符都匹配但参数字符串较短。>0 如果不匹配的第一个字符在此字符串中的值较高,或者所有比较的字符都匹配但参数字符串较长。

定义于文件 string_view.cuh314 行。

◆ data()

CUDF_HOST_DEVICE char const* cudf::string_view::data ( ) const
inline

返回指向内部设备数组的指针。

返回值
指向内部设备数组的指针

定义于文件 string_view.hpp63 行。

◆ empty()

CUDF_HOST_DEVICE bool cudf::string_view::empty ( ) const
inline

如果字符串没有字符,返回 true。

返回值
如果字符串没有字符,则为 true

定义于文件 string_view.hpp70 行。

◆ end()

const_iterator cudf::string_view::end ( ) const
inline

返回指向此字符串末尾之外的新的迭代器。

返回值
指向此字符串末尾之外的新的迭代器

◆ find() [1/3]

size_type cudf::string_view::find ( char const *  str,
size_type  bytes,
size_type  pos = 0,
size_type  count = -1 
) const
inline

返回数组 str 在此字符串字符范围 [pos,pos+n) 内第一次出现的字符位置。

参数
str在此字符串中搜索的目标数组。
bytesstr 中的字节数。
pos在此字符串中开始搜索的字符位置。
count从 pos 开始包含在搜索中的字符数。指定 -1 表示到字符串末尾。
返回值
如果参数字符串未在此字符串中找到,返回 npos。

定义于文件 string_view.cuh405 行。

◆ find() [2/3]

size_type cudf::string_view::find ( char_utf8  character,
size_type  pos = 0,
size_type  count = -1 
) const
inline

返回字符 character 在此字符串字符范围 [pos,pos+n) 内第一次出现的字符位置。

参数
character单个编码字符。
pos在此字符串中开始搜索的字符位置。
count从 pos 开始包含在搜索中的字符数。指定 -1 表示到字符串末尾。
返回值
如果参数字符串未在此字符串中找到,返回 npos。

定义于文件 string_view.cuh413 行。

◆ find() [3/3]

size_type cudf::string_view::find ( string_view const &  str,
size_type  pos = 0,
size_type  count = -1 
) const
inline

返回参数 str 在此字符串字符范围 [pos,pos+n) 内第一次出现的字符位置。

参数
str在此字符串中搜索的目标字符串。
pos在此字符串中开始搜索的字符位置。
count从 pos 开始包含在搜索中的字符数。指定 -1 表示到字符串末尾。
返回值
如果 str 未在此字符串中找到,返回 npos。

定义于文件 string_view.cuh368 行。

◆ length()

size_type cudf::string_view::length ( ) const
inline

返回此字符串中的字符数。

返回值
此字符串中的字符数

定义于文件 string_view.cuh139 行。

◆ max()

CUDF_HOST_DEVICE string_view cudf::string_view::max ( )
inline静态

返回与字符串类型关联的最大值。

此函数需要是 host callable 的,因为它被 host callable 函数 DeviceMin::identity<string_view>() 调用。

返回值
表示可能的最高有效 UTF-8 编码字符的字符串值。

定义于文件 string_view.cuh127 行。

◆ min()

CUDF_HOST_DEVICE string_view cudf::string_view::min ( )
inline静态

返回与字符串类型关联的最小值。

此函数需要是 host callable 的,因为它被 host callable 函数 DeviceMax::identity<string_view>() 调用。

返回值
一个空字符串

定义于文件 string_view.cuh116 行。

◆ operator!=()

bool cudf::string_view::operator!= ( string_view const &  rhs) const
inline

如果 rhs 与此字符串不匹配,返回 true。

参数
rhs与此字符串比较的目标字符串。
返回值
如果 rhs 与此字符串不匹配,则为 true

定义于文件 string_view.cuh341 行。

◆ operator<()

bool cudf::string_view::operator< ( string_view const &  rhs) const
inline

如果此字符串排序在 rhs 之前,返回 true。

参数
rhs与此字符串比较的目标字符串。
返回值
如果此字符串排序在 rhs 之前,则为 true

定义于文件 string_view.cuh346 行。

◆ operator<=()

bool cudf::string_view::operator<= ( string_view const &  rhs) const
inline

如果此字符串匹配或排序在 rhs 之前,返回 true。

参数
rhs与此字符串比较的目标字符串。
返回值
如果此字符串匹配或排序在 rhs 之前,则为 true

定义于文件 string_view.cuh356 行。

◆ operator=() [1/2]

string_view& cudf::string_view::operator= ( string_view &&  )
default

移动赋值运算符。

返回值
此实例的引用(转移所有权后)

◆ operator=() [2/2]

string_view& cudf::string_view::operator= ( string_view const &  )
default

复制赋值运算符。

返回值
此实例的引用

定义于文件 string_view.hpp365 行。

◆ operator==() ( string_view const &  rhs) const
inline

bool cudf::string_view::operator==

参数
rhs与此字符串比较的目标字符串。
返回值
如果 rhs 与此字符串完全匹配,返回 true。

如果 rhs 与此字符串完全匹配,则为 true

定义于文件 string_view.cuh336 行。

◆ operator>() ( string_view const &  rhs) const
inline

bool cudf::string_view::operator>

参数
rhs与此字符串比较的目标字符串。
返回值
如果 rhs 排序在此字符串之前,返回 true。

如果 rhs 排序在此字符串之前,则为 true

定义于文件 string_view.cuh351 行。

◆ operator>=() ( string_view const &  rhs) const
inline

bool cudf::string_view::operator>=

参数
rhs与此字符串比较的目标字符串。
返回值
如果 rhs 匹配或排序在此字符串之前,返回 true。

如果 rhs 匹配或排序在此字符串之前,则为 true

定义于文件 string_view.cuh362 行。

◆ operator[]() ( size_type  pos) const
inline

char_utf8 cudf::string_view::operator[]

参数
pos字符位置
返回值
返回给定字符位置处的单个 UTF-8 字符。

给定字符位置处的 UTF-8 字符

定义于文件 string_view.cuh299 行。

◆ rfind() [1/3] ( char const *  str,
size_type  bytes,
size_type  pos = 0,
size_type  count = -1 
) const
inline

size_type cudf::string_view::rfind

参数
str返回数组 str 在此字符串字符范围 [pos,pos+n) 内最后一次出现的字符位置。
bytesstr 中的字节数。
pos在此字符串中开始搜索的字符位置。
count从 pos 开始包含在搜索中的字符数。指定 -1 表示到字符串末尾。
返回值
如果参数字符串未在此字符串中找到,返回 npos。

在此字符串中搜索的目标字符串。

定义于文件 string_view.cuh427 行。

◆ rfind() [1/3] ( char_utf8  character,
size_type  pos = 0,
size_type  count = -1 
) const
inline

◆ rfind() [2/3]

参数
character单个编码字符。
pos在此字符串中开始搜索的字符位置。
count从 pos 开始包含在搜索中的字符数。指定 -1 表示到字符串末尾。
返回值
如果参数字符串未在此字符串中找到,返回 npos。

返回字符 character 在此字符串字符范围 [pos,pos+n) 内最后一次出现的字符位置。

定义于文件 string_view.cuh435 行。

◆ rfind() [1/3] ( string_view const &  str,
size_type  pos = 0,
size_type  count = -1 
) const
inline

◆ rfind() [3/3]

参数
str在此字符串中搜索的目标字符串。
pos在此字符串中开始搜索的字符位置。
count从 pos 开始包含在搜索中的字符数。指定 -1 表示到字符串末尾。
返回值
如果参数字符串未在此字符串中找到,返回 npos。

返回参数 str 在此字符串字符范围 [pos,pos+n) 内最后一次出现的字符位置。

定义于文件 string_view.cuh420 行。

◆ size_bytes() ( ) const
inline

CUDF_HOST_DEVICE size_type cudf::string_view::size_bytes

返回值
返回此字符串中的字节数。

此字符串中的字节数

定义于文件 string_view.hpp51 行。

◆ substr() ( size_type  string_view cudf::string_view::substr,
size_type  start
) const
inline

length 

参数
string_view cudf::string_view::substr返回此字符串的子字符串。必须在此实例的生命周期内维护原始字符串和设备内存。
子字符串的起始字符位置。length
返回值
从 start 开始包含在子字符串中的字符数。

指向此实例中字符子集的新实例。

定义于文件 string_view.cuh443 行。

成员数据文档

◆ npos
inline静态

cudf::size_type const cudf::string_view::npos {-1}

无位置值。

用于指定或返回无效或未知字符位置值时使用。


定义于文件 string_view.hpp369 行。