Classes | Namespaces | Typedefs | Functions | Variables
string_view.hpp File Reference

Class definition for cudf::string_view. More...

#include <cuda_runtime.h>
#include <cstddef>
#include <cudf/types.hpp>
#include <iterator>

Go to the source code of this file.

Classes

class  cudf::string_view
 A non-owning, immutable view of device data that is a variable length char array representing a UTF-8 string. More...
 
class  cudf::string_view::const_iterator
 Handy iterator for navigating through encoded characters. More...
 

Namespaces

 cudf
 cuDF interfaces
 
 cudf::strings
 Strings column APIs.
 

Typedefs

using cudf::char_utf8 = uint32_t
 UTF-8 characters are 1-4 bytes.
 

Functions

constexpr bool cudf::strings::detail::is_begin_utf8_char (uint8_t byte)
 This will return true if passed the first byte of a UTF-8 character. More...
 
constexpr size_type cudf::strings::detail::bytes_in_char_utf8 (char_utf8 character)
 Returns the number of bytes in the specified character. More...
 
constexpr size_type cudf::strings::detail::bytes_in_utf8_byte (uint8_t byte)
 Returns the number of bytes used to represent the provided byte. More...
 
CUDA_HOST_DEVICE_CALLABLE size_type cudf::strings::detail::to_char_utf8 (const char *str, char_utf8 &character)
 Convert a char array into a char_utf8 value. More...
 
CUDA_HOST_DEVICE_CALLABLE size_type cudf::strings::detail::from_char_utf8 (char_utf8 character, char *str)
 Place a char_utf8 value into a char array. More...
 

Variables

constexpr cudf::size_type cudf::UNKNOWN_STRING_LENGTH {-1}
 The string length is initialized to this value as a place-holder. More...
 
constexpr int8_t cudf::UNKNOWN_CHAR_WIDTH {-1}
 The char width is initialized to this value as a place-holder. More...
 
constexpr int8_t cudf::VARIABLE_CHAR_WIDTH {0}
 This value is assigned to the _char_width member if the string contains characters of different widths.
 

Detailed Description

Class definition for cudf::string_view.

Definition in file string_view.hpp.

Function Documentation

◆ bytes_in_char_utf8()

constexpr size_type cudf::strings::detail::bytes_in_char_utf8 ( char_utf8  character)
constexpr

Returns the number of bytes in the specified character.

Parameters
characterSingle character
Returns
Number of bytes

Definition at line 372 of file string_view.hpp.

◆ bytes_in_utf8_byte()

constexpr size_type cudf::strings::detail::bytes_in_utf8_byte ( uint8_t  byte)
constexpr

Returns the number of bytes used to represent the provided byte.

This could be 0 to 4 bytes. 0 is returned for intermediate bytes within a single character. For example, for the two-byte 0xC3A8 single character, the first byte would return 2 and the second byte would return 0.

Parameters
byteByte from an encoded character.
Returns
Number of bytes.

Definition at line 389 of file string_view.hpp.

◆ from_char_utf8()

CUDA_HOST_DEVICE_CALLABLE size_type cudf::strings::detail::from_char_utf8 ( char_utf8  character,
char *  str 
)

Place a char_utf8 value into a char array.

Parameters
characterSingle character
[out]strAllocated char array with enough space to hold the encoded characer.
Returns
The number of bytes in the character

Definition at line 431 of file string_view.hpp.

◆ is_begin_utf8_char()

constexpr bool cudf::strings::detail::is_begin_utf8_char ( uint8_t  byte)
constexpr

This will return true if passed the first byte of a UTF-8 character.

Parameters
byteAny byte from a valid UTF-8 character
Returns
true if this the first byte of the character

Definition at line 360 of file string_view.hpp.

◆ to_char_utf8()

CUDA_HOST_DEVICE_CALLABLE size_type cudf::strings::detail::to_char_utf8 ( const char *  str,
char_utf8 character 
)

Convert a char array into a char_utf8 value.

Parameters
strString containing encoded char bytes.
[out]characterSingle char_utf8 value.
Returns
The number of bytes in the character

Definition at line 404 of file string_view.hpp.