pmp.macro
Class MacroTable

java.lang.Object
  extended by pmp.AbstractMacro
      extended by pmp.macro.MacroTable

public class MacroTable
extends AbstractMacro

Allows manipulation with list of macros. This macro modifies MacroList component of Macroprocessor.

This macro exports or imports macro list according to specified action.

Title: PMP: Macroprocessor

Description: Java macroprocessor

Copyright: Copyright (c) 2005

Version:
1.0
Author:
Luděk Hlaváček

Field Summary
static java.lang.String ACTION_EXPORT
          Exports current list of macros into file given in the second argument.
static java.lang.String ACTION_IMPORT
          Imports macros from given configuration file.
static java.lang.String ACTION_REPLACE
          Replaces macro list with given list.
static java.lang.String DEFAULT_CONFIG
          If given in second parameter, this macro will load default configuration instead of reading external file.
static int PARAMS_REQUIRED
           
 
Constructor Summary
MacroTable()
           
 
Method Summary
 java.lang.String run(Macroprocessor mp, java.lang.String[] args)
          Main method of macro.
 
Methods inherited from class pmp.AbstractMacro
getRequiredParams, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PARAMS_REQUIRED

public static final int PARAMS_REQUIRED
See Also:
Constant Field Values

ACTION_EXPORT

public static final java.lang.String ACTION_EXPORT
Exports current list of macros into file given in the second argument.

See Also:
Constant Field Values

ACTION_IMPORT

public static final java.lang.String ACTION_IMPORT
Imports macros from given configuration file.

Previously undefined macros are added, existing macros are replaced and others are kept unchanged.

Read-only macros are kept unchanged as well.

See Also:
Constant Field Values

DEFAULT_CONFIG

public static final java.lang.String DEFAULT_CONFIG
If given in second parameter, this macro will load default configuration instead of reading external file. Can be used with ACTION_IMPORT and ACTION_REPLACE.

See Also:
Constant Field Values

ACTION_REPLACE

public static final java.lang.String ACTION_REPLACE
Replaces macro list with given list.

All but read-only macros are deleted prior importing new definitions.

See Also:
Constant Field Values
Constructor Detail

MacroTable

public MacroTable()
Method Detail

run

public java.lang.String run(Macroprocessor mp,
                            java.lang.String[] args)
Description copied from class: AbstractMacro
Main method of macro. This method is called when this macro is invoked. All subclasses must imlement this method

Specified by:
run in class AbstractMacro
Parameters:
mp - reference to Macroprocessor
args - parameters of macro. In args[0] is stored name of macro. Subclasses are free to modify this array.
Returns:
result of the macro as String