3Depict
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Functions
stringFuncs.h File Reference
#include <string>
#include <vector>
Include dependency graph for stringFuncs.h:
This graph shows which files directly or indirectly include this file:

Functions

bool genRandomFilename (std::string &s, bool timerInitRand=true)
 
std::string boolStrEnc (bool b)
 
bool boolStrDec (const std::string &s, bool &result)
 
void ucharToHexStr (unsigned char c, std::string &s)
 
void hexStrToUChar (const std::string &s, unsigned char &c)
 
std::string choiceString (std::vector< std::pair< unsigned int, std::string > > comboString, unsigned int curChoice)
 Generate string that can be parsed by wxPropertyGrid for combo control. More...
 
void choiceStringToVector (const std::string &str, std::vector< std::string > &choices, unsigned int &selected)
 
std::string digitString (unsigned int thisDigit, unsigned int maxDigit)
 Generate a string with leading digits up to maxDigit (eg, if maxDigit is 424, and thisDigit is 1. More...
 
std::string getActiveChoice (const std::string &choiceString)
 Returns Choice from string (see choiceString(...) for string format) More...
 
std::string stripWhite (const std::string &str)
 Strip whitespace, (eg tab,space) from either side of a string. More...
 
std::string stripChars (const std::string &Str, const char *chars)
 
std::string lowercase (std::string s)
 Return a lowercase version for a given string. More...
 
std::string uppercase (std::string s)
 Return a uppercase version for a given string. More...
 
void stripZeroEntries (std::vector< std::string > &s)
 
bool isVersionNumberString (const std::string &s)
 
std::string getMaxVerStr (const std::vector< std::string > &verStrings)
 Retrieve the maximum version string from a list of version strings. More...
 
unsigned int getVersionNumber (unsigned int major, unsigned int minor, unsigned int revision)
 
bool parseVersion (const std::string &s, unsigned int &version)
 
void splitStrsRef (const char *cpStr, const char delim, std::vector< std::string > &v)
 Split string references using a single delimiter. More...
 
void splitStrsRef (const char *cpStr, const char *delim, std::vector< std::string > &v)
 Split string references using any of a given string of delimiters. More...
 
void splitFileData (const std::string &filenameWithPath, std::string &path, std::string &basename, std::string &extension)
 Split the file into three parts, base path, base name and file extension. More...
 
std::string onlyFilename (const std::string &path)
 Return only the filename component. More...
 
std::string onlyDir (const std::string &path)
 Return only the directory name component of the full path. More...
 
std::string convertFileStringToNative (const std::string &s)
 Convert a path format into a native path from unix format. More...
 
std::string convertFileStringToCanonical (const std::string &s)
 Convert a path format into a unix path from native format. More...
 
std::string tabs (unsigned int nTabs)
 
std::string stlWStrToStlStr (const std::wstring &s)
 
std::wstring stlStrToStlWStr (const std::string &s)
 

Function Documentation

◆ boolStrDec()

bool boolStrDec ( const std::string &  s,
bool &  result 
)

◆ boolStrEnc()

std::string boolStrEnc ( bool  b)

◆ choiceString()

std::string choiceString ( std::vector< std::pair< unsigned int, std::string > >  comboString,
unsigned int  curChoice 
)

Generate string that can be parsed by wxPropertyGrid for combo control.

◆ choiceStringToVector()

void choiceStringToVector ( const std::string &  str,
std::vector< std::string > &  choices,
unsigned int &  selected 
)

◆ convertFileStringToCanonical()

std::string convertFileStringToCanonical ( const std::string &  s)

Convert a path format into a unix path from native format.

Referenced by ExternalProgramFilter::writeState(), RangeFileFilter::writeState(), DataLoadFilter::writeState(), and SpatialAnalysisFilter::writeState().

Here is the caller graph for this function:

◆ convertFileStringToNative()

std::string convertFileStringToNative ( const std::string &  s)

Convert a path format into a native path from unix format.

Referenced by RangeFileFilter::readState(), DataLoadFilter::readState(), and SpatialAnalysisFilter::readState().

Here is the caller graph for this function:

◆ digitString()

std::string digitString ( unsigned int  thisDigit,
unsigned int  maxDigit 
)

Generate a string with leading digits up to maxDigit (eg, if maxDigit is 424, and thisDigit is 1.

References stream_cast().

Referenced by BasicGLPane::saveImageSequence().

Here is the caller graph for this function:

◆ genRandomFilename()

bool genRandomFilename ( std::string &  s,
bool  timerInitRand = true 
)

◆ getActiveChoice()

std::string getActiveChoice ( const std::string &  choiceString)

Returns Choice from string (see choiceString(...) for string format)

Returns Choice from string (see choiceString(...) for string format)

References ASSERT, splitStrsRef(), and stream_cast().

◆ getMaxVerStr()

std::string getMaxVerStr ( const std::vector< std::string > &  verStrings)

Retrieve the maximum version string from a list of version strings.

References parseVersion().

Referenced by choiceStringToVector(), VersionCheckThread::Entry(), MainWindowFrame::OnCheckUpdatesThread(), and AnalysisState::save().

Here is the caller graph for this function:

◆ getVersionNumber()

unsigned int getVersionNumber ( unsigned int  major,
unsigned int  minor,
unsigned int  revision 
)

References ASSERT.

Referenced by IonColourFilter::readState().

Here is the caller graph for this function:

◆ hexStrToUChar()

void hexStrToUChar ( const std::string &  s,
unsigned char &  c 
)

References ASSERT.

Referenced by ColourRGBA::parse().

Here is the caller graph for this function:

◆ isVersionNumberString()

bool isVersionNumberString ( const std::string &  s)

Referenced by VersionCheckThread::Entry(), and parseVersion().

Here is the caller graph for this function:

◆ lowercase()

std::string lowercase ( std::string  s)

Return a lowercase version for a given string.

Referenced by RangeFile::detectFileType(), MainWindowFrame::guessFileType(), MainWindowFrame::OnFileExportPlot(), and MainWindowFrame::OnFileSaveAs().

Here is the caller graph for this function:

◆ onlyDir()

std::string onlyDir ( const std::string &  path)

Return only the directory name component of the full path.

Referenced by AnalysisState::save(), and splitFileData().

Here is the caller graph for this function:

◆ onlyFilename()

std::string onlyFilename ( const std::string &  path)

Return only the filename component.

Referenced by ExternalProgramFilter::refresh(), FilterTree::saveXML(), and splitFileData().

Here is the caller graph for this function:

◆ parseVersion()

bool parseVersion ( const std::string &  s,
unsigned int &  version 
)

References isVersionNumberString(), splitStrsRef(), and stream_cast().

Referenced by getMaxVerStr(), and AnalysisState::save().

Here is the caller graph for this function:

◆ splitFileData()

void splitFileData ( const std::string &  filenameWithPath,
std::string &  path,
std::string &  basename,
std::string &  extension 
)

Split the file into three parts, base path, base name and file extension.

References onlyDir(), and onlyFilename().

Referenced by choiceStringToVector(), and FilterTree::saveXML().

Here is the caller graph for this function:

◆ splitStrsRef() [1/2]

void splitStrsRef ( const char *  cpStr,
const char  delim,
std::vector< std::string > &  v 
)

◆ splitStrsRef() [2/2]

void splitStrsRef ( const char *  cpStr,
const char *  delim,
std::vector< std::string > &  v 
)

Split string references using any of a given string of delimiters.

◆ stlStrToStlWStr()

std::wstring stlStrToStlWStr ( const std::string &  s)
inline

◆ stlWStrToStlStr()

std::string stlWStrToStlStr ( const std::wstring &  s)
inline

◆ stripChars()

std::string stripChars ( const std::string &  Str,
const char *  chars 
)

Referenced by RangeFile::detectFileType(), and stripWhite().

Here is the caller graph for this function:

◆ stripWhite()

std::string stripWhite ( const std::string &  str)

◆ stripZeroEntries()

void stripZeroEntries ( std::vector< std::string > &  s)

Referenced by RangeFile::detectFileType(), limitLoadTextFile(), loadTextData(), and loadTextStringData().

Here is the caller graph for this function:

◆ tabs()

std::string tabs ( unsigned int  nTabs)
inline

◆ ucharToHexStr()

void ucharToHexStr ( unsigned char  c,
std::string &  s 
)

Referenced by ColourRGBA::rgbaString(), and ColourRGBA::rgbString().

Here is the caller graph for this function:

◆ uppercase()

std::string uppercase ( std::string  s)

Return a uppercase version for a given string.

Referenced by mglColourCode().

Here is the caller graph for this function: