org.pz.platypus.plugin.pdf.commands
Class DefUserString

java.lang.Object
  extended by org.pz.platypus.plugin.pdf.commands.DefUserString
All Implemented Interfaces:
IOutputCommand

public class DefUserString
extends java.lang.Object
implements IOutputCommand

handles processing of the definition of a user string (macro). Handled by the plug-in because the same value can be redefined numerous times by the Platypus file in context-dependent ways.

Author:
alb

Field Summary
private  ParamType parameterType
           
private  java.lang.String root
           
private  boolean validInCode
           
 
Constructor Summary
DefUserString()
           
 
Method Summary
 void convertToTextToken(Source source, TokenList tl)
          In the event of an error, the command is converted into a series of text tokens (after the error message is shown).
(package private)  java.lang.String extractMacroName(java.lang.String text)
          Extracts the macro name from the beginning of a string
(package private)  java.lang.String extractMacroValue(java.lang.String text, java.lang.String macroName)
          Extracts the substitute value from the macro definition
 ParamType getParamType()
           
 java.lang.String getRoot()
          get the root of the command.
 java.lang.String getRootSubstitute()
           
 TokenType getTokenType()
           
 boolean isAllowedInCode()
           
 void issueErrorMessage(GDD gdd, Source source, java.lang.String macro)
           
 int process(IOutputContext context, Token tok, int tokNum)
          method for processing this command in the output plugin.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

root

private java.lang.String root

parameterType

private ParamType parameterType

validInCode

private boolean validInCode
Constructor Detail

DefUserString

public DefUserString()
Method Detail

process

public int process(IOutputContext context,
                   Token tok,
                   int tokNum)
Description copied from interface: IOutputCommand
method for processing this command in the output plugin.

Specified by:
process in interface IOutputCommand
Parameters:
context - the context/state of the output document
tok - the command token as found in the token stream
tokNum - the number of the token in the token list

extractMacroName

java.lang.String extractMacroName(java.lang.String text)
Extracts the macro name from the beginning of a string

Parameters:
text - the string to extract the macro name from
Returns:
the macro name or an empty string if an error occurs

extractMacroValue

java.lang.String extractMacroValue(java.lang.String text,
                                   java.lang.String macroName)
Extracts the substitute value from the macro definition

Parameters:
text - the macro definition
macroName - the macro name
Returns:
the substitute string value, or the empty string in case of error.

issueErrorMessage

public void issueErrorMessage(GDD gdd,
                              Source source,
                              java.lang.String macro)

convertToTextToken

public void convertToTextToken(Source source,
                               TokenList tl)
In the event of an error, the command is converted into a series of text tokens (after the error message is shown). This is done by taking the root and making it a text token. Sub- sequent parsing by the parser will then view the remaining part of the command string as text.

Parameters:
source - the current file # and line #
tl - the token list to add the text token to

isAllowedInCode

public boolean isAllowedInCode()

getParamType

public ParamType getParamType()

getRoot

public java.lang.String getRoot()
Description copied from interface: IOutputCommand
get the root of the command. For example, fsize: in [fsize:12pt]

Specified by:
getRoot in interface IOutputCommand
Returns:
the root as a string

getRootSubstitute

public java.lang.String getRootSubstitute()

getTokenType

public TokenType getTokenType()


Copyright © 2008-10 Pacific Data Works LLC