Switched the implementation of intValue() and fpValue() to the .cpp file

from the .h file. This also fixes a compile problem a user had involving
a header file (that wasn't in the .h file but was in the .cpp file).
This commit is contained in:
Harry Moffat 2008-04-15 15:28:53 +00:00
parent aee97e5f8b
commit 58ddc135eb
2 changed files with 54 additions and 32 deletions

View file

@ -227,7 +227,14 @@ namespace Cantera {
return file;
}
int intValue(std::string val) {
return std::atoi(stripws(val).c_str());
}
doublereal fpValue(std::string val) {
return std::atof(stripws(val).c_str());
}
/**
* Generate a logfile name based on an input file name
*/

View file

@ -14,43 +14,58 @@
namespace Cantera {
class Phase;
class ThermoPhase;
class Phase;
class ThermoPhase;
std::string fp2str(double x, std::string fmt);
std::string fp2str(double x, std::string fmt);
//! Convert a double into a c++ string
/*!
* The default format to use is equivalent to the default
* format used by printf's %g formatting.
*
* @param x double to be converted
*/
std::string fp2str(double x);
std::string int2str(int n, std::string fmt);
std::string int2str(int n);
std::string stripws(std::string s);
std::string stripnonprint(std::string s);
std::string lowercase(std::string s);
void parseCompString(const std::string ss, compositionMap& x);
void split(const std::string ss, std::vector<std::string>& w);
int fillArrayFromString(const std::string& str, doublereal* a, char delim = ' ');
std::string report(const ThermoPhase& th, bool show_thermo = true);
std::string formatCompList(const Phase& mix, int xyc);
std::string logfileName(const std::string& infile);
std::string getFileName(const std::string& path);
//! Convert a double into a c++ string
/*!
* The default format to use is equivalent to the default
* format used by printf's %g formatting.
*
* @param x double to be converted
*/
std::string fp2str(double x);
std::string int2str(int n, std::string fmt);
std::string int2str(int n);
std::string stripws(std::string s);
std::string stripnonprint(std::string s);
std::string lowercase(std::string s);
void parseCompString(const std::string ss, compositionMap& x);
void split(const std::string ss, std::vector<std::string>& w);
int fillArrayFromString(const std::string& str, doublereal* a, char delim = ' ');
std::string report(const ThermoPhase& th, bool show_thermo = true);
std::string formatCompList(const Phase& mix, int xyc);
std::string logfileName(const std::string& infile);
std::string getFileName(const std::string& path);
inline int intValue(std::string val) {
return std::atoi(stripws(val).c_str());
}
//! Translate a string into one integer value
/*!
* No error checking is done on the conversion. The c stdlib function
* atoi() is used.
*
* @param val String value of the integer
*
* @return Returns an integer
*/
int intValue(std::string val);
inline doublereal fpValue(std::string val) {
return std::atof(stripws(val).c_str());
}
std::string wrapString(const std::string& s, int len=70);
//! Translate a string into one doublereal value
/*!
* No error checking is done on the conversion. The c stdlib function
* atof() is used.
*
* @param val String value of the double
*
* @return Returns a doublereal value
*/
doublereal fpValue(std::string val);
int stripLTWScstring(char str[]);
double atofCheck(const char *dptr);
std::string wrapString(const std::string& s, int len=70);
int stripLTWScstring(char str[]);
double atofCheck(const char *dptr);
}