Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Doxygen warnings in strings / header files #10937

Merged
merged 6 commits into from
Jun 2, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion cpp/include/cudf/strings/char_types/char_types.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2021, NVIDIA CORPORATION.
* Copyright (c) 2019-2022, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -51,11 +51,19 @@ enum string_character_types : uint32_t {

/**
* @brief OR operator for combining string_character_types
*
* @param lhs left-hand side of OR operation
* @param rhs right-hand side of OR operation
* @return combined string_character_types
codereport marked this conversation as resolved.
Show resolved Hide resolved
*/
string_character_types operator|(string_character_types lhs, string_character_types rhs);

/**
* @brief Compound assignment OR operator for combining string_character_types
*
* @param lhs left-hand side of OR operation
* @param rhs right-hand side of OR operation
* @return Reference to `lhs` after combining `lhs` and `rhs`
*/
string_character_types& operator|=(string_character_types& lhs, string_character_types rhs);

Expand Down
6 changes: 5 additions & 1 deletion cpp/include/cudf/strings/json.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, NVIDIA CORPORATION.
* Copyright (c) 2021-2022, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -47,6 +47,8 @@ class get_json_object_options {
/**
* @brief Returns true/false depending on whether single-quotes for representing strings
* are allowed.
*
* @return true if single-quotes are allowed, false otherwise.
*/
[[nodiscard]] CUDF_HOST_DEVICE inline bool get_allow_single_quotes() const
{
Expand Down Expand Up @@ -74,6 +76,8 @@ class get_json_object_options {
* Output = b
*
* @endcode
*
* @return true if individually returned string values have their quotes stripped.
*/
[[nodiscard]] CUDF_HOST_DEVICE inline bool get_strip_quotes_from_single_strings() const
{
Expand Down
2 changes: 2 additions & 0 deletions cpp/include/cudf/strings/string_view.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ __device__ inline size_type string_view::length() const
return _length;
}

// @cond
// this custom iterator knows about UTF8 encoding
__device__ inline string_view::const_iterator::const_iterator(const string_view& str, size_type pos)
: p{str.data()}, bytes{str.size_bytes()}, char_pos{pos}, byte_pos{str.byte_offset(pos)}
Expand Down Expand Up @@ -243,6 +244,7 @@ __device__ inline string_view::const_iterator string_view::end() const
{
return const_iterator(*this, length());
}
// @endcond

__device__ inline char_utf8 string_view::operator[](size_type pos) const
{
Expand Down
48 changes: 46 additions & 2 deletions cpp/include/cudf/strings/string_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,26 +50,35 @@ class string_view {
public:
/**
* @brief Return the number of bytes in this string
*
* @return The number of bytes in this string
*/
CUDF_HOST_DEVICE [[nodiscard]] inline size_type size_bytes() const { return _bytes; }
/**
* @brief Return the number of characters in this string
*
* @return The number of characters in this string
*/
__device__ [[nodiscard]] inline size_type length() const;
/**
* @brief Return a pointer to the internal device array
*
* @return A pointer to the internal device array
*/
CUDF_HOST_DEVICE [[nodiscard]] inline const char* data() const { return _data; }

/**
* @brief Return true if string has no characters
*
* @return true if string has no characters
*/
CUDF_HOST_DEVICE [[nodiscard]] inline bool empty() const { return size_bytes() == 0; }

/**
* @brief Handy iterator for navigating through encoded characters.
*/
class const_iterator {
/// @cond
public:
using difference_type = ptrdiff_t;
using value_type = char_utf8;
Expand Down Expand Up @@ -104,27 +113,34 @@ class string_view {
size_type bytes{};
size_type char_pos{};
size_type byte_pos{};
/// @endcond
};

/**
* @brief Return new iterator pointing to the beginning of this string
*
* @return new iterator pointing to the beginning of this string
*/
__device__ [[nodiscard]] inline const_iterator begin() const;
/**
* @brief Return new iterator pointing past the end of this string
*
* @return new iterator pointing past the end of this string
*/
__device__ [[nodiscard]] inline const_iterator end() const;

/**
* @brief Return single UTF-8 character at the given character position
*
* @param pos Character position
* @return UTF-8 character at the given character position
*/
__device__ inline char_utf8 operator[](size_type pos) const;
/**
* @brief Return the byte offset from data() for a given character position
*
* @param pos Character position
* @return Byte offset from data() for a given character position
*/
__device__ [[nodiscard]] inline size_type byte_offset(size_type pos) const;

Expand Down Expand Up @@ -160,26 +176,44 @@ class string_view {

/**
* @brief Returns true if rhs matches this string exactly.
*
* @param rhs Target string to compare with this string.
karthikeyann marked this conversation as resolved.
Show resolved Hide resolved
* @return true if rhs matches this string exactly
*/
__device__ inline bool operator==(const string_view& rhs) const;
/**
* @brief Returns true if rhs does not match this string.
*
* @param rhs Target string to compare with this string.
karthikeyann marked this conversation as resolved.
Show resolved Hide resolved
* @return true if rhs does not match this string
*/
__device__ inline bool operator!=(const string_view& rhs) const;
/**
* @brief Returns true if this string is ordered before rhs.
*
* @param rhs Target string to compare with this string.
karthikeyann marked this conversation as resolved.
Show resolved Hide resolved
* @return true if this string is ordered before rhs
*/
__device__ inline bool operator<(const string_view& rhs) const;
/**
* @brief Returns true if rhs is ordered before this string.
*
* @param rhs Target string to compare with this string.
karthikeyann marked this conversation as resolved.
Show resolved Hide resolved
* @return true if rhs is ordered before this string
*/
__device__ inline bool operator>(const string_view& rhs) const;
/**
* @brief Returns true if this string matches or is ordered before rhs.
*
* @param rhs Target string to compare with this string.
karthikeyann marked this conversation as resolved.
Show resolved Hide resolved
* @return true if this string matches or is ordered before rhs
*/
__device__ inline bool operator<=(const string_view& rhs) const;
/**
* @brief Returns true if rhs matches or is ordered before this string.
*
* @param rhs Target string to compare with this string.
karthikeyann marked this conversation as resolved.
Show resolved Hide resolved
* @return true if rhs matches or is ordered before this string
*/
__device__ inline bool operator>=(const string_view& rhs) const;

Expand Down Expand Up @@ -313,10 +347,20 @@ class string_view {
{
}

string_view(const string_view&) = default;
string_view(string_view&&) = default;
string_view(const string_view&) = default; ///< Copy constructor
string_view(string_view&&) = default; ///< Move constructor
~string_view() = default;
/**
* @brief Copy assignment operator
*
* @return Reference to this instance
*/
string_view& operator=(const string_view&) = default;
/**
* @brief Move assignment operator
*
* @return Reference to this instance (after transferring ownership)
*/
string_view& operator=(string_view&&) = default;

private:
Expand Down
37 changes: 29 additions & 8 deletions cpp/include/cudf/strings/strings_column_view.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2021, NVIDIA CORPORATION.
* Copyright (c) 2019-2022, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -35,15 +35,30 @@ namespace cudf {
*/
class strings_column_view : private column_view {
public:
/**
* @brief Construct a new strings column view object from a column view.s
*
* @param strings_column The column view to wrap.
karthikeyann marked this conversation as resolved.
Show resolved Hide resolved
*/
strings_column_view(column_view strings_column);
strings_column_view(strings_column_view&& strings_view) = default;
strings_column_view(const strings_column_view& strings_view) = default;
~strings_column_view() = default;
strings_column_view(strings_column_view&&) = default; ///< Move constructor
strings_column_view(strings_column_view const&) = default; ///< Copy constructor
~strings_column_view() = default;
/**
* @brief Copy assignment operator
*
* @return Reference to this instance
*/
strings_column_view& operator=(strings_column_view const&) = default;
/**
* @brief Move assignment operator
*
* @return Reference to this instance (after transferring ownership)
*/
strings_column_view& operator=(strings_column_view&&) = default;

static constexpr size_type offsets_column_index{0};
static constexpr size_type chars_column_index{1};
static constexpr size_type offsets_column_index{0}; ///< Child index of the offsets column
static constexpr size_type chars_column_index{1}; ///< Child index of the characters column

using column_view::has_nulls;
using column_view::is_empty;
Expand All @@ -52,18 +67,21 @@ class strings_column_view : private column_view {
using column_view::offset;
using column_view::size;

using offset_iterator = offset_type const*;
using chars_iterator = char const*;
using offset_iterator = offset_type const*; ///< offsets iterator type
using chars_iterator = char const*; ///< character iterator type

/**
* @brief Returns the parent column.
*
* @return The parents column
*/
[[nodiscard]] column_view parent() const;

/**
* @brief Returns the internal column of offsets
*
* @throw cudf::logic error if this is an empty column
* @return The offsets column
*/
[[nodiscard]] column_view offsets() const;

Expand All @@ -89,6 +107,7 @@ class strings_column_view : private column_view {
* @brief Returns the internal column of chars
*
* @throw cudf::logic error if this is an empty column
* @return The chars column
*/
[[nodiscard]] column_view chars() const;

Expand All @@ -97,6 +116,8 @@ class strings_column_view : private column_view {
*
* This accounts for empty columns but does not reflect a sliced parent column
* view (i.e.: non-zero offset or reduced row count).
*
* @return Number of bytes in the chars child column
*/
[[nodiscard]] size_type chars_size() const noexcept;

Expand Down