WXP::Strings Class Reference

This class creates a list of strings. More...

#include "../include/Strings.h"

List of all members.

Public Member Functions

 Strings ()
 Strings (int num)
 Strings (const char *string, char delim, int num)
 Strings (const char *string, char delim)
 Strings (const char *string)
 Strings (int cnt, const char *str[])
 Strings (const Strings &strings)
Strings operator= (const Strings &strings)
 ~Strings ()
int init ()
int set (int num)
int set (int ind, const char *string)
int set (const char *string, char delim, int num)
int set (const char *string, char delim)
int set (const char *string)
int set (int cnt, const char *str[])
int set (const Strings &strings)
int set (const char *string, const char *pattern)
const char * getString (int ind)
const char * getString (int ind, char delim)
const char * getString (int ind, int off)
const char * getStringAfter (int ind, char ch)
char getChar (int ind, int off)
bool valid (int ind)
bool equal (int ind, const char *str)
bool equal (int ind, int off, const char *str)
bool equal (int ind, const char *str, int num)
bool iequal (int ind, const char *str)
bool iequal (int ind, int off, const char *str)
bool iequal (int ind, const char *str, int num)
int find (const char *str)
int index (int ind, char s1)
bool contains (int ind, const char *str)
int getLength (int ind)
int scanf (int ind, const char *fmt,...)
int scanf (int ind, int off, const char *fmt,...)
int getInt (int ind)
int getInt (int ind, int off)
int getIntAfter (int ind, char ch)
float getFloat (int ind)
float getFloat (int ind, int off)
float getFloatAfter (int ind, char ch)
bool check (int ind, const char *pat)
int getNum ()
int print ()

Detailed Description

This class creates a list of strings.

Author:
Dan Vietor

Constructor & Destructor Documentation

Strings::Strings (  ) 

Constructor. Initializes class values

References init().

Strings::Strings ( int  rnum  ) 

Constructor. Sets up strings with number of blanks

Parameters:
rnum Number of blank strings to create

References init().

Strings::Strings ( const char *  string,
char  delim,
int  rnum 
)

Constructor. Sets up strings given string and delimiter

Parameters:
string Initial string to parse
delim Delimiter to break string up
rnum Number of resulting fields (-1 for unlimited)

References init().

Strings::Strings ( const char *  string,
char  delim 
)

Constructor. Sets up strings given string and delimiter

Parameters:
string Initial string to parse
delim Delimiter to break string up

References init().

Strings::Strings ( const char *  string  ) 

Constructor. Sets up strings given string and splits string on whitespace

Parameters:
string Initial string to parse

References init().

Strings::Strings ( int  cnt,
const char *  str[] 
)

Constructor. Sets up strings given an array of strings

Parameters:
cnt Number of strings in array
str Array of strings

References init().

Strings::Strings ( const Strings strings  ) 

Copy constructor.

Parameters:
strings Strings class to copy from

References init().

Strings::~Strings (  ) 

Destructor. Frees allocated strings


Member Function Documentation

bool Strings::equal ( int  ind,
const char *  str,
int  nlen 
)

Determines if string is equal to one in the list

Parameters:
ind Index of string in list
str String to compare it to
nlen Number of characters in string to compare
Returns:
True if equal

References equal().

bool Strings::equal ( int  ind,
int  off,
const char *  str 
)

Determines if string is equal to one in the list

Parameters:
ind Index of string in list
off Offset into string to start comparing
str String to compare it to
Returns:
True if equal

References equal().

bool Strings::equal ( int  ind,
const char *  str 
)
int Strings::find ( const char *  str  ) 

Finds a string in the list

Parameters:
str String to compare it to
Returns:
True if equal

References WXP::StrLib::equal().

char Strings::getChar ( int  ind,
int  off 
)

Gets the character at location off

Parameters:
ind Index of string in the list
off Offset of character in string
Returns:
Character or null character

Referenced by WXP::ResrcDB::create(), WXP::MapPlot::draw(), and WXP::XWindow::setParam().

float Strings::getFloat ( int  ind,
int  off 
)

Returns a float extracted from a string in the list

Parameters:
ind Index of string
off Offset into string to start extracting

References WXP::Const::MISS.

float Strings::getFloat ( int  ind  ) 
int Strings::getInt ( int  ind,
int  off 
)

Returns an integer extracted from a string in the list

Parameters:
ind Index of string
off Offset into string to start extracting

References WXP::Const::MISS.

int Strings::getInt ( int  ind  ) 
int Strings::getLength ( int  ind  ) 

Returns the length of a string in the list

Parameters:
ind Index of string in list

Referenced by WXP::CityTool::compareData(), WXP::XWindow::setParam(), WXP::RcmPlot::setParam(), WXP::NidsPlot::setParam(), WXP::MdrPlot::setParam(), WXP::Lev2Plot::setParam(), and WXP::CityPlot::setParam().

int WXP::Strings::getNum (  )  [inline]

Returns the number of strings in list

Referenced by WXP::CityTool::compareData(), WXP::ResrcDB::create(), WXP::Vtec::decode(), WXP::UpaXSectPlot::draw(), WXP::UpaXSectCont::draw(), WXP::ThermPlot::draw(), WXP::RedbookPlot::draw(), WXP::MapPlot::draw(), WXP::HodoPlot::draw(), WXP::CityPlot::draw(), WXP::Graph::drawText(), WXP::ResrcCL::getKeyed(), WXP::ResrcCL::getPosition(), WXP::SfcWxpFile::read(), WXP::GifFile::read(), WXP::ColorFile::read(), WXP::Prog::readResrcFile(), WXP::NameConv::set(), WXP::ModelSpec::set(), WXP::Message::set(), WXP::ColorFill::set(), WXP::Graph::setDevice(), WXP::Filename::setFile(), WXP::Filename::setFilePrompt(), WXP::XWindow::setParam(), WXP::WatchPlot::setParam(), WXP::UpaXSectPlot::setParam(), WXP::UpaXSectCont::setParam(), WXP::UpaPlot::setParam(), WXP::UpaDecode::setParam(), WXP::ThermPlot::setParam(), WXP::SfcPlot::setParam(), WXP::SatPlot::setParam(), WXP::RedbookPlot::setParam(), WXP::RcmPlot::setParam(), WXP::RcmDecode::setParam(), WXP::RawPlot::setParam(), WXP::RadPlot::setParam(), WXP::NidsPlot::setParam(), WXP::MosPlot::setParam(), WXP::MiscPlot::setParam(), WXP::MeteoPlot::setParam(), WXP::MetaPlot::setParam(), WXP::MdrPlot::setParam(), WXP::MapPlot::setParam(), WXP::LightPlot::setParam(), WXP::Lev2Plot::setParam(), WXP::ImagePlot::setParam(), WXP::HodoPlot::setParam(), WXP::GridPlot::setParam(), WXP::GridCont::setParam(), WXP::FrontPlot::setParam(), WXP::Figure::setParam(), WXP::DatumPlot::setParam(), WXP::Contour::setParam(), and WXP::CityPlot::setParam().

const char * Strings::getString ( int  ind,
int  off 
)

Gets the string from the list starting at off

Parameters:
ind Index of the string in the list to search
off Offset into string
Returns:
String starting at off or NULL
const char * Strings::getString ( int  ind,
char  delim 
)

Gets the string from the list starting at the delimiter

Parameters:
ind Index of the string in the list to search
delim Character to search for
Returns:
String starting with delim or NULL
const char * Strings::getString ( int  ind  ) 
const char * Strings::getStringAfter ( int  ind,
char  ch 
)
bool Strings::iequal ( int  ind,
const char *  str,
int  nlen 
)

Determines if string is equal to one in the list (case insensitive)

Parameters:
ind Index of string in list
str String to compare it to
nlen Number of characters in string to compare
Returns:
True if equal

References iequal().

bool Strings::iequal ( int  ind,
int  off,
const char *  str 
)

Determines if string is equal to one in the list (case insensitive)

Parameters:
ind Index of string in list
off Offset into string to start comparing
str String to compare it to
Returns:
True if equal

References iequal().

bool Strings::iequal ( int  ind,
const char *  str 
)
int Strings::index ( int  ind,
char  ch 
)

Returns the index of a character within a particular string

Parameters:
ind Index of string in list
ch Character to search for
Returns:
Index of character or -1

Referenced by WXP::DomainTool::decode(), getStringAfter(), WXP::ModelSpec::set(), WXP::XWindow::setParam(), and WXP::Figure::setParam().

int Strings::init (  ) 

Initializes class values

Referenced by set(), and Strings().

Strings Strings::operator= ( const Strings strings  ) 

Assignment operator. Used to overload copying

Parameters:
strings String class to copy from
int Strings::print (  ) 

Prints the class data to standard output

Referenced by WXP::MetaPlot::setParam().

int Strings::scanf ( int  ind,
int  off,
const char *  fmt,
  ... 
)

Scans a string in the list using a format (see sscanf)

Parameters:
ind Index of string in list to scan
off Offset into string to start scanning from
fmt Format to scan with
... Output parameters
Returns:
Number of parameters successfully scanned
int Strings::scanf ( int  ind,
const char *  fmt,
  ... 
)

Scans a string in the list using a format (see sscanf)

Parameters:
ind Index of string in list to scan
fmt Format to scan with
... Output parameters
Returns:
Number of parameters successfully scanned

Referenced by WXP::Vtec::decode(), WXP::CityPlot::draw(), WXP::SfcWxpFile::read(), WXP::NameConv::set(), WXP::XWindow::setParam(), WXP::UpaDecode::setParam(), WXP::RcmPlot::setParam(), WXP::NidsPlot::setParam(), WXP::MdrPlot::setParam(), WXP::Lev2Plot::setParam(), and WXP::Contour::setParam().

int Strings::set ( const char *  string,
const char *  pattern 
)

Sets the string table by parsing on a pattern.

Parameters:
string String to parse
pattern Pattern to parse string on

References WXP::StrLib::acopy(), and init().

int Strings::set ( const Strings strings  ) 

Sets the string data from another string class (used by copy constructor)

Parameters:
strings String class to copy from

References WXP::StrLib::acopy().

int Strings::set ( int  cnt,
const char *  str[] 
)

Sets up strings given an array of strings

Parameters:
cnt Number of strings in array
str Array of strings

References WXP::StrLib::acopy().

int Strings::set ( const char *  string  ) 

Sets up strings given string and splits string on whitespace

Parameters:
string Initial string to parse

References WXP::StrLib::acopy(), and init().

int Strings::set ( const char *  string,
char  delim 
)

Sets up strings given string and delimiter

Parameters:
string Initial string to parse
delim Delimiter to break string up
int Strings::set ( const char *  string,
char  delim,
int  rnum 
)

Sets up strings given string and delimiter

Parameters:
string Initial string to parse
delim Delimiter to break string up
rnum Number of resulting fields (-1 for unlimited)

References WXP::StrLib::acopy(), init(), and WXP::StrLib::length().

int Strings::set ( int  ind,
const char *  string 
)

Sets individual items in string list (overwrites existing string)

Parameters:
ind The index to put the string
string The string to put into list

References WXP::StrLib::acopy().

int Strings::set ( int  rnum  ) 

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