ALox  V. 2402 R. 0
Home ALox for C++ ALox for C# ALox for Java Download
Public Methods | Protected Types | Protected Fields | Protected Methods | List of all members
FormatterJavaStyle Class Reference
Inheritance diagram for FormatterJavaStyle:
[legend]
Collaboration diagram for FormatterJavaStyle:
[legend]

Class Description


Implements a Formatter according to the formatting standards of the Java language.

Note
Inherited, public fields of parent class FormatterStdImpl provide important possibilities for changing the formatting behavior of instances of this class. Therefore, do not forget to consult the parent classes documentation.

In general, the original specification is covered quite well. The differences and specialties are:

Public Methods

 FormatterJavaStyle ()
 
- Public Methods inherited from FormatterStdImpl
 FormatterStdImpl (String formatterClassName)
 
virtual void CloneSettings (FormatterStdImpl reference)
 
- Public Methods inherited from Formatter
virtual void Format (AString target, List< Object > args)
 
virtual void Format (AString target, params Object[] args)
 
virtual void Reset ()
 

Protected Types

enum  ppStates {
  POSITION = 1, FLAGS = 2, WIDTH = 3, PRECISION = 4,
  TYPE = 5, TYPE_SUFFIX = 6, END = 10
}
 
- Protected Types inherited from FormatterStdImpl
enum  PHType {
  NotGiven, String, Character, IntBase10,
  IntBinary, IntOctal, IntHex, Float,
  Bool, HashCode, Fill
}
 

Protected Fields

bool phaAlternateForm
 
bool phaExtConversionUpper
 
char phaExtDateTime
 
int phaExtDefaultPrecision
 
int phaExtPrecision
 
- Protected Fields inherited from FormatterStdImpl
int argOffset
 
int argsConsumed
 
List< Object > arguments
 
AString fieldBuffer = new AString()
 
Substring formatString = new Substring()
 
String formatterName
 
int nextAutoIdx
 
Substring parser = new Substring()
 
Alignment phaAlignment
 
bool phaAlignmentSpecified
 
Object phaArgument
 
int phaArgumentIdx
 
int phaCutContent
 
char phaFillChar
 
Substring phaFormatSpec = new Substring()
 
bool phaIsPercentage
 
NumberFormat phaNF = new NumberFormat()
 
int phaPreviousArgumentIdx
 
bool phaSignPaddingMode
 
PHType phaType
 
char phaTypeCode
 
int phaWidth
 
bool phaWriteBinOctHexPrefix
 
AString targetString
 
int targetStringStartLength
 
- Protected Fields inherited from Formatter
List< Object > boxes
 
Substring lamFormatString = new Substring()
 

Protected Methods

override bool checkStdFieldAgainstArgument ()
 
override int findPlaceholder ()
 
override bool parsePlaceholder ()
 
override bool parseStdFormatSpec ()
 
override bool preAndPostProcess (int startIdx, AString target)
 
override void replaceEscapeSequences (int startIdx)
 
override void resetPHAs ()
 
- Protected Methods inherited from FormatterStdImpl
virtual void errorFormatString (String msg)
 
override int format (AString targetString, Substring formatString, List< Object > arguments, int argOffset)
 
virtual bool setArgument (int pos, bool countStartsWith_1)
 
virtual bool writeCustomFormat ()
 
virtual void writeStdArgument ()
 
- Protected Methods inherited from Formatter
virtual void initializeFormat ()
 

Additional Inherited Members

- Public Fields inherited from FormatterStdImpl
NumberFormat AlternativeNumberFormat = new NumberFormat()
 
DateTimeFormatInfo DateTimeFormatProvider = DateTimeFormatInfo.InvariantInfo
 
NumberFormat DefaultNumberFormat = new NumberFormat()
 
bool WriteALibErrorReports = true
 
bool WriteErrorsToTargetString = true
 
- Public Fields inherited from Formatter
Formatter Next
 
- Public Static Methods inherited from Formatter
static Formatter AcquireDefault ()
 
static void ReleaseDefault ()
 
- Protected Static Fields inherited from Formatter
static Formatter defaultFormatter
 
static ThreadLock defaultFormatterLock = new ThreadLock()
 

Member Enumeration Documentation

◆ ppStates

enum ppStates
strongprotected

States used in parsePlaceholder.

Constructor & Destructor Documentation

◆ FormatterJavaStyle()

FormatterJavaStyle ( )
inline

Constructs this formatter. Inherited field DefaultNumberFormat is initialized to meet the formatting defaults of Java.

Member Function Documentation

◆ checkStdFieldAgainstArgument()

override bool checkStdFieldAgainstArgument ( )
inlineprotectedvirtual

Makes some attribute adjustments and invokes standard implementation

Returns
true if OK, false if replacement should be aborted.

Reimplemented from FormatterStdImpl.

◆ findPlaceholder()

override int findPlaceholder ( )
inlineprotectedvirtual

Searches for '%' which is not '%' or 'n'.

Returns
The index found, -1 if not found.

Implements FormatterStdImpl.

◆ parsePlaceholder()

override bool parsePlaceholder ( )
inlineprotectedvirtual

Parses placeholder field in Java syntax. The portion format_spec is not set as this is not supported by the syntax.

Returns
true on success, false on errors.

Implements FormatterStdImpl.

◆ parseStdFormatSpec()

override bool parseStdFormatSpec ( )
inlineprotectedvirtual

Does nothing. Java does not support custom format specifications.

Returns
true to indicate success.

Implements FormatterStdImpl.

◆ preAndPostProcess()

override bool preAndPostProcess ( int  startIdx,
AString  target 
)
inlineprotectedvirtual

All that this formatter does with this overridden method is to convert strings to upper case.

Parameters
startIdxThe int of the start of the field written in targetString. -1 indicates pre-phase.
targetThe target string, only if different from field targetString, which indicates intermediate phase.
Returns
false, if the placeholder should be skipped (nothing is written for it). true otherwise.

Reimplemented from FormatterStdImpl.

◆ replaceEscapeSequences()

override void replaceEscapeSequences ( int  startIdx)
inlineprotectedvirtual

Replaces "%%" with '%' and "%n" with ascii 0x0a. In addition applies AString.Escape on target which replaces standard codes like "\\n", "\\r" or "\\t" with corresponding ascii codes. (The latter is an extension to the standard behavior of Java formatter.)

Parameters
startIdxThe start of the region to replace

Implements FormatterStdImpl.

◆ resetPHAs()

override void resetPHAs ( )
inlineprotectedvirtual

Invokes parent implementation and then applies some changes to reflect what is defined as default in the Java string format specification.

Reimplemented from FormatterStdImpl.

Member Data Documentation

◆ phaAlternateForm

bool phaAlternateForm
protected

Alternate form given ('#').

◆ phaExtConversionUpper

bool phaExtConversionUpper
protected

Convert to upper case.

◆ phaExtDateTime

char phaExtDateTime
protected

The character after conversion type 't'/'T'.

◆ phaExtDefaultPrecision

int phaExtDefaultPrecision
protected

The default precision if not given. This is set to 6 in resetPHAs, but is changed when specific.

◆ phaExtPrecision

int phaExtPrecision
protected

The value read from the precision field. This is set to -1 in resetPHAs.


The documentation for this class was generated from the following file: