parse_cpp_function: Parse a C++ function

Description Usage Arguments Value Examples

View source: R/decor.R

Description

Parses a C++ function returning a tibble with the function name and return type and a list column with the arguments of the function.

Usage

1
parse_cpp_function(context, is_attribute = FALSE)

Arguments

context

The function context, as obtained by the 'context' column from [cpp_decorations()]

is_attribute

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

Value

A tibble with the following fields: - name - The name of the function - return_type - The return type of the function - args - A list column containing a tibble of the functions arguments - type - The type of the argument - name - The name of the argument - default - The default value of the argument (if any).

Examples

1
2
3
4
5
# Setup
context <- "int fun(int x) { return x + 1; }"

# Parse the function
parse_cpp_function(context)

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