|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--eapms.ANSIFormat | +--eapms.ColorFormatter
Class to format text in pretty colors
Nested Class Summary |
Nested classes inherited from class eapms.ANSIFormat |
ANSIFormat.Attrs, ANSIFormat.BGColors, ANSIFormat.FGColors |
Field Summary |
Fields inherited from class eapms.ANSIFormat |
CHAR_CLASS, DEFAULT_FLAGS, DEFAULT_INDEX, DEFAULT_REGEX, mFlags, mFlagsSet, mPattern, mRegex, mRepndx, PLACEHOLDER, UNICODE_ESCAPE |
Constructor Summary | |
ColorFormatter()
|
Method Summary | |
void |
compilePattern(java.lang.String regex,
int repndx,
int flags)
Compiles the regex supplied with the supplied flags. |
java.lang.String |
stringReplace(java.lang.String str)
There is a special format for the strings passed to this method: they use single character codes captured in the repndx th
capturing group. |
Methods inherited from class eapms.ANSIFormat |
compilePattern, compilePattern, compilePattern, getFlags, getPattern, getRegex |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ColorFormatter()
Method Detail |
public void compilePattern(java.lang.String regex, int repndx, int flags) throws java.lang.IllegalArgumentException, java.util.regex.PatternSyntaxException
ANSIFormat
regex
must be in a certain form.
As there is a specific character class
that must be
used in the matching, a placeholder
is used in the
regex string. You must therefore pass a regex
string with
this placeholder, such as
\<("+ANSIFormat.PLACEHOLDER+"*?)\>([^<]*)
"%%%"
, so the above would be:\<(%%%*?)\>([^<]*)"
character class
to become
\<([brnglmcw~+-_*;?!]*?)\>([^<]*)"
repndx
integer as the second
argument - this value tells the
stringReplace
method which
capturing group to look in to find where the actual color codes are held
(otherwise it won't know which part is color codes and which is text).
compilePattern
in class ANSIFormat
java.util.regex.PatternSyntaxException
- Wrong syntax, retard.
java.lang.IllegalArgumentException
- The repndx value must be greater
than zero - can also be thrown from something in the regex class, but I
don't know why...go look it up, idiot.public java.lang.String stringReplace(java.lang.String str)
repndx
th
capturing group. Here are the codes:Click here for
detailed usage information
Click here for current tag usage info.
stringReplace
in class ANSIFormat
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |