| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/decor.R |
| 3 |
\name{cpp_decorations} |
| 4 |
\alias{cpp_decorations} |
| 5 |
\title{Decorations in a `C++` file} |
| 6 |
\usage{ |
| 7 |
cpp_decorations(pkg = ".", files = cpp_files(pkg = pkg), is_attribute = FALSE) |
| 8 |
} |
| 9 |
\arguments{ |
| 10 |
\item{pkg}{The path to a package's root directory.} |
| 11 |
|
| 12 |
\item{files}{Paths to `C++` files. If given, `pkg` will not be used.} |
| 13 |
|
| 14 |
\item{is_attribute}{If `TRUE` the decorations are C++11 attributes, if `FALSE` they are comments.} |
| 15 |
} |
| 16 |
\value{ |
| 17 |
A tibble with the decorations found, containing fields: |
| 18 |
- file - The filename for the decoration |
| 19 |
- line - The line the decoration was found |
| 20 |
- decoration - The name of the decoration |
| 21 |
- params - Any parameters given with the decoration |
| 22 |
- context - The text of the decoration line and all lines until the next decoration (or the end of the file). |
| 23 |
} |
| 24 |
\description{ |
| 25 |
Decorations in a `C++` file |
| 26 |
} |
| 27 |
\examples{ |
| 28 |
# Setup |
| 29 |
f <- tempfile() |
| 30 |
writeLines("[[cpp11::register]] int fun(int x = 1) { return x + 1; }", f) |
| 31 |
|
| 32 |
# Retrieve the decorations in the file |
| 33 |
cpp_decorations(files = f, is_attribute = TRUE) |
| 34 |
|
| 35 |
# Cleanup |
| 36 |
unlink(f) |
| 37 |
} |