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