Overview   Project   Class   Tree   Deprecated   Index 
SourceFlow 1.0.beta API Documentation
FRAMES    NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD

Org.SourceFlow
Class CodeStyle

System.Object
   |
   +--CodeStyle

   in CodeStyle.cs

public class CodeStyle
extends System.Object

The base class for all code styles. The code style classes allows configuring some aspects of the source code generated. The code style classes also contain helper methods for the code generators. To create new code styles, this class should be subclassed.


Field Summary
 static readonly CodeStyle C
          The default C code style.
 static readonly CodeStyle CSHARP
          The default C# code style.
 static readonly CodeStyle JAVA
          The default Java code style.
 virtual int Margin
          Returns the right print margin.
 static readonly CodeStyle VISUAL_BASIC
          The default Visual Basic code style.
 
Constructor Summary
CodeStyle( int margin, string indent )
          Creates a new code style.
 
Method Summary
 virtual string AddStringEscapes( string str, char escape )
          Adds escapes in front of all " characters in a string. Any occurence of the escape character itself will also be escaped.
 virtual string GetIndent( int level )
          Returns the indentation string for the specified level.
 virtual string GetLowerCase( string str )
          Returns the lower-case version of a string.
 virtual string GetMixedCase( string str, bool initialUpper )
          Returns the mixed-case version of a string.
 virtual string GetStringConstant( string str, char escape )
          Creates a string constant from the specified string.
 virtual string GetUpperCase( string str )
          Returns the upper-case version of a string.
 virtual ArrayList LineBreak( string str, int margin )
          Returns a list with all the lines in a string.
 

Field Detail

C

public static readonly CodeStyle C;
The default C code style.

CSHARP

public static readonly CodeStyle CSHARP;
The default C# code style.

JAVA

public static readonly CodeStyle JAVA;
The default Java code style.

Margin

public virtual int Margin;
Returns the right print margin.
Returns:
the print margin

VISUAL_BASIC

public static readonly CodeStyle VISUAL_BASIC;
The default Visual Basic code style.


Constructor Detail

CodeStyle

public CodeStyle( int margin, string indent );
Creates a new code style.
Parameters:
margin - the print margin
indent - the indentation string


Method Detail

AddStringEscapes

public virtual string AddStringEscapes( string str, char escape );
Adds escapes in front of all " characters in a string. Any occurence of the escape character itself will also be escaped.
Parameters:
str - the string to convert
escape - the escape character to use
Returns:
the converted string

GetIndent

public virtual string GetIndent( int level );
Returns the indentation string for the specified level.
Parameters:
level - the indentation level
Returns:
a string containing the indentation

GetLowerCase

public virtual string GetLowerCase( string str );
Returns the lower-case version of a string. This method also handles transitions from a lower-case letter to an upper-case letter (inside the string) by appending a '_'. This will maintain the word stem separation, also in the lower-case string. Any characters outside the [A-Za-z0-9_] range will be removed from the string.
Parameters:
str - the string to transform
Returns:
the all lower-case version of the string

GetMixedCase

public virtual string GetMixedCase( string str, bool initialUpper );
Returns the mixed-case version of a string. This method also handles '_' characters by adding a transition from a lower-case letter to an upper-case letter (in the result string). This will maintain the word stem separation, in mixed-case. Any characters outside the [A-Za-z0-9] range will be removed from the string.
Parameters:
str - the string to transform
initialUpper - the first character upper-case flag
Returns:
the mixed-case version of the string

GetStringConstant

public virtual string GetStringConstant( string str, char escape );
Creates a string constant from the specified string. This will add " characters to start and the end, and all " character inside the string will be escaped. Also, any occurence of the escape character itself will be doubled (i.e. "\" becomes "\\").
Parameters:
str - the string to convert
escape - the escape character to use
Returns:
a string constant

GetUpperCase

public virtual string GetUpperCase( string str );
Returns the upper-case version of a string. This method also handles transitions from a lower-case letter to an upper-case letter (inside the string) by appending a '_'. This will maintain the word stem separation, also in the upper-case string. Any characters outside the [A-Za-z0-9_] range will be removed from the string.
Parameters:
str - the string to transform
Returns:
the all upper-case version of the string

LineBreak

public virtual ArrayList LineBreak( string str, int margin );
Returns a list with all the lines in a string. The string will be line breaked either upon newline characters or reaching the specified margin. Note that this method will NOT remove any characters, which means that the lines will probably end with a whitespace character (newline or space).
Parameters:
str - the string to line break
margin - the maximum line length
Returns:
the list of lines

 Overview   Project   Class   Tree   Deprecated   Index 
SourceFlow 1.0.beta API Documentation
FRAMES    NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD