|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gnu.iou.format
Tool parses string with '%format%' replaceable tokens, inserts arguments. Syntax- compatible with cog template (as a subfeature of "cog/build"), but does not interface to cog template features from here.
A "format" directive can optionally index the "argv" with a "%format[idx]%" syntax, where "idx" is an index into "argv". In this case the running "argc" index into "argv" is not incremented.
A "format" directive can optionally apply processing commands to the target string with a "%format(cmd args)%" syntax, where "cmd" is interpreted by the "cmd" function, see "pad" and "col", below.
By default, each instance of a "%format%" directive uses and increments an internal index into the "argv". Each call to the "format" function gets a fresh internal "argv" index, "argc".
cmd(gnu.iou.linebuf, int, java.lang.String, java.lang.String, java.lang.String[][], int, int)
,
pad(gnu.iou.linebuf, int, java.lang.String, int, boolean)
,
col(gnu.iou.linebuf, int, java.lang.String, int, int)
,
#format(java.lang.String,java.lang.String[])
,
#format(java.lang.String,java.lang.String)
,
#format(java.lang.String[][],java.lang.String[])
,
#format(java.lang.String[][],java.lang.String[],java.lang.String)
Constructor Summary | |
format()
|
Method Summary | |
static void |
cmd(linebuf editbuf,
int lidx,
java.lang.String cmd,
java.lang.String target,
java.lang.String[][] srcary,
int srci,
int srcii)
Interprets format "(cmd args)" functions. |
static void |
col(linebuf editbuf,
int lidx,
java.lang.String s,
int col0,
int cwide)
Wrap string into column using return elements for lines and the ASCII SPACE character for offsetting. |
static java.lang.String |
format(java.lang.String[][] templ_srcary,
java.lang.String[] argv)
Replace instances of "%format%" with elements of "argv". |
static java.lang.String |
format(java.lang.String[][] srcary,
java.lang.String[] argv,
java.lang.String format_key)
User format key replaces the default "format" string. |
static java.lang.String |
format(java.lang.String templ_src,
java.lang.String arg)
Format with one argument, creates stringary for you. |
static java.lang.String |
format(java.lang.String templ_src,
java.lang.String[] argv)
General user interface parses src for "%format%" elements. |
static void |
main(java.lang.String[] argv)
Command line filter tool applies its arguments to the `format'ed input stream. |
static void |
pad(linebuf editbuf,
int lidx,
java.lang.String s,
int len,
boolean leftj)
Pad with space, or truncate to length. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public format()
Method Detail |
public static java.lang.String format(java.lang.String templ_src, java.lang.String[] argv) throws java.lang.IllegalArgumentException
templ_src
- Source to be parsed by 'utl/templ' for "%...%"
directives.argv
- Arguments to "%format%" directives (dynamic
replacement text).java.lang.IllegalArgumentException
- For "%format%" syntax
errors, or "argv" array indexing (bounds) errors.public static java.lang.String format(java.lang.String templ_src, java.lang.String arg) throws java.lang.IllegalArgumentException
public static java.lang.String format(java.lang.String[][] templ_srcary, java.lang.String[] argv) throws java.lang.IllegalArgumentException
srcary
- Source parsed by 'utl/templ' for "%...%"
directives.argv
- Arguments to "%format%" directives (dynamic
replacement text).java.lang.IllegalArgumentException
- For "%format%" syntax
errors, or "argv" array indexing (bounds) errors.public static java.lang.String format(java.lang.String[][] srcary, java.lang.String[] argv, java.lang.String format_key) throws java.lang.IllegalArgumentException
srcary
- Source parsed by 'utl/templ' for "%...%"
directives.argv
- Arguments to format directives (dynamic
replacement text).format_key
- Optional string to identify format operators. Default
"format".java.lang.IllegalArgumentException
- For format syntax
errors, or "argv" array indexing (bounds) errors.public static final void cmd(linebuf editbuf, int lidx, java.lang.String cmd, java.lang.String target, java.lang.String[][] srcary, int srci, int srcii)
editbuf
- Buffer to write intolidx
- Buffer line index for this operationcmd
- The "(cmd args)" stringtarget
- The argv element applied to this commandsrcary
- The full text used in error reportingsrci
- The full text primary index used in error reportingsrcii
- The full text secondary index used in error reportingpad(gnu.iou.linebuf, int, java.lang.String, int, boolean)
,
col(gnu.iou.linebuf, int, java.lang.String, int, int)
public static final void pad(linebuf editbuf, int lidx, java.lang.String s, int len, boolean leftj)
editbuf
- Buffer to write intolidx
- Buffer line index for this operations
- Stringlen
- Length of outputleftj
- Left or right justified.cmd(gnu.iou.linebuf, int, java.lang.String, java.lang.String, java.lang.String[][], int, int)
public static final void col(linebuf editbuf, int lidx, java.lang.String s, int col0, int cwide)
editbuf
- Buffer to write column intolidx
- Buffer first- line index.s
- String source to fit into columncol0
- Column specification for first column indexcwide
- Column specification for widthcmd(gnu.iou.linebuf, int, java.lang.String, java.lang.String, java.lang.String[][], int, int)
public static void main(java.lang.String[] argv)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |