pycodeanalyzer.core.languages.analyzers.cppanalyzer
Summary
Classes:
Analyzer for C/CPP code. |
|
Diagrams
CppAnalyzer
classDiagram class CppAnalyzer { <<Class>> + List~str~ objectPaths + Encoding encoding + List~str~ forceIgnoredSymbols + Configuration configuration + bool configured + List~str~ defines +Constructor(Configuration config) None +analyze(str rootDir, str path) List~AbstractObject~ +isHeader(str path) bool +handleHeader(str path, str encoding, str code, List~AbstractObject~ abstractObjects) None +handleClass(str path, Any klass, List~AbstractObject~ abstractObjects) None +addMethods(AbstractClass abstraction, Any klass, str visibility) None +addMembers(AbstractClass abstraction, Any klass, str visibility) None +addParents(AbstractClass abstraction, Any klass) None +handleEnum(str path, Any enum, List~AbstractObject~ abstractObjects) None +handleFunction(str path, Any function, List~AbstractObject~ abstractObjects) None +clearNamespace(str namespace) str +extractUnexpectedFromParseError(CppHeaderParser::CppParseError err) str +defineConfig() None +handleConfigation() None } class Analyzer { <<Class>> + Any logger +Constructor(str name) None +analyze(str rootDir, str path) List~AbstractObject~ } link Analyzer "class££pycodeanalyzer::core::languages::analyzer::Analyzer" class Configuration { <<Class>> + Any logger + Any config + Dict<str,List<Tuple<str,str>>> definition +Constructor() None +load(str path) bool +defineConfig(str section, str name, str comment) None +get(str section, str name) str +getInt(str section, str name) int +getFloat(str section, str name) float +getBool(str section, str name) bool +getList(str section, str name) List~Any~ +generateTemplate(str path) None } link Configuration "class££pycodeanalyzer::core::configuration::configuration::Configuration" class AbstractObject { <<Class>> + str name + str type + str origin + List~str~ usingNS + AbstractObjectLanguage objectLanguage + List~str~ linkedGenericTypes +Constructor(str name, str origin) None +addUsingNamespace(str namespace) None } link AbstractObject "class££pycodeanalyzer::core::abstraction::objects::AbstractObject" class AbstractClass { <<Class>> + str namespace + str type + List<Tuple<str,str,str>> members + List<Tuple<str,str,List<Tuple<str,str>>,str>> methodes + List<Tuple<str,str,str>> parents + List~str~ linkedGenericTypes + List~AbstractClassClassifier~ classifiers +Constructor(str name, str namespace, str origin) None +addGenericType(str genType) None +addMember(str type, str name, str visibility) None +hasMember(str name) bool +addMethod(str returnType, str name, List<Tuple<str,str>> parameters, str visibility) None +addParent(str completetype, str name, str visibility) None +addClassifier(AbstractClassClassifier classifier) None +getMainClassifier() str +getLinkedTypes() List~str~ -isPotentialClassName(str type) bool -getDependanceFromType(str type) List~str~ -splitTypes(Any decl) List~str~ +getFullName() str -cleanLanguageArtifacts(str type) str -removeNonObjectTypes(List~str~ typeList) List~str~ +isParent(AbstractClass klass) bool +print() None } link AbstractClass "class££pycodeanalyzer::core::abstraction::objects::AbstractClass" class CppParseError <<External>> CppParseError class Encoding { <<Class>> + Any magic +Constructor() None +getFileEncoding(str file) str } link Encoding "class££pycodeanalyzer::core::encoding::encodings::Encoding" CppAnalyzer --|> Analyzer CppAnalyzer ..> Configuration CppAnalyzer ..> AbstractObject CppAnalyzer ..> AbstractClass CppAnalyzer ..> CppParseError CppAnalyzer ..> EncodingCppAnalyzer class diagram
CustomCppHeader
classDiagram class CustomCppHeader { <<Class>> +is_enum_namestack(Any nameStack) bool +is_property_namestack(Any nameStack) bool +is_method_namestack(Any stack) bool } class CppHeader <<External>> CppHeader CustomCppHeader ..> CppHeaderCustomCppHeader class diagram
CustumCppPreprocessor
classDiagram class CustumCppPreprocessor { <<Class>> + Any passthru_includes + bool expand_linemacro + bool expand_filemacro + bool expand_countermacro + bool bypass_ifpassthru +Constructor() None +parseFile(str path) None +addDefine(str d) None +getResult() str +on_include_not_found(Any is_malformed, Any is_system_include, Any curdir, Any includepath) None +on_comment(Any tok) Any +on_directive_handle(Any directive, Any toks, Any ifpassthru, Any precedingtoks) Any +on_unknown_macro_in_defined_expr(Any tok) bool } class Preprocessor <<External>> Preprocessor CustumCppPreprocessor --|> PreprocessorCustumCppPreprocessor class diagram
Reference
- class pycodeanalyzer.core.languages.analyzers.cppanalyzer.CustumCppPreprocessor[source]
Bases:
pcpp.preprocessor.Preprocessor- on_include_not_found(is_malformed: Any, is_system_include: Any, curdir: Any, includepath: Any) None[source]
Called when a #include wasn’t found.
Raise OutputDirective to pass through or remove, else return a suitable path. Remember that Preprocessor.add_path() lets you add search paths.
The default calls
self.on_error()with a suitable error message about the include file not found ifis_malformedis False, else a suitable error message about a malformed #include, and in both cases raises OutputDirective (pass through).
- on_comment(tok: Any) Any[source]
Called when the preprocessor encounters a comment token. You can modify the token in place. You must return True to let the comment pass through, else it will be removed.
Returning False or None modifies the token to become whitespace, becoming a single space if the comment is a block comment, else a single new line if the comment is a line comment.
- on_directive_handle(directive: Any, toks: Any, ifpassthru: Any, precedingtoks: Any) Any[source]
Called when there is one of
define, include, undef, ifdef, ifndef, if, elif, else, endif
Return True to execute and remove from the output, raise OutputDirective to pass through or remove without execution, or return None to execute AND pass through to the output (this only works for #define, #undef).
The default returns True (execute and remove from the output).
directive is the directive, toks is the tokens after the directive, ifpassthru is whether we are in passthru mode, precedingtoks is the tokens preceding the directive from the # token until the directive.
- on_unknown_macro_in_defined_expr(tok: Any) bool[source]
Called when an expression passed to an #if contained a defined operator performed on something unknown.
Return True if to treat it as defined, False if to treat it as undefined, raise OutputDirective to pass through without execution, or return None to pass through the mostly expanded #if expression apart from the unknown defined.
The default returns False, as per the C standard.
- class pycodeanalyzer.core.languages.analyzers.cppanalyzer.CustomCppHeader(headerFileName, argType='file', encoding=None, **kwargs)[source]
- class pycodeanalyzer.core.languages.analyzers.cppanalyzer.CppAnalyzer(config: pycodeanalyzer.core.configuration.configuration.Configuration)[source]
Bases:
pycodeanalyzer.core.languages.analyzer.AnalyzerAnalyzer for C/CPP code.
Handle C/CPP code using PCPP preprocessor and CppHeaderParser.
- analyze(rootDir: str, path: str) List[pycodeanalyzer.core.abstraction.objects.AbstractObject][source]
- handleHeader(path: str, encoding: str, code: str, abstractObjects: List[pycodeanalyzer.core.abstraction.objects.AbstractObject]) None[source]
- handleClass(path: str, klass: Any, abstractObjects: List[pycodeanalyzer.core.abstraction.objects.AbstractObject]) None[source]
- addMethods(abstraction: pycodeanalyzer.core.abstraction.objects.AbstractClass, klass: Any, visibility: str) None[source]
- addMembers(abstraction: pycodeanalyzer.core.abstraction.objects.AbstractClass, klass: Any, visibility: str) None[source]
- addParents(abstraction: pycodeanalyzer.core.abstraction.objects.AbstractClass, klass: Any) None[source]
- handleEnum(path: str, enum: Any, abstractObjects: List[pycodeanalyzer.core.abstraction.objects.AbstractObject]) None[source]
- handleFunction(path: str, function: Any, abstractObjects: List[pycodeanalyzer.core.abstraction.objects.AbstractObject]) None[source]
- extractUnexpectedFromParseError(err: CppHeaderParser.CppHeaderParser.CppParseError) Optional[str][source]
This file was automatically generated using better_apidoc.