getDataStructures: Get the top-level data types in a translation unit

View source: R/structDef.R

getDataStructuresR Documentation

Get the top-level data types in a translation unit

Description

This function retrieves descriptions of the data structures defined in a source file or translation unit. This includes unions, structs and typedefs.

Usage

getDataStructures(src, fileFilter = character(), collector = genDataStructCollector(), ...)
getStructDef(type, kids = children(tp), class = "StructDefinition")
getTypedefs(src, fileFilter = character(), col = genTypedefCollector(),  ...)

Arguments

src

the already created CXTranslationUnit object, or the name of the source file

collector, col

a visitor function or visitor object of class S4CursorVisitor-class or RefCursorVisitor-class.

fileFilter

a character vector. This is used to identify the files/directories of interest and to identify the cursors we want in the results. This can be a single string that is a regular expression. Alternatively, it can be a vector of directory or file names. For a vector of values, we check which correspond to actual file or directory names. For these, we filter the cursors based on whether they are in the specified file names, within files in the specified directories. For elements that are not files or directories, we use these as regular expressions. This mechanism allows us to include cursors by explicit file name, explicit directory, or by regular expression.

...

any additional arguments passed to createTU if src is not already a CXTranslationUnit.

type

the CXCursor defining a data type

kids

the collection of cursors defining the elements of the data type

class

the name of the class for the object we are creating. Either "StructDefinition" or "UnionDefinition" or a the name of a subclass.

Author(s)

Duncan Temple Lang

References

libclang http://clang.llvm.org/doxygen/group__CINDEX.html

See Also

getRoutines, getGlobalVariables, getCppClasses, getEnums, getInclusions

Examples

f = system.file("exampleCode", "funPointer.c", package = "RCIndex")
ds = getDataStructures(f)
names(ds)
sapply(ds, class)
ds$Bob

ff = ds$`_Foo`@fields
names(ff)
sapply(ff, getName)

omegahat/RClangSimple documentation built on April 25, 2024, 4:18 a.m.