Rerun C++ SDK
Loading...
Searching...
No Matches
text_document_format.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/build/re_type_definitions/rerun/blueprint/archetypes/text_document_format.def.rs".
3
4#pragma once
5
6#include "../../archetype_utils.hpp"
7#include "../../blueprint/components/enabled.hpp"
8#include "../../collection.hpp"
9#include "../../component_batch.hpp"
10#include "../../component_column.hpp"
11#include "../../result.hpp"
12
13#include <cstdint>
14#include <optional>
15#include <utility>
16#include <vector>
17
18namespace rerun::blueprint::archetypes {
19 /// **Archetype**: Formatting options for the text document view.
20 ///
21 /// These options only apply to plain text documents and have no effect on Markdown documents.
22 ///
23 /// ⚠ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
24 ///
26 /// Whether to use a monospace font for the document body.
27 ///
28 /// Defaults to disabled.
29 std::optional<ComponentBatch> monospace;
30
31 /// Whether to wrap long lines in the document body.
32 ///
33 /// Defaults to enabled.
34 std::optional<ComponentBatch> word_wrap;
35
36 public:
37 /// The name of the archetype as used in `ComponentDescriptor`s.
38 static constexpr const char ArchetypeName[] =
39 "rerun.blueprint.archetypes.TextDocumentFormat";
40
41 /// `ComponentDescriptor` for the `monospace` field.
43 ArchetypeName, "TextDocumentFormat:monospace",
45 );
46 /// `ComponentDescriptor` for the `word_wrap` field.
48 ArchetypeName, "TextDocumentFormat:word_wrap",
50 );
51
52 public:
53 TextDocumentFormat() = default;
54 TextDocumentFormat(TextDocumentFormat&& other) = default;
55 TextDocumentFormat(const TextDocumentFormat& other) = default;
56 TextDocumentFormat& operator=(const TextDocumentFormat& other) = default;
57 TextDocumentFormat& operator=(TextDocumentFormat&& other) = default;
58
59 /// Update only some specific fields of a `TextDocumentFormat`.
61 return TextDocumentFormat();
62 }
63
64 /// Clear all the fields of a `TextDocumentFormat`.
66
67 /// Whether to use a monospace font for the document body.
68 ///
69 /// Defaults to disabled.
71 ) && {
72 monospace =
73 ComponentBatch::from_loggable(_monospace, Descriptor_monospace).value_or_throw();
74 return std::move(*this);
75 }
76
77 /// Whether to wrap long lines in the document body.
78 ///
79 /// Defaults to enabled.
81 ) && {
82 word_wrap =
83 ComponentBatch::from_loggable(_word_wrap, Descriptor_word_wrap).value_or_throw();
84 return std::move(*this);
85 }
86
87 /// Partitions the component data into multiple sub-batches.
88 ///
89 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
90 /// instead, via `ComponentBatch::partitioned`.
91 ///
92 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
93 ///
94 /// The specified `lengths` must sum to the total length of the component batch.
96 return detail::partition_batches({&monospace, &word_wrap}, lengths_).value_or_throw();
97 }
98
99 /// Partitions the component data into unit-length sub-batches.
100 ///
101 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
102 /// where `n` is automatically guessed.
104 return detail::partition_batches_of_unit_length({&monospace, &word_wrap})
105 .value_or_throw();
106 }
107 };
108
109} // namespace rerun::blueprint::archetypes
110
111namespace rerun {
112 /// \private
113 template <typename T>
114 struct AsComponents;
115
116 /// \private
117 template <>
118 struct AsComponents<blueprint::archetypes::TextDocumentFormat> {
119 /// Serialize all set component batches.
120 static Result<Collection<ComponentBatch>> as_batches(
122 ) {
123 return detail::collect_batches({&archetype.monospace, &archetype.word_wrap});
124 }
125 };
126} // namespace rerun
Generic collection of elements that are roughly contiguous in memory.
Definition collection.hpp:49
A class for representing either a usable value, or an error.
Definition result.hpp:14
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:26
static Result< ComponentBatch > from_loggable(const rerun::Collection< T > &components, const ComponentDescriptor &descriptor)
Creates a new component batch from a collection of component instances.
Definition component_batch.hpp:46
A ComponentDescriptor fully describes the semantics of a column of data.
Definition component_descriptor.hpp:16
The Loggable trait is used by all built-in implementation of rerun::AsComponents to serialize a colle...
Definition loggable.hpp:11
Archetype: Formatting options for the text document view.
Definition text_document_format.hpp:25
std::optional< ComponentBatch > word_wrap
Whether to wrap long lines in the document body.
Definition text_document_format.hpp:34
static constexpr auto Descriptor_monospace
ComponentDescriptor for the monospace field.
Definition text_document_format.hpp:42
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
Definition text_document_format.hpp:95
static constexpr auto Descriptor_word_wrap
ComponentDescriptor for the word_wrap field.
Definition text_document_format.hpp:47
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition text_document_format.hpp:38
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
Definition text_document_format.hpp:103
static TextDocumentFormat update_fields()
Update only some specific fields of a TextDocumentFormat.
Definition text_document_format.hpp:60
TextDocumentFormat with_word_wrap(const rerun::blueprint::components::Enabled &_word_wrap) &&
Whether to wrap long lines in the document body.
Definition text_document_format.hpp:80
static TextDocumentFormat clear_fields()
Clear all the fields of a TextDocumentFormat.
TextDocumentFormat with_monospace(const rerun::blueprint::components::Enabled &_monospace) &&
Whether to use a monospace font for the document body.
Definition text_document_format.hpp:70
std::optional< ComponentBatch > monospace
Whether to use a monospace font for the document body.
Definition text_document_format.hpp:29
Component: Whether a procedure is enabled.
Definition enabled.hpp:17