Skip to content

Commit

Permalink
C++ extension for name component
Browse files Browse the repository at this point in the history
  • Loading branch information
Wumpf authored and teh-cmc committed Feb 6, 2024
1 parent 3c775ae commit d876540
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
10 changes: 10 additions & 0 deletions rerun_cpp/src/rerun/components/name.hpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions rerun_cpp/src/rerun/components/name_ext.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include "name.hpp"

// Uncomment for better auto-complete while editing the extension.
// #define EDIT_EXTENSION

namespace rerun {
namespace components {

#ifdef EDIT_EXTENSION
struct NameExt {
std::string value;
#define Name NameExt

// Don't provide a string_view constructor, std::string constructor exists and covers this.

// <CODEGEN_COPY_TO_HEADER>

/// Construct `Name` from a null-terminated UTF8 string.
Name(const char* str) : value(str) {}

const char* c_str() const {
return value.c_str();
}

// </CODEGEN_COPY_TO_HEADER>
};
#endif
} // namespace components
} // namespace rerun

0 comments on commit d876540

Please sign in to comment.