Package com.igormaznitsa.jcp.directives
Class AbstractDirectiveHandler
java.lang.Object
com.igormaznitsa.jcp.directives.AbstractDirectiveHandler
- Direct Known Subclasses:
AbortDirectiveHandler
,ActionDirectiveHandler
,BreakDirectiveHandler
,CommentNextLineDirectiveHandler
,ContinueDirectiveHandler
,DefineDirectiveHandler
,EchoDirectiveHandler
,ElseDirectiveHandler
,EndDirectiveHandler
,EndIfDirectiveHandler
,ErrorDirectiveHandler
,ExcludeIfDirectiveHandler
,ExitDirectiveHandler
,ExitIfDirectiveHandler
,FlushDirectiveHandler
,GlobalDirectiveHandler
,GlobalElseDirectiveHandler
,GlobalEndIfDirectiveHandler
,GlobalIfDirectiveHandler
,IfDefinedDirectiveHandler
,IfDirectiveHandler
,IncludeDirectiveHandler
,LocalDirectiveHandler
,MsgDirectiveHandler
,NoAutoFlushHandler
,OutDirDirectiveHandler
,OutDisabledDirectiveHandler
,OutEnabledDirectiveHandler
,OutNameDirectiveHandler
,PostfixDirectiveHandler
,PrefixDirectiveHandler
,WhileDirectiveHandler
The class is the abstract parent for all classes process preprocessor
directives
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The common preprocessor prefix for all directivesstatic final AbstractDirectiveHandler[]
The array contains all directives of the preprocessorstatic final AbstractDirectiveHandler[]
The array contains preprocessor directives active only during the global preprocessing phasestatic final String
The prefix for one line commentstatic final String
The prefix for lines to be kept by preprocessorstatic final String
The prefix for lines to be kept by preprocessor, which contain processed directives -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract AfterDirectiveProcessingBehaviour
execute
(String tailString, PreprocessorContext context) Execute directiveboolean
Shows that the directive can be executed only when the preprocessing n active state i.e.Get the argument type needed by the directiveGet the directive name with prefixabstract String
getName()
Get the name of the directive without prefixabstract String
Get the directive reference, it will be printed for a help requestboolean
Check that the directive is deprecated one and can be removed in a next releaseboolean
Shows that the directive can be executed during a global preprocessing phaseboolean
Shows that the directive can be executed during the second preprocessing phase
-
Field Details
-
DIRECTIVE_PREFIX
The common preprocessor prefix for all directives- See Also:
-
PREFIX_FOR_KEEPING_LINES
The prefix for lines to be kept by preprocessor- See Also:
-
PREFIX_FOR_KEEPING_LINES_PROCESSED_DIRECTIVES
The prefix for lines to be kept by preprocessor, which contain processed directives- See Also:
-
ONE_LINE_COMMENT
The prefix for one line comment- See Also:
-
DIRECTIVES
The array contains all directives of the preprocessor -
GLOBAL_DIRECTIVES
The array contains preprocessor directives active only during the global preprocessing phase
-
-
Constructor Details
-
AbstractDirectiveHandler
public AbstractDirectiveHandler()
-
-
Method Details
-
getName
Get the name of the directive without prefix- Returns:
- the directive name, must not be null
-
getReference
Get the directive reference, it will be printed for a help request- Returns:
- the directive reference as a String, must not be null
-
getFullName
Get the directive name with prefix- Returns:
- the full directive name (it including prefix)
-
getArgumentType
Get the argument type needed by the directive- Returns:
- the argument type needed by the directive, it can't be null
-
execute
public abstract AfterDirectiveProcessingBehaviour execute(String tailString, PreprocessorContext context) Execute directive- Parameters:
tailString
- the tail of the string where the directive has been met, must not be null but can be emptycontext
- the preprocessor context- Returns:
- the needed preprocessor behavior, must not be null
-
executeOnlyWhenExecutionAllowed
public boolean executeOnlyWhenExecutionAllowed()Shows that the directive can be executed only when the preprocessing n active state i.e. if it is in active block //#if..//#endif of //#while- Returns:
- true if the directive can be executed only if it is in active block, else the directive will be called in any case
-
isGlobalPhaseAllowed
public boolean isGlobalPhaseAllowed()Shows that the directive can be executed during a global preprocessing phase- Returns:
- true if the directive allows the global directive phase, false if the directive must be ignored during that phase
-
isPreprocessingPhaseAllowed
public boolean isPreprocessingPhaseAllowed()Shows that the directive can be executed during the second preprocessing phase- Returns:
- true uf the directive can be executed during the second preprocessing phase else false if the directive must be ignored
-
isDeprecated
public boolean isDeprecated()Check that the directive is deprecated one and can be removed in a next release- Returns:
- true if the directive is deprecated, false otherwise
-