cpp_decorations: Decorations in a C++ file

Description Usage Arguments Value Examples

View source: R/decor.R

Description

Decorations in a C++ file

Usage

1
cpp_decorations(pkg = ".", files = cpp_files(pkg = pkg), is_attribute = FALSE)

Arguments

pkg

The path to a package's root directory.

files

Paths to C++ files. If given, 'pkg' will not be used.

is_attribute

If 'TRUE' the decorations are C++11 attributes, if 'FALSE' they are comments.

Value

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).

Examples

1
2
3
4
5
6
7
8
9
# 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)

# Cleanup
unlink(f)

romainfrancois/decor documentation built on Dec. 14, 2021, 6:36 a.m.