C# Class Azavea.NijPredictivePolicing.Common.Data.FixedWidthField

Represents a column, and contains data about where that column is located in a row and what type of data it contains. This class contains some error checking, but it can be used in some very weird ways (for example, it doesn't care if columns overlap with each other). In general, it's your responsibility to use it sensibly.
Afficher le fichier Open project: azavea/acs-alchemist Class Usage Examples

Méthodes publiques

Свойство Type Description
ColumnName string
DefaultValue object
Description string
End int
Seeker FixedWidthPositions
Start int
Strict bool
Terminator FixedWidthTerminators
Type FixedWidthTypes

Méthodes publiques

Méthode Description
FixedWidthField ( ) : System
FixedWidthField ( FixedWidthField old ) : System
FixedWidthField ( int start, int end, FixedWidthTypes type, FixedWidthPositions seeker, FixedWidthTerminators terminator ) : System
FixedWidthField ( int start, int end, FixedWidthTypes type, FixedWidthPositions seeker, FixedWidthTerminators terminator, object defaultValue, bool strict ) : System
FixedWidthField ( string columnName, string description, int length, int start ) : System
FixedWidthField ( string columnName, string description, int length, int start, FixedWidthTypes type ) : System
FixedWidthField ( string columnName, string description, int length, int start, FixedWidthTypes type, FixedWidthTerminators term ) : System
GetFieldData ( string row, int &currentPos ) : string

Gets the raw data for this field from a row and updates the current position. Does not do any parsing. Throws errors if Strict is false.

GetFieldObject ( string row, int &currentPos ) : object

Gets the parsed object for this field from a row and updates the current position, as determined by Type.

Private Methods

Méthode Description
GetFieldRange ( string row, int currentPos, int &start, int &end ) : void

Method Details

FixedWidthField() public méthode

public FixedWidthField ( ) : System
Résultat System

FixedWidthField() public méthode

public FixedWidthField ( FixedWidthField old ) : System
old FixedWidthField
Résultat System

FixedWidthField() public méthode

public FixedWidthField ( int start, int end, FixedWidthTypes type, FixedWidthPositions seeker, FixedWidthTerminators terminator ) : System
start int
end int
type FixedWidthTypes
seeker FixedWidthPositions
terminator FixedWidthTerminators
Résultat System

FixedWidthField() public méthode

public FixedWidthField ( int start, int end, FixedWidthTypes type, FixedWidthPositions seeker, FixedWidthTerminators terminator, object defaultValue, bool strict ) : System
start int
end int
type FixedWidthTypes
seeker FixedWidthPositions
terminator FixedWidthTerminators
defaultValue object
strict bool
Résultat System

FixedWidthField() public méthode

public FixedWidthField ( string columnName, string description, int length, int start ) : System
columnName string
description string
length int
start int
Résultat System

FixedWidthField() public méthode

public FixedWidthField ( string columnName, string description, int length, int start, FixedWidthTypes type ) : System
columnName string
description string
length int
start int
type FixedWidthTypes
Résultat System

FixedWidthField() public méthode

public FixedWidthField ( string columnName, string description, int length, int start, FixedWidthTypes type, FixedWidthTerminators term ) : System
columnName string
description string
length int
start int
type FixedWidthTypes
term FixedWidthTerminators
Résultat System

GetFieldData() public méthode

Gets the raw data for this field from a row and updates the current position. Does not do any parsing. Throws errors if Strict is false.
public GetFieldData ( string row, int &currentPos ) : string
row string The row to read from
currentPos int The current position in the row
Résultat string

GetFieldObject() public méthode

Gets the parsed object for this field from a row and updates the current position, as determined by Type.
public GetFieldObject ( string row, int &currentPos ) : object
row string The row to read from
currentPos int The current position in the row
Résultat object

Property Details

ColumnName public_oe property

public string ColumnName
Résultat string

DefaultValue public_oe property

If we fail to retrieve a value for this field, what should we use instead? Note this isn't checked against Type, so if you set this to one type and Type to something else, it's your fault when you get type errors.
public object DefaultValue
Résultat object

Description public_oe property

public string Description
Résultat string

End public_oe property

Determines where the record ends
public int End
Résultat int

Seeker public_oe property

Determines how we interpret Start
public FixedWidthPositions Seeker
Résultat FixedWidthPositions

Start public_oe property

Determines where the record starts
public int Start
Résultat int

Strict public_oe property

If true, throws exceptions on error. If false, silently uses DefaultValue and continues.
public bool Strict
Résultat bool

Terminator public_oe property

Determines how we interpret End
public FixedWidthTerminators Terminator
Résultat FixedWidthTerminators

Type public_oe property

What type is this field?
public FixedWidthTypes Type
Résultat FixedWidthTypes