#include <Input.h>
Public Member Functions | |
InputCard (char keyword='$', char comment='#') | |
InputCard (istream &in, char keyword='$', char comment='#') | |
void | Read (istream &in) |
int | NumFields () const |
const String & | Keyword () const |
const String & | Field (int i) const |
int | iField (int i) const |
Numeric | nField (int i) const |
void | Print (ostream &out=StdOutput) const |
Protected Member Functions | |
void | AddRecord (const String &record) |
Protected Attributes | |
char | fComment |
char | fKeyword |
Array< String > | fCardFields |
This class can be used to read from input files that use a keyword leading symbol ('$' is the default). When the InputCard tries to read a record from a istream it will look for the keyword symbol then assume that this denotes a record and will read all the space or comma delineated fields until another keyword symbol is found. Also this class suports the use of a comment symbol ('#' is default). Any line which begins with the comment symbol is not processed.
Definition at line 35 of file Input.h.
basso::InputCard::InputCard | ( | char | keyword = '$' , |
|
char | comment = '#' | |||
) | [inline] |
basso::InputCard::InputCard | ( | istream & | in, | |
char | keyword = '$' , |
|||
char | comment = '#' | |||
) | [inline] |
void basso::InputCard::Read | ( | istream & | in | ) |
reads the next keyword card. This will clear any existing record stored
Definition at line 117 of file Input.h.
References AddRecord(), fCardFields, fComment, fKeyword, and String.
Referenced by InputCard(), and basso::TextInput::ProcessFile().
int basso::InputCard::NumFields | ( | ) | const [inline] |
Returns the number of fields in the card, not including the keyword
Definition at line 56 of file Input.h.
References fCardFields.
const String& basso::InputCard::Keyword | ( | ) | const [inline] |
Returns the keyword as a String for the card
Definition at line 59 of file Input.h.
References fCardFields.
Referenced by basso::TextInput::ProcessFile().
const String& basso::InputCard::Field | ( | int | i | ) | const [inline] |
Returns the a particular field of the card as a String. This is safe since the fields are stored as Strings.
i | field to be returned. This is zero offset and does not include the keyword |
Definition at line 65 of file Input.h.
References fCardFields.
int basso::InputCard::iField | ( | int | i | ) | const [inline] |
Returns the a particular field of the card as an integer. This is not safe since the fields are stored as Strings and may not convert to integers.
i | field to be returned. This is zero offset and does not include the keyword |
Definition at line 71 of file Input.h.
References fCardFields.
Numeric basso::InputCard::nField | ( | int | i | ) | const [inline] |
Returns the a particular field of the card as a Numeric. This is not safe since the fields are stored as Strings and may not convert to Numericss.
i | field to be returned. This is zero offset and does not include the keyword |
Definition at line 77 of file Input.h.
References fCardFields.
void basso::InputCard::AddRecord | ( | const String & | record | ) | [protected] |
Takes a string of teh entire record and breaks it up with spaces and commas then adds teh fields to the record
Definition at line 103 of file Input.h.
References fCardFields.
Referenced by Read().