PIP 5.6.1
Platform-Independent Primitives
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
PICodeParser Class Reference

Parser of C/C++ declarations used by the code model tools. More...

#include <picodeparser.h>

Classes

struct  Entity
 Parsed class, struct or namespace. More...
 
struct  Enum
 Parsed enumeration. More...
 
struct  EnumeratorInfo
 Parsed enumerator entry. More...
 
struct  Macro
 Parsed function-like macro. More...
 
struct  Member
 Parsed member declaration or function signature. More...
 

Public Types

enum  Visibility { Global , Public , Protected , Private }
 Visibility of a parsed declaration inside the current scope. More...
 
enum  Attribute
 Parsed declaration attributes.
 
typedef PIFlags< AttributeAttributes
 Bitmask of parsed declaration attributes.
 
typedef PIPair< PIString, PIStringDefine
 Preprocessor define name and value.
 
typedef PIPair< PIString, PIStringTypedef
 Typedef alias and target type.
 
typedef PIMap< PIString, PIStringMetaMap
 Parsed metadata map.
 

Public Member Functions

 PICodeParser ()
 Constructs a parser with built-in PIP macro presets.
 
void parseFile (const PIString &file, bool follow_includes=true)
 Parses one source file and optionally follows its includes.
 
void parseFiles (const PIStringList &files, bool follow_includes=true)
 Parses several source files into one parser state.
 
void parseFileContent (PIString fc)
 Parses source text provided directly in memory.
 
void includeDirectory (const PIString &dir)
 Adds a directory to the include search list.
 
void addDefine (const PIString &def_name, const PIString &def_value)
 Adds a custom preprocessor definition before parsing.
 
bool isEnum (const PIString &name)
 Returns whether an enum with name was parsed.
 
EntityfindEntityByName (const PIString &en)
 Finds a parsed entity by its full name.
 
PIStringList parsedFiles () const
 Returns the set of files already processed by the parser.
 
PIString mainFile () const
 Returns the file detected as the main translation unit.
 
const PICodeParser::Entityglobal () const
 Returns the synthetic global scope entity.
 
int macrosSubstitutionMaxIterations () const
 Returns the maximum number of macro substitution passes.
 
void setMacrosSubstitutionMaxIterations (int value)
 Sets the maximum number of macro substitution passes.
 

Public Attributes

PIVector< Definedefines
 Parsed define directives, including built-in and custom ones.
 
PIVector< Macromacros
 Parsed function-like macros.
 
PIVector< Enumenums
 Parsed enums from the processed files.
 
PIVector< Typedeftypedefs
 Parsed top-level typedef declarations.
 
PIVector< Entity * > entities
 Parsed entities discovered in the processed files.
 

Detailed Description

Parser of C/C++ declarations used by the code model tools.

Parser for analyzing C++ source files. Extracts information about classes, structures, enums, macros, functions, and members.

Member Enumeration Documentation

◆ Visibility

Visibility of a parsed declaration inside the current scope.

Enumerator
Global 

Global or namespace-level declaration.

Public 

Public class member.

Protected 

Protected class member.

Private 

Private class member.