WXP C++ Library Version 6.74.9
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
WXP::Parse Class Reference

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)
 

Static Public Attributes

static const int START = 0x1
 
static const int SEQ = 0x2
 
static const int HEADER = 0x3
 
static const int AWIP = 0x4
 
static const int SDATA = 0x5
 
static const int DATA = 0x10
 
static const int BLANK = 0x11
 
static const int DOLLAR = 0x12
 
static const int LOCATE = 0x13
 
static const int VTEC = 0x14
 
static const int LATLON = 0x15
 
static const int DESC = 0x16
 

Detailed Description

This class parses text files.

Author
Dan Vietor

Constructor & Destructor Documentation

◆ Parse() [1/2]

Parse::Parse ( )

Constructor. Initializes class values

References init().

◆ Parse() [2/2]

Parse::Parse ( const char *  str)

Constructor

Parameters
strThe parameters to initialize object

References init().

Member Function Documentation

◆ close()

int Parse::close ( )

Closes the file

References WXP::File::close().

◆ compare()

bool Parse::compare ( const char *  header,
const char *  header2,
const char *  pattern 
)
static

Comparison routine for matching WMO headers

Parameters
patternPattern to match against current WMO and AWIP headers

References WXP::StrLib::equal(), WXP::Const::MISS, and WXP::Wxp::outDebug().

◆ getAwip()

const char * Parse::getAwip ( )

Gets the latest AWIP header

Returns
AWIP header

◆ getHeader()

const char * Parse::getHeader ( )

Gets the latest matching WMO header

Returns
WMO header string

◆ getHeaderLoc()

int Parse::getHeaderLoc ( )

Gets the location of the current header line in the file (byte offset)

Returns
The byte offset into file

◆ getLine() [1/2]

int Parse::getLine ( char *  line,
int  len 
)

◆ getLine() [2/2]

int Parse::getLine ( String string)

Gets the next matching line in the file

Return values
stringString class to put data

References getLine().

◆ getLoc()

int Parse::getLoc ( )

Gets the location of the current line in the file (byte offset)

Returns
The byte offset into file

◆ init()

int Parse::init ( )

Initializes class values

Referenced by Parse(), and Parse().

◆ isData()

bool Parse::isData ( )

Returns if the data output is valid data

Returns
True if valid data

◆ isNewProd()

bool Parse::isNewProd ( )

Is data part of a new product.

Returns
True if data first part of a new product. Clears after first valid data of new product.

◆ isOpen()

bool Parse::isOpen ( )

Is file open

Returns
True if file open

◆ open()

int Parse::open ( Filename rfilename)

◆ rewind()

int Parse::rewind ( )

Rewind the file

References WXP::File::rewind().

◆ setHeader()

int Parse::setHeader ( const char *  str)

Sets the WMO header to search for

Parameters
strHeader string

References WXP::StrLib::copy().

◆ setId()

int Parse::setId ( const char *  str)

Sets the string identifier to search for within product

Parameters
strId string to search for

References WXP::StrLib::copy().

◆ setLoc()

int Parse::setLoc ( int  byte)

Sets a new location in the file to start searching for data

Parameters
byteByte offset into file

References WXP::File::getLine(), WXP::File::rewind(), WXP::File::seek(), and WXP::File::tell().

◆ useHdrFile()

int WXP::Parse::useHdrFile ( bool  val)
inline

Determines if header file is to be used in parsing

Parameters
valTrue if header file is to be used.

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