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

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

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

Public Member Functions

 Strings ()
 
 Strings (int num)
 
 Strings (const char *string, char delim, int num)
 
 Strings (const char *string, char delim, int num, const char *groups)
 
 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 clear ()
 
int set (int num)
 
int expand (int num)
 
int add (const char *string)
 
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, char delim, int num, const char *groups)
 
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 occurs (int ind, char c)
 
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)
 
long getLong (int ind)
 
long getLong (int ind, int off)
 
long getLongAfter (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() [1/8]

Strings::Strings ( )

Constructor. Initializes class values

References init().

◆ Strings() [2/8]

Strings::Strings ( int  rnum)

Constructor. Sets up strings with number of blanks

Parameters
rnumNumber of blank strings to create

References init(), and set().

◆ Strings() [3/8]

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

Constructor. Sets up strings given string and delimiter

Parameters
stringInitial string to parse
delimDelimiter to break string up
rnumNumber of resulting fields (-1 for unlimited)

References init(), and set().

◆ Strings() [4/8]

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

Constructor. Sets up strings given string and delimiter

Parameters
stringInitial string to parse
delimDelimiter to break string up
rnumNumber of resulting fields (-1 for unlimited)

References init(), and set().

◆ Strings() [5/8]

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

Constructor. Sets up strings given string and delimiter

Parameters
stringInitial string to parse
delimDelimiter to break string up

References init(), and set().

◆ Strings() [6/8]

Strings::Strings ( const char *  string)

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

Parameters
stringInitial string to parse

References init(), and set().

◆ Strings() [7/8]

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

Constructor. Sets up strings given an array of strings

Parameters
cntNumber of strings in array
strArray of strings

References init(), and set().

◆ Strings() [8/8]

Strings::Strings ( const Strings strings)

Copy constructor.

Parameters
stringsStrings class to copy from

References init(), and set().

◆ ~Strings()

Strings::~Strings ( )

Destructor. Frees allocated strings

Member Function Documentation

◆ add()

int Strings::add ( const char *  string)

Sets individual items in string list (overwrites existing string)

Parameters
indThe index to put the string
stringThe string to put into list

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

Referenced by WXP::WarnFile::read().

◆ clear()

int Strings::clear ( )

Clears the strings

Referenced by WXP::WarnFile::read().

◆ equal() [1/3]

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

◆ equal() [2/3]

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

Determines if string is equal to one in the list

Parameters
indIndex of string in list
strString to compare it to
nlenNumber of characters in string to compare
Returns
True if equal

References WXP::StrLib::equal().

◆ equal() [3/3]

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

Determines if string is equal to one in the list

Parameters
indIndex of string in list
offOffset into string to start comparing
strString to compare it to
Returns
True if equal

References WXP::StrLib::equal().

◆ expand()

int Strings::expand ( int  rmax)

Expands the array

Parameters
rmaxNew number of elements

Referenced by add(), and set().

◆ find()

int Strings::find ( const char *  str)

Finds a string in the list

Parameters
strString to compare it to
Returns
True if equal

References WXP::StrLib::equal().

◆ getChar()

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

Gets the character at location off

Parameters
indIndex of string in the list
offOffset of character in string
Returns
Character or null character

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

◆ getFloat() [1/2]

float Strings::getFloat ( int  ind)

◆ getFloat() [2/2]

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

Returns a float extracted from a string in the list

Parameters
indIndex of string
offOffset into string to start extracting

References WXP::Const::MISS.

◆ getInt() [1/2]

int Strings::getInt ( int  ind)

◆ getInt() [2/2]

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

Returns an integer extracted from a string in the list

Parameters
indIndex of string
offOffset into string to start extracting

References WXP::Const::MISS.

◆ getLength()

int Strings::getLength ( int  ind)

◆ getLong() [1/2]

long Strings::getLong ( int  ind)

Returns an integer extracted from a string in the list

Parameters
indIndex of string

References WXP::Const::MISS.

Referenced by WXP::NameConv::set().

◆ getLong() [2/2]

long Strings::getLong ( int  ind,
int  off 
)

Returns an integer extracted from a string in the list

Parameters
indIndex of string
offOffset into string to start extracting

References WXP::Const::MISS.

◆ getNum()

int WXP::Strings::getNum ( )
inline

Returns the number of strings in list

Referenced by WXP::CityTool::compareData(), WXP::ResrcDB::create(), WXP::Vtec::decode(), WXP::CityPlot::draw(), WXP::HodoPlot::draw(), WXP::MapPlot::draw(), WXP::MiscPlot::draw(), WXP::ProfPlot::draw(), WXP::RedbookPlot::draw(), WXP::SoundPlot::draw(), WXP::ThermPlot::draw(), WXP::UpaXSectCont::draw(), WXP::UpaXSectPlot::draw(), WXP::XSectionPlot::draw(), WXP::Graph::drawText(), WXP::ResrcCL::getKeyed(), WXP::ResrcCL::getPosition(), WXP::DatumAttr::parse(), WXP::ColorFile::read(), WXP::GifFile::read(), WXP::LZWComp::read(), WXP::PngFile::read(), WXP::SfcWxpFile::read(), WXP::WarnFile::read(), WXP::WmoIngest::readProdFile(), WXP::Prog::readResrcFile(), WXP::ColorFill::set(), WXP::ModelSpec::set(), WXP::ColorFill::set(), WXP::FloatArray::set(), WXP::Message::set(), WXP::NameConv::set(), WXP::Graph::setDevice(), WXP::Filename::setFile(), WXP::Filename::setFile(), WXP::Figure::setParam(), WXP::ObjectAnal::setParam(), WXP::VectPlot::setParam(), WXP::CityPlot::setParam(), WXP::ContPlot::setParam(), WXP::DatumPlot::setParam(), WXP::FrontPlot::setParam(), WXP::GridCont::setParam(), WXP::GridPlot::setParam(), WXP::GridVect::setParam(), WXP::HodoPlot::setParam(), WXP::HurPlot::setParam(), WXP::ImagePlot::setParam(), WXP::Lev2Plot::setParam(), WXP::LightPlot::setParam(), WXP::MapPlot::setParam(), WXP::MdrImage::setParam(), WXP::MdrPlot::setParam(), WXP::MetaPlot::setParam(), WXP::MeteoPlot::setParam(), WXP::MiscPlot::setParam(), WXP::MosPlot::setParam(), WXP::NidsImage::setParam(), WXP::NidsPlot::setParam(), WXP::ProfPlot::setParam(), WXP::RadPlot::setParam(), WXP::RawGrid::setParam(), WXP::RawPlot::setParam(), WXP::RcmDecode::setParam(), WXP::RcmPlot::setParam(), WXP::RedbookPlot::setParam(), WXP::SatPlot::setParam(), WXP::SfcPlot::setParam(), WXP::SoundPlot::setParam(), WXP::ThermPlot::setParam(), WXP::UpaDecode::setParam(), WXP::UpaPlot::setParam(), WXP::UpaXSectCont::setParam(), WXP::UpaXSectPlot::setParam(), WXP::WarnPlot::setParam(), WXP::WatchPlot::setParam(), WXP::WmoIngest::setParam(), WXP::XSectionPlot::setParam(), WXP::XWindow::setParam(), and WXP::CityHash::setup().

◆ getString() [1/3]

const char * Strings::getString ( int  ind)

Returns the string at set position in list

Parameters
indIndex in list
Returns
String at that location

Referenced by WXP::CityTool::compareData(), WXP::ResrcDB::create(), WXP::Vtec::decode(), WXP::DomainTool::decode(), WXP::HurPlot::draw(), WXP::MapPlot::draw(), WXP::MiscPlot::draw(), WXP::ProfPlot::draw(), WXP::RedbookPlot::draw(), WXP::ThermPlot::draw(), WXP::UpaXSectCont::draw(), WXP::UpaXSectPlot::draw(), WXP::WarnPlot::draw(), WXP::WatchPlot::draw(), WXP::XSectionPlot::draw(), WXP::Graph::drawText(), WXP::ResrcCL::getKeyed(), WXP::Filename::getName(), WXP::ResrcCL::getPosition(), WXP::DatumAttr::parse(), WXP::ColorFile::read(), WXP::GifFile::read(), WXP::LZWComp::read(), WXP::PngFile::read(), WXP::WarnFile::read(), WXP::WmoIngest::readProdFile(), WXP::Prog::readResrcFile(), WXP::ColorFill::set(), WXP::ModelSpec::set(), WXP::ColorFill::set(), WXP::FloatArray::set(), WXP::Message::set(), WXP::NameConv::set(), WXP::Filename::setFile(), WXP::Filename::setFile(), WXP::Filename::setFile(), WXP::ObjectAnal::setParam(), WXP::VectPlot::setParam(), WXP::CityPlot::setParam(), WXP::ContPlot::setParam(), WXP::FrontPlot::setParam(), WXP::GridCont::setParam(), WXP::GridPlot::setParam(), WXP::HurPlot::setParam(), WXP::ImagePlot::setParam(), WXP::Lev2Plot::setParam(), WXP::LightPlot::setParam(), WXP::MapPlot::setParam(), WXP::MdrPlot::setParam(), WXP::MeteoPlot::setParam(), WXP::MiscPlot::setParam(), WXP::MosPlot::setParam(), WXP::NidsPlot::setParam(), WXP::RawPlot::setParam(), WXP::RcmPlot::setParam(), WXP::RedbookPlot::setParam(), WXP::SatPlot::setParam(), WXP::SfcPlot::setParam(), WXP::SoundPlot::setParam(), WXP::UpaPlot::setParam(), WXP::WarnPlot::setParam(), WXP::WatchPlot::setParam(), and WXP::XWindow::setParam().

◆ getString() [2/3]

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

Gets the string from the list starting at the delimiter

Parameters
indIndex of the string in the list to search
delimCharacter to search for
Returns
String starting with delim or NULL

◆ getString() [3/3]

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

Gets the string from the list starting at off

Parameters
indIndex of the string in the list to search
offOffset into string
Returns
String starting at off or NULL

◆ getStringAfter()

const char * Strings::getStringAfter ( int  ind,
char  ch 
)

◆ iequal() [1/3]

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

◆ iequal() [2/3]

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

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

Parameters
indIndex of string in list
strString to compare it to
nlenNumber of characters in string to compare
Returns
True if equal

References WXP::StrLib::iequal().

◆ iequal() [3/3]

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

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

Parameters
indIndex of string in list
offOffset into string to start comparing
strString to compare it to
Returns
True if equal

References WXP::StrLib::iequal().

◆ index()

int Strings::index ( int  ind,
char  ch 
)

Returns the index of a character within a particular string

Parameters
indIndex of string in list
chCharacter to search for
Returns
Index of character or -1

References WXP::StrLib::index().

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

◆ init()

int Strings::init ( )

Initializes class values

Referenced by set(), set(), set(), set(), Strings(), Strings(), Strings(), Strings(), Strings(), Strings(), Strings(), and Strings().

◆ operator=()

Strings Strings::operator= ( const Strings strings)

Assignment operator. Used to overload copying

Parameters
stringsString class to copy from

References set().

◆ print()

int Strings::print ( )

Prints the class data to standard output

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

◆ scanf() [1/2]

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

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

Parameters
indIndex of string in list to scan
fmtFormat 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::ContPlot::setParam(), WXP::Lev2Plot::setParam(), WXP::MdrPlot::setParam(), WXP::NidsImage::setParam(), WXP::NidsPlot::setParam(), WXP::RcmPlot::setParam(), WXP::UpaDecode::setParam(), and WXP::XWindow::setParam().

◆ scanf() [2/2]

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

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

Parameters
indIndex of string in list to scan
offOffset into string to start scanning from
fmtFormat to scan with
...Output parameters
Returns
Number of parameters successfully scanned

◆ set() [1/9]

int Strings::set ( const char *  string)

Sets up strings given string and splits string on whitespace

Parameters
stringInitial string to parse

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

◆ set() [2/9]

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

Sets up strings given string and delimiter

Parameters
stringInitial string to parse
delimDelimiter to break string up

References set().

◆ set() [3/9]

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

Sets up strings given string and delimiter

Parameters
stringInitial string to parse
delimDelimiter to break string up
rnumNumber of resulting fields (-1 for unlimited)

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

◆ set() [4/9]

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

Sets up strings given string and delimiter

Parameters
stringInitial string to parse
delimDelimiter to break string up
rnumNumber of resulting fields (-1 for unlimited)

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

◆ set() [5/9]

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

Sets the string table by parsing on a pattern.

Parameters
stringString to parse
patternPattern to parse string on

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

◆ set() [6/9]

int Strings::set ( const Strings strings)

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

Parameters
stringsString class to copy from

References WXP::StrLib::acopy().

◆ set() [7/9]

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

Sets up strings given an array of strings

Parameters
cntNumber of strings in array
strArray of strings

References WXP::StrLib::acopy().

◆ set() [8/9]

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

Sets individual items in string list (overwrites existing string)

Parameters
indThe index to put the string
stringThe string to put into list

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

◆ set() [9/9]

int Strings::set ( int  rnum)

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