WXP C++ Library Version 6.74.9
|
This is a variable length string class. More...
#include "../include/String.h"
Public Member Functions | |
int | init () |
int | init (int length) |
String (int length) | |
String () | |
String (const char *str) | |
String (const String &string) | |
String | operator= (const String &string) |
~String () | |
int | set (const char *str) |
int | set (const String &string) |
int | reset () |
bool | valid () |
bool | isAlphaNum () |
const char * | get () |
const char * | get (int ind) |
char | getChar (int ind) |
int | length () |
int | maxLength () |
int | clear () |
int | resize (int length) |
int | resize () |
int | rewind () |
const char * | getPtr () |
int | scanf (const char *mess,...) |
int | scanp (const char *mess,...) |
int | printf (const char *mess,...) |
int | aprintf (const char *mess,...) |
int | replace (char tar, char rep) |
int | trimWS () |
int | stripWS () |
int | chop () |
int | upCase () |
int | lowCase () |
int | index (char ch) |
bool | equal (const char *str) |
bool | equal (const char *str, int num) |
bool | iequal (const char *str) |
bool | iequal (const char *str, int num) |
bool | contains (const char *str) |
int | occurs (char ch) |
int | copy (const char *str) |
int | copy (String &str) |
int | copy (const char *str, int num) |
int | append (const char *str) |
int | append (String &str) |
int | append (const char *str, int num) |
int | append (char str) |
int | trunc (int ind) |
int | print () |
This is a variable length string class.
String::String | ( | int | length | ) |
String::String | ( | ) |
Constructor of string. Length is 80 characters.
References init().
String::String | ( | const char * | str | ) |
Constructor of string based on existing string
str | String to initialize data to |
String::String | ( | const String & | string | ) |
String::~String | ( | ) |
Destructor
int String::append | ( | char | ch | ) |
Appends a single character to the end of the main string
ch | Character to append |
References resize().
int String::append | ( | const char * | str | ) |
Appends specified string to the end of main string
str | String to append |
References resize().
Referenced by WXP::FileTool::addOutPath(), WXP::FileTool::addPath(), WXP::FileTool::addPathDelim(), WXP::FileTool::addUserPath(), append(), WXP::FileTool::checkPath(), WXP::DateTool::createLabel(), WXP::DateTool::createLabel(), WXP::DateTool::createLabel(), WXP::MosPlot::draw(), WXP::ProfPlot::draw(), WXP::SfcPlot::draw(), WXP::UpaPlot::draw(), WXP::UpaXSectCont::draw(), WXP::UpaXSectPlot::draw(), WXP::NameConv::encode(), WXP::ResrcEnv::get(), WXP::WxTool::getSAWeather(), WXP::WxTool::getTextFromWeather(), WXP::VarName::makeLabel(), WXP::ResrcFile::open(), WXP::VarFile::read(), WXP::GridPlot::setForeTime(), WXP::ImagePlot::setForeTime(), WXP::MosRaw::setForeTime(), WXP::SoundPlot::setForeTime(), WXP::Variable::toAbbrCode(), WXP::Level::toLabel(), WXP::Variable::toLabel(), WXP::ForeTime::toString(), WXP::Level::toString(), WXP::Variable::toString(), WXP::Date::toText(), and WXP::ForeTime::toVarLabel().
int String::append | ( | const char * | str, |
int | num | ||
) |
int String::append | ( | String & | str | ) |
int String::aprintf | ( | const char * | fmt, |
... | |||
) |
Formats data into character string like sprintf, appends to end of string.
fmt | Sprintf format |
... | Additional parameters to sprintf |
Referenced by WXP::DateTool::createLabel(), WXP::SfcData::outString(), WXP::ForeTime::toString(), and WXP::Date::toText().
int String::chop | ( | ) |
Chops the last character off the string
Referenced by WXP::VarFile::read().
int String::clear | ( | ) |
Clears the string
Referenced by WXP::Filename::checkFile(), WXP::DateTool::createHourLabel(), WXP::DateTool::createLabel(), WXP::MosPlot::draw(), WXP::SfcPlot::draw(), WXP::UpaPlot::draw(), WXP::NameConv::encode(), WXP::Region::get(), WXP::ResrcFile::get(), WXP::ResrcCL::getKeyed(), WXP::FileTool::getPath(), WXP::WxTool::getTextFromWeather(), WXP::FrontPlot::init(), WXP::VarFileData::init(), WXP::NameConv::initParam(), WXP::Variable::toAbbrCode(), WXP::Level::toLabel(), WXP::Variable::toLabel(), WXP::ForeTime::toString(), WXP::Level::toString(), WXP::Variable::toString(), WXP::Date::toText(), WXP::ForeTime::toTimeLabel(), WXP::ForeTime::toTimeLabel(), and WXP::ForeTime::toTimeLabelDay().
bool String::contains | ( | const char * | str | ) |
Checks to see if string contains a specified string.
str | See if this string is contained in main string |
int String::copy | ( | const char * | str | ) |
Copies specified string into main string
str | String to copy from |
References resize().
Referenced by WXP::FileTool::addOutPath(), WXP::FileTool::addPath(), WXP::FileTool::addUserPath(), WXP::FileTool::checkPath(), copy(), WXP::DateTool::createHourLabel(), WXP::ResrcDB::decodeProgramName(), WXP::Region::get(), WXP::ResrcEnv::get(), WXP::ResrcFile::get(), WXP::ResrcCL::getKeyed(), WXP::MosData::getObvis(), WXP::FileTool::getPath(), WXP::ResrcCL::getPosition(), WXP::WxTool::getSAWeather(), WXP::WxTool::getTextFromSAWeather(), WXP::Resrc::getValues(), WXP::WxTool::getWeather(), WXP::ResrcFile::open(), WXP::VarFile::read(), set(), set(), and WXP::ForeTime::toString().
int String::copy | ( | const char * | str, |
int | num | ||
) |
int String::copy | ( | String & | str | ) |
bool String::equal | ( | const char * | str | ) |
Is the string equal to specified string
str | String to compare to |
Referenced by WXP::ContPlot::drawLine(), WXP::ContPlot::drawLineLabels(), WXP::ContPlot::drawMaxMin(), WXP::Menu::prompt(), and WXP::SatCdfFile::readHeader().
bool String::equal | ( | const char * | str, |
int | num | ||
) |
Is the string equal to a specified string. Only first num characters compared.
str | String to compare to |
num | Number of characters to compare |
const char * String::get | ( | ) |
Gets the string data
str | String data |
Referenced by WXP::GridMath::abs(), WXP::GridMath::add(), WXP::FileTool::addOutPath(), WXP::FileTool::addPath(), WXP::FileTool::addPathDelim(), append(), WXP::Unit::change(), WXP::FileTool::checkPath(), WXP::ObjectAnal::compute(), WXP::MosRaw::compute(), WXP::SfcRaw::compute(), WXP::UpaRaw::compute(), copy(), WXP::ResrcDB::create(), WXP::DomainTool::decode(), WXP::ResrcDB::decodeProgramName(), WXP::GridMath::diff(), WXP::GridMath::div(), WXP::CityPlot::draw(), WXP::FrontPlot::draw(), WXP::GridCont::draw(), WXP::GridPlot::draw(), WXP::GridVect::draw(), WXP::HurPlot::draw(), WXP::ImagePlot::draw(), WXP::Lev2Plot::draw(), WXP::LightPlot::draw(), WXP::MapPlot::draw(), WXP::MdrPlot::draw(), WXP::MeteoPlot::draw(), WXP::MiscPlot::draw(), WXP::MosPlot::draw(), WXP::NidsPlot::draw(), WXP::ProfPlot::draw(), WXP::RadPlot::draw(), WXP::RawPlot::draw(), WXP::RcmPlot::draw(), WXP::RedbookPlot::draw(), WXP::SatPlot::draw(), WXP::SfcPlot::draw(), WXP::SoundPlot::draw(), WXP::ThermPlot::draw(), WXP::UpaPlot::draw(), WXP::UpaXSectCont::draw(), WXP::UpaXSectPlot::draw(), WXP::WarnPlot::draw(), WXP::WatchPlot::draw(), WXP::DatumPlot::draw(), WXP::VectPlot::draw(), WXP::NidsPlot::drawData(), WXP::ContPlot::drawFill(), WXP::ImagePlot::drawImage(), WXP::ContPlot::drawLabels(), WXP::VectPlot::drawLabels(), WXP::ContPlot::drawLine(), WXP::ContPlot::drawLineLabels(), WXP::ContPlot::drawMaxMin(), WXP::VectPlot::drawStreamline(), WXP::ContPlot::drawValues(), WXP::VectPlot::drawVect(), WXP::NameConv::encode(), WXP::Figure::endPlot(), WXP::GridMath::exp(), WXP::File::File(), WXP::Region::get(), WXP::ModelName::get(), WXP::ModelName::get(), WXP::ResrcEnv::get(), WXP::ResrcFile::get(), WXP::GridCont::getDomain(), WXP::GridVect::getDomain(), WXP::Filename::getHeader(), WXP::Filename::getName(), WXP::Filename::getName(), WXP::NameConv::getPath(), WXP::ResrcFile::getValid(), WXP::GridMath::inv(), WXP::Filename::listFile(), WXP::GridMath::log(), WXP::GridMath::log10(), WXP::GribFile::makeDatim(), WXP::GribFile::makeInfo(), WXP::GridMath::max(), WXP::GridMath::min(), WXP::GridMath::mod(), WXP::GridMath::mult(), WXP::Graph::open(), WXP::VarFile::open(), WXP::File::open(), WXP::BufrFile::open(), WXP::SfcWxpFile::open(), WXP::SfcXmlFile::open(), WXP::ResrcFile::open(), WXP::File::open(), WXP::GridMath::pow(), WXP::Filename::print(), WXP::Grid::print(), WXP::MdrData::print(), WXP::MosData::print(), WXP::MosUData::print(), WXP::NidsPlot::print(), WXP::RcmData::print(), WXP::SfcData::print(), WXP::SfcPlot::print(), WXP::VarFileData::print(), WXP::VarSpec::print(), WXP::Message::print(), WXP::Grid::printInfo(), WXP::SfcData::printLine(), WXP::WmoIngest::printLog(), WXP::MosData::printTable(), WXP::WmoIngest::process(), WXP::ColorFile::read(), WXP::AreaFile::readData(), WXP::Unit::readFile(), WXP::ResrcFile::readFile(), WXP::SatUniFile::readHeader(), WXP::WmoIngest::readProdFile(), WXP::WmoIngest::readProdFile(), WXP::Prog::readResrcFile(), WXP::FileTool::remove(), WXP::CityTool::search(), WXP::VarName::searchFile(), WXP::VarName::searchFile(), WXP::ModelSpec::set(), WXP::Resrc::set(), WXP::Filename::set(), WXP::NameConv::set(), WXP::Grid::setDatim(), WXP::Filename::setFile(), WXP::Filename::setFile(), WXP::NameConv::setFile(), WXP::GridPlot::setFilename(), WXP::GridPlot::setFilename(), WXP::GridPlot::setFilename(), WXP::GridPlot::setFilename(), WXP::NameConvFile::setFilename(), WXP::Graph::setFont(), WXP::NameConvFile::setHdrFilename(), WXP::NameConv::setLatest(), WXP::Graph::setSymbol(), WXP::RcmDecode::setup(), WXP::CityHash::setup(), WXP::UpaRawinHash::setup(), WXP::CityHash::setup(), WXP::Unit::simplify(), WXP::GridMath::sqrt(), WXP::Variable::toAbbrCode(), WXP::VarSpec::toInfoLabel(), WXP::Variable::toLabel(), WXP::Variable::toString(), WXP::License::valid(), and WXP::ImgWxpFile::write().
const char * String::get | ( | int | ind | ) |
Returns a string starting at a specific index
ind | Index to start |
char String::getChar | ( | int | ind | ) |
Gets a specific character out of the string
ind | Index of character to retrieve |
Referenced by WXP::FileTool::addPathDelim(), WXP::Region::get(), WXP::ResrcFile::get(), WXP::ColorFile::readFile(), WXP::RedbookFile::readHeader(), and WXP::NameConv::set().
|
inline |
Returns internal data pointer
bool String::iequal | ( | const char * | str | ) |
Is the string equal to specified string (case insensitive)
str | String to compare to |
Referenced by WXP::ResrcFile::get(), WXP::Menu::prompt(), and WXP::ColorFile::readFile().
bool String::iequal | ( | const char * | str, |
int | num | ||
) |
Is the string equal to a specified string. Only first num characters compared. Case insensitive.
str | String to compare to |
num | Number of characters to compare |
int String::index | ( | char | ch | ) |
Returns the index of a specific character
ch | The character to search for |
int String::init | ( | ) |
Initializes the string data
Referenced by WXP::ContPlot::init(), WXP::Figure::init(), WXP::GridPlot::init(), WXP::MapPlot::init(), WXP::MosPlot::init(), WXP::SatPlot::init(), WXP::SatUniFile::init(), WXP::SfcPlot::init(), WXP::ThermPlot::init(), WXP::UpaPlot::init(), init(), String(), String(), and String().
int String::init | ( | int | length | ) |
int String::length | ( | ) |
Gets length of string
len | Length of string |
Referenced by WXP::FileTool::addPathDelim(), WXP::ResrcDB::create(), WXP::DateTool::createLabel(), WXP::ResrcDB::decodeProgramName(), WXP::VarName::get(), WXP::ResrcEnv::get(), WXP::WxTool::getTextFromWeather(), init(), WXP::Filename::listFile(), resize(), WXP::NameConv::set(), and String().
int String::lowCase | ( | ) |
Converts the string to lower case
Referenced by WXP::ResrcDB::decodeProgramName(), and WXP::ResrcFile::get().
int String::maxLength | ( | ) |
Gets the maximum length of the allocated string
int String::occurs | ( | char | ch | ) |
Returns the number of times a character occurs within string
ch | Character to search for |
Referenced by WXP::Figure::endPlot(), WXP::GridPlot::getLoopType(), WXP::ImagePlot::getLoopType(), and WXP::GridPlot::getNumFrames().
int String::print | ( | ) |
Prints the class values to standard output
int String::printf | ( | const char * | fmt, |
... | |||
) |
Formats data into character string like sprintf
fmt | Sprintf format |
... | Additional parameters to sprintf |
Referenced by WXP::Unit::change(), WXP::DateTool::createHourLabel(), WXP::ProfPlot::draw(), WXP::UpaXSectCont::draw(), WXP::UpaXSectPlot::draw(), WXP::ResrcEnv::get(), WXP::XWindow::getDevice(), WXP::SfcData::outString(), WXP::Unit::scale(), WXP::ForeTime::toString(), WXP::ForeTime::toTimeLabel(), WXP::ForeTime::toTimeLabel(), WXP::ForeTime::toTimeLabelDay(), and WXP::ForeTime::toVarLabel().
int String::replace | ( | char | tar, |
char | rep | ||
) |
Replaces characters in a string
tar | Target character to replace |
rep | The character to replace with |
int String::reset | ( | ) |
Resets string data
int String::resize | ( | ) |
int String::resize | ( | int | length | ) |
Resizes the string by changing maximum length of allocated data
length | New length of string data |
References length().
int String::rewind | ( | ) |
Rewinds internal data pointer
int String::scanf | ( | const char * | fmt, |
... | |||
) |
Does a sscanf on the string
fmt | Scanf format |
... | Additional parameters for sscanf |
Referenced by WXP::Region::get(), WXP::ResrcFile::get(), WXP::Menu::prompt(), WXP::ColorFile::readFile(), and WXP::NameConv::set().
int String::scanp | ( | const char * | fmt, |
... | |||
) |
Does a parsing scan on the string
fmt | Scanf format |
... | Additional parameters for sscanf |
int String::set | ( | const char * | str | ) |
Sets the content of string
str | String to set content to |
References copy().
Referenced by WXP::Filename::checkFile(), WXP::DateTool::createLabel(), WXP::DateTool::createLabel(), WXP::DateTool::createLabel(), WXP::VarName::get(), WXP::ModelName::get(), WXP::AreaFile::getComment(), WXP::GridCont::init(), WXP::GridPlot::init(), WXP::ImagePlot::init(), WXP::MdrPlot::init(), WXP::MeteoPlot::init(), WXP::MiscPlot::init(), WXP::NidsPlot::init(), WXP::RcmPlot::init(), WXP::ThermPlot::init(), WXP::VarName::makeLabel(), operator=(), WXP::SfcData::outString(), WXP::Unit::parse(), WXP::ResrcFile::parseName(), WXP::Prog::prompt(), WXP::Menu::prompt(), WXP::Prog::prompt(), WXP::Filename::set(), WXP::Filename::set(), WXP::Filename::set(), WXP::Message::set(), WXP::MapPlot::setColor(), WXP::HurPlot::setColor(), WXP::LightPlot::setColor(), WXP::MdrPlot::setColor(), WXP::MosPlot::setColor(), WXP::NidsPlot::setColor(), WXP::RcmPlot::setColor(), WXP::RedbookPlot::setColor(), WXP::VectPlot::setColor(), WXP::WarnPlot::setColor(), WXP::WatchPlot::setColor(), WXP::ContPlot::setColorFill(), WXP::DatumPlot::setColorFill(), WXP::GridPlot::setColorFill(), WXP::ImagePlot::setColorFill(), WXP::Lev2Plot::setColorFill(), WXP::LightPlot::setColorFill(), WXP::MdrPlot::setColorFill(), WXP::NidsPlot::setColorFill(), WXP::RadPlot::setColorFill(), WXP::RcmPlot::setColorFill(), WXP::SatPlot::setColorFill(), WXP::VectPlot::setColorFill(), WXP::ContPlot::setColorLabel(), WXP::MapPlot::setColorLatLon(), WXP::ContPlot::setColorLine(), WXP::MapPlot::setColorLine(), WXP::ContPlot::setColorTable(), WXP::DatumPlot::setColorTable(), WXP::GridPlot::setColorTable(), WXP::HurPlot::setColorTable(), WXP::ImagePlot::setColorTable(), WXP::Lev2Plot::setColorTable(), WXP::LightPlot::setColorTable(), WXP::MapPlot::setColorTable(), WXP::MdrPlot::setColorTable(), WXP::MosPlot::setColorTable(), WXP::NidsPlot::setColorTable(), WXP::RadPlot::setColorTable(), WXP::RcmPlot::setColorTable(), WXP::RedbookPlot::setColorTable(), WXP::SatPlot::setColorTable(), WXP::VectPlot::setColorTable(), WXP::WarnPlot::setColorTable(), WXP::WatchPlot::setColorTable(), WXP::Filename::setFile(), WXP::Filename::setFile(), WXP::Filename::setFile(), WXP::Filename::setFile(), WXP::CityPlot::setFilename(), WXP::CityPlot::setFilename(), WXP::GridPlot::setForeTime(), WXP::ImagePlot::setForeTime(), WXP::MosPlot::setForeTime(), WXP::MosRaw::setForeTime(), WXP::SoundPlot::setForeTime(), WXP::Filename::setHeader(), WXP::Plot::setLabelColor(), WXP::UpaPlot::setLevel(), WXP::UpaRaw::setLevel(), WXP::WmoIngest::setLogFile(), WXP::MapPlot::setMapFiles(), WXP::Filename::setName(), WXP::SfcPlot::setOutput(), WXP::Figure::setParam(), WXP::GridCont::setParam(), WXP::GridPlot::setParam(), WXP::ImagePlot::setParam(), WXP::MiscPlot::setParam(), WXP::MosPlot::setParam(), WXP::RadPlot::setParam(), WXP::SatPlot::setParam(), WXP::SfcPlot::setParam(), WXP::UpaPlot::setParam(), WXP::NameConv::setPath(), WXP::WmoIngest::setProdFile(), WXP::GridPlot::setVariable(), WXP::MdrPlot::setVariable(), WXP::MosPlot::setVariable(), WXP::MosRaw::setVariable(), WXP::NidsPlot::setVariable(), WXP::RcmPlot::setVariable(), WXP::SfcPlot::setVariable(), WXP::SfcRaw::setVariable(), WXP::UpaPlot::setVariable(), WXP::UpaRaw::setVariable(), WXP::Unit::simplify(), String(), WXP::VarSpec::toInfoLabel(), WXP::MosData::weather12(), and WXP::MosData::weather6().
int String::set | ( | const String & | string | ) |
int String::stripWS | ( | ) |
Strips all white space characters from the string
Referenced by WXP::VarFile::read().
int String::trimWS | ( | ) |
Trims whitespace characters off the end of the string
Referenced by WXP::ColorFile::readFile().
int String::trunc | ( | int | num | ) |
Truncates string to num characters.
num | Number of characters for the string to contain. If less than 0, num is offset from length of string |
Referenced by WXP::ResrcDB::decodeProgramName(), and WXP::ResrcFile::get().
int String::upCase | ( | ) |
Converts the string to upper case
Referenced by WXP::ResrcEnv::get().
bool String::valid | ( | ) |
Does the string contain data (length > 0)
Referenced by WXP::MosRaw::compute(), WXP::SfcRaw::compute(), WXP::UpaRaw::compute(), WXP::GridCont::draw(), WXP::GridPlot::draw(), WXP::HurPlot::draw(), WXP::ImagePlot::draw(), WXP::Lev2Plot::draw(), WXP::LightPlot::draw(), WXP::MapPlot::draw(), WXP::MosPlot::draw(), WXP::NidsPlot::draw(), WXP::RadPlot::draw(), WXP::RawPlot::draw(), WXP::RcmPlot::draw(), WXP::SatPlot::draw(), WXP::SoundPlot::draw(), WXP::WarnPlot::draw(), WXP::WatchPlot::draw(), WXP::DatumPlot::draw(), WXP::VectPlot::draw(), WXP::NidsPlot::drawData(), WXP::ContPlot::drawFill(), WXP::ImagePlot::drawImage(), WXP::VectPlot::drawLabels(), WXP::ContPlot::drawLine(), WXP::ContPlot::drawLineLabels(), WXP::ContPlot::drawMaxMin(), WXP::VectPlot::drawStreamline(), WXP::ContPlot::drawValues(), WXP::NameConv::encode(), WXP::Figure::endPlot(), WXP::GribFile::makeInfo(), WXP::AreaFile::readData(), WXP::SatUniFile::readHeader(), WXP::VarSpec::toInfoLabel(), and WXP::Filename::validHeader().