File Information
Library: CppParser
Package: CppParser
Header: Poco/CppParser/Utility.h
Description
Various helpers for parsing and analyzing C++ header files.
Member Summary
Member Functions: buildFileList, detectPrefixAndIncludes, fixup, parse, parseDir, parseOnly, preprocessFile, removeFile
Nested Classes
class FwdDeclBlock
Constructors
Destructor
~Utility
~Utility();
Member Functions
detectPrefixAndIncludes
static void detectPrefixAndIncludes(
const std::string & origHFile,
std::vector < std::string > & lines,
std::string & prefix
);
This method is poco coding style specific! It looks for a $(PREFIX)_BEGIN and extracts from it a prefix, also include files and fwd declarations are extracted from the h file.
fixup
static void fixup(
NameSpace::SymbolTable & st
);
Fixes all base pointers in the symbol table
parse
static void parse(
const std::string & file,
NameSpace::SymbolTable & st,
const std::string & exec,
const std::string & options,
const std::string & path
);
Preprocesses and parses the file. The resulting symboltable has base class references already fixed,
parseDir
static void parseDir(
const std::vector < std::string > & includePattern,
const std::vector < std::string > & excludePattern,
NameSpace::SymbolTable & st,
const std::string & exec,
const std::string & options,
const std::string & path
);
Preprocesses and parses all files specified by the include pattern (e.g.: p:/poco/Foundation/include/*/*.h) minus the ones defined in the exclude pattern
removeFile
static void removeFile(
const std::string & preprocessedfile
);
Tries to remove the file. If it fails, the error is silently ignored.
buildFileList
static void buildFileList(
std::set < std::string > & files,
const std::vector < std::string > & includePattern,
const std::vector < std::string > & excludePattern
);
Searches all files that match the defined patterns and inserts them into files.
parseOnly
static void parseOnly(
const std::string & file,
NameSpace::SymbolTable & st,
const std::string & preprocessedFile,
bool removePreprocessedFile = true
);
Parses the file, throws an exception if anything goes wrong.
preprocessFile
static std::string preprocessFile(
const std::string & file,
const std::string & exec,
const std::string & options,
const std::string & path
);
Preprocess the include file with name file. Parameter exec must contain the name of the preprocessor binary (e.g.: "cl" for Visual Studio). Parameter options contains the flag for the preprocessor, and parameter path sets the environment PATH settings during preprocessing. Returns the name of the created file or throws an exception.