Rerun C++ SDK
Loading...
Searching...
No Matches
utf8.hpp
1// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs
2// Based on "crates/re_types/definitions/rerun/datatypes/utf8.fbs".
3
4#pragma once
5
6#include "../result.hpp"
7
8#include <cstdint>
9#include <memory>
10#include <string>
11#include <utility>
12
13namespace arrow {
14 class Array;
15 class DataType;
16 class StringBuilder;
17} // namespace arrow
18
19namespace rerun::datatypes {
20 /// **Datatype**: A string of text, encoded as UTF-8.
21 struct Utf8 {
22 std::string value;
23
24 public:
25 // Extensions to generated type defined in 'utf8_ext.cpp'
26
27 /// Construct a `Utf8` from null-terminated UTF-8.
28 Utf8(const char* str) : value(str) {}
29
30 const char* c_str() const {
31 return value.c_str();
32 }
33
34 public:
35 Utf8() = default;
36
37 Utf8(std::string value_) : value(std::move(value_)) {}
38
39 Utf8& operator=(std::string value_) {
40 value = std::move(value_);
41 return *this;
42 }
43 };
44} // namespace rerun::datatypes
45
46namespace rerun {
47 template <typename T>
48 struct Loggable;
49
50 /// \private
51 template <>
52 struct Loggable<datatypes::Utf8> {
53 static constexpr const char Name[] = "rerun.datatypes.Utf8";
54
55 /// Returns the arrow data type this type corresponds to.
56 static const std::shared_ptr<arrow::DataType>& arrow_datatype();
57
58 /// Fills an arrow array builder with an array of this type.
59 static rerun::Error fill_arrow_array_builder(
60 arrow::StringBuilder* builder, const datatypes::Utf8* elements, size_t num_elements
61 );
62
63 /// Serializes an array of `rerun::datatypes::Utf8` into an arrow array.
64 static Result<std::shared_ptr<arrow::Array>> to_arrow(
65 const datatypes::Utf8* instances, size_t num_instances
66 );
67 };
68} // namespace rerun
Status outcome object (success or error) returned for fallible operations.
Definition error.hpp:87
All built-in datatypes. See Types in the Rerun manual.
Definition rerun.hpp:72
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:20
Datatype: A string of text, encoded as UTF-8.
Definition utf8.hpp:21
Utf8(const char *str)
Construct a Utf8 from null-terminated UTF-8.
Definition utf8.hpp:28