|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef TCONVERT_INCLUDED
|
|
Toshihiro Shimizu |
890ddd |
#define TCONVERT_INCLUDED
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "tcommon.h"
|
|
Toshihiro Shimizu |
890ddd |
class TFilePath;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// Nota: il file tconvert.cpp esiste gia' in rop.
|
|
Toshihiro Shimizu |
890ddd |
// l'implementazione di queste funzioni si trova in tstring.cpp
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#undef DVAPI
|
|
Toshihiro Shimizu |
890ddd |
#ifdef TNZCORE_EXPORTS //TNZCORE_DLL
|
|
Toshihiro Shimizu |
890ddd |
#define DVAPI DV_EXPORT_API
|
|
Toshihiro Shimizu |
890ddd |
#else
|
|
Toshihiro Shimizu |
890ddd |
#define DVAPI DV_IMPORT_API
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
DVAPI bool isInt(string s);
|
|
Toshihiro Shimizu |
890ddd |
DVAPI bool isDouble(string s);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
DVAPI string toString(int v);
|
|
Toshihiro Shimizu |
890ddd |
DVAPI string toString(unsigned long v);
|
|
Toshihiro Shimizu |
890ddd |
DVAPI string toString(unsigned long long v);
|
|
Toshihiro Shimizu |
890ddd |
DVAPI string toString(double v, int prec = -1);
|
|
Toshihiro Shimizu |
890ddd |
DVAPI string toString(wstring s);
|
|
Toshihiro Shimizu |
890ddd |
DVAPI string toString(const TFilePath &fp);
|
|
Toshihiro Shimizu |
890ddd |
DVAPI string toString(void *p);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
DVAPI int toInt(string s);
|
|
Toshihiro Shimizu |
890ddd |
DVAPI double toDouble(string s);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
DVAPI bool isInt(wstring s);
|
|
Toshihiro Shimizu |
890ddd |
DVAPI bool isDouble(wstring s);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
DVAPI wstring toWideString(string s);
|
|
Toshihiro Shimizu |
890ddd |
DVAPI wstring toWideString(int v);
|
|
Toshihiro Shimizu |
890ddd |
DVAPI wstring toWideString(double v, int prec = -1);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
DVAPI int toInt(wstring s);
|
|
Toshihiro Shimizu |
890ddd |
DVAPI double toDouble(wstring s);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
inline bool fromStr(int &v, string s)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (isInt(s)) {
|
|
Toshihiro Shimizu |
890ddd |
v = toInt(s);
|
|
Toshihiro Shimizu |
890ddd |
return true;
|
|
Toshihiro Shimizu |
890ddd |
} else
|
|
Toshihiro Shimizu |
890ddd |
return false;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
inline bool fromStr(double &v, string s)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (isDouble(s)) {
|
|
Toshihiro Shimizu |
890ddd |
v = toDouble(s);
|
|
Toshihiro Shimizu |
890ddd |
return true;
|
|
Toshihiro Shimizu |
890ddd |
} else
|
|
Toshihiro Shimizu |
890ddd |
return false;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
inline bool fromStr(string &out, string s)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
out = s;
|
|
Toshihiro Shimizu |
890ddd |
return true;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
DVAPI string toUpper(string a);
|
|
Toshihiro Shimizu |
890ddd |
DVAPI string toLower(string a);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
DVAPI wstring toUpper(wstring a);
|
|
Toshihiro Shimizu |
890ddd |
DVAPI wstring toLower(wstring a);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef TNZCORE_LIGHT
|
|
Campbell Barton |
d0e335 |
#include <qstring></qstring>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
inline bool fromStr(int &v, QString s)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
bool ret;
|
|
Toshihiro Shimizu |
890ddd |
v = s.toInt(&ret);
|
|
Toshihiro Shimizu |
890ddd |
return ret;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
inline bool fromStr(double &v, QString s)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
bool ret;
|
|
Toshihiro Shimizu |
890ddd |
v = s.toDouble(&ret);
|
|
Toshihiro Shimizu |
890ddd |
return ret;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif
|