WXP C++ Library Version 6.74.9
|
This class parses text files. More...
#include "../include/Parse.h"
Public Types | |
enum | Type { RAW , WXP } |
Public Member Functions | |
Parse () | |
Parse (const char *str) | |
int | init () |
int | setParam (const char *str) |
int | open (Filename &filename) |
int | open (const char *filename) |
bool | isOpen () |
int | rewind () |
int | close () |
int | useHdrFile (bool val) |
int | useAwipsHdr (bool val) |
bool | isNewProd () |
int | setHeader (const char *string) |
int | setId (const char *id) |
const char * | getHeader () |
const char * | getAwip () |
int | getLineStatus () |
int | tell () |
int | seek (int loc) |
int | getLoc () |
int | getHeaderLoc () |
int | getFileInd () |
int | setLoc (int byte) |
int | setLoc (int rind, int byte) |
int | getLine (char *string, int len) |
int | getLine (String &line) |
bool | isData () |
Static Public Member Functions | |
static bool | compare (const char *header, const char *awip, const char *pattern) |
static bool | checkZone (const char *line, const char *str) |
This class parses text files.
Parse::Parse | ( | ) |
Constructor. Initializes class values
References init().
Parse::Parse | ( | const char * | str | ) |
int Parse::close | ( | ) |
Closes the file
References WXP::File::close().
|
static |
Comparison routine for matching WMO headers
pattern | Pattern to match against current WMO and AWIP headers |
References WXP::StrLib::equal(), WXP::Const::MISS, and WXP::Wxp::outDebug().
const char * Parse::getAwip | ( | ) |
Gets the latest AWIP header
const char * Parse::getHeader | ( | ) |
Gets the latest matching WMO header
int Parse::getHeaderLoc | ( | ) |
Gets the location of the current header line in the file (byte offset)
int Parse::getLine | ( | char * | line, |
int | len | ||
) |
Gets the next matching line in the file
line | String to put data |
len | Length of string |
References WXP::StrLib::check(), WXP::StrLib::contains(), WXP::StrLib::copy(), WXP::StrLib::equal(), WXP::File::getLine(), WXP::StrLib::isAlphaNum(), WXP::Wxp::outDebug(), WXP::File::seek(), WXP::File::tell(), WXP::StrLib::trimWS(), and WXP::StrLib::valid().
Referenced by getLine().
int Parse::getLine | ( | String & | string | ) |
int Parse::getLoc | ( | ) |
Gets the location of the current line in the file (byte offset)
bool Parse::isData | ( | ) |
Returns if the data output is valid data
bool Parse::isNewProd | ( | ) |
Is data part of a new product.
bool Parse::isOpen | ( | ) |
Is file open
int Parse::open | ( | Filename & | rfilename | ) |
Opens a file to parse
rfilename | Filename to open along with header file. |
References WXP::Filename::getHeader(), WXP::Filename::getName(), WXP::Filename::getNumFiles(), WXP::File::isOpen(), WXP::File::open(), WXP::Wxp::outMessage(), WXP::Filename::setFile(), and WXP::StrLib::valid().
int Parse::rewind | ( | ) |
Rewind the file
References WXP::File::rewind().
int Parse::setHeader | ( | const char * | str | ) |
int Parse::setId | ( | const char * | str | ) |
Sets the string identifier to search for within product
str | Id string to search for |
References WXP::StrLib::copy().
int Parse::setLoc | ( | int | byte | ) |
Sets a new location in the file to start searching for data
byte | Byte offset into file |
References WXP::File::getLine(), WXP::File::rewind(), WXP::File::seek(), and WXP::File::tell().
|
inline |
Determines if header file is to be used in parsing
val | True if header file is to be used. |