#include <PUtilities.h>
LoopTK but are generally intended for internal use.
Static Public Member Functions | |
| static void | copyFile (const string &newFileName, const string &fileToCopy) |
| static void | makeDirectory (const string &dirName) |
| static void | trimSpaces (string &str) |
| template<typename T> | |
| static string | toStr (const T &x) |
| static string | padLeft (const string &s, unsigned int len, char padChar= ' ') |
| static string | padRight (const string &s, unsigned int len, char padChar= ' ') |
| static vector< string > | getLinesStarting (const vector< string > &lines, const string &prefix, bool trimPrefix=false, const string &terminationCode="") |
| static vector< string > | getTokens (const string &curLine) |
| static vector< string > | getLinesStarting (const string &fileName, const string &prefix, bool trimPrefix=false, const string &terminationCode="") |
| static vector< string > | getLines (const string &fileName) |
| static void | appendToFile (const string &fileName, const string &line) |
| static void | AbortProgram (const string &message) |
| static const void * | PointerThatIsNot (const void *p1, const void *p2, const void *have) |
| template<typename T> | |
| static T ** | New2DArray (unsigned size) |
| template<typename T> | |
| static void | Delete2DArray (T **table, unsigned size) |
| void PUtilities::copyFile | ( | const string & | newFileName, | |
| const string & | fileToCopy | |||
| ) | [static] |
Copies fileToCopy to the output file newFileName.
| void PUtilities::makeDirectory | ( | const string & | dirName | ) | [static] |
Creates the directory specified by dirName. Aborts the program if the directory cannot be created.
| void PUtilities::trimSpaces | ( | string & | str | ) | [static] |
Removes leading and trailing spaces from str.
| static string PUtilities::toStr | ( | const T & | x | ) | [inline, static] |
Returns a string version of x if possible, i.e. if stringstream::operator<< supports objects of type T.
| string PUtilities::padLeft | ( | const string & | s, | |
| unsigned int | len, | |||
| char | padChar = ' ' | |||
| ) | [static] |
Left-pads s with padChar until its length is len.
| string PUtilities::padRight | ( | const string & | s, | |
| unsigned int | len, | |||
| char | padChar = ' ' | |||
| ) | [static] |
Right-pads s with padChar until its length is len.
| vector< string > PUtilities::getLinesStarting | ( | const vector< string > & | lines, | |
| const string & | prefix, | |||
| bool | trimPrefix = false, |
|||
| const string & | terminationCode = "" | |||
| ) | [static] |
Returns a vector of all lines in the specified vector beginning with the specified prefix.
Optionally, if trimPrefix == true, the lines in the resulting vector will have the prefix removed. Also, if terminationCode is not the empty string, parsing will stop immediately if a line beginning with terminationCode is found.
| vector< string > PUtilities::getTokens | ( | const string & | curLine | ) | [static] |
Returns a vector of all the tokens in the specified string.
| vector< string > PUtilities::getLinesStarting | ( | const string & | fileName, | |
| const string & | prefix, | |||
| bool | trimPrefix = false, |
|||
| const string & | terminationCode = "" | |||
| ) | [static] |
Returns a vector of all lines in the specified fileName beginning with the specified prefix.
Optionally, if trimPrefix == true, the lines in the resulting vector will have the prefix removed. Also, if terminationCode is not the empty string, parsing will stop immediately if a line beginning with terminationCode is found.
| vector< string > PUtilities::getLines | ( | const string & | fileName | ) | [static] |
Returns a vector of all lines in the specified file, regardless of prefix.
| void PUtilities::appendToFile | ( | const string & | fileName, | |
| const string & | line | |||
| ) | [static] |
Appends line to the file fileName.
| void PUtilities::AbortProgram | ( | const string & | message | ) | [static] |
Outputs message to stderr and immediately terminates execution of the program.
| const void * PUtilities::PointerThatIsNot | ( | const void * | p1, | |
| const void * | p2, | |||
| const void * | have | |||
| ) | [static] |
Returns p2 if p1 and have point to the same address; otherwise, returns p1.
| static T** PUtilities::New2DArray | ( | unsigned | size | ) | [inline, static] |
Creates a newly-allocated 2D table of T's with dimension size by size.
| static void PUtilities::Delete2DArray | ( | T ** | table, | |
| unsigned | size | |||
| ) | [inline, static] |
Deletes the 2D array table, freeing all dynamically-allocated memory associated with it.
1.5.1