Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

CppTools.cpp File Reference

#include <ImLib3D/CppTools.hpp>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdexcept>
#include <map>
#include <errno.h>
#include <iterator>

Include dependency graph for CppTools.cpp:

Go to the source code of this file.

Functions

void FatalError (const string &message="")
 Throws an exception or seg faults after an error.
string TypeNameParser (string typeName)
 will parse the string returned by typeid, and try to build something portable (very random!!)
ErrorManagementType errorManagementType (ERROR_USE_EXCEPTIONS)
void SetErrorManagementType (ErrorManagementType _errorManagementType, void(*_ErrorHandler)(string))
 Change the error management policy, default is ERROR_SEGFAULT (good for debuging).
void ThrowErrorVA (const char *fmt,...)
 A Fatal error occured, print a message and fail.
vector< string > Strings (string s1, string s2, string s3, string s4, string s5, string s6, string s7, string s8, string s9, string s10)
vector< string > Strings (string s1, string s2, string s3, string s4, string s5, string s6, string s7, string s8, string s9)
vector< string > Strings (string s1, string s2, string s3, string s4, string s5, string s6, string s7, string s8)
vector< string > Strings (string s1, string s2, string s3, string s4, string s5, string s6, string s7)
vector< string > Strings (string s1, string s2, string s3, string s4, string s5, string s6)
vector< string > Strings (string s1, string s2, string s3, string s4, string s5)
vector< string > Strings (string s1, string s2, string s3, string s4)
vector< string > Strings (string s1, string s2, string s3)
vector< string > Strings (string s1, string s2)
vector< string > Strings (string s1)
vector< string > Strings ()
string SPrintfVA (const char *fmt,...)
 Create a string using mprintf vararg format.
bool FileIsMoreRecent (const string &filename1, const string &filename2)
 compares mtimes (modif times) of two files
bool IsSameFile (string filename1, string filename2)
 checks if two files are identical, really the same file... same inode
string WriteTmpFile (const string &data)
 Write data into a temp file who's name is returned.
void WriteStringToFile (const string &fname, const string &data)
 Write data into a file.
void RemoveFile (string fname)
 Unix rm commands.
void RemoveFiles (const vector< string > &fnames)
int Split (const string &s, char c, vector< string > &res)
 Split string s into result res. separator is c.
int Split (const string &s, const string &sep, vector< string > &res)
 Split string s into result res. separator is sep.
void Replace (string &res, const string &s1, const string &s2)
 Replace s1 by s2 in res.
int FileSize (const string &fname)
 returns the size of a file (-1 on fail)
void AppendToFile (const string &fname, const string &data)
 Adds a string at the end of a file.
string FindFileInPath (const string &path, const string &fname)
string FindFileInPath (const vector< string > &path, const string &fname)
string Command (const string &cmd)
 execute a command and put it's output in string
int Read (const string &fname, string &res, bool fail)
 Read file into string.
void * Read (const string &fname, int *rsize, bool fail)
 Read file into void *.
void Write (const string &fname, void *data, int size, bool fail)
 Write binary data into file.
string FilenameExtension (const string &fname)
 Returns the part of the string that comes after the last '.' symbol.
string FilenamePath (const string &fname)
 Returns the path of a unix filename: all that comes before and includes the last '/'-symbol.
string FilenameBasename (const string &fname)
 Returns all that comes after the last '/'-symbol.
ostream & operator<< (ostream &out, const vector< string > &v)
 Output stream operator for vector<string>.
string Chop (const string &s, char c)
 Chops the last part of a string s that comes after the separator c.
void GnuPlot (const vector< double > &x, const vector< double > &y, const string &xlabel, const string &ylabel)
void GnuPlot (const vector< double > &y, const string &ylabel)
void GnuPlot (const vector< float > &x0, const vector< float > &y0, const string &xlabel, const string &ylabel)
void GnuPlot (const vector< float > &y0, const string &ylabel)

Variables

void(* ErrorHandler )(string) = NULL
int globalVerbose = 1


Detailed Description

Definition in file CppTools.cpp.


Function Documentation

string TypeNameParser string  typeName  ) 
 

will parse the string returned by typeid, and try to build something portable (very random!!)

unmangling a name can be quite long, so results are cached...

Definition at line 38 of file CppTools.cpp.

References Command().

void Replace string &  res,
const string &  s1,
const string &  s2
 

Replace s1 by s2 in res.

(this should be done much more efficiently...)

Definition at line 355 of file CppTools.cpp.

Referenced by XMLBinaryFile::Quote(), Replace(), and XMLBinaryFile::UnQuote().

string FilenameExtension const string &  fname  ) 
 

Returns the part of the string that comes after the last '.' symbol.

If there is no '.' (dot), an empty string will be returned ("");

Definition at line 495 of file CppTools.cpp.

References Split().

ostream& operator<< ostream &  out,
const vector< string > &  v
 

Output stream operator for vector<string>.

<long-description> Each element of v will be outputed on a separate line

Parameters:
v.begin( 

Definition at line 535 of file CppTools.cpp.

string Chop const string &  s,
char  c
 

Chops the last part of a string s that comes after the separator c.

<long-description> returns chopped string including the c character, s remains untouched.

Parameters:
s 
c 
Returns:
<returnvalue>

Definition at line 550 of file CppTools.cpp.

References Split().


Generated on Fri Jun 17 13:36:13 2005 for ImLib3D by  doxygen 1.4.2