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 "../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: // START of extensions from utf8_ext.cpp:
25 /// Construct from a C string.
26 Utf8(const char* utf8_) : value(utf8_) {}
27
28 /// Explicit copy assignment from a C string to avoid ambiguity in some cases.
29 Utf8& operator=(const char* utf8_) {
30 value = utf8_;
31 return *this;
32 }
33
34 /// Returns a pointer to the underlying C string.
35 const char* c_str() const {
36 return value.c_str();
37 }
38
39 // END of extensions from utf8_ext.cpp, start of generated code:
40
41 public:
42 Utf8() = default;
43
44 Utf8(std::string value_) : value(std::move(value_)) {}
45
46 Utf8& operator=(std::string value_) {
47 value = std::move(value_);
48 return *this;
49 }
50 };
51} // namespace rerun::datatypes
52
53namespace rerun {
54 template <typename T>
55 struct Loggable;
56
57 /// \private
58 template <>
59 struct Loggable<datatypes::Utf8> {
60 static constexpr std::string_view ComponentType = "rerun.datatypes.Utf8";
61
62 /// Returns the arrow data type this type corresponds to.
63 static const std::shared_ptr<arrow::DataType>& arrow_datatype();
64
65 /// Serializes an array of `rerun::datatypes::Utf8` into an arrow array.
66 static Result<std::shared_ptr<arrow::Array>> to_arrow(
67 const datatypes::Utf8* instances, size_t num_instances
68 );
69
70 /// Fills an arrow array builder with an array of this type.
71 static rerun::Error fill_arrow_array_builder(
72 arrow::StringBuilder* builder, const datatypes::Utf8* elements, size_t num_elements
73 );
74 };
75} // namespace rerun
Status outcome object (success or error) returned for fallible operations.
Definition error.hpp:99
All built-in datatypes. See Types in the Rerun manual.
Definition rerun.hpp:82
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:21
Utf8(const char *utf8_)
Construct from a C string.
Definition utf8.hpp:26
Utf8 & operator=(const char *utf8_)
Explicit copy assignment from a C string to avoid ambiguity in some cases.
Definition utf8.hpp:29
const char * c_str() const
Returns a pointer to the underlying C string.
Definition utf8.hpp:35