public class TestTokenElementContext extends java.lang.Object implements ITokenElementContext
Constructor and Description |
---|
TestTokenElementContext(Resource codeFile,
ELanguage language) |
TestTokenElementContext(java.lang.String uniformPath,
ELanguage language,
java.lang.String unfilteredCode,
java.util.List<java.util.regex.Pattern> filterPatterns) |
Modifier and Type | Method and Description |
---|---|
protected void |
accessAst()
Template method that is called before accessing the AST.
|
protected void |
accessTypeResolution()
Template method called before accessing type resolution.
|
java.util.List<ShallowEntity> |
getAbstractSyntaxTree(ECodeViewOption view)
Returns the abstract syntax tree of the analyzed token element as list of
shallow entities based on the given view.
|
ClangTranslationUnitWrapper |
getClangTranslationUnitWrapper()
Returns a
ClangTranslationUnitWrapper containing the initialized JNI
interface to Clang for the current file. |
protected int |
getFilteredOffset(int unfilteredCodeOffset)
Returns the offset in filtered code that represents the same character as the
given offset in the unfiltered Code.
|
ELanguage |
getLanguage()
Returns the language of the analyzed token element.
|
ShallowEntity |
getRootEntity(ECodeViewOption view)
Returns the synthetic root entity of the abstract syntax tree based on the
given view.
|
java.lang.String |
getTextContent(ECodeViewOption.ETextViewOption view)
Returns the text content in the given view.
|
java.util.List<IToken> |
getTokens(ECodeViewOption view)
Returns the tokens in the given view.
|
ITypeResolution |
getTypeResolution(ECodeViewOption view)
Returns a type resolution, which contains information about known variables
and their types.
|
java.lang.String |
getUniformPath()
Returns the uniform path of the analyzed token element.
|
protected boolean |
isInFilteredRegion(int unfilteredCodeOffset)
Returns whether the given offset in unfiltered code is in a filtered region.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
calculateLocalPreprocessedTokens
public TestTokenElementContext(Resource codeFile, ELanguage language)
public TestTokenElementContext(java.lang.String uniformPath, ELanguage language, java.lang.String unfilteredCode, java.util.List<java.util.regex.Pattern> filterPatterns)
public ELanguage getLanguage()
getLanguage
in interface ITokenElementContext
public java.lang.String getUniformPath()
getUniformPath
in interface ITokenElementContext
protected void accessAst()
protected void accessTypeResolution()
protected int getFilteredOffset(int unfilteredCodeOffset)
protected boolean isInFilteredRegion(int unfilteredCodeOffset)
public java.lang.String getTextContent(ECodeViewOption.ETextViewOption view)
ECodeViewOption.ETextViewOption.FILTERED_CONTENT
, as usually
no findings shall be generated for filtered code.getTextContent
in interface ITokenElementContext
public java.util.List<IToken> getTokens(ECodeViewOption view)
ECheckParameter.ABSTRACT_SYNTAX_TREE
parameter.getTokens
in interface ITokenElementContext
public ShallowEntity getRootEntity(ECodeViewOption view) throws CheckException
This method can be used, if the executing check requests the
ECheckParameter.ABSTRACT_SYNTAX_TREE
parameter.
getRootEntity
in interface ITokenElementContext
CheckException
public java.util.List<ShallowEntity> getAbstractSyntaxTree(ECodeViewOption view) throws CheckException
This method can be used, if the executing check requests the
ECheckParameter.ABSTRACT_SYNTAX_TREE
parameter.
getAbstractSyntaxTree
in interface ITokenElementContext
CheckException
public ITypeResolution getTypeResolution(ECodeViewOption view) throws CheckException
ECheckParameter.TYPE_RESOLUTION
parameter. Based on the given
ECodeViewOption
.getTypeResolution
in interface ITokenElementContext
CheckException
public ClangTranslationUnitWrapper getClangTranslationUnitWrapper()
ITokenElementContext
ClangTranslationUnitWrapper
containing the initialized JNI
interface to Clang for the current file. To access this, specify the
ECheckParameter.CLANG
option in the custom check.getClangTranslationUnitWrapper
in interface ITokenElementContext