Shinya Kitaoka 810553
#pragma once
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
Shinya Kitaoka 120a6e
#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 9eb50d
DVAPI std::string to_string(double v, int prec);
Shinya Kitaoka 9eb50d
DVAPI std::string to_string(std::wstring s);
Shinya Kitaoka 9eb50d
DVAPI std::string to_string(const TFilePath &fp);
Shinya Kitaoka 120a6e
DVAPI std::string to_string(void *p);
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 9eb50d
DVAPI std::wstring to_wstring(std::string s);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
inline bool fromStr(int &v, std::string s) {
Shinya Kitaoka 120a6e
  if (isInt(s)) {
Shinya Kitaoka 120a6e
    v = std::stoi(s);
Shinya Kitaoka 120a6e
    return true;
Shinya Kitaoka 120a6e
  } else
Shinya Kitaoka 120a6e
    return false;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
inline bool fromStr(double &v, std::string s) {
Shinya Kitaoka 120a6e
  if (isDouble(s)) {
Shinya Kitaoka 120a6e
    v = std::stod(s);
Shinya Kitaoka 120a6e
    return true;
Shinya Kitaoka 120a6e
  } else
Shinya Kitaoka 120a6e
    return false;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
inline bool fromStr(std::string &out, std::string s) {
Shinya Kitaoka 120a6e
  out = s;
Shinya Kitaoka 120a6e
  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
Shinya Kitaoka 120a6e
inline bool fromStr(int &v, QString s) {
Shinya Kitaoka 120a6e
  bool ret;
Shinya Kitaoka 120a6e
  v = s.toInt(&ret);
Shinya Kitaoka 120a6e
  return ret;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
inline bool fromStr(double &v, QString s) {
Shinya Kitaoka 120a6e
  bool ret;
Shinya Kitaoka 120a6e
  v = s.toDouble(&ret);
Shinya Kitaoka 120a6e
  return ret;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif