WXP::Scanp Class Reference

This class parses data given expressions to search for. More...

#include "../include/Scanp.h"

List of all members.

Public Member Functions

int init ()
int scan (const char *pat,...)
 This routine scans a character string for data and parses information using a pattern description string.
int set (const char *str)
int getOffset ()
int offset (int off)
int inc (int off)
int inc ()
const char * string ()
char getChar (int off)
int search (const char *str)
int print ()
int length ()
int matched ()
int assigned ()
bool finished ()

Detailed Description

This class parses data given expressions to search for.

Author:
Dan Vietor

Member Function Documentation

char Scanp::getChar ( int  roff  ) 

Returns character at specific offset

Parameters:
off Offset
Returns:
Character

Referenced by WXP::SaoTool::decode(), WXP::RcmFile::decode(), and WXP::MetarTool::decode().

int Scanp::getOffset (  ) 

Returns current offset into string

Returns:
Current offset

Referenced by WXP::SaoTool::decode().

int Scanp::inc (  ) 

Increments offset based on matched length of previous scan (see scan)

int Scanp::inc ( int  roff  ) 

Increments offset into string

Parameters:
off Increment value

Referenced by WXP::SynopTool::decode(), WXP::SaoTool::decode(), WXP::RcmFile::decode(), WXP::MetarTool::decode(), and WXP::ClimatTool::decode().

int Scanp::init (  ) 

Initializes class values

Referenced by scan().

int Scanp::offset ( int  roff  ) 

Sets offset into string

Parameters:
Current offset

Referenced by WXP::MosUFile::decodeETA().

int Scanp::scan ( const char *  pat,
  ... 
)

This routine scans a character string for data and parses information using a pattern description string.

Scans and decodes data

Parameters:
pat Pattern to use Formatting similar to scanf except more robust:

%{*}{<}{f}{!m!}t

  • * Don't assign to a variable
  • f Field width - match exactly this number of characters
  • <f Field width - match up to this number of characters
  • !m! Specifies that a missing value can be specified
    either is nothing or the string m
  • t Format type
    -- s Standard string delimited by spaces
    -- S Match all characters - terminatint null character
    -- c Standard characters - no terminating null character
    -- A Alphabetic string only
    -- N Numeric string only
    -- n Current position in string
    -- d Integer
    -- D Integer, no white space skip
    -- f Floating point
    -- F Floating point, no white space skip
    -- w Whitespace
    -- W Whitespace, no newline
    -- (s) Match exact string
    -- (s|s|..) Match strings in this set of string delimited with |
    -- [s] Match character types or specific characters s = A for alphabetic, N for numeric, all others literal
    -- [^s] Match everythin but character types or specific characters

    Leading whitespace are not read on S,A,N,D or F formats.

    Non-format characters are literal except space which matches any number of whitespace characters.

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

Referenced by WXP::SynopTool::decode(), WXP::SaoTool::decode(), WXP::RcmFile::decode(), WXP::MetarTool::decode(), WXP::ClimatTool::decode(), and WXP::MosUFile::decodeETA().

int Scanp::search ( const char *  rstr  ) 

Searches the current string for another string

Parameters:
rstr String to search for
Returns:
1 if found, 0 if not
int Scanp::set ( const char *  rstr  ) 
const char * Scanp::string (  ) 

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

Generated on 8 Jan 2010 for WXP C++ Library by  doxygen 1.6.1