Decorations in a `C++` file
cpp_decorations(pkg = ".", files = cpp_files(pkg = pkg), is_attribute = FALSE)
A tibble with the decorations found, containing fields: - file - The filename for the decoration - line - The line the decoration was found - decoration - The name of the decoration - params - Any parameters given with the decoration - context - The text of the decoration line and all lines until the next decoration (or the end of the file).
# Setup
f <- tempfile()
writeLines("[[cpp11::register]] int fun(int x = 1) { return x + 1; }", f)
# Retrieve the decorations in the file
cpp_decorations(files = f, is_attribute = TRUE)
#> # A tibble: 1 × 5
#> file line decoration params context
#> <chr> <int> <chr> <list> <list>
#> 1 /tmp/RtmpqIO2xw/file391bc58980811 1 cpp11::register <chr [1]> <chr [1]>
# Cleanup
unlink(f)