Rerun C++ SDK
Loading...
Searching...
No Matches
text_document.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/archetypes/text_document.fbs".
3
4#pragma once
5
6#include "../collection.hpp"
7#include "../compiler_utils.hpp"
8#include "../component_batch.hpp"
9#include "../components/media_type.hpp"
10#include "../components/text.hpp"
11#include "../indicator_component.hpp"
12#include "../result.hpp"
13
14#include <cstdint>
15#include <optional>
16#include <utility>
17#include <vector>
18
19namespace rerun::archetypes {
20 /// **Archetype**: A text element intended to be displayed in its own text box.
21 ///
22 /// Supports raw text and markdown.
23 ///
24 /// ## Example
25 ///
26 /// ### Markdown text document
27 /// ![image](https://static.rerun.io/textdocument/babda19558ee32ed8d730495b595aee7a5e2c174/full.png)
28 ///
29 /// ```cpp
30 /// #include <rerun.hpp>
31 ///
32 /// int main() {
33 /// const auto rec = rerun::RecordingStream("rerun_example_text_document");
34 /// rec.spawn().exit_on_failure();
35 ///
36 /// rec.log("text_document", rerun::TextDocument("Hello, TextDocument!"));
37 ///
38 /// rec.log(
39 /// "markdown",
40 /// rerun::TextDocument(R"#(# Hello Markdown!
41 /// [Click here to see the raw text](recording://markdown:Text).
42 ///
43 /// Basic formatting:
44 ///
45 /// | **Feature** | **Alternative** |
46 /// | ----------------- | --------------- |
47 /// | Plain | |
48 /// | *italics* | _italics_ |
49 /// | **bold** | __bold__ |
50 /// | ~~strikethrough~~ | |
51 /// | `inline code` | |
52 ///
53 /// ----------------------------------
54 ///
55 /// ## Support
56 /// - [x] [Commonmark](https://commonmark.org/help/) support
57 /// - [x] GitHub-style strikethrough, tables, and checkboxes
58 /// - Basic syntax highlighting for:
59 /// - [x] C and C++
60 /// - [x] Python
61 /// - [x] Rust
62 /// - [ ] Other languages
63 ///
64 /// ## Links
65 /// You can link to [an entity](recording://markdown),
66 /// a [specific instance of an entity](recording://markdown[#0]),
67 /// or a [specific component](recording://markdown:Text).
68 ///
69 /// Of course you can also have [normal https links](https://github.com/rerun-io/rerun), e.g. <https://rerun.io>.
70 ///
71 /// ## Image
72 /// ![A random image](https://picsum.photos/640/480))#")
73 /// .with_media_type(rerun::MediaType::markdown())
74 /// );
75 /// }
76 /// ```
77 struct TextDocument {
78 /// Contents of the text document.
80
81 /// The Media Type of the text.
82 ///
83 /// For instance:
84 /// * `text/plain`
85 /// * `text/markdown`
86 ///
87 /// If omitted, `text/plain` is assumed.
88 std::optional<rerun::components::MediaType> media_type;
89
90 public:
91 static constexpr const char IndicatorComponentName[] =
92 "rerun.components.TextDocumentIndicator";
93
94 /// Indicator component, used to identify the archetype when converting to a list of components.
96
97 public:
98 TextDocument() = default;
99 TextDocument(TextDocument&& other) = default;
100
101 explicit TextDocument(rerun::components::Text _text) : text(std::move(_text)) {}
102
103 /// The Media Type of the text.
104 ///
105 /// For instance:
106 /// * `text/plain`
107 /// * `text/markdown`
108 ///
109 /// If omitted, `text/plain` is assumed.
111 media_type = std::move(_media_type);
112 // See: https://github.com/rerun-io/rerun/issues/4027
113 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
114 }
115 };
116
117} // namespace rerun::archetypes
118
119namespace rerun {
120 /// \private
121 template <typename T>
122 struct AsComponents;
123
124 /// \private
125 template <>
126 struct AsComponents<archetypes::TextDocument> {
127 /// Serialize all set component batches.
128 static Result<std::vector<ComponentBatch>> serialize(
129 const archetypes::TextDocument& archetype
130 );
131 };
132} // namespace rerun
All built-in archetypes. See Types in the Rerun manual.
Definition rerun.hpp:77
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:23
Archetype: A text element intended to be displayed in its own text box.
Definition text_document.hpp:77
rerun::components::Text text
Contents of the text document.
Definition text_document.hpp:79
TextDocument with_media_type(rerun::components::MediaType _media_type) &&
The Media Type of the text.
Definition text_document.hpp:110
std::optional< rerun::components::MediaType > media_type
The Media Type of the text.
Definition text_document.hpp:88
Indicator component used by archetypes when converting them to component lists.
Definition indicator_component.hpp:32
Component: A standardized media type (RFC2046, formerly known as MIME types), encoded as a string.
Definition media_type.hpp:21
Component: A string of text, e.g. for labels and text documents.
Definition text.hpp:17