Rerun C++ SDK
Loading...
Searching...
No Matches
utf8.hpp
1// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs
2// Based on "crates/store/re_types/definitions/rerun/datatypes/utf8.fbs".
3
4#pragma once
5
6#include "../component_descriptor.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::datatypes {
21 /// **Datatype**: A string of text, encoded as UTF-8.
22 struct Utf8 {
23 std::string value;
24
25 public: // START of extensions from utf8_ext.cpp:
26 /// Construct from a C string.
27 Utf8(const char* utf8_) : value(utf8_) {}
28
29 /// Explicit copy assignment from a C string to avoid ambiguity in some cases.
30 Utf8& operator=(const char* utf8_) {
31 value = utf8_;
32 return *this;
33 }
34
35 /// Returns a pointer to the underlying C string.
36 const char* c_str() const {
37 return value.c_str();
38 }
39
40 // END of extensions from utf8_ext.cpp, start of generated code:
41
42 public:
43 Utf8() = default;
44
45 Utf8(std::string value_) : value(std::move(value_)) {}
46
47 Utf8& operator=(std::string value_) {
48 value = std::move(value_);
49 return *this;
50 }
51 };
52} // namespace rerun::datatypes
53
54namespace rerun {
55 template <typename T>
56 struct Loggable;
57
58 /// \private
59 template <>
60 struct Loggable<datatypes::Utf8> {
61 static constexpr ComponentDescriptor Descriptor = "rerun.datatypes.Utf8";
62
63 /// Returns the arrow data type this type corresponds to.
64 static const std::shared_ptr<arrow::DataType>& arrow_datatype();
65
66 /// Serializes an array of `rerun::datatypes::Utf8` into an arrow array.
67 static Result<std::shared_ptr<arrow::Array>> to_arrow(
68 const datatypes::Utf8* instances, size_t num_instances
69 );
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 datatypes::Utf8* elements, size_t num_elements
74 );
75 };
76} // namespace rerun
Status outcome object (success or error) returned for fallible operations.
Definition error.hpp:95
All built-in datatypes. See Types in the Rerun manual.
Definition rerun.hpp:83
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:23
Datatype: A string of text, encoded as UTF-8.
Definition utf8.hpp:22
Utf8(const char *utf8_)
Construct from a C string.
Definition utf8.hpp:27
Utf8 & operator=(const char *utf8_)
Explicit copy assignment from a C string to avoid ambiguity in some cases.
Definition utf8.hpp:30
const char * c_str() const
Returns a pointer to the underlying C string.
Definition utf8.hpp:36