Commits


sgilmore10 authored and GitHub committed 9e6a1830705
GH-36483: [C++] Make `UTF8StringToUTF16` and `UTF16StringToUTF8` accept `string_views` (#36485) ### Rationale for this change As @ kou pointed out in #36366, it's better to pass read-only string data via as string_views than as const references. I recently submitted two new functions called `UTF8StringToUTF16` and `UTF16StringToUTF8`, both of which accept const references. This PR changes the signatures of those functions to accept string_views. ### What changes are included in this PR? Changed the function signatures of `UTF8StringToUTF16` and `UTF16StringToUTF8`: 1. `arrow::Result<std::u16string> UTF8StringToUTF16(const std::string& source)` -> `arrow::Result<std::u16string> UTF8StringToUTF16(std::string_view source)` 2. `arrow::Result<std::string> UTF16StringToUTF8(const std::u16string& source)` -> `arrow::Result<std::string> UTF16StringToUTF8(std::u16string_view source)` ### Are these changes tested? Uses existing tests in `utf8_util_test.cc` ### Are there any user-facing changes? No. Only the MATLAB Interface uses these functions, so I don't expect these changes to break anyone's code: 1. Search [results](https://github.com/search?q=repo%3Aapache%2Farrow%20UTF8StringToUTF16&type=code) for `UTF8StringToUTF16` 2. Search [results](https://github.com/search?q=repo%3Aapache%2Farrow+UTF16StringToUTF8&type=code) for `UTF16StringToUTF8` * Closes: #36483 Authored-by: Sarah Gilmore <sgilmore@mathworks.com> Signed-off-by: Sutou Kouhei <kou@clear-code.com>