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
Shinya Kitaoka 2148c8
DVAPI bool isInt(std::string s);
Shinya Kitaoka 2148c8
DVAPI bool isDouble(std::string s);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 2148c8
DVAPI std::string toString(int v);
Shinya Kitaoka 2148c8
DVAPI std::string toString(unsigned long v);
Shinya Kitaoka 2148c8
DVAPI std::string toString(unsigned long long v);
Shinya Kitaoka 2148c8
DVAPI std::string toString(double v, int prec = -1);
Shinya Kitaoka 3bfa54
DVAPI std::string toString(std::wstring s);
Shinya Kitaoka 2148c8
DVAPI std::string toString(const TFilePath &fp);
Shinya Kitaoka 2148c8
DVAPI std::string toString(void *p);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 2148c8
DVAPI int toInt(std::string s);
Shinya Kitaoka 2148c8
DVAPI double toDouble(std::string s);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 2148c8
DVAPI bool isInt(std::wstring s);
Shinya Kitaoka 2148c8
DVAPI bool isDouble(std::wstring s);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 2148c8
DVAPI std::wstring toWideString(std::string s);
Shinya Kitaoka 2148c8
DVAPI std::wstring toWideString(int v);
Shinya Kitaoka 2148c8
DVAPI std::wstring toWideString(double v, int prec = -1);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 2148c8
DVAPI int toInt(std::wstring s);
Shinya Kitaoka 2148c8
DVAPI double toDouble(std::wstring s);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 2148c8
inline bool fromStr(int &v, std::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
Shinya Kitaoka 2148c8
inline bool fromStr(double &v, std::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
Shinya Kitaoka 2148c8
inline bool fromStr(std::string &out, std::string s)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	out = s;
Toshihiro Shimizu 890ddd
	return true;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 2148c8
DVAPI std::string toUpper(std::string a);
Shinya Kitaoka 2148c8
DVAPI std::string toLower(std::string a);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 2148c8
DVAPI std::wstring toUpper(std::wstring a);
Shinya Kitaoka 2148c8
DVAPI std::wstring toLower(std::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