diff --git a/toonz/sources/colorfx/strokestyles.cpp b/toonz/sources/colorfx/strokestyles.cpp index da5ef91..1668d67 100644 --- a/toonz/sources/colorfx/strokestyles.cpp +++ b/toonz/sources/colorfx/strokestyles.cpp @@ -5900,7 +5900,7 @@ void OutlineViewerStyle::loadData(TInputStreamInterface &is) is >> m_enumPar; std::string str; is >> str; - m_pathPar = TFilePath(toWideString(str)); + m_pathPar = TFilePath(::to_wstring(str)); } //----------------------------------------------------------------------------- @@ -5916,7 +5916,7 @@ void OutlineViewerStyle::saveData(TOutputStreamInterface &os) const os << int(m_boolPar); os << m_intPar; os << m_enumPar; - os << toString(m_pathPar.getWideString()); + os << ::to_string(m_pathPar.getWideString()); } //----------------------------------------------------------------------------- diff --git a/toonz/sources/common/tapptools/tcli.cpp b/toonz/sources/common/tapptools/tcli.cpp index 6f4e0dd..691d375 100644 --- a/toonz/sources/common/tapptools/tcli.cpp +++ b/toonz/sources/common/tapptools/tcli.cpp @@ -86,7 +86,7 @@ void fetchElement(int &dst, int index, int &argc, char *argv[]) { string s = argv[index]; if (isInt(s)) - dst = toInt(s); + dst = std::stoi(s); else throw UsageError("expected int"); fetchElement(index, argc, argv); diff --git a/toonz/sources/common/tapptools/tenv.cpp b/toonz/sources/common/tapptools/tenv.cpp index 33c327b..f41fe41 100644 --- a/toonz/sources/common/tapptools/tenv.cpp +++ b/toonz/sources/common/tapptools/tenv.cpp @@ -23,16 +23,8 @@ TOfflineGL::Imp *MacOfflineGenerator1(const TDimension &dim) } #endif -//#include - -//#include -//#include - -//using namespace std; - #include -//#include -//#include +#include using namespace TEnv; @@ -113,7 +105,7 @@ public: std::cout << "varName:" << varName << " TOONZROOT not set..." << std::endl; return ""; } - return toString(systemVarPath); + return ::to_string(systemVarPath); /* char *value = getenv(varName.c_str()); if (!value) @@ -679,7 +671,7 @@ void fromString(std::string s, std::string &value) //------------------------------------------------------------------- -IntVar::IntVar(std::string name, int defValue) : Variable(name, toString(defValue)) {} +IntVar::IntVar(std::string name, int defValue) : Variable(name, std::to_string(defValue)) {} IntVar::IntVar(std::string name) : Variable(name) {} IntVar::operator int() const { @@ -687,11 +679,11 @@ IntVar::operator int() const fromString(getValue(), v); return v; } -void IntVar::operator=(int v) { assignValue(toString(v)); } +void IntVar::operator=(int v) { assignValue(std::to_string(v)); } //------------------------------------------------------------------- -DoubleVar::DoubleVar(std::string name, double defValue) : Variable(name, toString(defValue)) {} +DoubleVar::DoubleVar(std::string name, double defValue) : Variable(name, std::to_string(defValue)) {} DoubleVar::DoubleVar(std::string name) : Variable(name) {} DoubleVar::operator double() const { @@ -699,7 +691,7 @@ DoubleVar::operator double() const fromString(getValue(), v); return v; } -void DoubleVar::operator=(double v) { assignValue(toString(v)); } +void DoubleVar::operator=(double v) { assignValue(std::to_string(v)); } //------------------------------------------------------------------- @@ -715,7 +707,7 @@ void StringVar::operator=(const std::string &v) { assignValue(v); } //------------------------------------------------------------------- -FilePathVar::FilePathVar(std::string name, const TFilePath &defValue) : Variable(name, toString(defValue)) {} +FilePathVar::FilePathVar(std::string name, const TFilePath &defValue) : Variable(name, ::to_string(defValue)) {} FilePathVar::FilePathVar(std::string name) : Variable(name) {} FilePathVar::operator TFilePath() const { @@ -723,7 +715,7 @@ FilePathVar::operator TFilePath() const fromString(getValue(), v); return TFilePath(v); } -void FilePathVar::operator=(const TFilePath &v) { assignValue(toString(v)); } +void FilePathVar::operator=(const TFilePath &v) { assignValue(::to_string(v)); } //------------------------------------------------------------------- diff --git a/toonz/sources/common/tcache/timagecache.cpp b/toonz/sources/common/tcache/timagecache.cpp index 7871e0b..2ea1403 100644 --- a/toonz/sources/common/tcache/timagecache.cpp +++ b/toonz/sources/common/tcache/timagecache.cpp @@ -875,7 +875,7 @@ void TImageCache::Imp::doCompress() if (newItem->getSize() == 0) ///non c'era memoria sufficiente per il buffer compresso.... { assert(m_rootDir != TFilePath()); - TFilePath fp = m_rootDir + TFilePath(toString(TImageCache::Imp::m_fileid++)); + TFilePath fp = m_rootDir + TFilePath(std::to_string(TImageCache::Imp::m_fileid++)); newItem = new UncompressedOnDiskCacheItem(fp, item->getImage()); } m_compressedItems[id] = newItem; @@ -902,7 +902,7 @@ void TImageCache::Imp::doCompress() CompressedOnMemoryCacheItemP citem = itc->second; if (citem) { assert(m_rootDir != TFilePath()); - TFilePath fp = m_rootDir + TFilePath(toString(TImageCache::Imp::m_fileid++)); + TFilePath fp = m_rootDir + TFilePath(std::to_string(TImageCache::Imp::m_fileid++)); CacheItemP newItem = new CompressedOnDiskCacheItem(fp, citem->m_compressedRas, citem->m_builder->clone(), citem->m_imageInfo->clone()); @@ -964,7 +964,7 @@ void TImageCache::Imp::doCompress(std::string id) if (newItem->getSize() == 0) ///non c'era memoria sufficiente per il buffer compresso.... { assert(m_rootDir != TFilePath()); - TFilePath fp = m_rootDir + TFilePath(toString(TImageCache::Imp::m_fileid++)); + TFilePath fp = m_rootDir + TFilePath(std::to_string(TImageCache::Imp::m_fileid++)); newItem = new UncompressedOnDiskCacheItem(fp, item->getImage()); } m_compressedItems[id] = newItem; @@ -1037,7 +1037,7 @@ UCHAR *TImageCache::Imp::compressAndMalloc(TUINT32 size) //if (newItem->getSize()==0) // { assert(m_rootDir != TFilePath()); - TFilePath fp = m_rootDir + TFilePath(toString(TImageCache::Imp::m_fileid++)); + TFilePath fp = m_rootDir + TFilePath(std::to_string(TImageCache::Imp::m_fileid++)); newItem = new UncompressedOnDiskCacheItem(fp, item->getImage()); // } @@ -1072,7 +1072,7 @@ UCHAR *TImageCache::Imp::compressAndMalloc(TUINT32 size) CompressedOnMemoryCacheItemP citem = itc->second; if (citem) { assert(m_rootDir != TFilePath()); - TFilePath fp = m_rootDir + TFilePath(toString(TImageCache::Imp::m_fileid++)); + TFilePath fp = m_rootDir + TFilePath(std::to_string(TImageCache::Imp::m_fileid++)); CacheItemP newItem = new CompressedOnDiskCacheItem( fp, citem->m_compressedRas, @@ -1170,7 +1170,7 @@ void TImageCache::setRootDir(const TFilePath &cacheDir) if (m_imp->m_rootDir != TFilePath()) return; - m_imp->m_rootDir = cacheDir + TFilePath(toString(TSystem::getProcessId())); + m_imp->m_rootDir = cacheDir + TFilePath(std::to_string(TSystem::getProcessId())); #ifndef TNZCORE_LIGHT TFileStatus fs1(m_imp->m_rootDir); @@ -1955,17 +1955,17 @@ void TImageCache::Imp::outputMap(UINT chunkRequested, std::string filename) os << "************************************************************\n"; - os << "***requested memory: " + toString((int)chunkRequested / 1048576.0) + " MB\n"; - //os<<"*** memory in rasters: " + toString((int)TRaster::getTotalMemoryInKB()/1024.0) + " MB\n"; - //os<<"***virtualmem " + toString((int)currVirtualMemoryAvail) + " MB\n"; - os << "***phismem " + toString((int)currPhisMemoryAvail) + " MB; percent of tot:" + toString((int)((currPhisMemoryAvail * 100) / m_reservedMemory)) + "\n"; - //os<<"***bigmem available" + toString((int)TBigMemoryManager::instance()->getAvailableMemoryinKb()); - os << "***uncompressed NOT compressable(refcount>1) " + toString(umcount1) + " " + toString(umsize1 / 1024.0) + " MB\n"; - os << "***uncompressed NOT compressable(cantCompress) " + toString(umcount2) + " " + toString(umsize2 / 1024.0) + " MB\n"; - os << "***uncompressed compressable " + toString(umcount3) + " " + toString(umsize3 / 1024.0) + " MB\n"; - os << "***compressed on mem " + toString(cmcount) + " " + toString((int)cmsize / 1048576.0) + " MB\n"; - os << "***compressed on disk " + toString(cdcount) + " " + toString((int)cdsize / 1048576.0) + " MB\n"; - os << "***uncompressed on disk " + toString(udcount) + " " + toString((int)udsize / 1048576.0) + " MB\n"; + os << "***requested memory: " + std::to_string((int)chunkRequested / 1048576.0) + " MB\n"; + //os<<"*** memory in rasters: " + std::to_string((int)TRaster::getTotalMemoryInKB()/1024.0) + " MB\n"; + //os<<"***virtualmem " + std::to_string((int)currVirtualMemoryAvail) + " MB\n"; + os << "***phismem " + std::to_string((int)currPhisMemoryAvail) + " MB; percent of tot:" + std::to_string((int)((currPhisMemoryAvail * 100) / m_reservedMemory)) + "\n"; + //os<<"***bigmem available" + std::to_string((int)TBigMemoryManager::instance()->getAvailableMemoryinKb()); + os << "***uncompressed NOT compressable(refcount>1) " + std::to_string(umcount1) + " " + std::to_string(umsize1 / 1024.0) + " MB\n"; + os << "***uncompressed NOT compressable(cantCompress) " + std::to_string(umcount2) + " " + std::to_string(umsize2 / 1024.0) + " MB\n"; + os << "***uncompressed compressable " + std::to_string(umcount3) + " " + std::to_string(umsize3 / 1024.0) + " MB\n"; + os << "***compressed on mem " + std::to_string(cmcount) + " " + std::to_string((int)cmsize / 1048576.0) + " MB\n"; + os << "***compressed on disk " + std::to_string(cdcount) + " " + std::to_string((int)cdsize / 1048576.0) + " MB\n"; + os << "***uncompressed on disk " + std::to_string(udcount) + " " + std::to_string((int)udsize / 1048576.0) + " MB\n"; //TBigMemoryManager::instance()->printMap(); diff --git a/toonz/sources/common/tcore/tdata.cpp b/toonz/sources/common/tcore/tdata.cpp index 0d84c72..b131f52 100644 --- a/toonz/sources/common/tcore/tdata.cpp +++ b/toonz/sources/common/tcore/tdata.cpp @@ -6,7 +6,7 @@ DEFINE_CLASS_CODE(TData, 16) TTextData::TTextData(std::string text) - : m_text(toWideString(text)) + : m_text(::to_wstring(text)) { } diff --git a/toonz/sources/common/tcore/texception.cpp b/toonz/sources/common/tcore/texception.cpp index 4fccf77..539cc68 100644 --- a/toonz/sources/common/tcore/texception.cpp +++ b/toonz/sources/common/tcore/texception.cpp @@ -5,7 +5,7 @@ TException::TException(const std::string &msg) { - m_msg = toWideString(msg); + m_msg = ::to_wstring(msg); } /* ostream& operator<<(ostream &out, const TException &e) diff --git a/toonz/sources/common/tcore/tmathutil.cpp b/toonz/sources/common/tcore/tmathutil.cpp index 00c3a77..342520a 100644 --- a/toonz/sources/common/tcore/tmathutil.cpp +++ b/toonz/sources/common/tcore/tmathutil.cpp @@ -8,7 +8,7 @@ using TConsts::epsilon; TMathException::TMathException(std::string msg) - : m_msg(toWideString(msg)) + : m_msg(::to_wstring(msg)) { } diff --git a/toonz/sources/common/tcore/tstopwatch.cpp b/toonz/sources/common/tcore/tstopwatch.cpp index 420a741..5d7601f 100644 --- a/toonz/sources/common/tcore/tstopwatch.cpp +++ b/toonz/sources/common/tcore/tstopwatch.cpp @@ -2,6 +2,8 @@ #include "tstopwatch.h" +#include + #ifdef _WIN32 #include #else //_WIN32 diff --git a/toonz/sources/common/tcore/tstring.cpp b/toonz/sources/common/tcore/tstring.cpp index e1b0e00..fa123e6 100644 --- a/toonz/sources/common/tcore/tstring.cpp +++ b/toonz/sources/common/tcore/tstring.cpp @@ -13,6 +13,8 @@ #include "windows.h" #endif +#include + class TStringConvertException : public TException { std::string m_string; @@ -21,7 +23,7 @@ public: TStringConvertException(const std::string str) : m_string(str) {} }; -std::wstring toWideString(std::string s) +std::wstring to_wstring(std::string s) { #ifdef TNZCORE_LIGHT std::wstring ws; @@ -40,64 +42,26 @@ std::wstring toWideString(std::string s) #endif } -std::string toString(std::wstring ws) +std::string to_string(std::wstring ws) { #ifdef TNZCORE_LIGHT std::string s; s.assign(ws.begin(), ws.end()); return s; #else + QString const qString = QString::fromStdWString(ws); - QString qString = QString::fromStdWString(ws); - -// Test if 'ws' is not unicode (UTF-8) -#if 0 - if(qString.toAscii() == qString) -#else + // Test if 'ws' is not unicode (UTF-8) if (qString.toLatin1() == qString) -#endif - return qString.toStdString(); + return qString.toStdString(); - QByteArray a = qString.toUtf8(); - return std::string(a); + return std::string(qString.toUtf8()); #endif } -std::string toString(const TFilePath &fp) -{ - return toString(fp.getWideString()); -} - -std::wstring toWideString(int x) -{ - return toWideString(toString(x)); -} - -std::string toString(int value) -{ - std::ostrstream ss; - ss << value << '\0'; - std::string s = ss.str(); - ss.freeze(false); - return s; -} - -std::string toString(unsigned long value) -{ - std::ostrstream ss; - ss << value << '\0'; - std::string s = ss.str(); - ss.freeze(false); - return s; -} - -std::string toString(unsigned long long value) +std::string to_string(const TFilePath &fp) { - std::ostrstream ss; - ss << value << '\0'; - std::string s = ss.str(); - ss.freeze(false); - return s; + return ::to_string(fp.getWideString()); } /*! @@ -106,38 +70,24 @@ std::string toString(unsigned long long value) part, the remainder is not cut off but rounded. */ -std::string toString(double value, int prec) -{ - std::ostrstream ss; - ss.setf(std::ios_base::fixed, std::ios_base::floatfield); - if (prec >= 0) - ss.precision(prec); - ss << value << '\0'; - std::string s = ss.str(); - ss.freeze(0); - return s; -} - -std::string toString(void *p) +std::string to_string(double value, int prec) { - std::ostrstream ss; - ss << p << '\0'; - std::string s = ss.str(); - ss.freeze(false); - return s; -} + if (prec < 0) { + return std::to_string(value); + } -int toInt(std::string str) -{ - int value = 0; - for (int i = 0; i < (int)str.size(); i++) - value = value * 10 + str[i] - '0'; - return value; + std::ostringstream out; + out.setf(std::ios_base::fixed, std::ios_base::floatfield); + out.precision(prec); + out << value; + return out.str(); } -int toInt(std::wstring str) +std::string to_string(void* p) { - return toInt(toString(str)); + std::ostringstream out; + out << p; + return out.str(); } bool isInt(std::string s) @@ -183,26 +133,8 @@ bool isDouble(std::string s) return true; } -bool isInt(std::wstring s) { return isInt(toString(s)); } -bool isDouble(std::wstring s) { return isDouble(toString(s)); } - -double toDouble(std::string str) -{ - double value; - std::istrstream ss(str.c_str(), (std::streamsize)str.length()); - ss >> value; - return value; -} - -double toDouble(std::wstring str) -{ - return toDouble(toString(str)); -} - -std::wstring toWideString(double v, int p) -{ - return toWideString(toString(v, p)); -} +bool isInt(std::wstring s) { return isInt(::to_string(s)); } +bool isDouble(std::wstring s) { return isDouble(::to_string(s)); } std::string toUpper(std::string a) { diff --git a/toonz/sources/common/tfx/tcacheresource.cpp b/toonz/sources/common/tfx/tcacheresource.cpp index 5a1cc02..1996bcf 100644 --- a/toonz/sources/common/tfx/tcacheresource.cpp +++ b/toonz/sources/common/tfx/tcacheresource.cpp @@ -362,14 +362,14 @@ bool TCacheResource::checkTile(const TTile &tile) const inline std::string TCacheResource::getCellName(int idxX, int idxY) const { - return "cell" + toString(idxX) + "," + toString(idxY); + return "cell" + std::to_string(idxX) + "," + std::to_string(idxY); } //---------------------------------------------------------------- inline std::string TCacheResource::getCellCacheId(int idxX, int idxY) const { - return "TCacheResource" + toString(m_id) + getCellName(idxX, idxY); + return "TCacheResource" + std::to_string(m_id) + getCellName(idxX, idxY); } //---------------------------------------------------------------- diff --git a/toonz/sources/common/tfx/tmacrofx.cpp b/toonz/sources/common/tfx/tmacrofx.cpp index 04f0601..7113d8e 100644 --- a/toonz/sources/common/tfx/tmacrofx.cpp +++ b/toonz/sources/common/tfx/tmacrofx.cpp @@ -398,8 +398,8 @@ TMacroFx *TMacroFx::create(const std::vector &fxs) for (; k < count; k++) { TFxPort *port = fx->getInputPort(k); std::string portName = fx->getInputPortName(k); - std::string fxId = toString(fx->getFxId()); - portName += "_" + toString(macroFx->getInputPortCount()) + "_" + fxId; + std::string fxId = ::to_string(fx->getFxId()); + portName += "_" + std::to_string(macroFx->getInputPortCount()) + "_" + fxId; TFx *portFx = port->getFx(); if (portFx) { // se la porta k-esima del nodo di ingresso i-esimo e' collegata @@ -478,7 +478,7 @@ void TMacroFx::compatibilityTranslatePort(int major, int minor, std::string &por const std::string &fxId = portName.substr(portName.find_last_of('_') + 1, std::string::npos); - if (TFx *fx = getFxById(toWideString(fxId))) { + if (TFx *fx = getFxById(::to_wstring(fxId))) { size_t opnEnd = portName.find_first_of('_'); std::string originalPortName = portName.substr(0, opnEnd); @@ -533,7 +533,7 @@ void TMacroFx::loadData(TIStream &is) } else { name = is.getTagAttribute("name_inFx"); if (tnzVersion < VersionNumber(1, 17) && tnzVersion != VersionNumber(0, 0)) - name.insert(name.find("_"), "_" + toString(i)); + name.insert(name.find("_"), "_" + std::to_string(i)); compatibilityTranslatePort(tnzVersion.first, tnzVersion.second, name); @@ -545,7 +545,7 @@ void TMacroFx::loadData(TIStream &is) for (int i = 0; i < (int)m_fxs.size(); i++) { std::wstring fxId = m_fxs[i]->getFxId(); - if (fxId == toWideString(inFxId)) { + if (fxId == ::to_wstring(inFxId)) { if (TFxPort *port = m_fxs[i]->getInputPort(inPortName)) addInputPort(name, *port); } diff --git a/toonz/sources/common/tfx/tpassivecachemanager.cpp b/toonz/sources/common/tfx/tpassivecachemanager.cpp index 9028bef..805c66e 100644 --- a/toonz/sources/common/tfx/tpassivecachemanager.cpp +++ b/toonz/sources/common/tfx/tpassivecachemanager.cpp @@ -94,38 +94,6 @@ CONSIDERATIONS: */ //***************************************************************************************** -// Debug stuff -//***************************************************************************************** - -/* -#define DIAGNOSTICS -#include "diagnostics.h" - -namespace -{ - QString prefix("#Passive.txt | STACK | "); - - //-------------------------------------------------------------------------------------------------- - - inline std::string traduce(const TRectD& rect) - { - return "[" + toString(rect.x0) + " " + toString(rect.y0) + " " + - toString(rect.x1) + " " + toString(rect.y1) + "]"; - } - - //-------------------------------------------------------------------------------------------------- - - inline std::string traduce(const TAffine& aff) - { - return "(" + - toString(aff.a11) + " " + toString(aff.a12) + " " + - toString(aff.a13) + " " + toString(aff.a21) + " " + - toString(aff.a22) + " " + toString(aff.a23) + ")"; - } -} -*/ - -//***************************************************************************************** // Preliminaries //***************************************************************************************** @@ -512,7 +480,7 @@ void TPassiveCacheManager::setContextName(unsigned long renderId, const std::str it = m_contextNames.insert(std::make_pair(name, 0)).first; it->second = !it->second; - m_contextNamesByRenderId.insert(std::make_pair(renderId, name + "%" + ::toString(it->second))); + m_contextNamesByRenderId.insert(std::make_pair(renderId, name + "%" + std::to_string(it->second))); } //------------------------------------------------------------------------- diff --git a/toonz/sources/common/tfx/ttzpimagefx.cpp b/toonz/sources/common/tfx/ttzpimagefx.cpp index 4407d7e..33fbc1c 100644 --- a/toonz/sources/common/tfx/ttzpimagefx.cpp +++ b/toonz/sources/common/tfx/ttzpimagefx.cpp @@ -49,13 +49,13 @@ void insertIndexes(std::vector items, PaletteFilterFxRenderData *t) endtoken = strtok_s(NULL, subseps, &context); if (!endtoken && isInt(starttoken)) { int index; - index = toInt(starttoken); + index = std::stoi(starttoken); t->m_colors.insert(index); } else { if (isInt(starttoken) && isInt(endtoken)) { int start, end; - start = toInt(starttoken); - end = toInt(endtoken); + start = std::stoi(starttoken); + end = std::stoi(endtoken); for (int i = start; i <= end; i++) t->m_colors.insert(i); } @@ -70,13 +70,13 @@ void insertIndexes(std::vector items, PaletteFilterFxRenderData *t) endtoken = strtok(NULL, subseps); if (!endtoken && isInt(starttoken)) { int index; - index = toInt(starttoken); + index = std::stoi(starttoken); t->m_colors.insert(index); } else { if (isInt(starttoken) && isInt(endtoken)) { int start, end; - start = toInt(starttoken); - end = toInt(endtoken); + start = std::stoi(starttoken); + end = std::stoi(endtoken); for (int i = start; i <= end; i++) t->m_colors.insert(i); } @@ -136,9 +136,9 @@ std::string PaletteFilterFxRenderData::toString() const std::string alias; std::set::const_iterator it = m_colors.begin(); for (; it != m_colors.end(); ++it) - alias += ::toString(*it); - alias += "keep=" + ::toString((int)m_keep); - alias += "type=" + ::toString(m_type); + alias += std::to_string(*it); + alias += "keep=" + std::to_string(m_keep); + alias += "type=" + std::to_string(m_type); return alias; } @@ -202,38 +202,38 @@ std::string SandorFxRenderData::toString() const { std::string alias; if (m_type == BlendTz) { - alias += ::toString(m_blendParams.m_colorIndex) + " "; - alias += ::toString(m_blendParams.m_smoothness) + " "; - alias += ::toString(m_blendParams.m_amount) + " "; - alias += ::toString(m_blendParams.m_noBlending); + alias += ::to_string(m_blendParams.m_colorIndex) + " "; + alias += std::to_string(m_blendParams.m_smoothness) + " "; + alias += std::to_string(m_blendParams.m_amount) + " "; + alias += std::to_string(m_blendParams.m_noBlending); return alias; } if (m_type == Calligraphic || m_type == OutBorder) { - alias += ::toString(m_callParams.m_colorIndex) + " "; - alias += ::toString(m_callParams.m_noise) + " "; - alias += ::toString(m_callParams.m_accuracy) + " "; - alias += ::toString(m_callParams.m_upWDiagonal) + " "; - alias += ::toString(m_callParams.m_vertical) + " "; - alias += ::toString(m_callParams.m_upWDiagonal) + " "; - alias += ::toString(m_callParams.m_horizontal) + " "; - alias += ::toString(m_callParams.m_thickness); + alias += ::to_string(m_callParams.m_colorIndex) + " "; + alias += std::to_string(m_callParams.m_noise) + " "; + alias += std::to_string(m_callParams.m_accuracy) + " "; + alias += std::to_string(m_callParams.m_upWDiagonal) + " "; + alias += std::to_string(m_callParams.m_vertical) + " "; + alias += std::to_string(m_callParams.m_upWDiagonal) + " "; + alias += std::to_string(m_callParams.m_horizontal) + " "; + alias += std::to_string(m_callParams.m_thickness); return alias; } if (m_type == ArtAtContour) { - alias += ::toString(m_contourParams.m_maxSize) + " "; - alias += ::toString(m_contourParams.m_minSize) + " "; - alias += ::toString(m_contourParams.m_maxOrientation) + " "; - alias += ::toString(m_contourParams.m_minOrientation) + " "; - alias += ::toString(m_contourParams.m_randomness) + " "; - alias += ::toString(m_contourParams.m_maxDistance) + " "; - alias += ::toString(m_contourParams.m_minDistance) + " "; - alias += ::toString(m_contourParams.m_density) + " "; - alias += ::toString(m_contourParams.m_keepLine) + " "; - alias += ::toString(m_contourParams.m_keepColor) + " "; - alias += ::toString(m_contourParams.m_includeAlpha) + " "; - alias += ::toString(m_contourParams.m_colorIndex) + " "; + alias += std::to_string(m_contourParams.m_maxSize) + " "; + alias += std::to_string(m_contourParams.m_minSize) + " "; + alias += std::to_string(m_contourParams.m_maxOrientation) + " "; + alias += std::to_string(m_contourParams.m_minOrientation) + " "; + alias += std::to_string(m_contourParams.m_randomness) + " "; + alias += std::to_string(m_contourParams.m_maxDistance) + " "; + alias += std::to_string(m_contourParams.m_minDistance) + " "; + alias += std::to_string(m_contourParams.m_density) + " "; + alias += std::to_string(m_contourParams.m_keepLine) + " "; + alias += std::to_string(m_contourParams.m_keepColor) + " "; + alias += std::to_string(m_contourParams.m_includeAlpha) + " "; + alias += ::to_string(m_contourParams.m_colorIndex) + " "; alias += m_controllerAlias; return alias; } diff --git a/toonz/sources/common/tfx/unaryFx.cpp b/toonz/sources/common/tfx/unaryFx.cpp index abde0fd..68677b5 100644 --- a/toonz/sources/common/tfx/unaryFx.cpp +++ b/toonz/sources/common/tfx/unaryFx.cpp @@ -100,12 +100,12 @@ std::string TGeometryFx::getAlias(double frame, const TRenderSettings &info) con } return alias + - (areAlmostEqual(affine.a11, 0) ? "0" : ::toString(affine.a11, 5)) + "," + - (areAlmostEqual(affine.a12, 0) ? "0" : ::toString(affine.a12, 5)) + "," + - (areAlmostEqual(affine.a13, 0) ? "0" : ::toString(affine.a13, 5)) + "," + - (areAlmostEqual(affine.a21, 0) ? "0" : ::toString(affine.a21, 5)) + "," + - (areAlmostEqual(affine.a22, 0) ? "0" : ::toString(affine.a22, 5)) + "," + - (areAlmostEqual(affine.a23, 0) ? "0" : ::toString(affine.a23, 5)) + "]"; + (areAlmostEqual(affine.a11, 0) ? "0" : ::to_string(affine.a11, 5)) + "," + + (areAlmostEqual(affine.a12, 0) ? "0" : ::to_string(affine.a12, 5)) + "," + + (areAlmostEqual(affine.a13, 0) ? "0" : ::to_string(affine.a13, 5)) + "," + + (areAlmostEqual(affine.a21, 0) ? "0" : ::to_string(affine.a21, 5)) + "," + + (areAlmostEqual(affine.a22, 0) ? "0" : ::to_string(affine.a22, 5)) + "," + + (areAlmostEqual(affine.a23, 0) ? "0" : ::to_string(affine.a23, 5)) + "]"; } //-------------------------------------------------- diff --git a/toonz/sources/common/tgl/tgl.cpp b/toonz/sources/common/tgl/tgl.cpp index d80c433..a4489b8 100644 --- a/toonz/sources/common/tgl/tgl.cpp +++ b/toonz/sources/common/tgl/tgl.cpp @@ -414,7 +414,7 @@ void GlFontManager::drawText(/*const TRectD bBox,*/ if (!m_currentFont) return; - std::string text = toString(wtext); + std::string text = ::to_string(wtext); const char *textString = text.c_str(); glListBase(m_base); /* diff --git a/toonz/sources/common/tiio/movsettings.cpp b/toonz/sources/common/tiio/movsettings.cpp index c2af38d..6f6da8b 100644 --- a/toonz/sources/common/tiio/movsettings.cpp +++ b/toonz/sources/common/tiio/movsettings.cpp @@ -126,12 +126,12 @@ void visitAtoms(const QTAtomContainer &atoms, const QTAtom &parent, TPropertyGro while ((i + 1) < size && atomData[i + 1] == 0) i++, count++; if (count > 1) { - num = toString(count); + num = std::to_string(count); strapp = strapp + "z " + num + " "; continue; } } - num = toString(atomData[i]); + num = std::to_string(atomData[i]); strapp = strapp + string(num) + " "; } @@ -141,7 +141,7 @@ void visitAtoms(const QTAtomContainer &atoms, const QTAtom &parent, TPropertyGro //for (i=0; igetValue(); - string appo = toString(appow); + string appo = ::to_string(appow); const char *str = appo.c_str(); vector buf; diff --git a/toonz/sources/common/tiio/tiio_bmp.cpp b/toonz/sources/common/tiio/tiio_bmp.cpp index aa67b97..adf4639 100644 --- a/toonz/sources/common/tiio/tiio_bmp.cpp +++ b/toonz/sources/common/tiio/tiio_bmp.cpp @@ -697,7 +697,7 @@ void BmpWriter::open(FILE *file, const TImageInfo &info) TEnumProperty *p = (TEnumProperty *)(m_properties->getProperty("Bits Per Pixel")); assert(p); - std::string str = toString(p->getValue()); + std::string str = ::to_string(p->getValue()); m_bitPerPixel = atoi(str.c_str()); int cmapSize = 0; diff --git a/toonz/sources/common/timage_io/timage_io.cpp b/toonz/sources/common/timage_io/timage_io.cpp index f729955..9d01059 100644 --- a/toonz/sources/common/timage_io/timage_io.cpp +++ b/toonz/sources/common/timage_io/timage_io.cpp @@ -589,7 +589,7 @@ void TImageWriter::save(const TImageP &img) p->setValue(range[2]); // Horrible. See tiio_tif.cpp (732 or near) -.-' } - int bpp = p ? atoi((toString(p->getValue()).c_str())) : 32; + int bpp = p ? std::stoi(p->getValue()) : 32; // bpp 1 8 16 24 32 40 48 56 64 int spp[] = {1, 1, 1, 4, 4, 0, 4, 0, 4}; // 0s are for pixel sizes which are normally unsupported diff --git a/toonz/sources/common/tparam/tdoublekeyframe.cpp b/toonz/sources/common/tparam/tdoublekeyframe.cpp index 7b1d707..f34fdd5 100644 --- a/toonz/sources/common/tparam/tdoublekeyframe.cpp +++ b/toonz/sources/common/tparam/tdoublekeyframe.cpp @@ -33,7 +33,7 @@ void TDoubleKeyframe::saveData(TOStream &os) const if (!m_linkedHandles) attr["lnk"] = "no"; if (m_step > 1) - attr["step"] = toString(m_step); + attr["step"] = std::to_string(m_step); os.openChild(typeCodes[m_type], attr); switch (m_prevType) { case Linear: diff --git a/toonz/sources/common/tparam/tdoubleparam.cpp b/toonz/sources/common/tparam/tdoubleparam.cpp index 4e9686e..ada771c 100644 --- a/toonz/sources/common/tparam/tdoubleparam.cpp +++ b/toonz/sources/common/tparam/tdoubleparam.cpp @@ -60,7 +60,7 @@ public: m_unitName = ""; } else { if (m_unitName != "") - m_unit = measure->getUnit(toWideString(m_unitName)); + m_unit = measure->getUnit(::to_wstring(m_unitName)); else m_unit = 0; if (!m_unit) { @@ -1189,7 +1189,7 @@ void TDoubleParam::loadData(TIStream &is) continue; TDoubleKeyframe::FileParams params; params.m_path = TFilePath(is.getTagAttribute("path")); - params.m_fieldIndex = toInt(is.getTagAttribute("index")); + params.m_fieldIndex = std::stoi(is.getTagAttribute("index")); TActualDoubleKeyframe k1, k2; k1.m_frame = -1000; k2.m_frame = 1000; @@ -1276,7 +1276,7 @@ string TDoubleParam::getStreamTag() const string TDoubleParam::getValueAlias(double frame, int precision) { - return toString(getValue(frame), precision); + return ::to_string(getValue(frame), precision); } //------------------------------------------------------------------- diff --git a/toonz/sources/common/tparam/tdoubleparamfile.cpp b/toonz/sources/common/tparam/tdoubleparamfile.cpp index 8415c36..f22dee1 100644 --- a/toonz/sources/common/tparam/tdoubleparamfile.cpp +++ b/toonz/sources/common/tparam/tdoubleparamfile.cpp @@ -31,7 +31,7 @@ bool parseDouble(double &value, char *&s) } } std::string w(t, s - t); - value = toDouble(w); + value = std::stod(w); return true; } diff --git a/toonz/sources/common/tparam/tdoubleparamrelayproperty.cpp b/toonz/sources/common/tparam/tdoubleparamrelayproperty.cpp index 1e34197..95a7446 100644 --- a/toonz/sources/common/tparam/tdoubleparamrelayproperty.cpp +++ b/toonz/sources/common/tparam/tdoubleparamrelayproperty.cpp @@ -59,7 +59,7 @@ TProperty *TDoubleParamRelayProperty::clone() const std::string TDoubleParamRelayProperty::getValueAsString() { - return m_param ? toString(m_param->getValue(m_frame)) : ""; + return m_param ? std::to_string(m_param->getValue(m_frame)) : ""; } //------------------------------------------------------------------- diff --git a/toonz/sources/common/tparam/tspectrumparam.cpp b/toonz/sources/common/tparam/tspectrumparam.cpp index b8b2262..8bee58c 100644 --- a/toonz/sources/common/tparam/tspectrumparam.cpp +++ b/toonz/sources/common/tparam/tspectrumparam.cpp @@ -463,13 +463,13 @@ bool TSpectrumParam::isNotificationEnabled() const namespace { -inline std::string toString(const TPixel32 &color) +inline std::string to_string(const TPixel32 &color) { std::string alias = "("; - alias += ::toString(color.r) + ","; - alias += ::toString(color.g) + ","; - alias += ::toString(color.b) + ","; - alias += ::toString(color.m); + alias += std::to_string(color.r) + ","; + alias += std::to_string(color.g) + ","; + alias += std::to_string(color.b) + ","; + alias += std::to_string(color.m); alias += ")"; return alias; } @@ -477,8 +477,8 @@ inline std::string toString(const TPixel32 &color) inline std::string toString(const TSpectrum::ColorKey &key, int precision) { std::string alias = "("; - alias += ::toString(key.first, precision) + ","; - alias += toString(key.second); + alias += ::to_string(key.first, precision) + ","; + alias += to_string(key.second); alias += ")"; return alias; } diff --git a/toonz/sources/common/tproperty.cpp b/toonz/sources/common/tproperty.cpp index 8320d1e..00544bf 100644 --- a/toonz/sources/common/tproperty.cpp +++ b/toonz/sources/common/tproperty.cpp @@ -137,9 +137,9 @@ public: std::map attr; attr["type"] = "double"; attr["name"] = p->getName(); - attr["min"] = toString(p->getRange().first); - attr["max"] = toString(p->getRange().second); - attr["value"] = toString(p->getValue()); + attr["min"] = std::to_string(p->getRange().first); + attr["max"] = std::to_string(p->getRange().second); + attr["value"] = std::to_string(p->getValue()); m_os.openCloseChild("property", attr); } void visit(TDoublePairProperty *p) @@ -147,10 +147,10 @@ public: std::map attr; attr["type"] = "pair"; attr["name"] = p->getName(); - attr["min"] = toString(p->getRange().first); - attr["max"] = toString(p->getRange().second); + attr["min"] = std::to_string(p->getRange().first); + attr["max"] = std::to_string(p->getRange().second); TDoublePairProperty::Value value = p->getValue(); - attr["value"] = toString(value.first) + " " + toString(value.second); + attr["value"] = std::to_string(value.first) + " " + std::to_string(value.second); m_os.openCloseChild("property", attr); } void visit(TIntPairProperty *p) @@ -158,10 +158,10 @@ public: std::map attr; attr["type"] = "pair"; attr["name"] = p->getName(); - attr["min"] = toString(p->getRange().first); - attr["max"] = toString(p->getRange().second); + attr["min"] = std::to_string(p->getRange().first); + attr["max"] = std::to_string(p->getRange().second); TIntPairProperty::Value value = p->getValue(); - attr["value"] = toString(value.first) + " " + toString(value.second); + attr["value"] = std::to_string(value.first) + " " + std::to_string(value.second); m_os.openCloseChild("property", attr); } void visit(TIntProperty *p) @@ -169,9 +169,9 @@ public: std::map attr; attr["type"] = "int"; attr["name"] = p->getName(); - attr["min"] = toString(p->getRange().first); - attr["max"] = toString(p->getRange().second); - attr["value"] = toString(p->getValue()); + attr["min"] = std::to_string(p->getRange().first); + attr["max"] = std::to_string(p->getRange().second); + attr["value"] = std::to_string(p->getValue()); m_os.openCloseChild("property", attr); } void visit(TBoolProperty *p) @@ -187,7 +187,7 @@ public: std::map attr; attr["type"] = "string"; attr["name"] = p->getName(); - attr["value"] = toString(p->getValue()); + attr["value"] = ::to_string(p->getValue()); m_os.openCloseChild("property", attr); } @@ -205,13 +205,13 @@ public: std::map attr; attr["type"] = "enum"; attr["name"] = p->getName(); - attr["value"] = toString(p->getValue()); + attr["value"] = ::to_string(p->getValue()); if (TEnumProperty::isRangeSavingEnabled()) { m_os.openChild("property", attr); std::vector range = p->getRange(); for (int i = 0; i < (int)range.size(); i++) { attr.clear(); - attr["value"] = toString(range[i]); + attr["value"] = ::to_string(range[i]); m_os.openCloseChild("item", attr); } m_os.closeChild(); @@ -249,45 +249,45 @@ void TPropertyGroup::loadData(TIStream &is) if (type != "string" && svalue == "") throw TException("missing property value"); if (type == "double") { - double min = toDouble(is.getTagAttribute("min")); - double max = toDouble(is.getTagAttribute("max")); - add(new TDoubleProperty(name, min, max, toDouble(svalue))); + double min = std::stod(is.getTagAttribute("min")); + double max = std::stod(is.getTagAttribute("max")); + add(new TDoubleProperty(name, min, max, std::stod(svalue))); } if (type == "pair") { - double min = toDouble(is.getTagAttribute("min")); - double max = toDouble(is.getTagAttribute("max")); + double min = std::stod(is.getTagAttribute("min")); + double max = std::stod(is.getTagAttribute("max")); TDoublePairProperty::Value v(0, 0); int i = svalue.find(' '); if (i != (int)std::string::npos) { - v.first = toDouble(svalue.substr(0, i)); - v.second = toDouble(svalue.substr(i + 1)); + v.first = std::stod(svalue.substr(0, i)); + v.second = std::stod(svalue.substr(i + 1)); } add(new TDoublePairProperty(name, min, max, v.first, v.second)); } else if (type == "int") { - int min = toInt(is.getTagAttribute("min")); - int max = toInt(is.getTagAttribute("max")); - add(new TIntProperty(name, min, max, toInt(svalue))); + int min = std::stoi(is.getTagAttribute("min")); + int max = std::stoi(is.getTagAttribute("max")); + add(new TIntProperty(name, min, max, std::stoi(svalue))); } else if (type == "bool") { if (svalue != "true" && svalue != "false") throw TException("bad boolean property value"); add(new TBoolProperty(name, svalue == "true" ? true : false)); } else if (type == "string") { - add(new TStringProperty(name, toWideString(svalue))); + add(new TStringProperty(name, ::to_wstring(svalue))); } else if (type == "enum") { TEnumProperty *p = new TEnumProperty(name); if (is.isBeginEndTag()) - p->addValue(toWideString(svalue)); + p->addValue(::to_wstring(svalue)); else { while (is.matchTag(tagName)) { if (tagName == "item") { std::string item = is.getTagAttribute("value"); - p->addValue(toWideString(item)); + p->addValue(::to_wstring(item)); } else throw TException("expected range property "); } is.closeChild(); } - p->setValue(toWideString(svalue)); + p->setValue(::to_wstring(svalue)); add(p); } else throw TException("unrecognized property type : " + type); diff --git a/toonz/sources/common/trop/trop.cpp b/toonz/sources/common/trop/trop.cpp index 591e675..e6b7fd5 100644 --- a/toonz/sources/common/trop/trop.cpp +++ b/toonz/sources/common/trop/trop.cpp @@ -12,7 +12,7 @@ TString TRopException::getMessage() const { - return toWideString(message); + return ::to_wstring(message); } namespace diff --git a/toonz/sources/common/tsound/tsound.cpp b/toonz/sources/common/tsound/tsound.cpp index 442840a..d54fdf1 100644 --- a/toonz/sources/common/tsound/tsound.cpp +++ b/toonz/sources/common/tsound/tsound.cpp @@ -120,7 +120,7 @@ TSoundTrackP TSoundTrack::create( default: std::string s; - s = "Type " + toString((int)sampleRate) + " Hz " + toString(bitPerSample) + " bits "; + s = "Type " + std::to_string(sampleRate) + " Hz " + std::to_string(bitPerSample) + " bits "; if (channelCount == 1) s += "mono: "; else @@ -185,7 +185,7 @@ TSoundTrackP TSoundTrack::create( default: std::string s; - s = "Type " + toString((int)sampleRate) + " Hz " + toString(bitPerSample) + " bits "; + s = "Type " + std::to_string(sampleRate) + " Hz " + std::to_string(bitPerSample) + " bits "; if (channelCount == 1) s += "mono: "; else diff --git a/toonz/sources/common/tstream/tstream.cpp b/toonz/sources/common/tstream/tstream.cpp index 67317d2..df277d4 100644 --- a/toonz/sources/common/tstream/tstream.cpp +++ b/toonz/sources/common/tstream/tstream.cpp @@ -15,6 +15,7 @@ #include #include +#include using namespace std; @@ -428,7 +429,7 @@ TOStream &TOStream::operator<<(QString _v) TOStream &TOStream::operator<<(std::wstring v) { - return operator<<(toString(v)); + return operator<<(::to_string(v)); /* ostream &os = *(m_imp->m_os); int len = v.length(); @@ -1019,36 +1020,8 @@ TIStream &TIStream::operator>>(std::wstring &v) { string s; operator>>(s); - v = toWideString(s); + v = ::to_wstring(s); return *this; - - /* - int len = s.length(); - for(int i=0;i -//#include contenuto in tconvert.h -#include +#include +#include +#include bool TFilePath::m_underscoreFormatAllowed = true; @@ -259,14 +258,14 @@ void TFilePath::setPath(std::wstring path) TFilePath::TFilePath(const char *path) { - setPath(toWideString(path)); + setPath(::to_wstring(path)); } //----------------------------------------------------------------------------- TFilePath::TFilePath(const std::string &path) { - setPath(toWideString(path)); + setPath(::to_wstring(path)); } //----------------------------------------------------------------------------- @@ -471,7 +470,7 @@ QString TFilePath::getQString() const std::ostream &operator<<(std::ostream &out, const TFilePath &path) { std::wstring w = path.getWideString(); - return out << toString(w) << " "; + return out << ::to_string(w) << " "; // string w = path.getString(); // return out << w << " "; } @@ -542,7 +541,7 @@ std::string TFilePath::getDottedType() const // ritorna l'estensione con PUNTO ( if (i == (int)std::wstring::npos) return ""; - return toLower(toString(str.substr(i))); + return toLower(::to_string(str.substr(i))); } //----------------------------------------------------------------------------- @@ -554,7 +553,7 @@ std::string TFilePath::getUndottedType() const // ritorna l'estensione senza PUN i = str.rfind(L"."); if (i == std::wstring::npos || i == str.length() - 1) return ""; - return toLower(toString(str.substr(i + 1))); + return toLower(::to_string(str.substr(i + 1))); } //----------------------------------------------------------------------------- @@ -581,14 +580,14 @@ std::wstring TFilePath::getWideName() const // noDot! noSlash! std::string TFilePath::getName() const // noDot! noSlash! { - return toString(getWideName()); + return ::to_string(getWideName()); } //----------------------------------------------------------------------------- // es. TFilePath("/pippo/pluto.0001.gif").getLevelName() == "pluto..gif" std::string TFilePath::getLevelName() const { - return toString(getLevelNameW()); + return ::to_string(getLevelNameW()); } //----------------------------------------------------------------------------- @@ -674,7 +673,7 @@ TFrameId TFilePath::getFrame() const letter = str[k++] + ('a' - L'a'); if (number == 0 || k < i) // || letter!='\0') - throw(toString(m_path) + ": malformed frame name."); + throw(::to_string(m_path) + ": malformed frame name."); return TFrameId(number, letter); } @@ -692,18 +691,18 @@ TFilePath TFilePath::withType(const std::string &type) const if (type == "") return *this; else if (type[0] == '.') - return TFilePath(m_path + toWideString(type)); + return TFilePath(m_path + ::to_wstring(type)); else - return TFilePath(m_path + toWideString("." + type)); + return TFilePath(m_path + ::to_wstring("." + type)); } else // il path originale ha gia' il tipo { if (type == "") return TFilePath(m_path.substr(0, i + j + 1)); else if (type[0] == '.') - return TFilePath(m_path.substr(0, i + j + 1) + toWideString(type)); + return TFilePath(m_path.substr(0, i + j + 1) + ::to_wstring(type)); else - return TFilePath(m_path.substr(0, i + j + 2) + toWideString(type)); + return TFilePath(m_path.substr(0, i + j + 2) + ::to_wstring(type)); } } @@ -711,7 +710,7 @@ TFilePath TFilePath::withType(const std::string &type) const TFilePath TFilePath::withName(const std::string &name) const { - return withName(toWideString(name)); + return withName(::to_wstring(name)); } //----------------------------------------------------------------------------- @@ -770,7 +769,7 @@ TFilePath TFilePath::withFrame(const TFrameId &frame, TFrameId::FrameFormat form if (frame.isEmptyFrame() || frame.isNoFrame()) return *this; else - return TFilePath(m_path + toWideString(ch + frame.expand(format))); + return TFilePath(m_path + ::to_wstring(ch + frame.expand(format))); } std::string frameString; @@ -782,14 +781,14 @@ TFilePath TFilePath::withFrame(const TFrameId &frame, TFrameId::FrameFormat form int k = str.substr(0, j).rfind(L'.'); if (k != (int)std::wstring::npos) - return TFilePath(m_path.substr(0, k + i + 1) + toWideString(frameString) + str.substr(j)); + return TFilePath(m_path.substr(0, k + i + 1) + ::to_wstring(frameString) + str.substr(j)); else if (m_underscoreFormatAllowed) { k = str.substr(0, j).rfind(L'_'); if (k != (int)std::wstring::npos && (k == j - 1 || isNumbers(str, k, j))) /*-- "_." の並びか、"_[数字]."の並びのとき --*/ - return TFilePath(m_path.substr(0, k + i + 1) + ((frame.isNoFrame()) ? L"" : toWideString("_" + frame.expand(format))) + str.substr(j)); + return TFilePath(m_path.substr(0, k + i + 1) + ((frame.isNoFrame()) ? L"" : ::to_wstring("_" + frame.expand(format))) + str.substr(j)); } - return TFilePath(m_path.substr(0, j + i + 1) + toWideString(frameString) + str.substr(j)); + return TFilePath(m_path.substr(0, j + i + 1) + ::to_wstring(frameString) + str.substr(j)); } //----------------------------------------------------------------------------- diff --git a/toonz/sources/common/tsystem/tfilepath_io.cpp b/toonz/sources/common/tsystem/tfilepath_io.cpp index 7a5c410..117c9fb 100644 --- a/toonz/sources/common/tsystem/tfilepath_io.cpp +++ b/toonz/sources/common/tsystem/tfilepath_io.cpp @@ -24,7 +24,7 @@ using namespace std; FILE *fopen(const TFilePath &fp, string mode) { FILE *pFile; - errno_t err = _wfopen_s(&pFile, fp.getWideString().c_str(), toWideString(mode).c_str()); + errno_t err = _wfopen_s(&pFile, fp.getWideString().c_str(), ::to_wstring(mode).c_str()); if (err == -1) return NULL; return pFile; diff --git a/toonz/sources/common/tsystem/tlogger.cpp b/toonz/sources/common/tsystem/tlogger.cpp index 71a4a3b..fd263c0 100644 --- a/toonz/sources/common/tsystem/tlogger.cpp +++ b/toonz/sources/common/tsystem/tlogger.cpp @@ -127,18 +127,18 @@ TLogger::Stream &TLogger::Stream::operator<<(std::string v) TLogger::Stream &TLogger::Stream::operator<<(int v) { - m_text += toString(v); + m_text += std::to_string(v); return *this; } TLogger::Stream &TLogger::Stream::operator<<(double v) { - m_text += toString(v); + m_text += std::to_string(v); return *this; } TLogger::Stream &TLogger::Stream::operator<<(const TFilePath &v) { - m_text += toString(v.getWideString()); + m_text += v.getQString().toStdString(); return *this; } diff --git a/toonz/sources/common/tsystem/tpluginmanager.cpp b/toonz/sources/common/tsystem/tpluginmanager.cpp index 45348c1..d9f9c99 100644 --- a/toonz/sources/common/tsystem/tpluginmanager.cpp +++ b/toonz/sources/common/tsystem/tpluginmanager.cpp @@ -136,15 +136,14 @@ void TPluginManager::loadPlugin(const TFilePath &fp) #ifdef _WIN32 Plugin::Handle handle = LoadLibraryW(fp.getWideString().c_str()); #else - std::wstring str_fp = fp.getWideString(); - Plugin::Handle handle = dlopen(toString(str_fp).c_str(), RTLD_NOW); // RTLD_LAZY + Plugin::Handle handle = dlopen(::to_string(fp).c_str(), RTLD_NOW); // RTLD_LAZY #endif if (!handle) { // non riesce a caricare la libreria; TLogger::warning() << "Unable to load " << fp; #ifdef _WIN32 std::wstring getFormattedMessage(DWORD lastError); - TLogger::warning() << toString(getFormattedMessage(GetLastError())); + TLogger::warning() << ::to_string(getFormattedMessage(GetLastError())); #else TLogger::warning() << dlerror(); #endif diff --git a/toonz/sources/common/tsystem/tsystem.cpp b/toonz/sources/common/tsystem/tsystem.cpp index 4ad8489..bd26a07 100644 --- a/toonz/sources/common/tsystem/tsystem.cpp +++ b/toonz/sources/common/tsystem/tsystem.cpp @@ -943,7 +943,7 @@ bool TSystem::showDocument(const TFilePath &path) return true; #else string cmd = "open "; - string thePath(toString(path.getWideString())); + string thePath(::to_string(path)); UINT pos = 0, count = 0; //string newPath; char newPath[2048]; @@ -1001,7 +1001,7 @@ TSystemException::TSystemException(const TFilePath &fname, int err) //-------------------------------------------------------------- TSystemException::TSystemException(const TFilePath &fname, const std::string &msg) - : m_fname(fname), m_err(-1), m_msg(toWideString(msg)) + : m_fname(fname), m_err(-1), m_msg(::to_wstring(msg)) { } //-------------------------------------------------------------- @@ -1014,7 +1014,7 @@ TSystemException::TSystemException(const TFilePath &fname, const wstring &msg) //-------------------------------------------------------------- TSystemException::TSystemException(const std::string &msg) - : m_fname(""), m_err(-1), m_msg(toWideString(msg)) + : m_fname(""), m_err(-1), m_msg(::to_wstring(msg)) { } //-------------------------------------------------------------- diff --git a/toonz/sources/common/tsystem/tsystempd.cpp b/toonz/sources/common/tsystem/tsystempd.cpp index 47901ab..d3c6ff5 100644 --- a/toonz/sources/common/tsystem/tsystempd.cpp +++ b/toonz/sources/common/tsystem/tsystempd.cpp @@ -289,11 +289,10 @@ TINT64 TSystem::getDiskSize(const TFilePath &diskName) } #ifndef _WIN32 struct statfs buf; - wstring str_diskname = diskName.getWideString(); #ifdef __sgi - statfs(toString(str_diskname).c_str(), &buf, sizeof(struct statfs), 0); + statfs(::to_string(diskName).c_str(), &buf, sizeof(struct statfs), 0); #else - statfs(toString(str_diskname).c_str(), &buf); + statfs(::to_string(diskName).c_str(), &buf); #endif size = (TINT64)((buf.f_blocks * buf.f_bsize) >> 10); #else @@ -329,11 +328,10 @@ TINT64 TSystem::getFreeDiskSize(const TFilePath &diskName) } #ifndef _WIN32 struct statfs buf; - wstring str_diskname = diskName.getWideString(); #ifdef __sgi - statfs(str_diskname.c_str(), &buf, sizeof(struct statfs), 0); + statfs(diskName.getWideString().c_str(), &buf, sizeof(struct statfs), 0); #else - statfs(toString(str_diskname).c_str(), &buf); + statfs(::to_string(diskName).c_str(), &buf); #endif size = (TINT64)(buf.f_bfree * buf.f_bsize) >> 10; #else @@ -450,7 +448,7 @@ void TSystem::moveFileToRecycleBin(const TFilePath &fp) return; } //TFilePath dest = TFilePath(path)+(fp.getName()+fp.getDottedType()); - string fullNameWithExt = toString(fp.getWideString()); + string fullNameWithExt = ::to_string(fp); int i = fullNameWithExt.rfind("/"); string nameWithExt = fullNameWithExt.substr(i + 1); TFilePath dest = TFilePath((char *)path) + nameWithExt; @@ -517,11 +515,10 @@ void TSystem::touchFile(const TFilePath &path) // string filename = path.getFullPath(); if (TFileStatus(path).doesExist()) { int ret; -#if defined(MACOSX) || defined(LINUX) - wstring str_file = path.getWideString(); - ret = utimes(toString(str_file).c_str(), 0); -#else +#ifdef _WIN32 ret = _wutime(path.getWideString().c_str(), 0); +#else + ret = utimes(::to_string(path).c_str(), 0); #endif if (0 != ret) throw TSystemException(path, errno); diff --git a/toonz/sources/common/tsystem/uncpath.cpp b/toonz/sources/common/tsystem/uncpath.cpp index cf06429..bb32abe 100644 --- a/toonz/sources/common/tsystem/uncpath.cpp +++ b/toonz/sources/common/tsystem/uncpath.cpp @@ -28,7 +28,7 @@ TFilePath TSystem::toUNC(const TFilePath &fp) if (isUNC(fp)) return fp; - std::string fpStr = toString(fp.getWideString()); + std::string fpStr = ::to_string(fp); if (fpStr.length() > 1 && fpStr.c_str()[1] == ':') { std::string drive = fpStr.substr(0, 3); @@ -44,14 +44,14 @@ TFilePath TSystem::toUNC(const TFilePath &fp) // Pointers to head of buffer UNIVERSAL_NAME_INFO *puni = (UNIVERSAL_NAME_INFO *)&szBuff; - DWORD dwResult = WNetGetUniversalNameW(toWideString(fpStr).c_str(), + DWORD dwResult = WNetGetUniversalNameW(::to_wstring(fpStr).c_str(), UNIVERSAL_NAME_INFO_LEVEL, (LPVOID)&szBuff, &cbBuff); switch (dwResult) { case NO_ERROR: - return TFilePath(toString(puni->lpUniversalName)); + return TFilePath(::to_string(puni->lpUniversalName)); case ERROR_NOT_CONNECTED: // The network connection does not exists. @@ -94,7 +94,7 @@ TFilePath TSystem::toUNC(const TFilePath &fp) //#ifdef IS_DOTNET // shi502_path e' una wstring, aanche se la dichiarazione di PSHARE_INFO_502 non lo sa! std::wstring shareLocalPathW = (LPWSTR)(p->shi502_path); - std::string shareLocalPath = toString(shareLocalPathW); + std::string shareLocalPath = ::to_string(shareLocalPathW); //#else //string shareLocalPath = toString(p->shi502_path); //#endif @@ -104,7 +104,7 @@ TFilePath TSystem::toUNC(const TFilePath &fp) // #ifdef IS_DOTNET // shi502_netname e' una wstring, anche se la dichiarazione di PSHARE_INFO_502 non lo sa! std::wstring shareNetNameW = (LPWSTR)(p->shi502_netname); - std::string shareNetName = toString(shareNetNameW); + std::string shareNetName = ::to_string(shareNetNameW); // #else //string shareNetName = toString(p->shi502_netname); //#endif @@ -150,7 +150,7 @@ TFilePath TSystem::toLocalPath(const TFilePath &fp) if (!isUNC(fp)) return TFilePath(fp); - std::string pathStr = toString(fp.getWideString()); + std::string pathStr = ::to_string(fp); // estrae hostname e il nome dello share dal path UNC std::string::size_type idx = pathStr.find_first_of("\\", 2); @@ -186,7 +186,7 @@ TFilePath TSystem::toLocalPath(const TFilePath &fp) //#ifdef IS_DOTNET //shi502_netname e' una wstring, anche se la dichiarazione di PSHARE_INFO_502 non lo sa! std::wstring shareNetNameW = (LPWSTR)(p->shi502_netname); - std::string shareNetName = toString(shareNetNameW); + std::string shareNetName = ::to_string(shareNetNameW); // #else //string shareNetName = toString(p->shi502_netname); //#endif @@ -195,7 +195,7 @@ TFilePath TSystem::toLocalPath(const TFilePath &fp) //#ifdef IS_DOTNET // shi502_path e' una wstring, anche se la dichiarazione di PSHARE_INFO_502 non lo sa! std::wstring shareLocalPathW = (LPWSTR)(p->shi502_path); - std::string shareLocalPath = toString(shareLocalPathW); + std::string shareLocalPath = ::to_string(shareLocalPathW); //#else //string shareLocalPath = toString(p->shi502_path); //#endif diff --git a/toonz/sources/common/ttest/ttest.cpp b/toonz/sources/common/ttest/ttest.cpp index e5c6b9e..705a890 100644 --- a/toonz/sources/common/ttest/ttest.cpp +++ b/toonz/sources/common/ttest/ttest.cpp @@ -14,6 +14,7 @@ #include "tcolorstyles.h" #include +#include #if defined(LINUX) #include @@ -172,7 +173,7 @@ void TTest::runTests(string name) cout << "Test file : '" << testFile << "'" << endl; char buffer[1024]; while (is.getline(buffer, sizeof(buffer))) { - istrstream ss(buffer); + std::istrstream ss(buffer); while (ss) { string s; ss >> s; diff --git a/toonz/sources/common/tunit/tunit.cpp b/toonz/sources/common/tunit/tunit.cpp index d86add1..89bddd7 100644 --- a/toonz/sources/common/tunit/tunit.cpp +++ b/toonz/sources/common/tunit/tunit.cpp @@ -461,7 +461,7 @@ void TMeasuredValue::setMeasure(std::string measureName) bool TMeasuredValue::setValue(std::wstring s, int *pErr) { - if (s == ::toWideString("")) { + if (s == L"") { if (pErr) *pErr = -1; return false; @@ -471,7 +471,7 @@ bool TMeasuredValue::setValue(std::wstring s, int *pErr) bool valueFlag = false; int i = 0, len = s.length(); // skip blanks - i = s.find_first_not_of(::toWideString(" \t")); + i = s.find_first_not_of(::to_wstring(" \t")); assert(i != (int)std::wstring::npos); int j = i; // match number @@ -492,10 +492,10 @@ bool TMeasuredValue::setValue(std::wstring s, int *pErr) } } if (i > j) { - value = toDouble(s.substr(j, i - j)); + value = std::stod(s.substr(j, i - j)); valueFlag = true; // skip blanks - i = s.find_first_not_of(::toWideString(" \t"), i); + i = s.find_first_not_of(::to_wstring(" \t"), i); if (i == (int)std::wstring::npos) i = s.length(); } @@ -503,7 +503,7 @@ bool TMeasuredValue::setValue(std::wstring s, int *pErr) // remove trailing blanks if (i < (int)s.length()) { j = i; - i = s.find_last_not_of(::toWideString(" \t")); + i = s.find_last_not_of(::to_wstring(" \t")); if (i == (int)std::wstring::npos) i = len - 1; if (j <= i) { @@ -536,7 +536,7 @@ bool TMeasuredValue::setValue(std::wstring s, int *pErr) std::wstring TMeasuredValue::toWideString(int decimals) const { double v = getValue(CurrentUnit); - std::string s = toString(v, decimals); + std::string s = ::to_string(v, decimals); if (s.find('.') != std::string::npos) { int i = s.length(); while (i > 0 && s[i - 1] == '0') @@ -548,8 +548,8 @@ std::wstring TMeasuredValue::toWideString(int decimals) const } std::wstring measure = m_measure->getCurrentUnit()->getDefaultExtension(); if (measure.empty()) - return ::toWideString(s); - return ::toWideString(s) + ::toWideString(" ") + measure; + return ::to_wstring(s); + return ::to_wstring(s) + L" " + measure; } //=================================================================== diff --git a/toonz/sources/common/tvrender/tcolorstyles.cpp b/toonz/sources/common/tvrender/tcolorstyles.cpp index fc663be..2dcfe89 100644 --- a/toonz/sources/common/tvrender/tcolorstyles.cpp +++ b/toonz/sources/common/tvrender/tcolorstyles.cpp @@ -407,14 +407,14 @@ public: { int id = style->getTagId(); if (m_table.find(id) != m_table.end()) { - throw TException("Duplicate color style declaration. id = " + toString(id)); + throw TException("Duplicate color style declaration. id = " + std::to_string(id)); } m_table.insert(std::make_pair(id, Item(style))); std::vector ids; style->getObsoleteTagIds(ids); for (std::vector::iterator it = ids.begin(); it != ids.end(); ++it) { if (m_table.find(*it) != m_table.end()) { - throw TException("Duplicate color style declaration for obsolete style. id = " + toString(*it)); + throw TException("Duplicate color style declaration for obsolete style. id = " + std::to_string(*it)); } m_table.insert(std::make_pair(*it, Item(style->clone(), true))); } @@ -424,7 +424,7 @@ public: { Table::iterator it = m_table.find(id); if (it == m_table.end()) - throw TException("Unknown color style id; id = " + toString(id)); + throw TException("Unknown color style id; id = " + std::to_string(id)); isObsolete = it->second.m_isObsolete; @@ -548,19 +548,19 @@ void TColorStyle::save(TOutputStreamInterface &os) const std::wstring origName = getOriginalName(); if (gname != L"") { - os << toString(L"|" + gname); + os << ::to_string(L"|" + gname); //save the original name from studio palette if (origName != L"") { //write two "@"s if the edited flag is ON - os << toString(((m_isEditedFromOriginal) ? L"@@" : L"@") + origName); + os << ::to_string(((m_isEditedFromOriginal) ? L"@@" : L"@") + origName); } } if (numberedName) name.insert(0, L"_"); - os << toString(name) << (int)getTagId(); + os << ::to_string(name) << getTagId(); saveData(os); } @@ -580,7 +580,7 @@ TColorStyle *TColorStyle::load(TInputStreamInterface &is) is >> name; } if (name.length() > 0 && name[0] == '|') { - gname = toWideString(name.substr(1)); + gname = ::to_wstring(name.substr(1)); is >> name; //If the style is copied from studio palette, original name is here @@ -588,16 +588,16 @@ TColorStyle *TColorStyle::load(TInputStreamInterface &is) //if there are two "@"s, then activate the edited flag if (name[1] == '@') { isEdited = true; - origName = toWideString(name.substr(2)); + origName = ::to_wstring(name.substr(2)); } else { - origName = toWideString(name.substr(1)); + origName = ::to_wstring(name.substr(1)); } is >> name; } } int id = 0; if (!name.empty() && '0' <= name[0] && name[0] <= '9') { - id = toInt(name); + id = std::stoi(name); name = "color"; } else { if (!name.empty() && name[0] == '_') @@ -612,7 +612,7 @@ TColorStyle *TColorStyle::load(TInputStreamInterface &is) style->loadData(id, is); else style->loadData(is); - style->setName(toWideString(name)); + style->setName(::to_wstring(name)); style->setGlobalName(gname); style->setOriginalName(origName); style->setIsEditedFlag(isEdited); diff --git a/toonz/sources/common/tvrender/tpalette.cpp b/toonz/sources/common/tvrender/tpalette.cpp index c91c5c1..a348de3 100644 --- a/toonz/sources/common/tvrender/tpalette.cpp +++ b/toonz/sources/common/tvrender/tpalette.cpp @@ -510,7 +510,7 @@ public: { assert(m_rootDir != TFilePath()); - std::string name = "texture_" + toString(m_index); + std::string name = "texture_" + std::to_string(m_index); m_os << name; TFilePath filename = ((m_rootDir + "textures") + name).withType("bmp"); @@ -667,7 +667,7 @@ void TPalette::saveData(TOStream &os) StyleAnimation &animation = sat->second; std::map attributes; - attributes["id"] = toString(styleId); + attributes["id"] = std::to_string(styleId); os.openChild("style", attributes); { @@ -679,7 +679,7 @@ void TPalette::saveData(TOStream &os) assert(cs); attributes.clear(); - attributes["frame"] = toString(frame); + attributes["frame"] = std::to_string(frame); /*os.openChild("keycolor", attributes); // Up to Toonz 7.0, animations saved os << cs->getMainColor(); // the main color only diff --git a/toonz/sources/image/3gp/tiio_3gpM.cpp b/toonz/sources/image/3gp/tiio_3gpM.cpp index ab220a3..70887be 100644 --- a/toonz/sources/image/3gp/tiio_3gpM.cpp +++ b/toonz/sources/image/3gp/tiio_3gpM.cpp @@ -115,7 +115,7 @@ string buildQTErrorString(int ec) return "unable to set movie box"; default: { - return "unknown error ('" + toString(ec) + "')"; + return "unknown error ('" + std::to_string(ec) + "')"; } } } @@ -807,8 +807,7 @@ if (m_gworld) OSErr myErr = noErr; //UCHAR myCancelled = FALSE; - const char *pStr = toString(m_path.getWideString()).c_str(); - getFSSpecFromPosixPath(pStr, &fspec, true); + getFSSpecFromPosixPath(::to_string(m_path).c_str(), &fspec, true); myFlags = createMovieFileDeleteCurFile; // | //movieFileSpecValid | movieToFileOnlyExport; @@ -865,10 +864,9 @@ TLevelReader3gp::TLevelReader3gp(const TFilePath &path) return; } - const char *pStr = toString(m_path.getWideString()).c_str(); - FSMakeFSSpec(0, 0, (const unsigned char *)pStr, &fspec); - getFSSpecFromPosixPath(pStr, &fspec, false); - pStr = 0; + std::string const str_path = ::to_string(m_path).c_str(); + FSMakeFSSpec(0, 0, reinterpret_cast(str_path.c_str()), &fspec); + getFSSpecFromPosixPath(str_path.c_str(), &fspec, false); if ((err = OpenMovieFile(&fspec, &m_refNum, fsRdPerm))) { m_IOError = QTUnableToOpenFile; diff --git a/toonz/sources/image/3gp/tiio_3gpW.cpp b/toonz/sources/image/3gp/tiio_3gpW.cpp index 660cc38..93ce097 100644 --- a/toonz/sources/image/3gp/tiio_3gpW.cpp +++ b/toonz/sources/image/3gp/tiio_3gpW.cpp @@ -2,6 +2,8 @@ #ifndef x64 +#include + #include "texception.h" #include "tsound.h" #include "tconvert.h" @@ -114,7 +116,7 @@ string buildQTErrorString(int ec) return "unable to set movie box"; default: { - return "unknown error ('" + toString(ec) + "')"; + return "unknown error ('" + std::to_string(ec) + "')"; } } } diff --git a/toonz/sources/image/avi/tiio_avi.cpp b/toonz/sources/image/avi/tiio_avi.cpp index c8fd766..ed15771 100644 --- a/toonz/sources/image/avi/tiio_avi.cpp +++ b/toonz/sources/image/avi/tiio_avi.cpp @@ -231,7 +231,7 @@ TLevelWriterAvi::~TLevelWriterAvi() AVIFileExit(); CoUninitialize(); if (!m_delayedFrames.empty()) - throw TImageException(getFilePath(), "error compressing frame " + toString(m_delayedFrames.front())); + throw TImageException(getFilePath(), "error compressing frame " + std::to_string(m_delayedFrames.front())); } //----------------------------------------------------------- @@ -274,14 +274,14 @@ void TLevelWriterAvi::searchForCodec() WideChar2Char(icinfo.szName, name, sizeof(name)); std::string compressorName; - compressorName = std::string(name) + " '" + toString(bpp) + "' " + std::string(descr); + compressorName = std::string(name) + " '" + std::to_string(bpp) + "' " + std::string(descr); if (hic) { if (ICCompressQuery(hic, &inFmt, NULL) != ICERR_OK) { ICClose(hic); continue; // Skip this compressor if it can't handle the format. } - if (toWideString(compressorName) == codecName) { + if (::to_wstring(compressorName) == codecName) { found = true; m_bpp = bpp; break; @@ -389,7 +389,7 @@ void TLevelWriterAvi::save(const TImageP &img, int frameIndex) rc = ICCompressGetFormat(m_hic, m_bitmapinfo, m_outputFmt); if (rc != ICERR_OK) throw TImageException(getFilePath(), - "Error codec (ec = " + toString(rc) + ")"); + "Error codec (ec = " + std::to_string(rc) + ")"); ICCOMPRESSFRAMES icf; memset(&icf, 0, sizeof icf); @@ -409,7 +409,7 @@ void TLevelWriterAvi::save(const TImageP &img, int frameIndex) rc = ICCompressBegin(m_hic, m_bitmapinfo, m_outputFmt); if (rc != ICERR_OK) throw TImageException(getFilePath(), - "Error starting codec (ec = " + toString(rc) + ")"); + "Error starting codec (ec = " + std::to_string(rc) + ")"); if (AVIStreamSetFormat(m_videoStream, 0, &m_outputFmt->bmiHeader, m_outputFmt->bmiHeader.biSize)) throw TImageException(getFilePath(), "unable to set format"); @@ -466,7 +466,7 @@ void TLevelWriterAvi::save(const TImageP &img, int frameIndex) if (res != ICERR_OK) { if (bufferOut) _aligned_free(bufferOut); - throw TImageException(getFilePath(), "error compressing frame " + toString(index)); + throw TImageException(getFilePath(), "error compressing frame " + std::to_string(index)); } if (outHeader.biCompression == '05xd' || @@ -744,9 +744,9 @@ TLevelReaderAvi::TLevelReaderAvi(const TFilePath &path) WideChar2Char(icinfo.szDescription, descr, sizeof(descr)); WideChar2Char(icinfo.szName, name, sizeof(name)); std::string compressorName; - compressorName = std::string(name) + " '" + toString(m_dstBitmapInfo->bmiHeader.biBitCount) + "' " + std::string(descr); + compressorName = std::string(name) + " '" + std::to_string(m_dstBitmapInfo->bmiHeader.biBitCount) + "' " + std::string(descr); TEnumProperty *p = (TEnumProperty *)m_info->m_properties->getProperty("Codec"); - p->setValue(toWideString(compressorName)); + p->setValue(::to_wstring(compressorName)); m_decompressedBuffer = _aligned_malloc(m_dstBitmapInfo->bmiHeader.biSizeImage, 128); } else { m_hic = 0; @@ -910,7 +910,7 @@ TImageP TLevelReaderAvi::load(int frameIndex) if (!m_hic) { rc = readFrameFromStream(m_decompressedBuffer, si.dwSuggestedBufferSize, frameIndex); if (rc) { - throw TImageException(m_path, "unable read frame " + toString(frameIndex) + "from video stream."); + throw TImageException(m_path, "unable read frame " + std::to_string(frameIndex) + "from video stream."); } } else { int prevKeyFrame = m_prevFrame == frameIndex - 1 ? frameIndex : getPrevKeyFrame(m_videoStream, frameIndex); @@ -920,14 +920,14 @@ TImageP TLevelReaderAvi::load(int frameIndex) rc = readFrameFromStream(bufferOut, bytesRead, prevKeyFrame); if (rc) { _aligned_free(bufferOut); - throw TImageException(m_path, "unable read frame " + toString(frameIndex) + "from video stream."); + throw TImageException(m_path, "unable read frame " + std::to_string(frameIndex) + "from video stream."); } DWORD res = decompressFrame(bufferOut, bytesRead, m_decompressedBuffer, prevKeyFrame, frameIndex); _aligned_free(bufferOut); if (res != ICERR_OK) { - throw TImageException(m_path, "error decompressing frame " + toString(frameIndex)); + throw TImageException(m_path, "error decompressing frame " + std::to_string(frameIndex)); } prevKeyFrame++; } @@ -952,7 +952,7 @@ TImageP TLevelReaderAvi::load(int frameIndex) return i; } default: { - throw TImageException(m_path, toString(bpp) + " to 32 bit not supported\n"); + throw TImageException(m_path, std::to_string(bpp) + " to 32 bit not supported\n"); } } return TRasterImageP(); @@ -1154,7 +1154,7 @@ Tiio::AviWriterProperties::AviWriterProperties() } std::string compressorName; - compressorName = std::string(name) + " '" + toString(bpp) + "' " + std::string(descr); + compressorName = std::string(name) + " '" + std::to_string(bpp) + "' " + std::string(descr); // per il momento togliamo i codec indeo if (std::string(compressorName).find("Indeo") != -1) { @@ -1165,9 +1165,9 @@ Tiio::AviWriterProperties::AviWriterProperties() continue; // Skip this compressor if it can't handle the format. } - m_defaultCodec.addValue(toWideString(compressorName)); + m_defaultCodec.addValue(::to_wstring(compressorName)); if (compressorName.find("inepak") != -1) { - m_defaultCodec.setValue(toWideString(compressorName)); + m_defaultCodec.setValue(::to_wstring(compressorName)); } } } diff --git a/toonz/sources/image/mov/tiio_movM.cpp b/toonz/sources/image/mov/tiio_movM.cpp index 017e075..d1ee3a7 100644 --- a/toonz/sources/image/mov/tiio_movM.cpp +++ b/toonz/sources/image/mov/tiio_movM.cpp @@ -267,7 +267,7 @@ string buildQTErrorString(int ec) return "unable to set movie box"; default: { - return "unknown error ('" + toString(ec) + "')"; + return "unknown error ('" + std::to_string(ec) + "')"; } } } @@ -557,11 +557,6 @@ void TLevelWriterMov::save(const TImageP &img, int frameIndex) Tiio::MovWriterProperties *prop = (Tiio::MovWriterProperties *)(m_properties); - /* -const char* codec = toString(prop->m_codec.getValue()).c_str(); -const char* qual = toString(prop->m_quality.getValue()).c_str(); -*/ - //CodecType codecType; //try { //codecType = prop->getCurrentCodec(); @@ -754,13 +749,9 @@ TLevelWriterMov::TLevelWriterMov(const TFilePath &path, TPropertyGroup *winfo) throw TImageException(m_path, buildQTErrorString(m_IOError)); } - // const char *pStr = toString(m_path.getWideString()).c_str(); QString qStr = QString::fromStdWString(m_path.getWideString()); const char *pStr = qStr.toUtf8().data(); - // std::cout << "TLevelWriterMov costruttore FP: " << toString(m_path.getWideString()) << std::endl; - // std::cout << "TLevelWriterMov costruttore char: " << pStr << std::endl; - if (!getFSSpecFromPosixPath(pStr, &fspec, true)) { m_IOError = QTUnableToOpenFile; throw TImageException(m_path, buildQTErrorString(m_IOError)); @@ -1048,7 +1039,6 @@ TLevelWriterMov::~TLevelWriterMov() /**************************************************************************************/ #ifdef PROVA3GP - // char *inputFileName = toString(m_path.getWideString()).c_str(); QString qStr = QString::fromStdWString(m_path.getWideString()); char *inputFileName = qStr.toUtf8().data(); @@ -1130,8 +1120,6 @@ TImageWriterP TLevelWriterMov::getFrameWriter(TFrameId fid) TLevelReaderMov::TLevelReaderMov(const TFilePath &path) : TLevelReader(path), m_IOError(QTNoError), m_track(0), m_movie(0), m_depth(0), m_readAsToonzOutput(false) { - - //std::cout << "MOVIE PATH : " << toString(path) << std::endl; FSSpec fspec; QDErr err; Boolean dataRefWasChanged; @@ -1140,11 +1128,9 @@ TLevelReaderMov::TLevelReaderMov(const TFilePath &path) return; } - // const char *pStr = toString(m_path.getWideString()).c_str(); QString qStr = QString::fromStdWString(m_path.getWideString()); char *pStr = qStr.toUtf8().data(); - //FSMakeFSSpec(0, 0,(const unsigned char*)pStr , &fspec); getFSSpecFromPosixPath(pStr, &fspec, false); pStr = 0; diff --git a/toonz/sources/image/mov/tiio_movW.cpp b/toonz/sources/image/mov/tiio_movW.cpp index d21815e..c561b47 100644 --- a/toonz/sources/image/mov/tiio_movW.cpp +++ b/toonz/sources/image/mov/tiio_movW.cpp @@ -121,7 +121,7 @@ string buildQTErrorString(int ec) return "unable to set movie box"; default: { - return "unknown error ('" + toString(ec) + "')"; + return "unknown error ('" + std::to_string(ec) + "')"; } } } diff --git a/toonz/sources/image/pli/tiio_pli.cpp b/toonz/sources/image/pli/tiio_pli.cpp index 32e7c73..0615428 100644 --- a/toonz/sources/image/pli/tiio_pli.cpp +++ b/toonz/sources/image/pli/tiio_pli.cpp @@ -92,7 +92,7 @@ public: TInputStreamInterface &operator>>(std::string &x) { if ((*m_stream)[m_count].m_type == TStyleParam::SP_INT) - x = toString((int)(*m_stream)[m_count++].m_numericVal); + x = std::to_string(static_cast((*m_stream)[m_count++].m_numericVal)); else { assert((*m_stream)[m_count].m_type == TStyleParam::SP_STRING); x = (*m_stream)[m_count++].m_string; @@ -165,7 +165,7 @@ void buildPalette(ParsedPli *pli, const TImageP img) // se c'e' una reference image, uso il primo stile della palette per memorizzare il path TFilePath fp; if ((fp = vPalette->getRefImgPath()) != TFilePath()) { - TStyleParam styleParam("refimage" + toString(fp)); + TStyleParam styleParam("refimage" + ::to_string(fp)); StyleTag *refImageTag = new StyleTag(0, 0, 1, &styleParam); pli->m_palette_tags.push_back((PliObjectTag *)refImageTag); } @@ -177,7 +177,7 @@ void buildPalette(ParsedPli *pli, const TImageP img) std::vector pageNames(vPalette->getPageCount()); for (i = 0; i < pageNames.size(); i++) - pageNames[i] = TStyleParam(toString(vPalette->getPage(i)->getName())); + pageNames[i] = TStyleParam(::to_string(vPalette->getPage(i)->getName())); StyleTag *pageNamesTag = new StyleTag(0, 0, pageNames.size(), pageNames.data()); pli->m_palette_tags.push_back((PliObjectTag *)pageNamesTag); @@ -685,9 +685,9 @@ TPalette *readPalette(GroupTag *paletteTag, int majorVersion, int minorVersion) for (int j = 0; j < styleTag->m_numParams; j++) { assert(styleTag->m_param[j].m_type == TStyleParam::SP_STRING); if (j == 0) - palette->getPage(0)->setName(toWideString(styleTag->m_param[j].m_string)); + palette->getPage(0)->setName(::to_wstring(styleTag->m_param[j].m_string)); else { - palette->addPage(toWideString(styleTag->m_param[j].m_string)); + palette->addPage(::to_wstring(styleTag->m_param[j].m_string)); //palette->getPage(j)->addStyle(TPixel32::Red); } } diff --git a/toonz/sources/image/sgi/filesgi.cpp b/toonz/sources/image/sgi/filesgi.cpp index e202b66..3f27848 100644 --- a/toonz/sources/image/sgi/filesgi.cpp +++ b/toonz/sources/image/sgi/filesgi.cpp @@ -1159,7 +1159,7 @@ void SgiWriter::open(FILE *file, const TImageInfo &info) TEnumProperty *p = (TEnumProperty *)(m_properties->getProperty("Bits Per Pixel")); assert(p); - string str = toString(p->getValue()); + string str = ::to_string(p->getValue()); int bitPerPixel = atoi(str.c_str()); int channelBytesNum = 1; int dim = 3; @@ -1197,7 +1197,7 @@ void SgiWriter::open(FILE *file, const TImageInfo &info) bool compressed = bp->getValue(); p = (TEnumProperty *)(m_properties->getProperty("Endianess")); assert(p); - str = toString(p->getValue()); + str = ::to_string(p->getValue()); bool bigEndian = (str == "Big Endian"); m_header = iopen(fileno(file), OpenWrite, compressed ? RLE(BPP(channelBytesNum)) : VERBATIM(BPP(channelBytesNum)), diff --git a/toonz/sources/image/tif/tiio_tif.cpp b/toonz/sources/image/tif/tiio_tif.cpp index 33f75d0..b519cef 100644 --- a/toonz/sources/image/tif/tiio_tif.cpp +++ b/toonz/sources/image/tif/tiio_tif.cpp @@ -781,8 +781,7 @@ void TifWriter::open(FILE *file, const TImageInfo &info) TEnumProperty *p = (TEnumProperty *)(m_properties->getProperty("Bits Per Pixel")); assert(p); - std::string str = toString(p->getValue()); - //const char* str = toString(p->getValue()).c_str(); + std::string str = ::to_string(p->getValue()); m_bpp = atoi(str.c_str()); assert(m_bpp == 1 || m_bpp == 8 || m_bpp == 16 || m_bpp == 24 || m_bpp == 32 || m_bpp == 48 || m_bpp == 64); diff --git a/toonz/sources/include/tcli.h b/toonz/sources/include/tcli.h index 01dd751..2312ae1 100644 --- a/toonz/sources/include/tcli.h +++ b/toonz/sources/include/tcli.h @@ -34,7 +34,7 @@ namespace TCli inline bool fromStr(int &value, std::string s) { if (isInt(s)) { - value = toInt(s); + value = std::stoi(s); return true; } else return false; @@ -42,7 +42,7 @@ inline bool fromStr(int &value, std::string s) inline bool fromStr(double &value, std::string s) { if (isDouble(s)) { - value = toDouble(s); + value = std::stod(s); return true; } else return false; diff --git a/toonz/sources/include/tcommon.h b/toonz/sources/include/tcommon.h index 554b427..7ad3e4c 100644 --- a/toonz/sources/include/tcommon.h +++ b/toonz/sources/include/tcommon.h @@ -24,7 +24,6 @@ #endif #include -#include #include #include #include diff --git a/toonz/sources/include/tconvert.h b/toonz/sources/include/tconvert.h index 8782797..084d275 100644 --- a/toonz/sources/include/tconvert.h +++ b/toonz/sources/include/tconvert.h @@ -21,31 +21,20 @@ class TFilePath; DVAPI bool isInt(std::string s); DVAPI bool isDouble(std::string s); -DVAPI std::string toString(int v); -DVAPI std::string toString(unsigned long v); -DVAPI std::string toString(unsigned long long v); -DVAPI std::string toString(double v, int prec = -1); -DVAPI std::string toString(std::wstring s); -DVAPI std::string toString(const TFilePath &fp); -DVAPI std::string toString(void *p); - -DVAPI int toInt(std::string s); -DVAPI double toDouble(std::string s); +DVAPI std::string to_string(double v, int prec); +DVAPI std::string to_string(std::wstring s); +DVAPI std::string to_string(const TFilePath &fp); +DVAPI std::string to_string(void* p); DVAPI bool isInt(std::wstring s); DVAPI bool isDouble(std::wstring s); -DVAPI std::wstring toWideString(std::string s); -DVAPI std::wstring toWideString(int v); -DVAPI std::wstring toWideString(double v, int prec = -1); - -DVAPI int toInt(std::wstring s); -DVAPI double toDouble(std::wstring s); +DVAPI std::wstring to_wstring(std::string s); inline bool fromStr(int &v, std::string s) { if (isInt(s)) { - v = toInt(s); + v = std::stoi(s); return true; } else return false; @@ -54,7 +43,7 @@ inline bool fromStr(int &v, std::string s) inline bool fromStr(double &v, std::string s) { if (isDouble(s)) { - v = toDouble(s); + v = std::stod(s); return true; } else return false; diff --git a/toonz/sources/include/tnotanimatableparam.h b/toonz/sources/include/tnotanimatableparam.h index be51cc1..5b1e3c4 100644 --- a/toonz/sources/include/tnotanimatableparam.h +++ b/toonz/sources/include/tnotanimatableparam.h @@ -173,7 +173,8 @@ public: std::string getValueAlias(double, int) { - return toString(getValue()); + using namespace std; + return to_string(getValue()); } bool hasKeyframes() const { return 0; }; void getKeyframes(std::set &) const {}; diff --git a/toonz/sources/include/tproperty.h b/toonz/sources/include/tproperty.h index bec9fb7..5271546 100644 --- a/toonz/sources/include/tproperty.h +++ b/toonz/sources/include/tproperty.h @@ -5,6 +5,8 @@ #include "tconvert.h" +#include + #undef DVAPI #undef DVVAR @@ -149,7 +151,7 @@ public: std::string getValueAsString() { - return toString(m_value); + return std::to_string(m_value); } void accept(Visitor &v) { v.visit(this); } @@ -208,7 +210,7 @@ public: } std::string getValueAsString() { - return toString(m_value.first) + "," + toString(m_value.second); + return std::to_string(m_value.first) + "," + std::to_string(m_value.second); } void accept(Visitor &v) { v.visit(this); }; @@ -259,7 +261,7 @@ public: } std::string getValueAsString() { - return toString(m_value.first) + "," + toString(m_value.second); + return std::to_string(m_value.first) + "," + std::to_string(m_value.second); } void accept(Visitor &v) { v.visit(this); }; @@ -285,7 +287,7 @@ public: bool getValue() const { return m_value; } std::string getValueAsString() { - return toString(m_value); + return std::to_string(m_value); } void accept(Visitor &v) { v.visit(this); }; @@ -309,7 +311,7 @@ public: std::wstring getValue() const { return m_value; } std::string getValueAsString() { - return toString(m_value); + return ::to_string(m_value); } void accept(Visitor &v) { v.visit(this); }; @@ -334,7 +336,7 @@ public: std::string getValueAsString() { - return toString(m_value); + return ::to_string(m_value); } void accept(Visitor &v) { v.visit(this); }; @@ -360,7 +362,7 @@ public: std::string getValueAsString() { - return toString((unsigned long long)m_value); + return ::to_string(m_value); } void accept(Visitor &v) { v.visit(this); }; @@ -439,7 +441,7 @@ public: const Range &getRange() const { return m_range; } std::wstring getValue() const { return (m_index < 0) ? L"" : m_range[m_index]; } - std::string getValueAsString() { return toString(m_range[m_index]); } + std::string getValueAsString() { return ::to_string(m_range[m_index]); } int getIndex() const { return m_index; } void accept(Visitor &v) { v.visit(this); } diff --git a/toonz/sources/stdfx/artcontourfx.cpp b/toonz/sources/stdfx/artcontourfx.cpp index 02b5874..3e752ca 100644 --- a/toonz/sources/stdfx/artcontourfx.cpp +++ b/toonz/sources/stdfx/artcontourfx.cpp @@ -62,7 +62,7 @@ public: { int argc = 12; const char *argv[12]; - argv[0] = strsave(toString(m_colorIndex->getValue()).c_str()); + argv[0] = strsave(::to_string(m_colorIndex->getValue()).c_str()); getValues(argv, argc, frame); SandorFxRenderData *artContourData = new SandorFxRenderData(ArtAtContour, argc, argv, @@ -167,7 +167,7 @@ private: { std::string app; for (int i = 1; i <= 11; i++) { - app = toString(param[i]); + app = std::to_string(param[i]); cParam[i] = strsave(app.c_str()); } } diff --git a/toonz/sources/stdfx/blendtzfx.cpp b/toonz/sources/stdfx/blendtzfx.cpp index 7cdea50..eace03b 100644 --- a/toonz/sources/stdfx/blendtzfx.cpp +++ b/toonz/sources/stdfx/blendtzfx.cpp @@ -98,7 +98,7 @@ private: { std::string app; for (int i = 2; i < cParamLen - 1; i++) { - app = toString(param[i]); + app = std::to_string(param[i]); cParam[i] = strsave(app.c_str()); } } @@ -126,7 +126,7 @@ private: int shrink = tround((ri.m_shrinkX + ri.m_shrinkY) / 2.0); int argc = 6; const char *argv[6]; - argv[0] = strsave(toString(m_colorIndex->getValue()).c_str()); + argv[0] = strsave(::to_string(m_colorIndex->getValue()).c_str()); argv[1] = argv[0]; argv[5] = "1"; getValues(argv, argc, frame); diff --git a/toonz/sources/stdfx/calligraphicfx.cpp b/toonz/sources/stdfx/calligraphicfx.cpp index 9a7611a..a3cdd38 100644 --- a/toonz/sources/stdfx/calligraphicfx.cpp +++ b/toonz/sources/stdfx/calligraphicfx.cpp @@ -68,7 +68,7 @@ public: int shrink = tround((info.m_shrinkX + info.m_shrinkY) / 2.0); int argc = 8; const char *argv[8]; - argv[0] = strsave(toString(m_colorIndex->getValue()).c_str()); + argv[0] = strsave(::to_string(m_colorIndex->getValue()).c_str()); getValues(argv, argc, frame); SandorFxRenderData *calligraphicData = new SandorFxRenderData(Calligraphic, argc, argv, 0, shrink); CalligraphicParams ¶ms = calligraphicData->m_callParams; @@ -122,7 +122,7 @@ private: { std::string app; for (int i = 1; i < cParamLen; i++) { - app = toString(param[i]); + app = std::to_string(param[i]); cParam[i] = strsave(app.c_str()); } } @@ -135,7 +135,7 @@ private: int shrink = tround((ri.m_shrinkX + ri.m_shrinkY) / 2.0); int argc = 8; const char *argv[8]; - argv[0] = strsave(toString(m_colorIndex->getValue()).c_str()); + argv[0] = strsave(::to_string(m_colorIndex->getValue()).c_str()); getValues(argv, argc, frame); TRenderSettings ri2(ri); SandorFxRenderData *calligraphicData = new SandorFxRenderData(Calligraphic, argc, argv, 0, shrink); @@ -166,7 +166,7 @@ private: int shrink = tround((infoOnOutput.m_shrinkX + infoOnOutput.m_shrinkY) / 2.0); int argc = 8; const char *argv[8]; - argv[0] = strsave(toString(m_colorIndex->getValue()).c_str()); + argv[0] = strsave(::to_string(m_colorIndex->getValue()).c_str()); getValues(argv, argc, frame); SandorFxRenderData *calligraphicData = new SandorFxRenderData(Calligraphic, argc, argv, 0, shrink); CalligraphicParams ¶ms = calligraphicData->m_callParams; @@ -230,7 +230,7 @@ public: int shrink = tround((info.m_shrinkX + info.m_shrinkY) / 2.0); int argc = 8; const char *argv[8]; - argv[0] = strsave(toString(L"-1").c_str()); + argv[0] = "-1"; getValues(argv, argc, frame); SandorFxRenderData *outBorderData = new SandorFxRenderData(OutBorder, argc, argv, 0, shrink); CalligraphicParams ¶ms = outBorderData->m_callParams; @@ -282,7 +282,7 @@ private: { std::string app; for (int i = 1; i < cParamLen; i++) { - app = toString(param[i]); + app = std::to_string(param[i]); cParam[i] = strsave(app.c_str()); } } @@ -295,7 +295,7 @@ private: int shrink = tround((ri.m_shrinkX + ri.m_shrinkY) / 2.0); int argc = 8; const char *argv[8]; - argv[0] = strsave(toString(L"-1").c_str()); + argv[0] = "-1"; getValues(argv, argc, frame); TRenderSettings ri2(ri); SandorFxRenderData *outBorderData = new SandorFxRenderData(OutBorder, argc, argv, 0, shrink); @@ -325,7 +325,7 @@ private: int shrink = tround((infoOnOutput.m_shrinkX + infoOnOutput.m_shrinkY) / 2.0); int argc = 8; const char *argv[8]; - argv[0] = strsave(toString(L"-1").c_str()); + argv[0] = "-1"; getValues(argv, argc, frame); SandorFxRenderData *outBorderData = new SandorFxRenderData(OutBorder, argc, argv, 0, shrink); CalligraphicParams ¶ms = outBorderData->m_callParams; diff --git a/toonz/sources/stdfx/cornerpinfx.cpp b/toonz/sources/stdfx/cornerpinfx.cpp index c9a425a..ddd1239 100644 --- a/toonz/sources/stdfx/cornerpinfx.cpp +++ b/toonz/sources/stdfx/cornerpinfx.cpp @@ -375,7 +375,7 @@ void CornerPinFx::doDryCompute(TRectD &rect, double frame, const TRenderSettings return; std::vector items; - std::string indexes = toString(m_string->getValue()); + std::string indexes = ::to_string(m_string->getValue()); parseIndexes(indexes, items); TRenderSettings ri2(ri); PaletteFilterFxRenderData *PaletteFilterData = new PaletteFilterFxRenderData; @@ -431,7 +431,7 @@ void CornerPinFx::doCompute(TTile &tile, double frame, const TRenderSettings &ri //carico il vettore items con gli indici dei colori std::vector items; - std::string indexes = toString(m_string->getValue()); + std::string indexes = ::to_string(m_string->getValue()); parseIndexes(indexes, items); //genero il tile il cui raster contiene l'immagine in input a cui sono stati tolti i pixel diff --git a/toonz/sources/stdfx/externalpalettefx.cpp b/toonz/sources/stdfx/externalpalettefx.cpp index 47d59fd..8763160 100644 --- a/toonz/sources/stdfx/externalpalettefx.cpp +++ b/toonz/sources/stdfx/externalpalettefx.cpp @@ -105,7 +105,7 @@ std::string ExternalPaletteFx::getAlias(double frame, const TRenderSettings &inf TFx *fx = m_expalette.getFx(); TPaletteP plt(getPalette(fx, frame)); if (plt && plt->isAnimated()) - alias += toString(frame); + alias += std::to_string(frame); } return alias; @@ -124,7 +124,7 @@ void ExternalPaletteFx::doDryCompute(TRectD &rect, double frame, const TRenderSe TPaletteP palette(getPalette(fx, frame)); if (palette && palette->isAnimated()) - pltAlias += toString(frame); + pltAlias += std::to_string(frame); TRenderSettings ri2(ri); ExternalPaletteFxRenderData *data = @@ -150,7 +150,7 @@ void ExternalPaletteFx::doCompute(TTile &tile, double frame, const TRenderSettin TPaletteP palette(getPalette(fx, frame)); if (palette && palette->isAnimated()) - pltAlias += toString(frame); + pltAlias += std::to_string(frame); TRenderSettings ri2(ri); ExternalPaletteFxRenderData *data = diff --git a/toonz/sources/stdfx/iwa_motionblurfx.cpp b/toonz/sources/stdfx/iwa_motionblurfx.cpp index 0dda8e8..760ac65 100644 --- a/toonz/sources/stdfx/iwa_motionblurfx.cpp +++ b/toonz/sources/stdfx/iwa_motionblurfx.cpp @@ -989,7 +989,7 @@ std::string Iwa_MotionBlurCompFx::getAlias(double frame, const TRenderSettings & paramalias += param->getName() + "=" + param->getValueAlias(frame, 3); } unsigned long id = getIdentifier(); - return alias + toString(frame) + "," + toString(id) + paramalias + "]"; + return alias + std::to_string(frame) + "," + std::to_string(id) + paramalias + "]"; } FX_PLUGIN_IDENTIFIER(Iwa_MotionBlurCompFx, "iwa_MotionBlurCompFx") diff --git a/toonz/sources/stdfx/iwa_particlesengine.cpp b/toonz/sources/stdfx/iwa_particlesengine.cpp index a57321b..af1eb33 100644 --- a/toonz/sources/stdfx/iwa_particlesengine.cpp +++ b/toonz/sources/stdfx/iwa_particlesengine.cpp @@ -27,6 +27,8 @@ #include #include +#include + namespace { QMutex mutex; diff --git a/toonz/sources/stdfx/iwa_particlesfx.cpp b/toonz/sources/stdfx/iwa_particlesfx.cpp index 04bcc08..32795a0 100644 --- a/toonz/sources/stdfx/iwa_particlesfx.cpp +++ b/toonz/sources/stdfx/iwa_particlesfx.cpp @@ -331,7 +331,7 @@ std::string Iwa_TiledParticlesFx::getAlias(double frame, const TRenderSettings & paramalias += param->getName() + "=" + param->getValueAlias(frame, 3); } - return alias + toString(frame) + "," + toString(getIdentifier()) + paramalias + "]"; + return alias + std::to_string(frame) + "," + std::to_string(getIdentifier()) + paramalias + "]"; } //------------------------------------------------------------------ diff --git a/toonz/sources/stdfx/motionblurfx.cpp b/toonz/sources/stdfx/motionblurfx.cpp index 9575e0d..08d6a21 100644 --- a/toonz/sources/stdfx/motionblurfx.cpp +++ b/toonz/sources/stdfx/motionblurfx.cpp @@ -449,7 +449,7 @@ public: { unsigned long id = getIdentifier(); double value = m_intensity->getValue(frame); - return getFxType() + "[" + toString(id) + "," + toString(frame) + "," + toString(value) + "]"; + return getFxType() + "[" + std::to_string(id) + "," + std::to_string(frame) + "," + std::to_string(value) + "]"; } }; diff --git a/toonz/sources/stdfx/noisefx.cpp b/toonz/sources/stdfx/noisefx.cpp index a7b2546..3740c34 100644 --- a/toonz/sources/stdfx/noisefx.cpp +++ b/toonz/sources/stdfx/noisefx.cpp @@ -196,7 +196,7 @@ std::string NoiseFx::getAlias(double frame, const TRenderSettings &info) const } if (addframe) - alias += toString(frame) + ","; + alias += std::to_string(frame) + ","; alias += paramalias + "]"; return alias; diff --git a/toonz/sources/stdfx/palettefilterfx.cpp b/toonz/sources/stdfx/palettefilterfx.cpp index 35c6237..ee76fa2 100644 --- a/toonz/sources/stdfx/palettefilterfx.cpp +++ b/toonz/sources/stdfx/palettefilterfx.cpp @@ -64,7 +64,7 @@ void PaletteFilterFx::doDryCompute(TRectD &rect, double frame, return; std::vector items; - std::string indexes = toString(m_string->getValue()); + std::string indexes = ::to_string(m_string->getValue()); parseIndexes(indexes, items); TRenderSettings ri2(info); PaletteFilterFxRenderData *PaletteFilterData = new PaletteFilterFxRenderData; @@ -94,7 +94,7 @@ void PaletteFilterFx::doCompute(TTile &tile, double frame, const TRenderSettings return; std::vector items; - std::string indexes = toString(m_string->getValue()); + std::string indexes = ::to_string(m_string->getValue()); parseIndexes(indexes, items); TRenderSettings ri2(ri); PaletteFilterFxRenderData *PaletteFilterData = new PaletteFilterFxRenderData; diff --git a/toonz/sources/stdfx/particlesengine.cpp b/toonz/sources/stdfx/particlesengine.cpp index 5572d2b..f9dc779 100644 --- a/toonz/sources/stdfx/particlesengine.cpp +++ b/toonz/sources/stdfx/particlesengine.cpp @@ -26,6 +26,8 @@ #include "trenderer.h" +#include + /*-----------------------------------------------------------------*/ Particles_Engine::Particles_Engine(ParticlesFx *parent, double frame) diff --git a/toonz/sources/stdfx/particlesfx.cpp b/toonz/sources/stdfx/particlesfx.cpp index eb671e4..5b21478 100644 --- a/toonz/sources/stdfx/particlesfx.cpp +++ b/toonz/sources/stdfx/particlesfx.cpp @@ -259,7 +259,7 @@ std::string ParticlesFx::getAlias(double frame, const TRenderSettings &info) con paramalias += param->getName() + "=" + param->getValueAlias(frame, 3); } - return alias + toString(frame) + "," + toString(getIdentifier()) + paramalias + "]"; + return alias + std::to_string(frame) + "," + std::to_string(getIdentifier()) + paramalias + "]"; } //------------------------------------------------------------------ diff --git a/toonz/sources/stdfx/saltpeppernoisefx.cpp b/toonz/sources/stdfx/saltpeppernoisefx.cpp index 703206f..83adddb 100644 --- a/toonz/sources/stdfx/saltpeppernoisefx.cpp +++ b/toonz/sources/stdfx/saltpeppernoisefx.cpp @@ -128,7 +128,7 @@ std::string SaltPepperNoiseFx::getAlias(double frame, const TRenderSettings &inf } if (addframe) - alias += toString(frame) + ","; + alias += std::to_string(frame) + ","; alias += paramalias + "]"; return alias; diff --git a/toonz/sources/stdfx/texturefx.cpp b/toonz/sources/stdfx/texturefx.cpp index 75d4590..d1b2fad 100644 --- a/toonz/sources/stdfx/texturefx.cpp +++ b/toonz/sources/stdfx/texturefx.cpp @@ -76,7 +76,7 @@ void TextureFx::doDryCompute(TRectD &rect, double frame, const TRenderSettings & return; std::vector items; - std::string indexes = toString(m_string->getValue()); + std::string indexes = ::to_string(m_string->getValue()); parseIndexes(indexes, items); TRenderSettings ri2(info); PaletteFilterFxRenderData *PaletteFilterData = new PaletteFilterFxRenderData; @@ -115,7 +115,7 @@ void TextureFx::doCompute(TTile &tile, double frame, const TRenderSettings &ri) //carico il vettore items con gli indici dei colori std::vector items; - std::string indexes = toString(m_string->getValue()); + std::string indexes = ::to_string(m_string->getValue()); parseIndexes(indexes, items); //genero il tile il cui raster contiene l'immagine in input a cui sono stati tolti i pixel diff --git a/toonz/sources/tcleanupper/tcleanupper.cpp b/toonz/sources/tcleanupper/tcleanupper.cpp index 48a4aa6..bf672b7 100644 --- a/toonz/sources/tcleanupper/tcleanupper.cpp +++ b/toonz/sources/tcleanupper/tcleanupper.cpp @@ -51,7 +51,7 @@ using namespace std; inline ostream &operator<<(ostream &out, const wstring &w) { - return out << toString(w); + return out << ::to_string(w); } //------------------------------------------------------------------------ @@ -413,7 +413,7 @@ void cleanupLevel(TXshSimpleLevel *xl, std::set fidsInXsheet, TFilePath fp = scene->decodeFilePath(xl->getPath()); TSystem::touchParentDir(fp); cout << "cleanupping " << xl->getName() << " path=" << fp << endl; - string info = "cleanupping " + toString(xl->getPath()); + string info = "cleanupping " + ::to_string(xl->getPath()); LevelUpdater updater(xl); m_userLog.info(info); DVGui::info(QString::fromStdString(info)); @@ -539,9 +539,9 @@ int main(int argc, char *argv[]) TFilePath fproot = TEnv::getStuffDir(); if (fproot == TFilePath()) - fatalError(string("Undefined: \"") + toString(TEnv::getRootVarPath().getWideString()) + "\""); + fatalError(string("Undefined: \"") + ::to_string(TEnv::getRootVarPath()) + "\""); if (!TFileStatus(fproot).isDirectory()) - fatalError(string("Directory \"") + toString(fproot.getWideString()) + "\" not found or not readable"); + fatalError(string("Directory \"") + ::to_string(fproot) + "\" not found or not readable"); TFilePath lRootDir = TEnv::getStuffDir() + "toonzfarm"; TFilePath logFilePath = lRootDir + "tcleanup.log"; @@ -586,7 +586,7 @@ int main(int argc, char *argv[]) if (pos == string::npos) UseRenderFarm = false; else { - FarmControllerPort = toInt(fdata.substr(0, pos)); + FarmControllerPort = std::stoi(fdata.substr(0, pos)); FarmControllerName = fdata.substr(pos + 1); } } diff --git a/toonz/sources/tcomposer/tcomposer.cpp b/toonz/sources/tcomposer/tcomposer.cpp index c9bea28..30231fd 100644 --- a/toonz/sources/tcomposer/tcomposer.cpp +++ b/toonz/sources/tcomposer/tcomposer.cpp @@ -238,7 +238,7 @@ QString TaskId; void tcomposerRunOutOfContMemHandler(unsigned long size) { - string msg("Run out of contiguous memory: tried to allocate " + toString(size >> 10) + " KB"); + string msg("Run out of contiguous memory: tried to allocate " + std::to_string(size >> 10) + " KB"); cout << msg << endl; m_userLog->error(msg); @@ -277,9 +277,9 @@ bool MyMovieRenderListener::onFrameCompleted(int frame) TFilePath fp = m_fp.withFrame(frame + 1); string msg; if (m_stereo) - msg = toString(fp.withName(fp.getName() + "_l").getWideString()) + " and " + toString(fp.withName(fp.getName() + "_r").getWideString()) + " computed"; + msg = ::to_string(fp.withName(fp.getName() + "_l")) + " and " + ::to_string(fp.withName(fp.getName() + "_r")) + " computed"; else - msg = toString(fp.getWideString()) + " computed"; + msg = ::to_string(fp) + " computed"; cout << msg << endl; m_userLog->info(msg); DVGui::info(QString::fromStdString(msg)); @@ -287,7 +287,7 @@ bool MyMovieRenderListener::onFrameCompleted(int frame) try { FarmController->taskProgress(TaskId, m_frameCompletedCount + m_frameFailedCount, m_frameCount, frame + 1, FrameDone); } catch (...) { - msg = "Unable to connect to " + toString(FarmControllerPort) + "@" + FarmControllerName.toStdString(); + msg = "Unable to connect to " + std::to_string(FarmControllerPort) + "@" + FarmControllerName.toStdString(); cout << msg; m_userLog->error(msg); } @@ -304,10 +304,10 @@ bool MyMovieRenderListener::onFrameFailed(int frame, TException &e) { TFilePath fp = m_fp.withFrame(frame + 1); string msg; - msg = toString(fp.getWideString()) + " failed"; + msg = ::to_string(fp) + " failed"; if (!e.getMessage().empty()) - msg += ": " + toString(e.getMessage()); + msg += ": " + ::to_string(e.getMessage()); cout << msg << endl; m_userLog->error(msg); @@ -315,7 +315,7 @@ bool MyMovieRenderListener::onFrameFailed(int frame, TException &e) try { FarmController->taskProgress(TaskId, m_frameCompletedCount + m_frameFailedCount, m_frameCount, frame + 1, FrameFailed); } catch (...) { - msg = "Unable to connect to " + toString(FarmControllerPort) + "@" + FarmControllerName.toStdString(); + msg = "Unable to connect to " + std::to_string(FarmControllerPort) + "@" + FarmControllerName.toStdString(); cout << msg; m_userLog->error(msg); } @@ -360,14 +360,14 @@ public: bool MyMultimediaRenderListener::onFrameCompleted(int frame, int column) { int actualFrame = frame + 1; - string msg = toString(m_fp.getWideString()) + ", column " + toString(column) + ", frame " + toString(actualFrame) + " computed"; + string msg = ::to_string(m_fp) + ", column " + std::to_string(column) + ", frame " + std::to_string(actualFrame) + " computed"; cout << msg << endl; m_userLog->info(msg); if (FarmController) { try { FarmController->taskProgress(TaskId, m_frameCompletedCount + m_frameFailedCount, m_frameCount, actualFrame, FrameDone); } catch (...) { - msg = "Unable to connect to " + toString(FarmControllerPort) + "@" + FarmControllerName.toStdString(); + msg = "Unable to connect to " + std::to_string(FarmControllerPort) + "@" + FarmControllerName.toStdString(); cout << msg; m_userLog->error(msg); } @@ -382,10 +382,10 @@ bool MyMultimediaRenderListener::onFrameCompleted(int frame, int column) bool MyMultimediaRenderListener::onFrameFailed(int frame, int column, TException &e) { int actualFrame = frame + 1; - string msg = toString(m_fp.getWideString()) + ", column " + toString(column) + ", frame " + toString(actualFrame) + " failed"; + string msg = ::to_string(m_fp) + ", column " + std::to_string(column) + ", frame " + std::to_string(actualFrame) + " failed"; if (!e.getMessage().empty()) - msg += ": " + toString(e.getMessage()); + msg += ": " + ::to_string(e.getMessage()); cout << msg << endl; m_userLog->error(msg); @@ -393,7 +393,7 @@ bool MyMultimediaRenderListener::onFrameFailed(int frame, int column, TException try { FarmController->taskProgress(TaskId, m_frameCompletedCount + m_frameFailedCount, m_frameCount, actualFrame, FrameFailed); } catch (...) { - msg = "Unable to connect to " + toString(FarmControllerPort) + "@" + FarmControllerName.toStdString(); + msg = "Unable to connect to " + std::to_string(FarmControllerPort) + "@" + FarmControllerName.toStdString(); cout << msg; m_userLog->error(msg); } @@ -439,7 +439,7 @@ std::pair generateMovie(ToonzScene *scene, TPropertyGroup *props = scene->getProperties()->getOutputProperties()->getFileFormatProperties(ext); string codecName = props->getProperty(0)->getValueAsString(); TDimension res = scene->getCurrentCamera()->getRes(); - if (!AviCodecRestrictions::canWriteMovie(toWideString(codecName), res)) { + if (!AviCodecRestrictions::canWriteMovie(::to_wstring(codecName), res)) { string msg("The resolution of the output camera does not fit with the options chosen for the output file format."); m_userLog->error(msg); exit(1); @@ -631,9 +631,9 @@ int main(int argc, char *argv[]) // controllo se la xxxroot e' definita e corrisponde ad un file esistente TFilePath fp = TEnv::getStuffDir(); if (fp == TFilePath()) - fatalError(string("Undefined: \"") + toString(TEnv::getRootVarPath().getWideString()) + "\""); + fatalError(string("Undefined: \"") + ::to_string(TEnv::getRootVarPath()) + "\""); if (!TFileStatus(fp).isDirectory()) - fatalError(string("Directory \"") + toString(fp.getWideString()) + "\" not found or not readable"); + fatalError(string("Directory \"") + ::to_string(fp) + "\" not found or not readable"); TFilePath lRootDir = fp + "toonzfarm"; TFilePath logFilePath = lRootDir + "tcomposer.log"; @@ -690,7 +690,7 @@ int main(int argc, char *argv[]) if (pos == string::npos) UseRenderFarm = false; else { - FarmControllerPort = toInt(fdata.substr(0, pos)); + FarmControllerPort = std::stoi(fdata.substr(0, pos)); FarmControllerName = QString::fromStdString(fdata.substr(pos + 1)); } } @@ -760,12 +760,12 @@ int main(int argc, char *argv[]) scene->load(srcFilePath); Sw2.stop(); } catch (TException &e) { - cout << toString(e.getMessage()) << endl; - m_userLog->error(toString(e.getMessage())); + cout << ::to_string(e.getMessage()) << endl; + m_userLog->error(::to_string(e.getMessage())); return -2; } catch (...) { string msg; - msg = "There were problems loading the scene " + toString(srcFilePath.getWideString()) + + msg = "There were problems loading the scene " + ::to_string(srcFilePath) + ".\n Some files may be missing."; cout << msg << endl; m_userLog->error(msg); @@ -878,9 +878,9 @@ int main(int argc, char *argv[]) maxTileSize = maxTileSizes[maxTileSizeIndex]; } - m_userLog->info("Threads count: " + toString(threadCount)); + m_userLog->info("Threads count: " + std::to_string(threadCount)); if (maxTileSize != (std::numeric_limits::max)()) - m_userLog->info("Render tile: " + toString(maxTileSize)); + m_userLog->info("Render tile: " + std::to_string(maxTileSize)); //Disable the Passive cache manager. It has no sense if it cannot write on disk... //TCacheResourcePool::instance(); //Needs to be instanced before TPassiveCacheManager... @@ -903,27 +903,19 @@ int main(int argc, char *argv[]) Sw1.stop(); - m_userLog->info("Raster Allocation Peak: " + toString(TBigMemoryManager::instance()->getAllocationPeak()) + " KB"); - m_userLog->info("Raster Allocation Mean: " + toString(TBigMemoryManager::instance()->getAllocationMean()) + " KB"); + m_userLog->info("Raster Allocation Peak: " + std::to_string(TBigMemoryManager::instance()->getAllocationPeak()) + " KB"); + m_userLog->info("Raster Allocation Mean: " + std::to_string(TBigMemoryManager::instance()->getAllocationMean()) + " KB"); - msg = "Compositing completed in " + toString(Sw1.getTotalTime() / 1000.0, 2) + " seconds"; - string msg2 = "\n" + toString(Sw2.getTotalTime() / 1000.0, 2) + " seconds spent on loading" + "\n" + - toString(TStopWatch::global(0).getTotalTime() / 1000.0, 2) + " seconds spent on saving" + "\n" + - toString(TStopWatch::global(8).getTotalTime() / 1000.0, 2) + " seconds spent on rendering" + "\n"; + msg = "Compositing completed in " + ::to_string(Sw1.getTotalTime() / 1000.0, 2) + " seconds"; + string msg2 = "\n" + ::to_string(Sw2.getTotalTime() / 1000.0, 2) + " seconds spent on loading" + "\n" + + ::to_string(TStopWatch::global(0).getTotalTime() / 1000.0, 2) + " seconds spent on saving" + "\n" + + ::to_string(TStopWatch::global(8).getTotalTime() / 1000.0, 2) + " seconds spent on rendering" + "\n"; cout << msg + msg2; m_userLog->info(msg + msg2); DVGui::info(QString::fromStdString(msg)); TImageCache::instance()->clear(true); - /* - cout << "Compositing completed in " + toString(Sw1.getTotalTime()/1000.0, 2) + " seconds"; - cout << endl; - - cout << toString(Sw2.getTotalTime()/1000.0, 2) << " seconds spent on loading" << endl; - cout << toString(TStopWatch::global(0).getTotalTime()/1000.0, 2) << " seconds spent on saving" << endl; - cout << toString(TStopWatch::global(8).getTotalTime()/1000.0, 2) << " seconds spent on rendering" << endl; - cout << endl;*/ } catch (TException &e) { - msg = "Untrapped exception: " + toString(e.getMessage()), + msg = "Untrapped exception: " + ::to_string(e.getMessage()), cout << msg << endl; m_userLog->error(msg); TImageCache::instance()->clear(true); diff --git a/toonz/sources/tconverter/tconverter.cpp b/toonz/sources/tconverter/tconverter.cpp index 1b4327b..9699952 100644 --- a/toonz/sources/tconverter/tconverter.cpp +++ b/toonz/sources/tconverter/tconverter.cpp @@ -143,7 +143,7 @@ void convertFromCM(const TLevelReaderP &lr, const TPaletteP &plt, const TLevelWr iw->save(rasImage); } } catch (...) { - string msg = "Frame " + toString(frames[i].getNumber()) + ": conversion failed!"; + string msg = "Frame " + std::to_string(frames[i].getNumber()) + ": conversion failed!"; cout << msg << endl; } } @@ -165,7 +165,7 @@ void convertFromVI(const TLevelReaderP &lr, const TPaletteP &plt, const TLevelWr images.push_back(img); maxBbox += img->getBBox(); } catch (...) { - string msg = "Frame " + toString(frames[i].getNumber()) + ": conversion failed!"; + string msg = "Frame " + std::to_string(frames[i].getNumber()) + ": conversion failed!"; cout << msg << endl; } } @@ -393,7 +393,7 @@ int main(int argc, char *argv[]) string ext = dstFilePath.getType(); //controllo che ci sia un'estensione if (ext == "") { - ext = toString(dstFilePath.getWideString()); + ext = ::to_string(dstFilePath); if (ext == "") { msg = "Invalid extension!"; cout << msg << endl; @@ -418,7 +418,7 @@ int main(int argc, char *argv[]) scene->loadTnzFile(tnzFilePath); } catch (...) { string msg; - msg = "There were problems loading the scene " + toString(srcFilePath.getWideString()) + + msg = "There were problems loading the scene " + ::to_string(srcFilePath) + ".\n Some files may be missing."; cout << msg << endl; //return false; @@ -442,7 +442,7 @@ int main(int argc, char *argv[]) exit(1); } } catch (TException &e) { - msg = "Untrapped exception: " + toString(e.getMessage()); + msg = "Untrapped exception: " + ::to_string(e.getMessage()); cout << msg << endl; return -1; } diff --git a/toonz/sources/tnzbase/stringtable.cpp b/toonz/sources/tnzbase/stringtable.cpp index 18d4f9c..d57a8cd 100644 --- a/toonz/sources/tnzbase/stringtable.cpp +++ b/toonz/sources/tnzbase/stringtable.cpp @@ -275,9 +275,9 @@ void TStringTableImp::load(const TFilePath &fp) } } Item &item = m_table[id]; - item.m_name = toWideString(name); - item.m_help = toWideString(help); - item.m_tip = toWideString(tip); + item.m_name = ::to_wstring(name); + item.m_help = ::to_wstring(help); + item.m_tip = ::to_wstring(tip); } else if (tagName == "defaultFont") { std::string fontName; int fontSize = 0; @@ -333,7 +333,7 @@ std::wstring TStringTable::translate(std::string name) if (item) return item->m_name; else - return toWideString(name); + return ::to_wstring(name); } //------------------------------------------------------------------- diff --git a/toonz/sources/tnzbase/texternfx.cpp b/toonz/sources/tnzbase/texternfx.cpp index 97bf97e..b9fa4d5 100644 --- a/toonz/sources/tnzbase/texternfx.cpp +++ b/toonz/sources/tnzbase/texternfx.cpp @@ -220,7 +220,7 @@ void TExternalProgramFx::doCompute(TTile &tile, double frame, const TRenderSetti if (!ras) return; std::string args = m_args; - std::string executablePath = toString(m_executablePath.getWideString()); + std::string executablePath = ::to_string(m_executablePath); std::map tmpFiles; // portname --> file TFilePath outputTmpFile; @@ -271,13 +271,13 @@ void TExternalProgramFx::doCompute(TTile &tile, double frame, const TRenderSetti if (it != tmpFiles.end()) { // e' una porta. il valore e' il nome del // file temporaneo - value = "\"" + toString(it->second.getWideString()) + "\""; + value = "\"" + ::to_string(it->second.getWideString()) + "\""; } else { // e' un parametro // se il nome non viene riconosciuto sostituisco la stringa nulla TDoubleParamP param = TParamP(getParams()->getParam(name)); if (param) - value = toString(param->getValue(frame)); + value = std::to_string(param->getValue(frame)); } args.replace(i, m + 1, value); diff --git a/toonz/sources/tnzbase/trasterfx.cpp b/toonz/sources/tnzbase/trasterfx.cpp index 8c17095..0723106 100644 --- a/toonz/sources/tnzbase/trasterfx.cpp +++ b/toonz/sources/tnzbase/trasterfx.cpp @@ -173,12 +173,12 @@ inline std::string traduce(const TAffine &aff) return //Observe that toString distinguishes + and - 0. That is a problem //when comparing aliases - so near 0 values are explicitly rounded to 0. - (areAlmostEqual(aff.a11, 0.0) ? "0" : toString(aff.a11, 5)) + "," + - (areAlmostEqual(aff.a12, 0.0) ? "0" : toString(aff.a12, 5)) + "," + - (areAlmostEqual(aff.a13, 0.0) ? "0" : toString(aff.a13, 5)) + "," + - (areAlmostEqual(aff.a21, 0.0) ? "0" : toString(aff.a21, 5)) + "," + - (areAlmostEqual(aff.a22, 0.0) ? "0" : toString(aff.a22, 5)) + "," + - (areAlmostEqual(aff.a23, 0.0) ? "0" : toString(aff.a23, 5)); + (areAlmostEqual(aff.a11, 0.0) ? "0" : ::to_string(aff.a11, 5)) + "," + + (areAlmostEqual(aff.a12, 0.0) ? "0" : ::to_string(aff.a12, 5)) + "," + + (areAlmostEqual(aff.a13, 0.0) ? "0" : ::to_string(aff.a13, 5)) + "," + + (areAlmostEqual(aff.a21, 0.0) ? "0" : ::to_string(aff.a21, 5)) + "," + + (areAlmostEqual(aff.a22, 0.0) ? "0" : ::to_string(aff.a22, 5)) + "," + + (areAlmostEqual(aff.a23, 0.0) ? "0" : ::to_string(aff.a23, 5)); } } // Local namespace @@ -684,7 +684,7 @@ void TRasterFx::dryCompute(TRectD &rect, return; } - std::string alias = getAlias(frame, info) + "[" + ::traduce(info.m_affine) + "][" + ::toString(info.m_bpp) + "]"; + std::string alias = getAlias(frame, info) + "[" + ::traduce(info.m_affine) + "][" + std::to_string(info.m_bpp) + "]"; int renderStatus = TRenderer::instance().getRenderStatus(TRenderer::renderId()); TFxCacheManager *cacheManager = TFxCacheManager::instance(); @@ -869,7 +869,7 @@ void TRasterFx::compute(TTile &tile, double frame, TRectD tilePlacement = myConvert(tile.getRaster()->getBounds()) + tile.m_pos; //Build the fx result alias (in other words, its name) - std::string alias = getAlias(frame, info) + "[" + ::traduce(info.m_affine) + "][" + ::toString(info.m_bpp) + "]"; //To be moved below + std::string alias = getAlias(frame, info) + "[" + ::traduce(info.m_affine) + "][" + std::to_string(info.m_bpp) + "]"; //To be moved below TRectD bbox; getBBox(frame, bbox, info); @@ -1089,23 +1089,23 @@ TRenderSettings::~TRenderSettings() std::string TRenderSettings::toString() const { std::string ss = - ::toString(m_bpp) + ";" + - ::toString(m_quality) + ";" + - ::toString(m_gamma) + ";" + - ::toString(m_timeStretchFrom) + ";" + - ::toString(m_timeStretchTo) + ";" + - ::toString(m_fieldPrevalence) + ";" + - ::toString(m_shrinkX) + "," + - ::toString(m_shrinkY) + ";" + - ::toString(m_affine.a11) + "," + - ::toString(m_affine.a12) + "," + - ::toString(m_affine.a13) + "," + - ::toString(m_affine.a21) + "," + - ::toString(m_affine.a22) + "," + - ::toString(m_affine.a23) + ";" + - ::toString(m_maxTileSize) + ";" + - ::toString(m_isSwatch) + ";" + - ::toString(m_userCachable) + ";{"; + std::to_string(m_bpp) + ";" + + std::to_string(m_quality) + ";" + + std::to_string(m_gamma) + ";" + + std::to_string(m_timeStretchFrom) + ";" + + std::to_string(m_timeStretchTo) + ";" + + std::to_string(m_fieldPrevalence) + ";" + + std::to_string(m_shrinkX) + "," + + std::to_string(m_shrinkY) + ";" + + std::to_string(m_affine.a11) + "," + + std::to_string(m_affine.a12) + "," + + std::to_string(m_affine.a13) + "," + + std::to_string(m_affine.a21) + "," + + std::to_string(m_affine.a22) + "," + + std::to_string(m_affine.a23) + ";" + + std::to_string(m_maxTileSize) + ";" + + std::to_string(m_isSwatch) + ";" + + std::to_string(m_userCachable) + ";{"; if (!m_data.empty()) { ss += m_data[0]->toString(); for (int i = 1; i < (int)m_data.size(); i++) diff --git a/toonz/sources/tnzbase/tscanner/TScannerIO/TUSBScannerIO_M.cpp b/toonz/sources/tnzbase/tscanner/TScannerIO/TUSBScannerIO_M.cpp index ec7835d..2290c3c 100644 --- a/toonz/sources/tnzbase/tscanner/TScannerIO/TUSBScannerIO_M.cpp +++ b/toonz/sources/tnzbase/tscanner/TScannerIO/TUSBScannerIO_M.cpp @@ -3,6 +3,7 @@ #include "TUSBScannerIO.h" #include "tsystem.h" #include +#include //#define HAS_LIBUSB diff --git a/toonz/sources/tnzbase/tscanner/TScannerIO/TUSBScannerIO_W.cpp b/toonz/sources/tnzbase/tscanner/TScannerIO/TUSBScannerIO_W.cpp index 6014d14..c6b24e9 100644 --- a/toonz/sources/tnzbase/tscanner/TScannerIO/TUSBScannerIO_W.cpp +++ b/toonz/sources/tnzbase/tscanner/TScannerIO/TUSBScannerIO_W.cpp @@ -5,6 +5,8 @@ #include +#include + class TUSBScannerIOPD { public: diff --git a/toonz/sources/tnzbase/tscanner/tscanner.cpp b/toonz/sources/tnzbase/tscanner/tscanner.cpp index d5bfea3..1a1c0b3 100644 --- a/toonz/sources/tnzbase/tscanner/tscanner.cpp +++ b/toonz/sources/tnzbase/tscanner/tscanner.cpp @@ -232,25 +232,25 @@ void TScannerParameters::saveData(TOStream &os) const if (m_dpi.m_supported) { attr.clear(); - attr["value"] = toString(m_dpi.m_value); + attr["value"] = std::to_string(m_dpi.m_value); os.openCloseChild("dpi", attr); } if (m_brightness.m_supported) { attr.clear(); - attr["value"] = toString(m_brightness.m_value); + attr["value"] = std::to_string(m_brightness.m_value); os.openCloseChild("brightness", attr); } if (m_contrast.m_supported) { attr.clear(); - attr["value"] = toString(m_contrast.m_value); + attr["value"] = std::to_string(m_contrast.m_value); os.openCloseChild("contrast", attr); } if (m_threshold.m_supported) { attr.clear(); - attr["value"] = toString(m_threshold.m_value); + attr["value"] = std::to_string(m_threshold.m_value); os.openCloseChild("threshold", attr); } } @@ -264,19 +264,19 @@ void TScannerParameters::loadData(TIStream &is) if (tagName == "dpi") { std::string s = is.getTagAttribute("value"); if (isDouble(s)) - m_dpi.m_value = (float)toDouble(s); + m_dpi.m_value = std::stof(s); } else if (tagName == "brightness") { std::string s = is.getTagAttribute("value"); if (isDouble(s)) - m_brightness.m_value = (float)toDouble(s); + m_brightness.m_value = std::stof(s); } else if (tagName == "threshold") { std::string s = is.getTagAttribute("value"); if (isDouble(s)) - m_threshold.m_value = (float)toDouble(s); + m_threshold.m_value = std::stof(s); } else if (tagName == "contrast") { std::string s = is.getTagAttribute("value"); if (isDouble(s)) - m_contrast.m_value = (float)toDouble(s); + m_contrast.m_value = std::stof(s); } else if (tagName == "autoFeeder") { m_paperFeeder.m_value = 1.0; } else if (tagName == "reverseOrder") { @@ -582,10 +582,10 @@ void TPaperFormatManager::readPaperFormat(const TFilePath &path) name = value; } else if (std::string(buffer).find("WIDTH") == 0) { if (isDouble(value)) - size.lx = toDouble(value); + size.lx = std::stod(value); } else if (std::string(buffer).find("LENGTH") == 0) { if (isDouble(value)) - size.ly = toDouble(value); + size.ly = std::stod(value); } } if (name == "" || size.lx == 0 || size.ly == 0) { diff --git a/toonz/sources/tnzbase/tscanner/tscannerepson.cpp b/toonz/sources/tnzbase/tscanner/tscannerepson.cpp index ce94afa..a34498e 100644 --- a/toonz/sources/tnzbase/tscanner/tscannerepson.cpp +++ b/toonz/sources/tnzbase/tscanner/tscannerepson.cpp @@ -1,6 +1,5 @@ -#include #include #include "texception.h" #include "tscanner.h" @@ -9,10 +8,14 @@ #include "tsystem.h" #include "tconvert.h" #include "trop.h" -#include -#include + #include "TScannerIO/TUSBScannerIO.h" +#include +#include +#include +#include + using namespace TScannerUtil; void sense(bool) {} @@ -81,10 +84,10 @@ public: TScannerExpection(const std::vector ¬Fatal, const std::string &fatal) : TException("Scanner Expection") { - m_scannerMsg = toWideString(fatal); + m_scannerMsg = ::to_wstring(fatal); for (int i = notFatal.size(); i; i--) - m_scannerMsg += toWideString("\n") + toWideString(notFatal[i - 1]); - log(std::string("Exception created: ") + toString(m_scannerMsg)); + m_scannerMsg += L"\n" + ::to_wstring(notFatal[i - 1]); + log("Exception created: " + ::to_string(m_scannerMsg)); } TString getMessage() const { return m_scannerMsg; } }; @@ -171,7 +174,7 @@ void TScannerEpson::updateParameters(TScannerParameters ¶meters) char lev0, lev1; unsigned short lowRes, hiRes, hMax, vMax; collectInformation(&lev0, &lev1, &lowRes, &hiRes, &hMax, &vMax); - log("collected info. res = " + toString(lowRes) + "/" + toString(hiRes)); + log("collected info. res = " + std::to_string(lowRes) + "/" + std::to_string(hiRes)); // non supportiamo black & white parameters.setSupportedTypes(true, true, true); @@ -225,7 +228,7 @@ void TScannerEpson::acquire(const TScannerParameters ¶ms, int paperCount) */ for (int i = 0; i < paperCount; ++i) { - log("paper " + toString(i)); + log("paper " + std::to_string(i)); #ifdef _DEBUG m_scannerIO->trace(true); #endif diff --git a/toonz/sources/tnztools/filltool.cpp b/toonz/sources/tnztools/filltool.cpp index 0c676e8..3020c8d 100644 --- a/toonz/sources/tnztools/filltool.cpp +++ b/toonz/sources/tnztools/filltool.cpp @@ -967,7 +967,7 @@ void doFill(const TImageP &img, if (tileSaver.getTileSet()->getTileCount() != 0) { static int count = 0; - TSystem::outputDebug("FILL" + toString(count++) + "\n"); + TSystem::outputDebug("FILL" + std::to_string(count++) + "\n"); if (offs != TPoint()) for (int i = 0; i < tileSet->getTileCount(); i++) { TTileSet::Tile *t = tileSet->editTile(i); @@ -2059,7 +2059,7 @@ void FillTool::leftButtonDrag(const TPointD &pos, const TMouseEvent &e) invalidate(); return; } - TSystem::outputDebug("ok. pix=" + toString(pix.getTone()) + "," + toString(pix.getPaint()) + "\n"); + TSystem::outputDebug("ok. pix=" + std::to_string(pix.getTone()) + "," + std::to_string(pix.getPaint()) + "\n"); } else return; doFill(img, pos, params, e.isShiftPressed(), m_level.getPointer(), getCurrentFid()); @@ -2116,7 +2116,7 @@ bool FillTool::onPropertyChanged(std::string propertyName) //Areas, Lines etc. if (propertyName == m_colorType.getName()) { - FillColorType = toString(m_colorType.getValue()); + FillColorType = ::to_string(m_colorType.getValue()); rectPropChangedflag = true; /*--- ColorModelのCursor更新のためにSIGNALを出す ---*/ @@ -2131,13 +2131,13 @@ bool FillTool::onPropertyChanged(std::string propertyName) FillOnion = (int)(m_onion.getValue()); FillSegment = (int)(m_segment.getValue()); } - FillType = toString(m_fillType.getValue()); + FillType = ::to_string(m_fillType.getValue()); rectPropChangedflag = true; } // Onion Skin else if (propertyName == m_onion.getName()) { if (m_onion.getValue()) - FillType = toString(m_fillType.getValue()); + FillType = ::to_string(m_fillType.getValue()); FillOnion = (int)(m_onion.getValue()); } // Frame Range @@ -2158,7 +2158,7 @@ bool FillTool::onPropertyChanged(std::string propertyName) // Segment else if (propertyName == m_segment.getName()) { if (m_segment.getValue()) - FillType = toString(m_fillType.getValue()); + FillType = ::to_string(m_fillType.getValue()); FillSegment = (int)(m_segment.getValue()); } @@ -2300,8 +2300,8 @@ void FillTool::onActivate() */ if (m_firstTime) { m_fillDepth.setValue(TDoublePairProperty::Value(MinFillDepth, MaxFillDepth)); - m_fillType.setValue(toWideString((FillType.getValue()))); - m_colorType.setValue(toWideString((FillColorType.getValue()))); + m_fillType.setValue(::to_wstring(FillType.getValue())); + m_colorType.setValue(::to_wstring(FillColorType.getValue())); // m_onlyEmpty.setValue(FillSelective ? 1 :0); m_onion.setValue(FillOnion ? 1 : 0); m_segment.setValue(FillSegment ? 1 : 0); diff --git a/toonz/sources/tnztools/fullcolorerasertool.cpp b/toonz/sources/tnztools/fullcolorerasertool.cpp index 9e14fa6..fedce8e 100644 --- a/toonz/sources/tnztools/fullcolorerasertool.cpp +++ b/toonz/sources/tnztools/fullcolorerasertool.cpp @@ -429,7 +429,7 @@ void FullColorEraserTool::onActivate() m_size.setValue(FullcolorEraseSize); m_opacity.setValue(FullcolorEraserOpacity); m_hardness.setValue(FullcolorEraseHardness); - m_eraseType.setValue(toWideString(FullcolorEraserType.getValue())); + m_eraseType.setValue(::to_wstring(FullcolorEraserType.getValue())); m_invertOption.setValue((bool)FullcolorEraserInvert); m_multi.setValue((bool)FullcolorEraserRange); m_firstTime = false; @@ -957,7 +957,7 @@ bool FullColorEraserTool::onPropertyChanged(std::string propertyName) FullcolorEraseSize = m_size.getValue(); FullcolorEraseHardness = m_hardness.getValue(); FullcolorEraserOpacity = m_opacity.getValue(); - FullcolorEraserType = toString(m_eraseType.getValue()); + FullcolorEraserType = ::to_string(m_eraseType.getValue()); FullcolorEraserInvert = (int)m_invertOption.getValue(); FullcolorEraserRange = (int)m_multi.getValue(); if (propertyName == "Hardness:" || propertyName == "Size:") { diff --git a/toonz/sources/tnztools/geometrictool.cpp b/toonz/sources/tnztools/geometrictool.cpp index 7052e3c..ea2d1fa 100644 --- a/toonz/sources/tnztools/geometrictool.cpp +++ b/toonz/sources/tnztools/geometrictool.cpp @@ -750,7 +750,7 @@ public: void addPrimitive(Primitive *p) { // TODO: aggiungere il controllo per evitare nomi ripetuti - std::wstring name = toWideString(p->getName()); + std::wstring name = ::to_wstring(p->getName()); //wstring name = TStringTable::translate(p->getName()); m_primitiveTable[name] = p; @@ -838,9 +838,9 @@ public: m_param.m_selective.setValue(GeometricSelective ? 1 : 0); m_param.m_autogroup.setValue(GeometricGroupIt ? 1 : 0); m_param.m_autofill.setValue(GeometricAutofill ? 1 : 0); - std::wstring typeCode = toWideString((GeometricType.getValue())); + std::wstring typeCode = ::to_wstring(GeometricType.getValue()); m_param.m_type.setValue(typeCode); - GeometricType = toString(typeCode); + GeometricType = ::to_string(typeCode); m_typeCode = typeCode; changeType(typeCode); m_param.m_edgeCount.setValue(GeometricEdgeCount); @@ -900,7 +900,7 @@ public: GeometricSize = m_param.m_toolSize.getValue(); } else if (propertyName == m_param.m_type.getName()) { std::wstring typeCode = m_param.m_type.getValue(); - GeometricType = toString(typeCode); + GeometricType = ::to_string(typeCode); if (typeCode != m_typeCode) { m_typeCode = typeCode; changeType(typeCode); @@ -2082,7 +2082,7 @@ void PolygonPrimitive::draw() return; tglColor(m_isEditing ? m_color : TPixel32::Green); - int edgeCount = atoi(toString(m_param->m_edgeCount.getValue()).c_str()); + int edgeCount = m_param->m_edgeCount.getValue(); if (edgeCount == 0) return; @@ -2141,7 +2141,7 @@ TStroke *PolygonPrimitive::makeStroke() const { double thick = getThickness(); - int edgeCount = atoi(toString(m_param->m_edgeCount.getValue()).c_str()); + int edgeCount = m_param->m_edgeCount.getValue(); if (edgeCount == 0) return 0; diff --git a/toonz/sources/tnztools/hooktool.cpp b/toonz/sources/tnztools/hooktool.cpp index fa457f9..9140e43 100644 --- a/toonz/sources/tnztools/hooktool.cpp +++ b/toonz/sources/tnztools/hooktool.cpp @@ -151,7 +151,7 @@ public: std::string handle = getXsheet()->getStageObject(getObjectId())->getHandle(); if (handle.find("H") != 0) return -1; - return toInt(handle.substr(1)) - 1; + return std::stoi(handle.substr(1)) - 1; } void drawHooks(HookSet *hookSet, const TFrameId &fid, bool isOnion); // other hooks are drawn in the current level reference frame @@ -346,7 +346,7 @@ void HookTool::draw() } TPixel32 balloonColor(200, 220, 205, 200); TPoint balloonOffset(20, 20); - std::string hookName = toString(i + 1); + std::string hookName = std::to_string(i + 1); drawBalloon(p0, hookName, balloonColor, balloonOffset, false, &balloons); if (!linked) drawBalloon(p1, hookName, balloonColor, balloonOffset, false, &balloons); @@ -739,7 +739,7 @@ bool HookTool::snap(TPointD &pos, double &range2) snappedPos = m_otherHooks[k].m_hookPos; m_snappedPos = snappedPos; m_snappedReason = - "Col" + toString(m_otherHooks[k].m_columnIndex + 1) + "/" + toString(m_otherHooks[k].m_hookIndex + 1); + "Col" + std::to_string(m_otherHooks[k].m_columnIndex + 1) + "/" + std::to_string(m_otherHooks[k].m_hookIndex + 1); ret = true; } pos = snappedPos; diff --git a/toonz/sources/tnztools/paintbrushtool.cpp b/toonz/sources/tnztools/paintbrushtool.cpp index fd15b3d..95d26b2 100644 --- a/toonz/sources/tnztools/paintbrushtool.cpp +++ b/toonz/sources/tnztools/paintbrushtool.cpp @@ -358,7 +358,7 @@ bool PaintBrushTool::onPropertyChanged(std::string propertyName) else if (propertyName == m_onlyEmptyAreas.getName()) { if (m_onlyEmptyAreas.getValue() && m_colorType.getValue() == LINES) { m_colorType.setValue(AREAS); - PaintBrushColorType = toString(m_colorType.getValue()); + PaintBrushColorType = ::to_string(m_colorType.getValue()); } PaintBrushSelective = (int)(m_onlyEmptyAreas.getValue()); } @@ -368,7 +368,7 @@ bool PaintBrushTool::onPropertyChanged(std::string propertyName) if (m_colorType.getValue() == LINES) { PaintBrushSelective = (int)(m_onlyEmptyAreas.getValue()); } - PaintBrushColorType = toString(m_colorType.getValue()); + PaintBrushColorType = ::to_string(m_colorType.getValue()); /*--- ColorModelのCursor更新のためにSIGNALを出す ---*/ TTool::getApplication()->getCurrentTool()->notifyToolChanged(); } @@ -460,7 +460,7 @@ void PaintBrushTool::onEnter() { if (m_firstTime) { m_onlyEmptyAreas.setValue(PaintBrushSelective ? 1 : 0); - m_colorType.setValue(toWideString((PaintBrushColorType.getValue()))); + m_colorType.setValue(::to_wstring(PaintBrushColorType.getValue())); m_toolSize.setValue(PaintBrushSize); m_firstTime = false; } diff --git a/toonz/sources/tnztools/rastererasertool.cpp b/toonz/sources/tnztools/rastererasertool.cpp index fc7ae1d..af81ded 100644 --- a/toonz/sources/tnztools/rastererasertool.cpp +++ b/toonz/sources/tnztools/rastererasertool.cpp @@ -1334,7 +1334,7 @@ bool EraserTool::onPropertyChanged(std::string propertyName) /*--- polylineにした時、前回のpolyline選択をクリアする ---*/ if (m_eraseType.getValue() == POLYLINEERASE && !m_polyline.empty()) m_polyline.clear(); - EraseType = toString(m_eraseType.getValue()); + EraseType = ::to_string(m_eraseType.getValue()); } else if (propertyName == m_toolSize.getName()) { @@ -1361,7 +1361,7 @@ bool EraserTool::onPropertyChanged(std::string propertyName) } else if (propertyName == m_colorType.getName()) { - EraseColorType = toString(m_colorType.getValue()); + EraseColorType = ::to_string(m_colorType.getValue()); /*-- ColorModelのCursor更新のためにSIGNALを出す --*/ TTool::getApplication()->getCurrentTool()->notifyToolChanged(); } @@ -1439,10 +1439,10 @@ void EraserTool::onEnter() return; if (m_firstTime) { m_toolSize.setValue(EraseSize); - m_eraseType.setValue(toWideString(EraseType.getValue())); + m_eraseType.setValue(::to_wstring(EraseType.getValue())); m_currentStyle.setValue(EraseSelective ? 1 : 0); m_invertOption.setValue(EraseInvert ? 1 : 0); - m_colorType.setValue(toWideString(EraseColorType.getValue())); + m_colorType.setValue(::to_wstring(EraseColorType.getValue())); m_multi.setValue(EraseRange ? 1 : 0); m_hardness.setValue(EraseHardness); m_pencil.setValue(ErasePencil); diff --git a/toonz/sources/tnztools/rasterselection.cpp b/toonz/sources/tnztools/rasterselection.cpp index bfb3e38..4a857c7 100644 --- a/toonz/sources/tnztools/rasterselection.cpp +++ b/toonz/sources/tnztools/rasterselection.cpp @@ -318,7 +318,7 @@ public: : TUndo(), m_level(level), m_frameId(selection->getFrameId()), m_strokes(selection->getOriginalStrokes()) { TImageP image = m_level->getFrame(m_frameId, true); - m_erasedImageId = "UndoDeleteSelection" + toString(m_id++); + m_erasedImageId = "UndoDeleteSelection" + std::to_string(m_id++); TRasterP ras = getRaster(image); TRasterP erasedRas; if (!selection->isFloating()) @@ -458,10 +458,10 @@ public: if (!image) return; - m_imageId = "UndoPasteImage_" + toString(m_id); + m_imageId = "UndoPasteImage_" + std::to_string(m_id); TImageCache::instance()->add(m_imageId, image, false); - m_floatingImageId = "UndoPasteFloatingSelection_floating_" + toString(m_id); + m_floatingImageId = "UndoPasteFloatingSelection_floating_" + std::to_string(m_id); TRasterP floatingRas = currentSelection->getFloatingSelection(); TImageP floatingImage; if (TRasterCM32P toonzRas = (TRasterCM32P)(floatingRas)) @@ -472,7 +472,7 @@ public: floatingImage = TRasterImageP(grRas); TImageCache::instance()->add(m_floatingImageId, floatingImage, false); - m_oldFloatingImageId = "UndoPasteFloatingSelection_oldFloating_" + toString(m_id); + m_oldFloatingImageId = "UndoPasteFloatingSelection_oldFloating_" + std::to_string(m_id); TRasterP oldFloatingRas = currentSelection->getOriginalFloatingSelection(); TImageP olfFloatingImage; if (TRasterCM32P toonzRas = (TRasterCM32P)(oldFloatingRas)) @@ -490,7 +490,7 @@ public: TRect rRect = convertWorldToRaster(wRect, image); rRect *= rasImage->getBounds(); if (!rRect.isEmpty()) { - m_undoImageId = "UndoPasteFloatingSelection_undo" + toString(m_id); + m_undoImageId = "UndoPasteFloatingSelection_undo" + std::to_string(m_id); TRasterP undoRas = rasImage->extract(rRect)->clone(); TImageP undoImage; if (TRasterCM32P toonzRas = (TRasterCM32P)(undoRas)) diff --git a/toonz/sources/tnztools/rasterselectiontool.cpp b/toonz/sources/tnztools/rasterselectiontool.cpp index 719bcd1..257610e 100644 --- a/toonz/sources/tnztools/rasterselectiontool.cpp +++ b/toonz/sources/tnztools/rasterselectiontool.cpp @@ -90,7 +90,7 @@ DragSelectionTool::UndoRasterDeform::UndoRasterDeform(RasterSelectionTool *tool) { RasterSelection *selection = (RasterSelection *)tool->getSelection(); m_oldStrokes = selection->getStrokes(); - m_oldFloatingImageId = "UndoRasterDeform_old_floating_" + toString(m_id++); + m_oldFloatingImageId = "UndoRasterDeform_old_floating_" + std::to_string(m_id++); TRasterP floatingRas = selection->getFloatingSelection(); TImageP floatingImage; if (TRasterCM32P toonzRas = (TRasterCM32P)(floatingRas)) { @@ -127,7 +127,7 @@ void DragSelectionTool::UndoRasterDeform::registerRasterDeformation() { RasterSelection *selection = (RasterSelection *)m_tool->getSelection(); m_newStrokes = selection->getStrokes(); - m_newFloatingImageId = "UndoRasterDeform_new_floating_" + toString(m_id); + m_newFloatingImageId = "UndoRasterDeform_new_floating_" + std::to_string(m_id); TRasterP floatingRas = selection->getFloatingSelection(); TImageP floatingImage; if (TRasterCM32P toonzRas = (TRasterCM32P)(floatingRas)) diff --git a/toonz/sources/tnztools/rastertapetool.cpp b/toonz/sources/tnztools/rastertapetool.cpp index 7537bf4..2e017c4 100644 --- a/toonz/sources/tnztools/rastertapetool.cpp +++ b/toonz/sources/tnztools/rastertapetool.cpp @@ -221,10 +221,10 @@ public: params.m_closingDistance = (int)(m_distance.getValue()); params.m_spotAngle = (int)(m_angle.getValue()); params.m_opacity = m_opacity.getValue(); - std::string inkString = toString(m_inkIndex.getValue()); + std::string inkString = ::to_string(m_inkIndex.getValue()); int inkIndex = TTool::getApplication()->getCurrentLevelStyleIndex(); //TApp::instance()->getCurrentPalette()->getStyleIndex(); if (isInt(inkString)) - inkIndex = toInt(inkString); + inkIndex = std::stoi(inkString); params.m_inkIndex = inkIndex; TPoint delta; @@ -493,7 +493,7 @@ public: bool onPropertyChanged(std::string propertyName) { if (propertyName == m_closeType.getName()) { - AutocloseVectorType = toString(m_closeType.getValue()); + AutocloseVectorType = ::to_string(m_closeType.getValue()); resetMulti(); } @@ -668,7 +668,7 @@ public: void onActivate() { if (m_firstTime) { - m_closeType.setValue(toWideString((AutocloseVectorType.getValue()))); + m_closeType.setValue(::to_wstring(AutocloseVectorType.getValue())); m_distance.setValue(AutocloseDistance); m_angle.setValue(AutocloseAngle); m_opacity.setValue(AutocloseOpacity); diff --git a/toonz/sources/tnztools/rgbpickertool.cpp b/toonz/sources/tnztools/rgbpickertool.cpp index dfeea8c..c2ce87d 100644 --- a/toonz/sources/tnztools/rgbpickertool.cpp +++ b/toonz/sources/tnztools/rgbpickertool.cpp @@ -534,7 +534,7 @@ void RGBPickerTool::pickStroke() bool RGBPickerTool::onPropertyChanged(std::string propertyName) { if (propertyName == m_pickType.getName()) - PickVectorType = toString(m_pickType.getValue()); + PickVectorType = ::to_string(m_pickType.getValue()); else if (propertyName == m_passivePick.getName()) PickPassive = m_passivePick.getValue(); return true; @@ -545,7 +545,7 @@ bool RGBPickerTool::onPropertyChanged(std::string propertyName) void RGBPickerTool::onActivate() { if (m_firstTime) { - m_pickType.setValue(toWideString((PickVectorType.getValue()))); + m_pickType.setValue(::to_wstring(PickVectorType.getValue())); m_passivePick.setValue(PickPassive ? 1 : 0); m_firstTime = false; } diff --git a/toonz/sources/tnztools/selectiontool.cpp b/toonz/sources/tnztools/selectiontool.cpp index 64348c1..bf2546f 100644 --- a/toonz/sources/tnztools/selectiontool.cpp +++ b/toonz/sources/tnztools/selectiontool.cpp @@ -1260,7 +1260,7 @@ void SelectionTool::drawCommandHandle(const TImage *image) void SelectionTool::onActivate() { if (m_firstTime) { - m_strokeSelectionType.setValue(toWideString(SelectionType.getValue())); + m_strokeSelectionType.setValue(::to_wstring(SelectionType.getValue())); m_firstTime = false; } if (isLevelType() || isSelectedFramesType()) @@ -1293,7 +1293,7 @@ void SelectionTool::onSelectionChanged() bool SelectionTool::onPropertyChanged(std::string propertyName) { if (propertyName == m_strokeSelectionType.getName()) { - SelectionType = toString(m_strokeSelectionType.getValue()); + SelectionType = ::to_string(m_strokeSelectionType.getValue()); return true; } return false; diff --git a/toonz/sources/tnztools/skeletontool.cpp b/toonz/sources/tnztools/skeletontool.cpp index abf7864..26abbaa 100644 --- a/toonz/sources/tnztools/skeletontool.cpp +++ b/toonz/sources/tnztools/skeletontool.cpp @@ -192,7 +192,7 @@ HookData::HookData(TXsheet *xsh, int columnIndex, int hookId, const TPointD &pos m_isPivot = true; } } else { - m_name = toString(m_hookId); + m_name = std::to_string(m_hookId); m_isPivot = "H" + m_name == handle; } } @@ -1206,7 +1206,7 @@ void SkeletonTool::drawHooks() const HookData &h1 = magicLink.m_h1; std::string name; name = (m_parentProbeEnabled ? "Linking " : "Link ") + removeTrailingH(magicLink.m_h0.getHandle()) + - " to Col " + toString(h1.m_columnIndex + 1) + "/" + removeTrailingH(h1.getHandle()); + " to Col " + std::to_string(h1.m_columnIndex + 1) + "/" + removeTrailingH(h1.getHandle()); int code = TD_MagicLink + i; glPushName(code); @@ -1226,7 +1226,7 @@ void SkeletonTool::drawDrawingBrowser(const TXshCell &cell, const TPointD ¢e return; double pixelSize = getPixelSize(); - std::string name = toString(cell.m_level->getName()) + "." + toString(cell.m_frameId.getNumber()); + std::string name = ::to_string(cell.m_level->getName()) + "." + std::to_string(cell.m_frameId.getNumber()); QString qText = QString::fromStdString(name); QFont font("Arial", 10); // ,QFont::Bold); diff --git a/toonz/sources/tnztools/tooloptions.cpp b/toonz/sources/tnztools/tooloptions.cpp index 5d6dcb9..8cb267d 100644 --- a/toonz/sources/tnztools/tooloptions.cpp +++ b/toonz/sources/tnztools/tooloptions.cpp @@ -380,7 +380,7 @@ void ToolOptionControlBuilder::visit(TEnumProperty *p) QSignalMapper *signalMapper = 0; int index = 0; for (it = range.begin(); it != range.end(); ++it, ++index) { - std::string item = toString(*it); + std::string item = ::to_string(*it); std::string itemActionName = actionName + ":" + item; a = CommandManager::instance()->getAction(itemActionName.c_str()); if (a) { @@ -804,7 +804,7 @@ ArrowToolOptionsBox::ArrowToolOptionsBox(QWidget *parent, TTool *tool, TProperty QSignalMapper *signalMapper = 0; int index = 0; for (it = range.begin(); it != range.end(); ++it, ++index) { - std::string item = toString(*it); + std::string item = ::to_string(*it); std::string itemActionName = actionName + ":" + item; a = CommandManager::instance()->getAction(itemActionName.c_str()); if (a) { diff --git a/toonz/sources/tnztools/toolutils.cpp b/toonz/sources/tnztools/toolutils.cpp index 4012322..72d0b39 100644 --- a/toonz/sources/tnztools/toolutils.cpp +++ b/toonz/sources/tnztools/toolutils.cpp @@ -473,7 +473,7 @@ ToolUtils::TToolUndo::TToolUndo(TXshSimpleLevel *level, const TFrameId &frameId, } } if (createdFrame) { - m_imageId = "TToolUndo" + toString(m_idCount++); + m_imageId = "TToolUndo" + std::to_string(m_idCount++); TImageCache::instance()->add(m_imageId, level->getFrame(frameId, false), false); } } diff --git a/toonz/sources/tnztools/trackertool.cpp b/toonz/sources/tnztools/trackertool.cpp index c05fed9..c6aa052 100644 --- a/toonz/sources/tnztools/trackertool.cpp +++ b/toonz/sources/tnztools/trackertool.cpp @@ -351,7 +351,7 @@ void TrackerTool::draw() TPointD p1 = hook->getBPos(fid); bool linked = p0 == p1; drawHook(p0, linked ? ToolUtils::NormalHook : ToolUtils::PassHookA, m_hookSelectedIndex == i); - std::string hookName = toString(i + 1); + std::string hookName = std::to_string(i + 1); TPixel32 balloonColor(200, 220, 205, 200); TPoint balloonOffset(20, 20); drawBalloon(p0, hookName, balloonColor, balloonOffset, false, &balloons); diff --git a/toonz/sources/tnztools/typetool.cpp b/toonz/sources/tnztools/typetool.cpp index b07928e..c32c456 100644 --- a/toonz/sources/tnztools/typetool.cpp +++ b/toonz/sources/tnztools/typetool.cpp @@ -546,7 +546,7 @@ void TypeTool::loadFonts() m_fontFamilyMenu.addValue(*it); std::string favFontApp = EnvCurrentFont; - std::wstring favouriteFont = toWideString(favFontApp); + std::wstring favouriteFont = ::to_wstring(favFontApp); if (m_fontFamilyMenu.isValue(favouriteFont)) { m_fontFamilyMenu.setValue(favouriteFont); setFont(favouriteFont); @@ -603,7 +603,7 @@ void TypeTool::setFont(std::wstring family) updateStrokeChar(); invalidate(); - EnvCurrentFont = toString(m_fontFamily); + EnvCurrentFont = ::to_string(m_fontFamily); } catch (TFontCreationError &) { // TMessage::error(toString(e.getMessage())); assert(m_fontFamily == instance->getCurrentFamily()); @@ -636,7 +636,7 @@ void TypeTool::setSize(std::wstring strSize) { // font e tool fields update - double dimension = (double)atoi(toString(strSize).c_str()); + double dimension = std::stod(strSize); if (m_dimension == dimension) return; diff --git a/toonz/sources/tnztools/vectorerasertool.cpp b/toonz/sources/tnztools/vectorerasertool.cpp index c12e0bd..dd7882c 100644 --- a/toonz/sources/tnztools/vectorerasertool.cpp +++ b/toonz/sources/tnztools/vectorerasertool.cpp @@ -1062,7 +1062,7 @@ void EraserTool::mouseMove(const TPointD &pos, const TMouseEvent &e) bool EraserTool::onPropertyChanged(std::string propertyName) { - EraseVectorType = toString(m_eraseType.getValue()); + EraseVectorType = ::to_string(m_eraseType.getValue()); EraseVectorSize = m_toolSize.getValue(); EraseVectorSelective = m_selective.getValue(); EraseVectorInvert = m_invertOption.getValue(); @@ -1088,7 +1088,7 @@ void EraserTool::onEnter() { if (m_firstTime) { m_toolSize.setValue(EraseVectorSize); - m_eraseType.setValue(toWideString((EraseVectorType.getValue()))); + m_eraseType.setValue(::to_wstring(EraseVectorType.getValue())); m_selective.setValue(EraseVectorSelective ? 1 : 0); m_invertOption.setValue(EraseVectorInvert ? 1 : 0); m_multi.setValue(EraseVectorRange ? 1 : 0); diff --git a/toonz/sources/tnztools/vectortapetool.cpp b/toonz/sources/tnztools/vectortapetool.cpp index eb622d5..31cfe13 100644 --- a/toonz/sources/tnztools/vectortapetool.cpp +++ b/toonz/sources/tnztools/vectortapetool.cpp @@ -244,11 +244,11 @@ public: bool onPropertyChanged(std::string propertyName) { - TapeMode = toString(m_mode.getValue()); + TapeMode = ::to_string(m_mode.getValue()); TapeSmooth = (int)(m_smooth.getValue()); std::wstring s = m_type.getValue(); if (!s.empty()) - TapeType = toString(s); + TapeType = ::to_string(s); TapeJoinStrokes = (int)(m_joinStrokes.getValue()); AutocloseFactor = (double)(m_autocloseFactor.getValue()); m_selectionRect = TRectD(); @@ -734,10 +734,10 @@ public: if (!m_firstTime) return; - std::wstring s = toWideString(TapeMode.getValue()); + std::wstring s = ::to_wstring(TapeMode.getValue()); if (s != L"") m_mode.setValue(s); - s = toWideString(TapeType.getValue()); + s = ::to_wstring(TapeType.getValue()); if (s != L"") m_type.setValue(s); m_autocloseFactor.setValue(AutocloseFactor); diff --git a/toonz/sources/toonz/CMakeLists.txt b/toonz/sources/toonz/CMakeLists.txt index df8a677..0a759d6 100644 --- a/toonz/sources/toonz/CMakeLists.txt +++ b/toonz/sources/toonz/CMakeLists.txt @@ -143,9 +143,7 @@ set(MOC_HEADERS metnum.h ObjectTracker.h predict3d.h - processor.h - viewer.h - writer.h) + processor.h) set(HEADERS ${MOC_HEADERS}) @@ -300,9 +298,7 @@ set(SOURCES dummyprocessor.cpp metnum.cpp ObjectTracker.cpp - predict3d.cpp - viewer.cpp - writer.cpp) + predict3d.cpp) add_translation(toonz ${HEADERS} ${SOURCES}) diff --git a/toonz/sources/toonz/batchserversviewer.cpp b/toonz/sources/toonz/batchserversviewer.cpp index 530d604..fc1a694 100644 --- a/toonz/sources/toonz/batchserversviewer.cpp +++ b/toonz/sources/toonz/batchserversviewer.cpp @@ -55,7 +55,7 @@ void FarmServerListView::update() new MyListItem(sid.m_id, sid.m_name, this); } } catch (TException &e) { - DVGui::warning(QString::fromStdString(toString(e.getMessage()))); + DVGui::warning(QString::fromStdString(::to_string(e.getMessage()))); } } @@ -73,7 +73,7 @@ void FarmServerListView::activate() BatchesController::instance()->update(); static_cast(parentWidget())->updateSelected(); } catch (TException &e) { - DVGui::warning(QString::fromStdString(toString(e.getMessage()))); + DVGui::warning(QString::fromStdString(::to_string(e.getMessage()))); } } @@ -91,7 +91,7 @@ void FarmServerListView::deactivate() BatchesController::instance()->update(); static_cast(parentWidget())->updateSelected(); } catch (TException &e) { - DVGui::warning(QString::fromStdString(toString(e.getMessage()))); + DVGui::warning(QString::fromStdString(::to_string(e.getMessage()))); } } //----------------------------------------------------------------------------- @@ -109,7 +109,7 @@ void FarmServerListView::openContextMenu(const QPoint &p) try { state = controller->queryServerState2(item->m_id); } catch (TException &e) { - DVGui::warning(QString::fromStdString(toString(e.getMessage()))); + DVGui::warning(QString::fromStdString(::to_string(e.getMessage()))); return; } @@ -181,7 +181,7 @@ void BatchServersViewer::updateServerInfo(const QString &id) try { controller->queryServerInfo(id, info); } catch (TException &e) { - DVGui::warning(QString::fromStdString(toString(e.getMessage()))); + DVGui::warning(QString::fromStdString(::to_string(e.getMessage()))); } switch (info.m_state) { @@ -223,7 +223,7 @@ void BatchServersViewer::updateServerInfo(const QString &id) m_tasks->setText("<" + task.m_id + "> " + task.m_name); } catch (TException &e) { m_tasks->setText(""); - DVGui::warning(QString::fromStdString(toString(e.getMessage()))); + DVGui::warning(QString::fromStdString(::to_string(e.getMessage()))); } } @@ -361,7 +361,7 @@ void BatchServersViewer::onProcessWith(int index) m_processWith->setCurrentIndex(0); return; } catch (TException &e) { - DVGui::warning(QString::fromStdString(toString(e.getMessage()))); + DVGui::warning(QString::fromStdString(::to_string(e.getMessage()))); m_processWith->setCurrentIndex(0); return; } diff --git a/toonz/sources/toonz/cachefxcommand.cpp b/toonz/sources/toonz/cachefxcommand.cpp index 05a0c1f..511d76f 100644 --- a/toonz/sources/toonz/cachefxcommand.cpp +++ b/toonz/sources/toonz/cachefxcommand.cpp @@ -288,7 +288,7 @@ void buildNodeTreeDescription(std::string &desc, const TFxP &root) } } - desc += ::toString(root->getIdentifier()) + ";"; + desc += std::to_string(root->getIdentifier()) + ";"; unsigned int count = root->getInputPortCount(); for (unsigned int i = 0; i < count; ++i) diff --git a/toonz/sources/toonz/canvassizepopup.cpp b/toonz/sources/toonz/canvassizepopup.cpp index 24d5644..d631ac8 100644 --- a/toonz/sources/toonz/canvassizepopup.cpp +++ b/toonz/sources/toonz/canvassizepopup.cpp @@ -55,8 +55,8 @@ public: const TDimension &oldDim, const TDimension &newDim) : TUndo(), m_level(level), m_fid(fid), m_oldDim(oldDim), m_newDim(newDim) { - m_oldImageId = "ResizeCanvasUndo_oldImage_" + toString(m_idCount); - m_newImageId = "ResizeCanvasUnd_newImage_" + toString(m_idCount++); + m_oldImageId = "ResizeCanvasUndo_oldImage_" + std::to_string(m_idCount); + m_newImageId = "ResizeCanvasUnd_newImage_" + std::to_string(m_idCount++); TImageCache::instance()->add(m_oldImageId, oldImage); TImageCache::instance()->add(m_newImageId, newImage); diff --git a/toonz/sources/toonz/comboviewerpane.cpp b/toonz/sources/toonz/comboviewerpane.cpp index 5ce1d92..59e16b2 100644 --- a/toonz/sources/toonz/comboviewerpane.cpp +++ b/toonz/sources/toonz/comboviewerpane.cpp @@ -576,7 +576,7 @@ void ComboViewerPanel::changeWindowTitle() sceneName += QString(" *"); name = tr("Scene: ") + sceneName; if (frame >= 0) - name = name + tr(" :: Frame: ") + tr(toString(frame + 1).c_str()); + name = name + tr(" :: Frame: ") + tr(std::to_string(frame + 1).c_str()); int col = app->getCurrentColumn()->getColumnIndex(); if (col < 0) { setWindowTitle(name); diff --git a/toonz/sources/toonz/curveio.cpp b/toonz/sources/toonz/curveio.cpp index d5b1691..ef66cbc 100644 --- a/toonz/sources/toonz/curveio.cpp +++ b/toonz/sources/toonz/curveio.cpp @@ -203,7 +203,7 @@ bool ExportCurvePopup::execute() TSystem::touchParentDir(fp); Tofstream os(fp); os << "# RELEASE: 5.0" << std::endl; - os << "# FILE NAME: " << toString(fp.getWideString()) << std::endl; + os << "# FILE NAME: " << ::to_string(fp) << std::endl; os << "# COMPOSED BY: " << TSystem::getUserName().toStdString() << std::endl; os << "# MACHINE NAME: " << TSystem::getHostName().toStdString() << std::endl; // os << "# DATE: " << TSystem::getCurrentTime() << endl; diff --git a/toonz/sources/toonz/dvdirtreeview.cpp b/toonz/sources/toonz/dvdirtreeview.cpp index f2521e8..e7a32da 100644 --- a/toonz/sources/toonz/dvdirtreeview.cpp +++ b/toonz/sources/toonz/dvdirtreeview.cpp @@ -397,7 +397,7 @@ void DvDirTreeView::dropEvent(QDropEvent *e) TFilePath dstFp = folderNode->getPath(); TFilePath path = dstFp + TFilePath(srcFp.getLevelNameW()); - NameBuilder *nameBuilder = NameBuilder::getBuilder(toWideString(path.getName())); + NameBuilder *nameBuilder = NameBuilder::getBuilder(::to_wstring(path.getName())); std::wstring levelNameOut; do levelNameOut = nameBuilder->getNext(); diff --git a/toonz/sources/toonz/filebrowser.cpp b/toonz/sources/toonz/filebrowser.cpp index fcc3935..6a2d409 100644 --- a/toonz/sources/toonz/filebrowser.cpp +++ b/toonz/sources/toonz/filebrowser.cpp @@ -1514,14 +1514,14 @@ bool FileBrowser::drop(const QMimeData *mimeData) return false; std::wstring levelName = sl->getName(); - folderPath += TFilePath(levelName + toWideString(sl->getPath().getDottedType())); + folderPath += TFilePath(levelName + ::to_wstring(sl->getPath().getDottedType())); if (TSystem::doesExistFileOrLevel(folderPath)) { QString question = "Level " + toQString(folderPath) + " already exists\nDo you want to duplicate it?"; int ret = DVGui::MsgBox(question, QObject::tr("Duplicate"), QObject::tr("Don't Duplicate"), 0); if (ret == 2 || ret == 0) return false; TFilePath path = folderPath; - NameBuilder *nameBuilder = NameBuilder::getBuilder(toWideString(path.getName())); + NameBuilder *nameBuilder = NameBuilder::getBuilder(::to_wstring(path.getName())); do levelName = nameBuilder->getNext(); while (TSystem::doesExistFileOrLevel(path.withName(levelName))); @@ -2140,7 +2140,7 @@ void FileBrowser::newFolder() TFilePath folderPath = parentFolder + folderName; int i = 1; while (TFileStatus(folderPath).doesExist()) - folderPath = parentFolder + (folderName + L" " + toWideString(++i)); + folderPath = parentFolder + (folderName + L" " + std::to_wstring(++i)); try { TSystem::mkDir(folderPath); diff --git a/toonz/sources/toonz/filebrowsermodel.cpp b/toonz/sources/toonz/filebrowsermodel.cpp index d6c6e96..a6cd653 100644 --- a/toonz/sources/toonz/filebrowsermodel.cpp +++ b/toonz/sources/toonz/filebrowsermodel.cpp @@ -399,7 +399,7 @@ DvDirModelSceneFolderNode::DvDirModelSceneFolderNode(DvDirModelNode *parent, con std::string folderName = project->getFolderName(i); TFilePath folderPath = project->getFolder(i); if (folderPath.isAbsolute() && !project->isConstantFolder(i)) { - std::wstring alias = L"+" + toWideString(folderName); + std::wstring alias = L"+" + ::to_wstring(folderName); TFilePath folderActualPath = scene.decodeFilePath(TFilePath(alias)); m_folders[alias] = folderActualPath; } @@ -883,7 +883,7 @@ void DvDirVersionControlProjectNode::getChildrenNames(std::vector TFilePath folderPath = project->getFolder(i); //if(folderPath.isAbsolute() || folderPath.getParentDir() != TFilePath()) if (folderPath.isAbsolute() && project->isConstantFolder(i)) { - names.push_back(L"+" + toWideString(folderName)); + names.push_back(L"+" + ::to_wstring(folderName)); } } delete project; @@ -978,7 +978,7 @@ void DvDirModelProjectNode::getChildrenNames(std::vector &names) c TFilePath folderPath = project->getFolder(i); //if(folderPath.isAbsolute() || folderPath.getParentDir() != TFilePath()) if (folderPath.isAbsolute() && project->isConstantFolder(i)) { - names.push_back(L"+" + toWideString(folderName)); + names.push_back(L"+" + ::to_wstring(folderName)); } } delete project; @@ -992,7 +992,7 @@ DvDirModelNode *DvDirModelProjectNode::makeChild(std::wstring name) TProjectManager *pm = TProjectManager::instance(); TProject *project = new TProject(); project->load(getProjectPath()); - std::string folderName = toString(name.substr(1)); + std::string folderName = ::to_string(name.substr(1)); TFilePath folderPath = project->getFolder(folderName); DvDirModelNode *node = new DvDirModelFileFolderNode(this, name, folderPath); delete project; @@ -1008,7 +1008,7 @@ DvDirModelNode *DvDirModelProjectNode::makeChild(std::wstring name) //----------------------------------------------------------------------------- DvDirModelDayNode::DvDirModelDayNode(DvDirModelNode *parent, std::wstring dayDateString) - : DvDirModelNode(parent, dayDateString), m_dayDateString(toString(dayDateString)) + : DvDirModelNode(parent, dayDateString), m_dayDateString(::to_string(dayDateString)) { m_nodeType = "Day"; } @@ -1050,7 +1050,7 @@ void DvDirModelHistoryNode::refreshChildren() History *h = History::instance(); for (int i = 0; i < h->getDayCount(); i++) { const History::Day *day = h->getDay(i); - DvDirModelNode *child = new DvDirModelDayNode(this, toWideString(day->getDate())); + DvDirModelNode *child = new DvDirModelDayNode(this, ::to_wstring(day->getDate())); addChild(child); } } diff --git a/toonz/sources/toonz/filebrowserpopup.cpp b/toonz/sources/toonz/filebrowserpopup.cpp index f28c096..4beacb7 100644 --- a/toonz/sources/toonz/filebrowserpopup.cpp +++ b/toonz/sources/toonz/filebrowserpopup.cpp @@ -2050,7 +2050,7 @@ QString BrowserPopupController::getPath() TFilePath fp = m_browserPopup->getPath(); if (scene) fp = scene->codeFilePath(fp); - std::cout << toString(fp.getWideString()) << std::endl; + std::cout << ::to_string(fp) << std::endl; return toQString(fp); } diff --git a/toonz/sources/toonz/filedata.cpp b/toonz/sources/toonz/filedata.cpp index 4967da9..5394fac 100644 --- a/toonz/sources/toonz/filedata.cpp +++ b/toonz/sources/toonz/filedata.cpp @@ -55,7 +55,7 @@ void FileData::getFiles(TFilePath folder, std::vector &newFiles) cons return; } - NameBuilder *nameBuilder = NameBuilder::getBuilder(toWideString(path.getName())); + NameBuilder *nameBuilder = NameBuilder::getBuilder(::to_wstring(path.getName())); std::wstring levelNameOut; do levelNameOut = nameBuilder->getNext(); diff --git a/toonz/sources/toonz/flipbook.cpp b/toonz/sources/toonz/flipbook.cpp index db347be..83ce696 100644 --- a/toonz/sources/toonz/flipbook.cpp +++ b/toonz/sources/toonz/flipbook.cpp @@ -614,7 +614,7 @@ bool FlipBook::doSaveImages(TFilePath fp) TPropertyGroup *props = outputSettings->getFileFormatProperties(ext); std::string codecName = props->getProperty(0)->getValueAsString(); TDimension res = scene->getCurrentCamera()->getRes(); - if (!AviCodecRestrictions::canWriteMovie(toWideString(codecName), res)) { + if (!AviCodecRestrictions::canWriteMovie(::to_wstring(codecName), res)) { QString msg(QObject::tr("The resolution of the output camera does not fit with the options chosen for the output file format.")); DVGui::warning(msg); return false; @@ -655,7 +655,7 @@ bool FlipBook::doSaveImages(TFilePath fp) TSystem::mkDir(parent); DvDirModel::instance()->refreshFolder(parent.getParentDir()); } catch (TException &e) { - DVGui::error("Cannot create " + toQString(fp.getParentDir()) + " : " + QString(toString(e.getMessage()).c_str())); + DVGui::error("Cannot create " + toQString(fp.getParentDir()) + " : " + QString(::to_string(e.getMessage()).c_str())); return false; } catch (...) { DVGui::error("Cannot create " + toQString(fp.getParentDir())); @@ -730,8 +730,7 @@ void FlipBook::saveImage() return; } - QString str = tr("Saved %1 frames out of %2 in %3").arg(toString(savedFrames).c_str()).arg(toString(m_framesCount).c_str()).arg(toString(m_lw->getFilePath().getWideString()).c_str()); - QString(toString(m_lw->getFilePath().getWideString()).c_str()); + QString str = tr("Saved %1 frames out of %2 in %3").arg(std::to_string(savedFrames).c_str()).arg(std::to_string(m_framesCount).c_str()).arg(::to_string(m_lw->getFilePath()).c_str()); if (!Pd) str = "Canceled! " + str; @@ -1537,7 +1536,7 @@ TImageP FlipBook::getCurrentImage(int frame) fid = m_levels[i].flipbookIndexToLevelFrame(frameIndex); if (fid == TFrameId()) return 0; - id = levelName.toStdString() + fid.expand(TFrameId::NO_PAD) + ((m_isPreviewFx) ? "" : toString(this)); + id = levelName.toStdString() + fid.expand(TFrameId::NO_PAD) + ((m_isPreviewFx) ? "" : ::to_string(this)); if (!m_isPreviewFx) m_title1 = m_viewerTitle + " :: " + fp.withoutParentDir().withFrame(fid); @@ -1546,7 +1545,7 @@ TImageP FlipBook::getCurrentImage(int frame) } else if (m_levelNames.empty()) return 0; else //is a render - id = m_levelNames[0].toStdString() + toString(frame); + id = m_levelNames[0].toStdString() + std::to_string(frame); bool showSub = m_flipConsole->isChecked(FlipConsole::eUseLoadBox); @@ -1696,7 +1695,7 @@ void FlipBook::clearCache() if (!m_levels.empty()) //is a viewfile for (i = 0; i < m_levels.size(); i++) for (it = m_levels[i].m_level->begin(); it != m_levels[i].m_level->end(); ++it) - TImageCache::instance()->remove(m_levelNames[i].toStdString() + toString(it->first.getNumber()) + ((m_isPreviewFx) ? "" : toString(this))); + TImageCache::instance()->remove(m_levelNames[i].toStdString() + std::to_string(it->first.getNumber()) + ((m_isPreviewFx) ? "" : ::to_string(this))); else { int from, to, step; m_flipConsole->getFrameRange(from, to, step); @@ -1707,12 +1706,12 @@ void FlipBook::clearCache() std::vector fids(m_palette->getRefLevelFids()); if (!fids.empty() && (int)fids.size() >= i) { int frame = fids[i - 1].getNumber(); - TImageCache::instance()->remove(m_levelNames[0].toStdString() + toString(frame)); + TImageCache::instance()->remove(m_levelNames[0].toStdString() + std::to_string(frame)); } else { - TImageCache::instance()->remove(m_levelNames[0].toStdString() + toString(i)); + TImageCache::instance()->remove(m_levelNames[0].toStdString() + std::to_string(i)); } } else - TImageCache::instance()->remove(m_levelNames[0].toStdString() + toString(i)); + TImageCache::instance()->remove(m_levelNames[0].toStdString() + std::to_string(i)); } } @@ -2134,7 +2133,7 @@ void FlipBook::loadAndCacheAllTlvImages(Level level, if (fid == TFrameId()) continue; - std::string id = fileName + fid.expand(TFrameId::NO_PAD) + toString(this); + std::string id = fileName + fid.expand(TFrameId::NO_PAD) + ::to_string(this); TImageReaderP ir = m_lr->getFrameReader(fid); ir->setShrink(m_shrink); diff --git a/toonz/sources/toonz/formatsettingspopups.cpp b/toonz/sources/toonz/formatsettingspopups.cpp index 5aeabca..770f1ff 100644 --- a/toonz/sources/toonz/formatsettingspopups.cpp +++ b/toonz/sources/toonz/formatsettingspopups.cpp @@ -178,7 +178,7 @@ void FormatSettingsPopup::buildPropertyLineEdit(int index, TPropertyGroup *props DVGui::PropertyLineEdit *lineEdit = new DVGui::PropertyLineEdit(this, prop); m_widgets[prop->getName()] = lineEdit; - lineEdit->setText(tr(toString(prop->getValue()).c_str())); + lineEdit->setText(tr(::to_string(prop->getValue()).c_str())); int row = m_mainLayout->rowCount(); m_mainLayout->addWidget(new QLabel(tr(prop->getName().c_str()) + ":", this), row, 0, Qt::AlignRight | Qt::AlignVCenter); diff --git a/toonz/sources/toonz/insertfxpopup.cpp b/toonz/sources/toonz/insertfxpopup.cpp index 59f2fc9..fe66ffc 100644 --- a/toonz/sources/toonz/insertfxpopup.cpp +++ b/toonz/sources/toonz/insertfxpopup.cpp @@ -124,8 +124,8 @@ TFx *createMacroFxByPath(TFilePath path) std::string oldPortName = fx->getInputPortName(i); std::string inFxOldId = oldPortName; inFxOldId.erase(0, inFxOldId.find_last_of("_") + 1); - assert(oldNewId.contains(toWideString(inFxOldId))); - std::string inFxNewId = toString(oldNewId[toWideString(inFxOldId)]); + assert(oldNewId.contains(::to_wstring(inFxOldId))); + std::string inFxNewId = ::to_string(oldNewId[::to_wstring(inFxOldId)]); std::string newPortName = oldPortName; newPortName.erase(newPortName.find_last_of("_") + 1, newPortName.size() - 1); newPortName.append(inFxNewId); diff --git a/toonz/sources/toonz/iocommand.cpp b/toonz/sources/toonz/iocommand.cpp index e8d55f9..f0169b3 100644 --- a/toonz/sources/toonz/iocommand.cpp +++ b/toonz/sources/toonz/iocommand.cpp @@ -1514,7 +1514,7 @@ bool IoCmd::saveLevel(const TFilePath &path) std::string dotts = sl->getPath().getDots(); TFilePath realPath = path; if (realPath.getType() == "") - realPath = TFilePath(realPath.getWideString() + toWideString(dotts + ext)); + realPath = TFilePath(realPath.getWideString() + ::to_wstring(dotts + ext)); saveLevel(realPath, sl, false); RecentFiles::instance()->addFilePath(toQString(realPath), RecentFiles::Level); @@ -1632,7 +1632,7 @@ bool IoCmd::saveLevel(TXshSimpleLevel *sl) } //=========================================================================== -// IoCmd::saveAll() save current scene and all of its levels +// IoCmd::saveSound(soundPath, soundColumn, overwrite) //--------------------------------------------------------------------------- bool IoCmd::saveAll() diff --git a/toonz/sources/toonz/levelsettingspopup.cpp b/toonz/sources/toonz/levelsettingspopup.cpp index 8b39165..9c7cdbe 100644 --- a/toonz/sources/toonz/levelsettingspopup.cpp +++ b/toonz/sources/toonz/levelsettingspopup.cpp @@ -435,7 +435,7 @@ void LevelSettingsPopup::updateLevelSettings() // name if (selectedLevel) { - m_nameFld->setText(toString(selectedLevel->getName()).c_str()); + m_nameFld->setText(::to_string(selectedLevel->getName()).c_str()); m_nameFld->setEnabled(true); } else { m_nameFld->setText(tr("")); @@ -670,7 +670,7 @@ void LevelSettingsPopup::onPathChanged() if (sl) { QString question; - question = "The path you entered for the level " + QString(toString(sl->getName()).c_str()) + + question = "The path you entered for the level " + QString(::to_string(sl->getName()).c_str()) + "is already used: this may generate some conflicts in the file management.\nAre you sure you want to assign the same path to two different levels?"; int ret = DVGui::MsgBox(question, QObject::tr("Yes"), QObject::tr("No")); if (ret == 0 || ret == 2) { @@ -831,7 +831,7 @@ void LevelSettingsPopup::onDpiFieldChanged() j++; } if (i < j) { - dpi.x = toDouble(s.substr(i, j - i)); + dpi.x = std::stod(s.substr(i, j - i)); i = j; while (i < len && s[i] == ' ') i++; @@ -839,7 +839,7 @@ void LevelSettingsPopup::onDpiFieldChanged() i++; while (i < len && s[i] == ' ') i++; - dpi.y = toDouble(s.substr(i)); + dpi.y = std::stod(s.substr(i)); } } diff --git a/toonz/sources/toonz/main.cpp b/toonz/sources/toonz/main.cpp index 1e93d96..c4b906c 100644 --- a/toonz/sources/toonz/main.cpp +++ b/toonz/sources/toonz/main.cpp @@ -392,7 +392,7 @@ int main(int argc, char *argv[]) a.processEvents(); // Carico la traduzione contenuta in toonz.qm (se � presente) - QString languagePathString = QString::fromStdString(toString(TEnv::getConfigDir() + "loc")); + QString languagePathString = QString::fromStdString(::to_string(TEnv::getConfigDir() + "loc")); #ifndef WIN32 //the merge of menu on osx can cause problems with different languages with the Preferences menu //qt_mac_set_menubar_merge(false); diff --git a/toonz/sources/toonz/mainwindow.cpp b/toonz/sources/toonz/mainwindow.cpp index bcd99e1..f16816e 100644 --- a/toonz/sources/toonz/mainwindow.cpp +++ b/toonz/sources/toonz/mainwindow.cpp @@ -176,7 +176,7 @@ void makePrivate(Room *room) if (roomPath == TFilePath() || roomPath.getParentDir() != layoutDir) { int count = 1; for (;;) { - roomPath = layoutDir + ("room" + toString(count++) + ".ini"); + roomPath = layoutDir + ("room" + std::to_string(count++) + ".ini"); if (!TFileStatus(roomPath).doesExist()) break; } @@ -1304,7 +1304,7 @@ void MainWindow::checkForUpdates() void MainWindow::onUpdateCheckerDone(bool error) { if (error) { - // Don't bother doing the update if there was an error + // Get the last update date return; } @@ -1316,7 +1316,7 @@ void MainWindow::onUpdateCheckerDone(bool error) buttons.push_back(QObject::tr("Cancel")); int ret = DVGui::MsgBox(DVGui::INFORMATION, QObject::tr("An update is available for this software.\nVisit the Web site for more information."), buttons); if (ret == 1) { - // This URL can be "translated" to give a localised version to non-English users + // Write the new last date to file QDesktopServices::openUrl(QObject::tr("https://opentoonz.github.io/e/")); } } diff --git a/toonz/sources/toonz/previewer.cpp b/toonz/sources/toonz/previewer.cpp index 826239b..9745943 100644 --- a/toonz/sources/toonz/previewer.cpp +++ b/toonz/sources/toonz/previewer.cpp @@ -314,7 +314,7 @@ void Previewer::Imp::updateCamera() //All previously rendered frames must be erased std::map::iterator it; for (it = m_frames.begin(); it != m_frames.end(); ++it) - TImageCache::instance()->remove(m_cachePrefix + toString(it->first)); + TImageCache::instance()->remove(m_cachePrefix + std::to_string(it->first)); m_frames.clear(); } @@ -339,7 +339,7 @@ void Previewer::Imp::updateRenderSettings() std::map::iterator it; for (it = m_frames.begin(); it != m_frames.end(); ++it) - TImageCache::instance()->remove(m_cachePrefix + toString(it->first)); + TImageCache::instance()->remove(m_cachePrefix + std::to_string(it->first)); m_frames.clear(); } @@ -355,7 +355,7 @@ void Previewer::Imp::updateFrameRange() std::map::iterator it, jt = m_frames.lower_bound(newFrameCount); for (it = jt; it != m_frames.end(); ++it) //Release all associated cached images - TImageCache::instance()->remove(m_cachePrefix + toString(it->first)); + TImageCache::instance()->remove(m_cachePrefix + std::to_string(it->first)); m_frames.erase(jt, m_frames.end()); @@ -460,7 +460,7 @@ void Previewer::Imp::updateAliasKeyword(const std::string &keyword) it->second.m_renderedRegion = QRegion(); //No need to release the cached image... eventually, clear it - TRasterImageP ri = TImageCache::instance()->get(m_cachePrefix + toString(it->first), true); + TRasterImageP ri = TImageCache::instance()->get(m_cachePrefix + std::to_string(it->first), true); if (ri) ri->getRaster()->clear(); } @@ -517,7 +517,7 @@ void Previewer::Imp::refreshFrame(int frame) it->second.m_renderId = m_renderer.nextRenderId(); std::string contextName("P"); contextName += m_subcamera ? "SC" : "FU"; - contextName += ::toString(frame); + contextName += std::to_string(frame); TPassiveCacheManager::instance()->setContextName(it->second.m_renderId, contextName); //Start the render @@ -536,7 +536,7 @@ void Previewer::Imp::remove(int frame) } //Remove the associated image from cache - TImageCache::instance()->remove(m_cachePrefix + toString(frame)); + TImageCache::instance()->remove(m_cachePrefix + std::to_string(frame)); } //----------------------------------------------------------------------------- @@ -548,7 +548,7 @@ void Previewer::Imp::remove() //Remove all cached images std::map::iterator it; for (it = m_frames.begin(); it != m_frames.end(); ++it) - TImageCache::instance()->remove(m_cachePrefix + toString(it->first)); + TImageCache::instance()->remove(m_cachePrefix + std::to_string(it->first)); m_frames.clear(); } @@ -666,7 +666,7 @@ void Previewer::Imp::doOnRenderRasterCompleted(const RenderData &renderData) //Store the rendered image in the cache - this is done in the MAIN thread due //to the necessity of accessing it->second.m_rectUnderRender for raster extraction. - std::string str = m_cachePrefix + toString(frame); + std::string str = m_cachePrefix + std::to_string(frame); TRasterImageP ri(TImageCache::instance()->get(str, true)); TRasterP cachedRas(ri ? ri->getRaster() : TRasterP()); @@ -859,7 +859,7 @@ bool Previewer::Imp::doSaveRenderedFrames(TFilePath fp) TSystem::mkDir(parent); DvDirModel::instance()->refreshFolder(parent.getParentDir()); } catch (TException &e) { - error("Cannot create " + toQString(fp.getParentDir()) + " : " + QString(toString(e.getMessage()).c_str())); + error("Cannot create " + toQString(fp.getParentDir()) + " : " + QString(::to_string(e.getMessage()).c_str())); return false; } catch (...) { error("Cannot create " + toQString(fp.getParentDir())); @@ -877,7 +877,7 @@ bool Previewer::Imp::doSaveRenderedFrames(TFilePath fp) try { m_lw = TLevelWriterP(fp, outputSettings->getFileFormatProperties(fp.getType())); } catch (TImageException &e) { - error(QString::fromStdString(toString(e.getMessage()))); + error(QString::fromStdString(::to_string(e.getMessage()))); return false; } @@ -916,7 +916,7 @@ void Previewer::Imp::saveFrame() m_pbStatus[currFrameToSave] != FlipSlider::PBFrameFinished) continue; - TImageP img = TImageCache::instance()->get(m_cachePrefix + toString(currFrameToSave), false); + TImageP img = TImageCache::instance()->get(m_cachePrefix + std::to_string(currFrameToSave), false); if (!img) continue; @@ -935,11 +935,11 @@ void Previewer::Imp::saveFrame() //Output the save result QString str = "Saved " + - QString(toString(savedFrames).c_str()) + + QString(std::to_string(savedFrames).c_str()) + " frames out of " + - QString(toString(frameCount).c_str()) + + QString(std::to_string(frameCount).c_str()) + " in " + - QString(toString(m_lw->getFilePath().getWideString()).c_str()); + QString(::to_string(m_lw->getFilePath()).c_str()); if (!Pd) str = "Canceled! " + str; @@ -1110,7 +1110,7 @@ TRasterP Previewer::getRaster(int frame, bool renderIfNeeded) const if (it != m_imp->m_frames.end()) { if (frame < m_imp->m_pbStatus.size()) { if (m_imp->m_pbStatus[frame] == FlipSlider::PBFrameFinished || !renderIfNeeded) { - std::string str = m_imp->m_cachePrefix + toString(frame); + std::string str = m_imp->m_cachePrefix + std::to_string(frame); TRasterImageP rimg = (TRasterImageP)TImageCache::instance()->get(str, false); if (rimg) { TRasterP ras = rimg->getRaster(); @@ -1127,7 +1127,7 @@ TRasterP Previewer::getRaster(int frame, bool renderIfNeeded) const } //Retrieve the cached image, if any - std::string str = m_imp->m_cachePrefix + toString(frame); + std::string str = m_imp->m_cachePrefix + std::to_string(frame); TRasterImageP rimg = (TRasterImageP)TImageCache::instance()->get(str, false); if (rimg) { TRasterP ras = rimg->getRaster(); @@ -1174,7 +1174,7 @@ bool Previewer::isBusy() const void Previewer::onImageChange(TXshLevel *xl, const TFrameId &fid) { TFilePath fp = xl->getPath().withFrame(fid); - std::string levelKeyword = toString(fp.getWideString()); + std::string levelKeyword = ::to_string(fp); //Inform the cache managers of level invalidation if (!m_imp->m_subcamera) @@ -1252,7 +1252,7 @@ void Previewer::updateView() void Previewer::onLevelChange(TXshLevel *xl) { TFilePath fp = xl->getPath(); - std::string levelKeyword = toString(fp.getWideString()); + std::string levelKeyword = ::to_string(fp); //Inform the cache managers of level invalidation if (!m_imp->m_subcamera) @@ -1274,7 +1274,7 @@ void Previewer::onLevelChanged() std::string levelKeyword; TFilePath fp = xl->getPath(); - levelKeyword = toString(fp.withType("").getWideString()); + levelKeyword = ::to_string(fp.withType("")); //Inform the cache managers of level invalidation if (!m_imp->m_subcamera) diff --git a/toonz/sources/toonz/previewfxmanager.cpp b/toonz/sources/toonz/previewfxmanager.cpp index 2ccbc2b..e4187fa 100644 --- a/toonz/sources/toonz/previewfxmanager.cpp +++ b/toonz/sources/toonz/previewfxmanager.cpp @@ -89,7 +89,7 @@ const int notificationDelay = 300; inline std::string getCacheId(const TFxP &fx, int frame) { - return toString(fx->getIdentifier()) + ".noext" + toString(frame); + return std::to_string(fx->getIdentifier()) + ".noext" + std::to_string(frame); } //---------------------------------------------------------------------------- @@ -351,7 +351,7 @@ PreviewFxInstance::~PreviewFxInstance() //Release the user cache about this instance std::string contextName("PFX"); - contextName += ::toString(m_fx->getIdentifier()); + contextName += std::to_string(m_fx->getIdentifier()); TPassiveCacheManager::instance()->releaseContextNamesWithPrefix(contextName); //Clear the cached images @@ -545,7 +545,7 @@ void PreviewFxInstance::updateFrameRange() } //Build a level to associate the flipbook with the rendered output - m_level->setName(toString(m_fx->getIdentifier()) + ".noext"); + m_level->setName(std::to_string(m_fx->getIdentifier()) + ".noext"); int i; for (i = 0; i < frameCount; i++) m_level->setFrame(TFrameId(i), 0); @@ -936,7 +936,7 @@ void PreviewFxInstance::startRender(bool rebuild) //Retrieve the renderId unsigned long renderId = m_renderer.nextRenderId(); std::string contextName("PFX"); - contextName += ::toString(m_fx->getIdentifier()); + contextName += std::to_string(m_fx->getIdentifier()); TPassiveCacheManager::instance()->setContextName(renderId, contextName); //Finally, start rendering all frames which were not found in cache @@ -1317,14 +1317,14 @@ void PreviewFxManager::freeze(FlipBook *flipbook) //Then, perform the level copy { - std::string levelName("freezed" + ::toString(flipbook->getPoolIndex()) + ".noext"); + std::string levelName("freezed" + std::to_string(flipbook->getPoolIndex()) + ".noext"); int i; //Clone the preview images for (i = previewInstance->m_start; i <= previewInstance->m_end; i += previewInstance->m_step) { TImageP cachedImage = TImageCache::instance()->get(getCacheId(fx, i), false); if (cachedImage) - TImageCache::instance()->add(levelName + ::toString(i), cachedImage->cloneImage()); + TImageCache::instance()->add(levelName + std::to_string(i), cachedImage->cloneImage()); } //Associate a level with the cached images @@ -1395,7 +1395,7 @@ void PreviewFxManager::onLevelChanged() TXshLevel *xl = TApp::instance()->getCurrentLevel()->getLevel(); std::string aliasKeyword; TFilePath fp = xl->getPath(); - aliasKeyword = toString(fp.withType("").getWideString()); + aliasKeyword = ::to_string(fp.withType("")); QMap::iterator it; for (it = m_previewInstances.begin(); it != m_previewInstances.end(); ++it) { diff --git a/toonz/sources/toonz/psdsettingspopup.cpp b/toonz/sources/toonz/psdsettingspopup.cpp index 99b72ee..e017de8 100644 --- a/toonz/sources/toonz/psdsettingspopup.cpp +++ b/toonz/sources/toonz/psdsettingspopup.cpp @@ -87,7 +87,7 @@ void doPSDInfo(TFilePath psdpath, QTreeWidget *psdTree) psdTree->insertTopLevelItems(0, items); } catch (TImageException &e) { - error(QString::fromStdString(toString(e.getMessage()))); + error(QString::fromStdString(::to_string(e.getMessage()))); return; } } @@ -295,18 +295,18 @@ void PsdSettingsPopup::doPsdParser() } case FRAMES: { mode = "#frames"; - std::string name = psdpath.getName() + "#" + toString(1) + mode + psdpath.getDottedType(); + std::string name = psdpath.getName() + "#1" + mode + psdpath.getDottedType(); psdpath = psdpath.getParentDir() + TFilePath(name); break; } case COLUMNS: { - std::string name = psdpath.getName() + "#" + toString(1) + psdpath.getDottedType(); + std::string name = psdpath.getName() + "#1" + psdpath.getDottedType(); psdpath = psdpath.getParentDir() + TFilePath(name); break; } case FOLDER: { mode = "#group"; - std::string name = psdpath.getName() + "#" + toString(1) + mode + psdpath.getDottedType(); + std::string name = psdpath.getName() + "#1" + mode + psdpath.getDottedType(); psdpath = psdpath.getParentDir() + TFilePath(name); break; } @@ -322,7 +322,7 @@ void PsdSettingsPopup::doPsdParser() int layerId = m_psdparser->getLevelId(i); std::string name = m_path.getName(); if (layerId > 0 && m_mode != FRAMES) { - name += "#" + toString(layerId); + name += "#" + std::to_string(layerId); } if (mode != "") name += mode; @@ -331,7 +331,7 @@ void PsdSettingsPopup::doPsdParser() m_psdLevelPaths.push_back(psdpath); } } catch (TImageException &e) { - error(QString::fromStdString(toString(e.getMessage()))); + error(QString::fromStdString(::to_string(e.getMessage()))); return; } } @@ -346,7 +346,7 @@ TFilePath PsdSettingsPopup::getPsdFramePath(int levelIndex, int frameIndex) int frameId = m_psdparser->getFrameId(layerId, frameIndex); std::string name = m_path.getName(); if (frameId > 0) - name += "#" + toString(frameId); + name += "#" + std::to_string(frameId); name += m_path.getDottedType(); TFilePath psdpath = TApp::instance()->getCurrentScene()->getScene()->decodeFilePath(m_path).getParentDir() + TFilePath(name); diff --git a/toonz/sources/toonz/rendercommand.cpp b/toonz/sources/toonz/rendercommand.cpp index 51e09b3..7ba8ba3 100644 --- a/toonz/sources/toonz/rendercommand.cpp +++ b/toonz/sources/toonz/rendercommand.cpp @@ -121,7 +121,7 @@ public: bool isPreview = (m_fp.getType() == "noext"); - TImageCache::instance()->remove(toString(m_fp.getWideString() + L".0")); + TImageCache::instance()->remove(::to_string(m_fp.getWideString() + L".0")); TNotifier::instance()->notify(TSceneNameChange()); if (Preferences::instance()->isGeneratedMovieViewEnabled()) { @@ -265,7 +265,7 @@ bool RenderCommand::init(bool isPreview) TSystem::mkDir(parent); DvDirModel::instance()->refreshFolder(parent.getParentDir()); } catch (TException &e) { - DVGui::warning(QObject::tr("It is not possible to create folder : %1").arg(QString::fromStdString(toString(e.getMessage())))); + DVGui::warning(QObject::tr("It is not possible to create folder : %1").arg(QString::fromStdString(::to_string(e.getMessage())))); return false; } catch (...) { DVGui::warning(QObject::tr("It is not possible to create a folder.")); @@ -348,7 +348,7 @@ void RenderCommand::flashRender() TSystem::showDocument(m_fp); //QDesktopServices::openUrl(QUrl(toQString(m_fp))); - TImageCache::instance()->remove(toString(m_fp.getWideString() + L".0")); + TImageCache::instance()->remove(::to_string(m_fp.getWideString() + L".0")); TNotifier::instance()->notify(TSceneNameChange()); } @@ -444,7 +444,7 @@ void RenderCommand::rasterRender(bool isPreview) TPropertyGroup *props = scene->getProperties()->getOutputProperties()->getFileFormatProperties(ext); std::string codecName = props->getProperty(0)->getValueAsString(); TDimension res = scene->getCurrentCamera()->getRes(); - if (!AviCodecRestrictions::canWriteMovie(toWideString(codecName), res)) { + if (!AviCodecRestrictions::canWriteMovie(::to_wstring(codecName), res)) { QString msg(QObject::tr("The resolution of the output camera does not fit with the options chosen for the output file format.")); DVGui::warning(msg); return; @@ -651,7 +651,7 @@ void RenderCommand::multimediaRender() TPropertyGroup *props = scene->getProperties()->getOutputProperties()->getFileFormatProperties(ext); std::string codecName = props->getProperty(0)->getValueAsString(); TDimension res = scene->getCurrentCamera()->getRes(); - if (!AviCodecRestrictions::canWriteMovie(toWideString(codecName), res)) { + if (!AviCodecRestrictions::canWriteMovie(::to_wstring(codecName), res)) { QString msg(QObject::tr("The resolution of the output camera does not fit with the options chosen for the output file format.")); DVGui::warning(msg); return; @@ -767,7 +767,7 @@ void RenderCommand::doRender(bool isPreview) /*-- 通常のRendering --*/ rasterRender(isPreview); } catch (TException &e) { - DVGui::warning(QString::fromStdString(toString(e.getMessage()))); + DVGui::warning(QString::fromStdString(::to_string(e.getMessage()))); } catch (...) { DVGui::warning(QObject::tr("It is not possible to complete the rendering.")); } diff --git a/toonz/sources/toonz/scanlist.cpp b/toonz/sources/toonz/scanlist.cpp index d5fa5c5..9616310 100644 --- a/toonz/sources/toonz/scanlist.cpp +++ b/toonz/sources/toonz/scanlist.cpp @@ -124,7 +124,7 @@ void ScanListFrame::setRasterImage(const TRasterImageP &ras, bool isBW) const prop->setValue(range[2]); else { for (int i = 0; i < (int)range.size(); i++) { - int bpp = atoi(toString(range[i]).substr(0, 2).c_str()); + int bpp = std::stoi(::to_string(range[i]).substr(0, 2)); #ifdef LINETEST if (bpp == ps * 8) diff --git a/toonz/sources/toonz/subscenecommand.cpp b/toonz/sources/toonz/subscenecommand.cpp index bea1ebe..35ea9c1 100644 --- a/toonz/sources/toonz/subscenecommand.cpp +++ b/toonz/sources/toonz/subscenecommand.cpp @@ -571,7 +571,7 @@ void bringObjectOut(TStageObject *obj, TXsheet *xsh, outerObj->removeFromAllGroup(); if (groupId != -1) { outerObj->setGroupId(groupId); - outerObj->setGroupName(L"Group " + toWideString(groupId)); + outerObj->setGroupName(L"Group " + std::to_wstring(groupId)); } if (!objGroupData.m_groupIds.empty()) { int i; @@ -641,7 +641,7 @@ set explodeStageObjects(TXsheet *xsh, TXsheet *subXsh, int index, const TSt obj->removeFromAllGroup(); groupId = outerTree->getNewGroupId(); obj->setGroupId(groupId); - obj->setGroupName(L"Group " + toWideString(groupId)); + obj->setGroupName(L"Group " + std::to_wstring(groupId)); if (!objGroupData.m_groupIds.empty()) { int i; for (i = 0; i < objGroupData.m_groupIds.size(); i++) { @@ -707,7 +707,7 @@ set explodeStageObjects(TXsheet *xsh, TXsheet *subXsh, int index, const TSt outerCol->removeFromAllGroup(); if (groupId != -1) { outerCol->setGroupId(groupId); - outerCol->setGroupName(L"Group " + toWideString(groupId)); + outerCol->setGroupName(L"Group " + std::to_wstring(groupId)); } if (onlyColumn) @@ -870,7 +870,7 @@ void explodeFxs(TXsheet *xsh, TXsheet *subXsh, QPair pair = it.value(); TFx *outerFx = pair.first; outerFx->getAttributes()->setGroupId(groupId); - outerFx->getAttributes()->setGroupName(L"Group " + toWideString(groupId)); + outerFx->getAttributes()->setGroupName(L"Group " + std::to_wstring(groupId)); TPointD outerFxPos = outerFx->getAttributes()->getDagNodePos(); if (outerFxPos != TConst::nowhere) outerFx->getAttributes()->setDagNodePos(outerFxPos - offset); diff --git a/toonz/sources/toonz/tasksviewer.cpp b/toonz/sources/toonz/tasksviewer.cpp index ecd7034..1506a74 100644 --- a/toonz/sources/toonz/tasksviewer.cpp +++ b/toonz/sources/toonz/tasksviewer.cpp @@ -1271,7 +1271,7 @@ void TaskTreeModel::start(bool) BatchesController::instance()->start(task->m_id); } } catch (TException &e) { - DVGui::warning(QString::fromStdString(toString(e.getMessage()))); + DVGui::warning(QString::fromStdString(::to_string(e.getMessage()))); } emit layoutChanged(); @@ -1304,7 +1304,7 @@ void TaskTreeModel::stop(bool) BatchesController::instance()->stop(task->m_id); } } catch (TException &e) { - DVGui::warning(QString::fromStdString(toString(e.getMessage()))); + DVGui::warning(QString::fromStdString(::to_string(e.getMessage()))); } emit layoutChanged(); diff --git a/toonz/sources/toonz/tfarmstuff.cpp b/toonz/sources/toonz/tfarmstuff.cpp index c6bbe72..48e3506 100644 --- a/toonz/sources/toonz/tfarmstuff.cpp +++ b/toonz/sources/toonz/tfarmstuff.cpp @@ -117,6 +117,6 @@ TFilePath TFarmStuff::getGlobalRoot() void TFarmStuff::setGlobalRoot(const TFilePath &fp) { - GRootEnvVar = toString(fp.getWideString()); + GRootEnvVar = ::to_string(fp); //GRootEnvVar = fp; } diff --git a/toonz/sources/toonz/vectorizerpopup.cpp b/toonz/sources/toonz/vectorizerpopup.cpp index a49635b..c07a869 100644 --- a/toonz/sources/toonz/vectorizerpopup.cpp +++ b/toonz/sources/toonz/vectorizerpopup.cpp @@ -916,7 +916,7 @@ bool VectorizerPopup::apply() for (auto const level : levels) { TXshSimpleLevel *sl = dynamic_cast(level); if (!sl || !sl->getSimpleLevel() || !isLevelToConvert(sl)) { - QString levelName = tr(toString(sl->getName()).c_str()); + QString levelName = tr(::to_string(sl->getName()).c_str()); QString errorMsg = tr("Cannot convert to vector the current selection.") + levelName; error(errorMsg); continue; diff --git a/toonz/sources/toonz/viewer.cpp b/toonz/sources/toonz/viewer.cpp deleted file mode 100644 index 5da5b9a..0000000 --- a/toonz/sources/toonz/viewer.cpp +++ /dev/null @@ -1,83 +0,0 @@ - - -#include -#include "tgl.h" -#include "viewer.h" -#include "processor.h" - -//============================================================================= -// Viewer -//----------------------------------------------------------------------------- - -Viewer::Viewer(QWidget *parent) - : QGLWidget(parent), m_raster(0), m_processor(0), update_frame(true) -{ -} - -//----------------------------------------------------------------------------- - -Viewer::~Viewer() -{ -} - -//----------------------------------------------------------------------------- - -void Viewer::initializeGL() -{ - glClearColor(1.0f, 1.0f, 1.0f, 0.0f); -} - -//----------------------------------------------------------------------------- - -void Viewer::resizeGL(int width, int height) -{ - glViewport(0, 0, width, height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(0, width, 0, height, -1, 1); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - // To maintain pixel accuracy - glTranslated(0.375, 0.375, 0.0); -} - -//----------------------------------------------------------------------------- - -void Viewer::paintGL() -{ - glClear(GL_COLOR_BUFFER_BIT); - if (m_raster) { - glRasterPos2d(0, 0); - glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); // ras->getWrap()); - glDrawPixels(m_raster->getLx(), m_raster->getLy(), TGL_FMT, TGL_TYPE, m_raster->getRawData()); - } - if (m_processor) { - m_processor->draw(); - } - - if (m_message != "") { - glColor3d(0, 0, 0); - glPushMatrix(); - const double sc = 5; - glScaled(sc, sc, sc); - tglDrawText(TPointD(5, 5), m_message); - glPopMatrix(); - } -} - -//----------------------------------------------------------------------------- - -void Viewer::setRaster(TRaster32P raster) -{ - m_raster = raster; - if (update_frame) - update(); -} - -//----------------------------------------------------------------------------- - -void Viewer::setMessage(std::string msg) -{ - m_message = msg; - update(); -} diff --git a/toonz/sources/toonz/viewer.h b/toonz/sources/toonz/viewer.h deleted file mode 100644 index a035b28..0000000 --- a/toonz/sources/toonz/viewer.h +++ /dev/null @@ -1,46 +0,0 @@ -#pragma once - -#ifndef VIEWER_H -#define VIEWER_H - -#include -#include "traster.h" - -class Processor; - -//! OpenGL Widget that display the movie -class Viewer : public QGLWidget -{ - //! Raster that store the current Frame of the Movie. - TRaster32P m_raster; - Q_OBJECT; - //! String used to display "loading" text while the movie is being loaded - std::string m_message; - //! Pointer to a Processor to process the frame drawing OpenGL primitive over it. - Processor *m_processor; - -public: - bool update_frame; - - //! Construct a QGLWidget object which is a child of parent. - Viewer(QWidget *parent = 0); - //! Destroys the widget - ~Viewer(); - - //! Set the raster to draw - void setRaster(TRaster32P raster); - //! Returns the raster - const TRaster32P &getRaster() const { return m_raster; } - - //! Set the Processor to draw over the current frame - void setProcessor(Processor *processor) { m_processor = processor; } - //! Set the message. This message is displayed for every frame (if is a non-empty string). - void setMessage(std::string msg); - -protected: - void initializeGL(); - void paintGL(); - void resizeGL(int width, int height); -}; - -#endif // VIEWER_H diff --git a/toonz/sources/toonz/viewerdraw.cpp b/toonz/sources/toonz/viewerdraw.cpp index dba98ec..0c0a930 100644 --- a/toonz/sources/toonz/viewerdraw.cpp +++ b/toonz/sources/toonz/viewerdraw.cpp @@ -738,7 +738,7 @@ void ViewerDraw::drawFieldGuide() glEnd(); for (i = 1; i <= n; i++) { TPointD delta = 0.03 * TPointD(ux, uy); - std::string s = toString(i); + std::string s = std::to_string(i); tglDrawText(TPointD(0, i * uy) + delta, s); tglDrawText(TPointD(0, -i * uy) + delta, s); tglDrawText(TPointD(-i * ux, 0) + delta, s); diff --git a/toonz/sources/toonz/viewerpane.cpp b/toonz/sources/toonz/viewerpane.cpp index 544b571..bb09f0b 100644 --- a/toonz/sources/toonz/viewerpane.cpp +++ b/toonz/sources/toonz/viewerpane.cpp @@ -420,7 +420,7 @@ void SceneViewerPanel::changeWindowTitle() sceneName += QString("*"); name = tr("Scene: ") + sceneName; if (frame >= 0) - name = name + tr(" :: Frame: ") + tr(toString(frame + 1).c_str()); + name = name + tr(" :: Frame: ") + tr(std::to_string(frame + 1).c_str()); int col = app->getCurrentColumn()->getColumnIndex(); if (col < 0) { setWindowTitle(name); diff --git a/toonz/sources/toonz/writer.cpp b/toonz/sources/toonz/writer.cpp deleted file mode 100644 index c5c9829..0000000 --- a/toonz/sources/toonz/writer.cpp +++ /dev/null @@ -1,60 +0,0 @@ - - -#include -#include "tgl.h" -#include "writer.h" -#include "processor.h" -#include "trasterimage.h" - -//============================================================================= -// Writer -//---------------------------------------------------------------------------- - -Writer::Writer(const TFilePath &outputFile, int lx, int ly) - : m_pixmap(lx, ly), m_context(0), m_levelWriter(outputFile), m_frameCount(0), m_raster(lx, ly) -{ - QGLFormat glFormat; - m_context = new QGLContext(glFormat, &m_pixmap); - m_context->makeCurrent(); - - glViewport(0, 0, lx, ly); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(0, lx, 0, ly, -1, 1); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - // To maintain pixel accuracy - glTranslated(0.375, 0.375, 0.0); - glClearColor(1.0f, 1.0f, 1.0f, 0.0f); -} - -//----------------------------------------------------------------------------- - -Writer::~Writer() -{ - delete m_context; -} - -//----------------------------------------------------------------------------- - -void Writer::write(const TRaster32P &ras, Processor *processor) -{ - m_context->makeCurrent(); - glClear(GL_COLOR_BUFFER_BIT); - if (ras) { - glRasterPos2d(0, 0); - glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); // ras->getWrap()); - glDrawPixels(ras->getLx(), ras->getLy(), TGL_FMT, TGL_TYPE, ras->getRawData()); - } - if (processor) { - processor->draw(); - } - glRasterPos2d(0, 0); - glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); // ras->getWrap()); - glReadPixels(0, 0, m_raster->getLx(), m_raster->getLy(), TGL_FMT, TGL_TYPE, m_raster->getRawData()); - - TImageP img = TRasterImageP(m_raster); - m_levelWriter->getFrameWriter(++m_frameCount)->save(img); -} - -//----------------------------------------------------------------------------- diff --git a/toonz/sources/toonz/writer.h b/toonz/sources/toonz/writer.h deleted file mode 100644 index 4e388e4..0000000 --- a/toonz/sources/toonz/writer.h +++ /dev/null @@ -1,47 +0,0 @@ -#pragma once - -#ifndef WRITER_H -#define WRITER_H - -#include -#include "traster.h" -#include "tfilepath.h" -#include "tlevel_io.h" - -class Processor; - -//! Draw the frame (with the processing) before saving it. -class Writer -{ - //! QPaintDevice used only to initialize the QGLContext - QPixmap m_pixmap; - //! Offline OpenGL context that draw directly to a QPaintDevice (in this case a QPixmap) - QGLContext *m_context; - //! Class to write the level to file - TLevelWriterP m_levelWriter; - //! Frame counter - int m_frameCount; - //! Current Raster - TRaster32P m_raster; - -public: - //! Constructor - /*! - \param &outputFile filename of the output movie - \param lx an integer contains the width of the movie - \param ly an integer contains the height of the movie - */ - Writer(const TFilePath &outputFile, int lx, int ly); - //! Destructor - ~Writer(); - - /*! Write the raster, using the processor to the GL Context, - then read the context to store it in the m_raster. - Hence write m_raster to the movie file using TLevelWriter - */ - void write(const TRaster32P &ras, Processor *processor); - -protected: -}; - -#endif // WRITER_H diff --git a/toonz/sources/toonz/xshcellviewer.cpp b/toonz/sources/toonz/xshcellviewer.cpp index 4550e2f..95ddee8 100644 --- a/toonz/sources/toonz/xshcellviewer.cpp +++ b/toonz/sources/toonz/xshcellviewer.cpp @@ -497,7 +497,7 @@ void RenameCellField::showInRowCol(int row, int col) else { std::string frameNumber(""); if (fid.getNumber() > 0) - frameNumber = toString(fid.getNumber()); + frameNumber = std::to_string(fid.getNumber()); if (fid.getLetter() != 0) frameNumber.append(1, fid.getLetter()); setText((frameNumber.empty()) ? QString::fromStdWString(levelName) @@ -971,7 +971,7 @@ void CellArea::drawLevelCell(QPainter &p, int row, int col, bool isReference) int x = m_viewer->columnToX(col); int y = m_viewer->rowToY(row); QRect rect = QRect(x + 1, y + 1, ColumnWidth - 1, RowHeight - 1); - if (cell.isEmpty()) { // draw end-of-level mark of which the previous cell is not empty + if (cell.isEmpty()) { // vuol dire che la precedente non e' vuota QColor levelEndColor = m_viewer->getTextColor(); levelEndColor.setAlphaF(0.3); p.setPen(levelEndColor); @@ -1081,7 +1081,7 @@ void CellArea::drawLevelCell(QPainter &p, int row, int col, bool isReference) std::string frameNumber(""); //set number if (fid.getNumber() > 0) - frameNumber = toString(fid.getNumber()); + frameNumber = std::to_string(fid.getNumber()); //add letter if (fid.getLetter() != 0) frameNumber.append(1, fid.getLetter()); @@ -1193,7 +1193,7 @@ void CellArea::drawPaletteCell(QPainter &p, int row, int col, bool isReference) int x = m_viewer->columnToX(col); int y = m_viewer->rowToY(row); QRect rect = QRect(x + 1, y + 1, ColumnWidth - 1, RowHeight - 1); - if (cell.isEmpty()) { // draw end-of-level mark of which the previous cell is not empty + if (cell.isEmpty()) { // vuol dire che la precedente non e' vuota QColor levelEndColor = m_viewer->getTextColor(); levelEndColor.setAlphaF(0.3); p.setPen(levelEndColor); @@ -1254,7 +1254,7 @@ void CellArea::drawPaletteCell(QPainter &p, int row, int col, bool isReference) std::wstring levelName = cell.m_level->getName(); std::string frameNumber(""); if (fid.getNumber() > 0) - frameNumber = toString(fid.getNumber()); + frameNumber = std::to_string(fid.getNumber()); if (fid.getLetter() != 0) frameNumber.append(1, fid.getLetter()); @@ -1786,7 +1786,7 @@ void CellArea::mouseMoveEvent(QMouseEvent *event) } else { std::string frameNumber(""); if (fid.getNumber() > 0) - frameNumber = toString(fid.getNumber()); + frameNumber = std::to_string(fid.getNumber()); if (fid.getLetter() != 0) frameNumber.append(1, fid.getLetter()); m_tooltip = QString((frameNumber.empty()) ? QString::fromStdWString(levelName) diff --git a/toonz/sources/toonz/xshcolumnviewer.cpp b/toonz/sources/toonz/xshcolumnviewer.cpp index 736bd7b..e97c0c0 100644 --- a/toonz/sources/toonz/xshcolumnviewer.cpp +++ b/toonz/sources/toonz/xshcolumnviewer.cpp @@ -336,7 +336,7 @@ void ChangeObjectParent::refresh() for (i = 0; i < objectCount; i++) { TStageObjectId id = tree->getStageObject(i)->getId(); int index = id.getIndex(); - QString indexStr = QString(toString(id.getIndex() + 1).c_str()); + QString indexStr(std::to_string(id.getIndex() + 1).c_str()); QString newText; if (id == parentId) { if (parentId.isPegbar()) @@ -495,7 +495,7 @@ void RenameColumnField::show(QPoint pos, int col) TXshColumn *column = xsh->getColumn(col); TXshZeraryFxColumn *zColumn = dynamic_cast(column); if (zColumn) - name = toString(zColumn->getZeraryColumnFx()->getZeraryFx()->getName()); + name = ::to_string(zColumn->getZeraryColumnFx()->getZeraryFx()->getName()); setText(QString(name.c_str())); selectAll(); @@ -513,7 +513,7 @@ void RenameColumnField::renameColumn() TXshColumn *column = m_xsheetHandle->getXsheet()->getColumn(columnId.getIndex()); TXshZeraryFxColumn *zColumn = dynamic_cast(column); if (zColumn) - TFxCommand::renameFx(zColumn->getZeraryColumnFx(), toWideString(newName), m_xsheetHandle); + TFxCommand::renameFx(zColumn->getZeraryColumnFx(), ::to_wstring(newName), m_xsheetHandle); else TStageObjectCmd::rename(columnId, newName, m_xsheetHandle); m_xsheetHandle->notifyXsheetChanged(); @@ -888,7 +888,7 @@ void ColumnArea::drawSoundColumnHead(QPainter &p, int col) // column number p.setPen((isCurrent) ? Qt::red : Qt::black); - p.drawText(columnNamePos, QString(toString(col + 1).c_str())); + p.drawText(columnNamePos, QString(std::to_string(col + 1).c_str())); //Icona sound if (sc->isPlaying()) { @@ -1131,7 +1131,7 @@ void ColumnArea::drawSoundTextColumnHead(QPainter &p, int col) p.fillRect(indexBox, m_viewer->getDarkBGColor()); // indice colonna in alto a sinistra p.setPen(isCurrent ? Qt::red : Qt::black); - p.drawText(indexBox.adjusted(0, 2, -2, 0), Qt::AlignRight, QString(toString(col + 1).c_str())); + p.drawText(indexBox.adjusted(0, 2, -2, 0), Qt::AlignRight, QString(std::to_string(col + 1).c_str())); x0 = orig.x() + m_tabBox.x() + 1; int x1 = x0 + RowHeight; diff --git a/toonz/sources/toonz/xsheetcmd.cpp b/toonz/sources/toonz/xsheetcmd.cpp index f079083..8dce2c1 100644 --- a/toonz/sources/toonz/xsheetcmd.cpp +++ b/toonz/sources/toonz/xsheetcmd.cpp @@ -1319,10 +1319,10 @@ void readParameters() std::string s; s = is.getTagAttribute("rows"); if (s != "" && isInt(s)) - rowsPerPage = toInt(s); + rowsPerPage = std::stoi(s); s = is.getTagAttribute("columns"); if (s != "" && isInt(s)) - columnsPerPage = toInt(s); + columnsPerPage = std::stoi(s); } else if (tagName == "info") { std::string name = is.getTagAttribute("name"); std::string value = is.getTagAttribute("value"); @@ -1523,9 +1523,9 @@ void XsheetWriter::cell(ostream &os, int r, int c) std::string levelName; if (level->getChildLevel()) { int index = getChildLevelIndex(level->getChildLevel()); - levelName = index >= 0 ? "Sub" + toString(index + 1) : ""; + levelName = index >= 0 ? "Sub" + std::to_string(index + 1) : ""; } else - levelName = toString(level->getName()); + levelName = ::to_string(level->getName()); os << levelName << " " << cell.m_frameId.getNumber(); } os << "" << endl; @@ -1610,7 +1610,7 @@ void makeHtml(TFilePath fp) ToonzScene *scene = app->getCurrentScene()->getScene(); std::string sceneName = scene->getScenePath().getName(); - std::string projectName = toString(scene->getProject()->getName()); + std::string projectName = ::to_string(scene->getProject()->getName()); Tofstream os(fp); @@ -1654,13 +1654,13 @@ void makeHtml(TFilePath fp) TXshLevel *level = levels[i]; if (!level->getSimpleLevel()) continue; - os << "
" << toString(level->getName()) << "
" << endl; + os << "
" << ::to_string(level->getName()) << "
" << endl; os << "
" << endl; TFilePath fp = level->getPath(); - os << toString(fp.getWideString()); + os << ::to_string(fp); TFilePath fp2 = scene->decodeFilePath(fp); if (fp != fp2) - os << "
" << toString(fp2.getWideString()); + os << "
" << ::to_string(fp2); os << "
" << endl; } os << "" << endl; diff --git a/toonz/sources/toonz/xsheetviewer.cpp b/toonz/sources/toonz/xsheetviewer.cpp index 91769c4..39c0222 100644 --- a/toonz/sources/toonz/xsheetviewer.cpp +++ b/toonz/sources/toonz/xsheetviewer.cpp @@ -1154,7 +1154,7 @@ void XsheetViewer::changeWindowTitle() sceneName += QString("*"); QString name = tr("Scene: ") + sceneName; int frameCount = scene->getFrameCount(); - name = name + " :: " + tr(toString(frameCount).c_str()) + tr(" Frames"); + name = name + " :: " + tr(std::to_string(frameCount).c_str()) + tr(" Frames"); // subXsheet or not ChildStack *childStack = scene->getChildStack(); diff --git a/toonz/sources/toonz/xshrowviewer.cpp b/toonz/sources/toonz/xshrowviewer.cpp index f450792..626db24 100644 --- a/toonz/sources/toonz/xshrowviewer.cpp +++ b/toonz/sources/toonz/xshrowviewer.cpp @@ -309,10 +309,10 @@ void RowArea::drawOnionSkinSelection(QPainter &p) if (osMask.isEnabled()) p.setBrush(mos < 0 ? backColor : frontColor); - else + else p.setBrush(Qt::NoBrush); p.drawEllipse(onionDotDiam, y, onionDotDiam, onionDotDiam); - } + } //-- draw fixed onions for (int i = 0; i < osMask.getFosCount(); i++) diff --git a/toonz/sources/toonzfarm/tfarm/service.cpp b/toonz/sources/toonzfarm/tfarm/service.cpp index e03e27d..b8170c6 100644 --- a/toonz/sources/toonzfarm/tfarm/service.cpp +++ b/toonz/sources/toonzfarm/tfarm/service.cpp @@ -445,7 +445,7 @@ void TService::install(const std::string &name, const std::string &displayName, SERVICE_WIN32_OWN_PROCESS, // service type SERVICE_DEMAND_START, // start type SERVICE_ERROR_NORMAL, // error control type - toString(appPath.getWideString()).c_str(), // service's binary + ::to_string(appPath.getWideString()).c_str(), // service's binary NULL, // no load ordering group NULL, // no tag identifier TEXT(SZDEPENDENCIES), // dependencies diff --git a/toonz/sources/toonzfarm/tfarm/tfarmcontroller_c.cpp b/toonz/sources/toonzfarm/tfarm/tfarmcontroller_c.cpp index c5e707b..9b56d10 100644 --- a/toonz/sources/toonzfarm/tfarm/tfarmcontroller_c.cpp +++ b/toonz/sources/toonzfarm/tfarm/tfarmcontroller_c.cpp @@ -8,6 +8,8 @@ #include "tfarmproxy.h" #include "tfilepath_io.h" +#include + namespace { diff --git a/toonz/sources/toonzfarm/tfarm/tfarmproxy.cpp b/toonz/sources/toonzfarm/tfarm/tfarmproxy.cpp index 425f5f5..b0208c6 100644 --- a/toonz/sources/toonzfarm/tfarm/tfarmproxy.cpp +++ b/toonz/sources/toonzfarm/tfarm/tfarmproxy.cpp @@ -51,7 +51,7 @@ TString CantConnectToStub::getMessage() const string msg("Unable to connect to "); msg += m_hostName.toStdString(); msg += " on port "; - msg += toString(m_port); + msg += std::to_string(m_port); - return toWideString(msg); + return ::to_wstring(msg); } diff --git a/toonz/sources/toonzfarm/tfarm/ttcpipclient.cpp b/toonz/sources/toonzfarm/tfarm/ttcpipclient.cpp index 6dea38d..00ef6ab 100644 --- a/toonz/sources/toonzfarm/tfarm/ttcpipclient.cpp +++ b/toonz/sources/toonzfarm/tfarm/ttcpipclient.cpp @@ -235,7 +235,7 @@ int readData(int sock, QString &data) for (int i = x1; i < x2; ++i) ssize.push_back(buff[i]); - int size = toInt(ssize); + int size = std::stoi(ssize); data = QString(buff + x2 + sizeof("#$#THE") - 1); size -= data.size(); diff --git a/toonz/sources/toonzfarm/tfarm/ttcpipserver.cpp b/toonz/sources/toonzfarm/tfarm/ttcpipserver.cpp index d78f8da..2b0b910 100644 --- a/toonz/sources/toonzfarm/tfarm/ttcpipserver.cpp +++ b/toonz/sources/toonzfarm/tfarm/ttcpipserver.cpp @@ -94,7 +94,7 @@ int TTcpIpServerImp::readData(int sock, QString &data) for (int i = x1; i < x2; ++i) ssize.push_back(buff[i]); - int dataSize = toInt(ssize); + int dataSize = std::stoi(ssize); unsigned long size = dataSize; data = QString(buff + x2 + sizeof("#$#THE") - 1); @@ -136,7 +136,7 @@ int TTcpIpServerImp::readData(int sock, QString &data) } #ifdef TRACE - cout << "read " << toString((int)data.length()) << " on " << toString((int)dataSize) << endl + cout << "read " << toString((int)data.length()) << " on " << dataSize << endl << endl; #endif diff --git a/toonz/sources/toonzfarm/tfarmcontroller/tfarmcontroller.cpp b/toonz/sources/toonzfarm/tfarmcontroller/tfarmcontroller.cpp index 85cd22c..c9b77f0 100644 --- a/toonz/sources/toonzfarm/tfarmcontroller/tfarmcontroller.cpp +++ b/toonz/sources/toonzfarm/tfarmcontroller/tfarmcontroller.cpp @@ -20,6 +20,7 @@ #include "tthread.h" +#include #include using namespace std; @@ -136,7 +137,7 @@ bool myDoesExists(const TFilePath &fp) TFileStatus fs(fp); exists = fs.doesExist(); #else - int acc = access(toString(fp.getWideString()).c_str(), 00); // 00 == solo esistenza + int acc = access(::to_string(fp).c_str(), 00); // 00 == solo esistenza exists = acc != -1; #endif return exists; @@ -151,7 +152,7 @@ bool dirExists(const TFilePath &dirFp) TFileStatus fs(dirFp); exists = fs.isDirectory(); #else - int acc = access(toString(dirFp.getWideString()).c_str(), 00); // 00 == solo esistenza + int acc = access(::to_string(dirFp).c_str(), 00); // 00 == solo esistenza exists = acc != -1; #endif return exists; diff --git a/toonz/sources/toonzfarm/tfarmserver/tfarmserver.cpp b/toonz/sources/toonzfarm/tfarmserver/tfarmserver.cpp index cd49e82..eaf02ed 100644 --- a/toonz/sources/toonzfarm/tfarmserver/tfarmserver.cpp +++ b/toonz/sources/toonzfarm/tfarmserver/tfarmserver.cpp @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -168,7 +169,7 @@ bool dirExists(const TFilePath &dirFp) TFileStatus fs(dirFp); exists = fs.isDirectory(); #else - int acc = access(toString(dirFp.getWideString()).c_str(), 00); // 00 == solo esistenza + int acc = access(::to_string(dirFp).c_str(), 00); // 00 == solo esistenza exists = acc != -1; #endif return exists; @@ -183,7 +184,7 @@ bool myDoesExists(const TFilePath &fp) TFileStatus fs(fp); exists = fs.doesExist(); #else - int acc = access(toString(fp.getWideString()).c_str(), 00); // 00 == solo esistenza + int acc = access(::to_string(fp).c_str(), 00); // 00 == solo esistenza exists = acc != -1; #endif return exists; @@ -790,7 +791,7 @@ bool loadServerData(const QString &hostname, QString &addr, int &port) TFilePath fp = rootDir + "config" + "servers.txt"; #ifndef _WIN32 - int acc = access(toString(fp.getWideString()).c_str(), 00); // 00 == solo esistenza + int acc = access(::to_string(fp).c_str(), 00); // 00 == solo esistenza bool fileExists = acc != -1; if (!fileExists) return false; @@ -859,7 +860,7 @@ void FarmServerService::onStart(int argc, char *argv[]) } TFilePath gRootDir = getGlobalRoot(); - if (toString(gRootDir.getWideString()) == "") { + if (::to_string(gRootDir) == "") { std::string errMsg("Unable to get TFARMGLOBALROOT environment variable"); addToMessageLog(errMsg); @@ -877,7 +878,7 @@ void FarmServerService::onStart(int argc, char *argv[]) if (!gRootDirExists) { std::string errMsg("Unable to start the Server"); errMsg += "\n"; - errMsg += "The directory " + toString(gRootDir.getWideString()) + " specified as Global Root does not exist"; + errMsg += "The directory " + ::to_string(gRootDir) + " specified as Global Root does not exist"; ; addToMessageLog(errMsg); @@ -902,7 +903,7 @@ void FarmServerService::onStart(int argc, char *argv[]) } catch (TException &e) { std::string errMsg("Unable to start the Server"); errMsg += "\n"; - errMsg += toString(e.getMessage()); + errMsg += ::to_string(e.getMessage()); addToMessageLog(errMsg); setStatus(TService::Stopped, NO_ERROR, 0); // exit the program } @@ -1071,7 +1072,7 @@ void FarmServerService::loadDiskMountingPoints(const TFilePath &fp) { Tifstream is(fp); if (!is) - throw std::string("File " + toString(fp.getWideString()) + " not found"); + throw std::string("File " + ::to_string(fp) + " not found"); char buffer[1024]; while (is.getline(buffer, sizeof(buffer))) { char *s = buffer; diff --git a/toonz/sources/toonzlib/autopos.cpp b/toonz/sources/toonzlib/autopos.cpp index a7dde5c..54932e0 100644 --- a/toonz/sources/toonzlib/autopos.cpp +++ b/toonz/sources/toonzlib/autopos.cpp @@ -3,6 +3,8 @@ #include "autopos.h" #include "cleanupcommon.h" +#include + using namespace CleanupTypes; /* diff --git a/toonz/sources/toonzlib/avicodecrestrictions.cpp b/toonz/sources/toonzlib/avicodecrestrictions.cpp index d5204c3..ef8f50c 100644 --- a/toonz/sources/toonzlib/avicodecrestrictions.cpp +++ b/toonz/sources/toonzlib/avicodecrestrictions.cpp @@ -36,14 +36,14 @@ HIC getCodec(const std::wstring &codecName, int &bpp) WideCharToMultiByte(CP_ACP, 0, icinfo.szName, -1, name, sizeof(name), 0, 0); std::string compressorName; - compressorName = std::string(name) + " '" + toString(bpp) + "' " + std::string(descr); + compressorName = std::string(name) + " '" + std::to_string(bpp) + "' " + std::string(descr); if (hic) { if (ICCompressQuery(hic, &inFmt, NULL) != ICERR_OK) { ICClose(hic); continue; // Skip this compressor if it can't handle the format. } - if (toWideString(compressorName) == codecName) { + if (::to_wstring(compressorName) == codecName) { found = true; break; } @@ -229,7 +229,7 @@ QMap AviCodecRestrictions::getUsableCodecs(const TDimension WideCharToMultiByte(CP_ACP, 0, icinfo.szName, -1, name, sizeof(name), 0, 0); std::wstring compressorName; - compressorName = toWideString(std::string(name) + " '" + toString(bpp) + "' " + std::string(descr)); + compressorName = ::to_wstring(std::string(name) + " '" + std::to_string(bpp) + "' " + std::string(descr)); if (hic) { if (ICCompressQuery(hic, &inFmt, NULL) != ICERR_OK) { diff --git a/toonz/sources/toonzlib/cleanupparameters.cpp b/toonz/sources/toonzlib/cleanupparameters.cpp index de78ca2..55166a3 100644 --- a/toonz/sources/toonzlib/cleanupparameters.cpp +++ b/toonz/sources/toonzlib/cleanupparameters.cpp @@ -92,7 +92,7 @@ void FdgManager::loadFieldGuideInfo() TFilePath fname = *it; if (fname.getType() != "fdg") continue; - fp = fopen(toString(fname.getWideString()).c_str(), "r"); + fp = fopen(::to_string(fname.getWideString()).c_str(), "r"); if (!fp) continue; FDG_INFO fdg_info; @@ -321,9 +321,8 @@ void CleanupParameters::saveData(TOStream &os) const std::map attr; if (m_autocenterType != AUTOCENTER_NONE) { attr.clear(); - attr["type"] = toString((int)m_autocenterType); - attr["pegHoles"] = toString((int)m_pegSide); - //attr["fieldGuide"] = toString((int)m_pegSide); + attr["type"] = std::to_string(m_autocenterType); + attr["pegHoles"] = std::to_string(m_pegSide); os.openCloseChild("autoCenter", attr); } @@ -334,19 +333,18 @@ void CleanupParameters::saveData(TOStream &os) const if (flip != "") attr["flip"] = flip; if (m_rotate != 0) - attr["rotate"] = toString(m_rotate); - //if(m_scale!=1) attr["scale"] = toString(m_scale); + attr["rotate"] = std::to_string(m_rotate); if (m_offx != 0.0) - attr["xoff"] = toString(m_offx); + attr["xoff"] = std::to_string(m_offx); if (m_offy != 0.0) - attr["yoff"] = toString(m_offy); + attr["yoff"] = std::to_string(m_offy); os.openCloseChild("transform", attr); } if (m_lineProcessingMode != lpNone) { attr.clear(); - attr["sharpness"] = toString(m_sharpness); - attr["autoAdjust"] = toString((int)m_autoAdjustMode); + attr["sharpness"] = std::to_string(m_sharpness); + attr["autoAdjust"] = std::to_string(m_autoAdjustMode); attr["mode"] = (m_lineProcessingMode == lpGrey ? "grey" : "color"); os.openCloseChild("lineProcessing", attr); } @@ -359,13 +357,13 @@ void CleanupParameters::saveData(TOStream &os) const os.openCloseChild("MLAA", attr); } attr.clear(); - attr["value"] = toString(m_despeckling); + attr["value"] = std::to_string(m_despeckling); os.openCloseChild("despeckling", attr); attr.clear(); - attr["value"] = toString(m_aaValue); + attr["value"] = std::to_string(m_aaValue); os.openCloseChild("aaValue", attr); attr.clear(); - attr["value"] = toString(m_closestField); + attr["value"] = std::to_string(m_closestField); os.openCloseChild("closestField", attr); attr.clear(); attr["name"] = m_fdgInfo.m_name; @@ -373,14 +371,6 @@ void CleanupParameters::saveData(TOStream &os) const attr.clear(); if (m_path != TFilePath()) os.child("path") << m_path; - - // attr["path"] = toString(m_path.getWideString()); - // os.openCloseChild("path", attr); - - //m_closestField = param->m_closestField; - //m_autoAdjustMode = param->m_autoAdjustMode; - //m_sharpness = param->m_sharpness; - //m_transparencyCheckEnabled = param->m_transparencyCheckEnabled; } //--------------------------------------------------------- @@ -409,42 +399,42 @@ void CleanupParameters::loadData(TIStream &is, bool globalParams) m_autocenterType = AUTOCENTER_FDG; std::string s = is.getTagAttribute("type"); if (s != "" && isInt(s)) - m_autocenterType = (AUTOCENTER_TYPE)toInt(s); + m_autocenterType = (AUTOCENTER_TYPE)std::stoi(s); s = is.getTagAttribute("pegHoles"); if (s != "" && isInt(s)) - m_pegSide = (PEGS_SIDE)toInt(s); + m_pegSide = (PEGS_SIDE)std::stoi(s); } else if (tagName == "transform") { std::string s = is.getTagAttribute("flip"); m_flipx = (s.find("x") != std::string::npos); m_flipy = (s.find("y") != std::string::npos); s = is.getTagAttribute("rotate"); if (s != "" && isInt(s)) - m_rotate = toInt(s); + m_rotate = std::stoi(s); s = is.getTagAttribute("xoff"); if (s != "" && isDouble(s)) - m_offx = toDouble(s); + m_offx = std::stod(s); s = is.getTagAttribute("yoff"); if (s != "" && isDouble(s)) - m_offy = toDouble(s); + m_offy = std::stod(s); } else if (tagName == "lineProcessing") { m_lineProcessingMode = lpGrey; std::string s = is.getTagAttribute("sharpness"); if (s != "" && isDouble(s)) - m_sharpness = toDouble(s); + m_sharpness = std::stod(s); s = is.getTagAttribute("autoAdjust"); if (s != "" && isDouble(s)) - m_autoAdjustMode = (CleanupTypes::AUTO_ADJ_MODE)toInt(s); + m_autoAdjustMode = (CleanupTypes::AUTO_ADJ_MODE)std::stoi(s); s = is.getTagAttribute("mode"); if (s != "" && s == "color") m_lineProcessingMode = lpColor; } else if (tagName == "despeckling") { std::string s = is.getTagAttribute("value"); if (s != "" && isInt(s)) - m_despeckling = toInt(s); + m_despeckling = std::stoi(s); } else if (tagName == "aaValue") { std::string s = is.getTagAttribute("value"); if (s != "" && isInt(s)) - m_aaValue = toInt(s); + m_aaValue = std::stoi(s); } else if (tagName == "noAntialias") m_noAntialias = true; else if (tagName == "MLAA") @@ -452,7 +442,7 @@ void CleanupParameters::loadData(TIStream &is, bool globalParams) else if (tagName == "closestField") { std::string s = is.getTagAttribute("value"); if (s != "" && isDouble(s)) - m_closestField = toDouble(s); + m_closestField = std::stod(s); } else if (tagName == "fdg") { std::string s = is.getTagAttribute("name"); if (s != "") diff --git a/toonz/sources/toonzlib/convert2tlv.cpp b/toonz/sources/toonzlib/convert2tlv.cpp index d9ba2a6..98eca4e 100644 --- a/toonz/sources/toonzlib/convert2tlv.cpp +++ b/toonz/sources/toonzlib/convert2tlv.cpp @@ -688,12 +688,12 @@ bool Convert2Tlv::init(std::string &errorMessage) if (m_lr1) m_level1 = m_lr1->loadInfo(); } catch (...) { - errorMessage = "Error: can't read level " + toString(m_levelIn1.getWideString()); + errorMessage = "Error: can't read level " + ::to_string(m_levelIn1.getWideString()); return false; } if (m_level1->getFrameCount() == 0) { - errorMessage = "Error: can't find level " + toString(m_levelIn1.getWideString()); + errorMessage = "Error: can't find level " + ::to_string(m_levelIn1.getWideString()); return false; } @@ -705,12 +705,12 @@ bool Convert2Tlv::init(std::string &errorMessage) if (m_lr2) level2 = m_lr2->loadInfo(); } catch (...) { - errorMessage = "Error: can't read level " + toString(m_levelIn2.getWideString()); + errorMessage = "Error: can't read level " + ::to_string(m_levelIn2.getWideString()); return false; } if (level2->getFrameCount() == 0) { - errorMessage = "Error: can't find level " + toString(m_levelIn2.getWideString()); + errorMessage = "Error: can't find level " + ::to_string(m_levelIn2.getWideString()); return false; } @@ -734,7 +734,7 @@ bool Convert2Tlv::init(std::string &errorMessage) TImageReaderP ir1 = m_lr1->getFrameReader(m_it->first); const TImageInfo *info1 = ir1->getImageInfo(); if (!info1) { - errorMessage = "Error: can't read frame " + toString(m_it->first.getNumber()) + " of level " + toString(m_levelIn1.getWideString()); + errorMessage = "Error: can't read frame " + std::to_string(m_it->first.getNumber()) + " of level " + ::to_string(m_levelIn1.getWideString()); return false; } @@ -751,7 +751,7 @@ bool Convert2Tlv::init(std::string &errorMessage) if (ir2) { const TImageInfo *info2 = ir2->getImageInfo(); if (!info1) { - errorMessage = "Error: can't read frame " + toString(it2->first.getNumber()) + " of level " + toString(m_levelIn2.getWideString()); + errorMessage = "Error: can't read frame " + std::to_string(it2->first.getNumber()) + " of level " + ::to_string(m_levelIn2.getWideString()); ; return false; } @@ -815,7 +815,7 @@ bool Convert2Tlv::convertNext(std::string &errorMessage) TImageReaderP ir1 = m_lr1->getFrameReader(m_it->first); TRasterImageP imgIn1 = (TRasterImageP)ir1->load(); if (!imgIn1) { - errorMessage = "Error: cannot read frame" + toString(m_it->first.getNumber()) + " of " + toString(m_levelIn1.getWideString()) + "!"; + errorMessage = "Error: cannot read frame" + std::to_string(m_it->first.getNumber()) + " of " + ::to_string(m_levelIn1.getWideString()) + "!"; return false; } TRasterP rin1 = imgIn1->getRaster(); @@ -829,7 +829,7 @@ bool Convert2Tlv::convertNext(std::string &errorMessage) TImageReaderP ir2 = m_lr2->getFrameReader(m_it->first); imgIn2 = (TRasterImageP)ir2->load(); if (!imgIn2) { - errorMessage = "Error: cannot read frame " + toString(m_it->first.getNumber()) + " of " + toString(m_levelIn2.getWideString()) + "!"; + errorMessage = "Error: cannot read frame " + std::to_string(m_it->first.getNumber()) + " of " + ::to_string(m_levelIn2.getWideString()) + "!"; return false; } rin2 = imgIn2->getRaster(); diff --git a/toonz/sources/toonzlib/fxcommand.cpp b/toonz/sources/toonzlib/fxcommand.cpp index 299ffbd..e70a659 100644 --- a/toonz/sources/toonzlib/fxcommand.cpp +++ b/toonz/sources/toonzlib/fxcommand.cpp @@ -3671,7 +3671,7 @@ void UndoGroupFxs::initialize() void UndoGroupFxs::redo() const { - const std::wstring groupName = L"Group " + toWideString(m_groupId); + const std::wstring groupName = L"Group " + std::to_wstring(m_groupId); std::vector::const_iterator gt, gEnd = m_groupData.end(); for (gt = m_groupData.begin(); gt != gEnd; ++gt) { diff --git a/toonz/sources/toonzlib/hook.cpp b/toonz/sources/toonzlib/hook.cpp index 769e149..15056c1 100644 --- a/toonz/sources/toonzlib/hook.cpp +++ b/toonz/sources/toonzlib/hook.cpp @@ -528,5 +528,5 @@ std::string getHookName(int code) if (code == 0) return "B"; else - return "H" + toString(code); + return "H" + std::to_string(code); } diff --git a/toonz/sources/toonzlib/levelset.cpp b/toonz/sources/toonzlib/levelset.cpp index 9578a69..0e3817d 100644 --- a/toonz/sources/toonzlib/levelset.cpp +++ b/toonz/sources/toonzlib/levelset.cpp @@ -338,7 +338,7 @@ void TLevelSet::loadFolder(TIStream &is, TFilePath folder) } } else if (tagName == "folder") { is.getTagParam("name", s); - TFilePath child = createFolder(folder, toWideString(s)); + TFilePath child = createFolder(folder, ::to_wstring(s)); loadFolder(is, child); } else throw TException("expected or "); @@ -364,7 +364,7 @@ void TLevelSet::loadData(TIStream &is) } } } else if (tagName == "folder") { - std::string name = toString(defaultRootFolder.getWideString()); + std::string name = ::to_string(defaultRootFolder.getWideString()); is.getTagParam("name", name); TFilePath folder(name); if (folderCount == 1) diff --git a/toonz/sources/toonzlib/levelupdater.cpp b/toonz/sources/toonzlib/levelupdater.cpp index b19f2f6..aeebc24 100644 --- a/toonz/sources/toonzlib/levelupdater.cpp +++ b/toonz/sources/toonzlib/levelupdater.cpp @@ -47,12 +47,12 @@ void enforceBpp(TPropertyGroup *pg, int bpp, bool upgradeOnly) int idx = bppProp->getIndex(); // Search for a suitable 32-bit or 64-bit value - int currentBpp = upgradeOnly ? atoi(bppProp->getValueAsString().c_str()) : 0; + int currentBpp = upgradeOnly ? std::stoi(bppProp->getValueAsString()) : 0; int targetBpp = (std::numeric_limits::max)(), targetIdx = -1; int i, count = (int)range.size(); for (i = 0; i < count; ++i) { - int bppEntry = atoi(toString(range[i]).c_str()); + int bppEntry = std::stoi(range[i]); if ((bppEntry % bpp == 0) && currentBpp <= bppEntry && bppEntry < targetBpp) targetBpp = bppEntry, targetIdx = i; } @@ -313,7 +313,7 @@ TFilePath LevelUpdater::getNewTemporaryFilePath(const TFilePath &fp) int count = 1; for (;;) { - fp2 = fp.withName(fp.getWideName() + L"__" + toWideString(count++)); + fp2 = fp.withName(fp.getWideName() + L"__" + std::to_wstring(count++)); if (!TSystem::doesExistFileOrLevel(fp2)) break; } diff --git a/toonz/sources/toonzlib/movierenderer.cpp b/toonz/sources/toonzlib/movierenderer.cpp index 765256f..12b1267 100644 --- a/toonz/sources/toonzlib/movierenderer.cpp +++ b/toonz/sources/toonzlib/movierenderer.cpp @@ -398,7 +398,7 @@ std::pair MovieRenderer::Imp::saveFrame(double frame, const std::pair imgA->setRaster(aux); } - TImageCache::instance()->add(m_renderCacheId + toString(fid.getNumber()), imgA); + TImageCache::instance()->add(m_renderCacheId + std::to_string(fid.getNumber()), imgA); } success = true; @@ -527,7 +527,7 @@ void MovieRenderer::Imp::doRenderRasterCompleted(const RenderData &renderData) getRange(m_scene, false, from, to); // It's ok since cancels can only happen from Toonz... for (int i = from; i < to; i++) - TImageCache::instance()->remove(m_renderCacheId + toString(i + 1)); + TImageCache::instance()->remove(m_renderCacheId + std::to_string(i + 1)); } m_renderer.stopRendering(); diff --git a/toonz/sources/toonzlib/multimediarenderer.cpp b/toonz/sources/toonzlib/multimediarenderer.cpp index 265eab0..c73b1d4 100644 --- a/toonz/sources/toonzlib/multimediarenderer.cpp +++ b/toonz/sources/toonzlib/multimediarenderer.cpp @@ -371,7 +371,6 @@ void MultimediaRenderer::Imp::start() std::wstring fpName = m_fp.getWideName() + L"_" + columnName + (columnId == columnName ? L"" : L"(" + columnId + L")") + (fxId.empty() ? L"" : L"_" + fxName + (fxId == fxNameNoSpaces ? L"" : L"(" + fxId + L")")); - //+ modeStr + toWideString(columnIndex+1); TFilePath movieFp(m_fp.withName(fpName)); //Initialize a MovieRenderer with our infos diff --git a/toonz/sources/toonzlib/namebuilder.cpp b/toonz/sources/toonzlib/namebuilder.cpp index 20fbb0d..1294259 100644 --- a/toonz/sources/toonzlib/namebuilder.cpp +++ b/toonz/sources/toonzlib/namebuilder.cpp @@ -49,7 +49,7 @@ NameModifier::NameModifier(std::wstring name) if (j != (int)std::wstring::npos && j + 1 < (int)name.length() && name[j] == '_') { - m_index = toInt(name.substr(j + 1)); + m_index = std::stoi(name.substr(j + 1)); m_nameBase = name.substr(0, j); } } @@ -62,5 +62,5 @@ std::wstring NameModifier::getNext() if (index < 1) return m_nameBase; else - return m_nameBase + L"_" + toWideString(index); + return m_nameBase + L"_" + std::to_wstring(index); } diff --git a/toonz/sources/toonzlib/palettecmd.cpp b/toonz/sources/toonzlib/palettecmd.cpp index b43a5dd..c0ba6ed 100644 --- a/toonz/sources/toonzlib/palettecmd.cpp +++ b/toonz/sources/toonzlib/palettecmd.cpp @@ -403,7 +403,7 @@ void PaletteCmd::createStyle( /*- StudioPalette上でStyleを追加した場合、GlobalNameを自動で割り振る -*/ if (palette->getGlobalName() != L"") { TColorStyle *cs = palette->getStyle(newStyleId); - std::wstring gname = L"-" + palette->getGlobalName() + L"-" + toWideString(newStyleId); + std::wstring gname = L"-" + palette->getGlobalName() + L"-" + std::to_wstring(newStyleId); cs->setGlobalName(gname); } @@ -727,7 +727,7 @@ void PaletteCmd::addPage(TPaletteHandle *paletteHandle, std::wstring name, bool { TPalette *palette = paletteHandle->getPalette(); if (name == L"") - name = L"page " + toWideString(palette->getPageCount() + 1); + name = L"page " + std::to_wstring(palette->getPageCount() + 1); TPalette::Page *page = palette->addPage(name); palette->setDirtyFlag(true); diff --git a/toonz/sources/toonzlib/plasticdeformerfx.cpp b/toonz/sources/toonzlib/plasticdeformerfx.cpp index 5ca4c79..8d2d7e3 100644 --- a/toonz/sources/toonzlib/plasticdeformerfx.cpp +++ b/toonz/sources/toonzlib/plasticdeformerfx.cpp @@ -42,12 +42,12 @@ std::string toString(const TAffine &aff) return //Observe that toString distinguishes + and - 0. That is a problem //when comparing aliases - so near 0 values are explicitly rounded to 0. - (areAlmostEqual(aff.a11, 0.0) ? "0" : ::toString(aff.a11, 5)) + "," + - (areAlmostEqual(aff.a12, 0.0) ? "0" : ::toString(aff.a12, 5)) + "," + - (areAlmostEqual(aff.a13, 0.0) ? "0" : ::toString(aff.a13, 5)) + "," + - (areAlmostEqual(aff.a21, 0.0) ? "0" : ::toString(aff.a21, 5)) + "," + - (areAlmostEqual(aff.a22, 0.0) ? "0" : ::toString(aff.a22, 5)) + "," + - (areAlmostEqual(aff.a23, 0.0) ? "0" : ::toString(aff.a23, 5)); + (areAlmostEqual(aff.a11, 0.0) ? "0" : ::to_string(aff.a11, 5)) + "," + + (areAlmostEqual(aff.a12, 0.0) ? "0" : ::to_string(aff.a12, 5)) + "," + + (areAlmostEqual(aff.a13, 0.0) ? "0" : ::to_string(aff.a13, 5)) + "," + + (areAlmostEqual(aff.a21, 0.0) ? "0" : ::to_string(aff.a21, 5)) + "," + + (areAlmostEqual(aff.a22, 0.0) ? "0" : ::to_string(aff.a22, 5)) + "," + + (areAlmostEqual(aff.a23, 0.0) ? "0" : ::to_string(aff.a23, 5)); } //----------------------------------------------------------------------------------- @@ -57,7 +57,7 @@ std::string toString(SkVD *vd, double sdFrame) std::string result; for (int p = 0; p < SkVD::PARAMS_COUNT; ++p) - result += ::toString(vd->m_params[p]->getValue(sdFrame), 5) + " "; + result += ::to_string(vd->m_params[p]->getValue(sdFrame), 5) + " "; return result; } @@ -67,7 +67,7 @@ std::string toString(SkVD *vd, double sdFrame) std::string toString(const PlasticSkeleton::vertex_type &vx) { // TODO: Add z and rigidity - return ::toString(vx.P().x, 5) + " " + ::toString(vx.P().y, 5); + return ::to_string(vx.P().x, 5) + " " + ::to_string(vx.P().y, 5); } //----------------------------------------------------------------------------------- @@ -349,7 +349,7 @@ void PlasticDeformerFx::doCompute(TTile &tile, double frame, const TRenderSettin TRop::depremultiply(tex); // Textures must be stored depremultiplied. // See docs about the tglDraw() below. static TAtomicVar var; - const std::string &texId = "render_tex " + ::toString((int)++var); + const std::string &texId = "render_tex " + std::to_string(++var); // Prepare an OpenGL context std::auto_ptr context(new TOfflineGL(tile.getRaster()->getSize())); diff --git a/toonz/sources/toonzlib/preferences.cpp b/toonz/sources/toonzlib/preferences.cpp index 4a6be30..0539057 100644 --- a/toonz/sources/toonzlib/preferences.cpp +++ b/toonz/sources/toonzlib/preferences.cpp @@ -900,7 +900,7 @@ void setCurrentUnits(std::string measureName, std::string units) TMeasure *m = TMeasureManager::instance()->get(measureName); if (!m) return; - TUnit *u = m->getUnit(toWideString(units)); + TUnit *u = m->getUnit(::to_wstring(units)); if (!u) return; m->setCurrentUnit(u); diff --git a/toonz/sources/toonzlib/sandor_fxs/toonz4_6staff.cpp b/toonz/sources/toonzlib/sandor_fxs/toonz4_6staff.cpp index 561e569..449fa51 100644 --- a/toonz/sources/toonzlib/sandor_fxs/toonz4_6staff.cpp +++ b/toonz/sources/toonzlib/sandor_fxs/toonz4_6staff.cpp @@ -45,7 +45,7 @@ void convertParam(double param[], const char *cParam[], int cParamLen) { std::string app; for (int i = 1; i < 12; i++) { - app = toString(param[i]); + app = std::to_string(param[i]); cParam[i] = strsave(app.c_str()); } } diff --git a/toonz/sources/toonzlib/sceneresources.cpp b/toonz/sources/toonzlib/sceneresources.cpp index 97ec48c..a9c43c8 100644 --- a/toonz/sources/toonzlib/sceneresources.cpp +++ b/toonz/sources/toonzlib/sceneresources.cpp @@ -75,7 +75,7 @@ bool makePathUnique(ToonzScene *scene, TFilePath &path) bool ret = false; while (TSystem::doesExistFileOrLevel(scene->decodeFilePath(path))) { ret = true; - path = path.withName(name + L"_" + toWideString(id)); + path = path.withName(name + L"_" + std::to_wstring(id)); id++; } return ret; diff --git a/toonz/sources/toonzlib/scriptbinding_files.cpp b/toonz/sources/toonzlib/scriptbinding_files.cpp index 3804ed2..afe2784 100644 --- a/toonz/sources/toonzlib/scriptbinding_files.cpp +++ b/toonz/sources/toonzlib/scriptbinding_files.cpp @@ -127,13 +127,7 @@ QScriptValue FilePath::concat(const QScriptValue &value) const err = checkFilePath(context(), value, fp); if (err.isError()) return err; - /* - if(!isDirectory()) - { - QScriptValue v = toString(); - return context()->throwError(tr("%1 is not a directory").arg(toString().toString())); - } - */ + if (fp.isAbsolute()) return context()->throwError(tr("can't concatenate an absolute path : %1").arg(value.toString())); fp = getToonzFilePath() + fp; diff --git a/toonz/sources/toonzlib/studiopalette.cpp b/toonz/sources/toonzlib/studiopalette.cpp index 7fb824a..9b8d360 100644 --- a/toonz/sources/toonzlib/studiopalette.cpp +++ b/toonz/sources/toonzlib/studiopalette.cpp @@ -35,11 +35,11 @@ TFilePath makeUniqueName(TFilePath fp) int index = 2; int j = name.find_last_not_of(L"0123456789"); if (j != (int)std::wstring::npos && j + 1 < (int)name.length()) { - index = toInt(name.substr(j + 1)) + 1; + index = std::stoi(name.substr(j + 1)) + 1; name = name.substr(0, j + 1); } for (;;) { - fp = fp.withName(name + toWideString(index)); + fp = fp.withName(name + std::to_wstring(index)); if (TFileStatus(fp).doesExist() == false) return fp; index++; @@ -128,7 +128,7 @@ std::wstring readPaletteGlobalName(TFilePath path) return L""; std::string name; if (is.getTagParam("name", name)) - return toWideString(name); + return ::to_wstring(name); } catch (...) { } return L""; @@ -416,7 +416,7 @@ TFilePath StudioPalette::createPalette(const TFilePath &folderPath, std::string TFilePath fp = makeUniqueName(folderPath + (name + ".tpl")); time_t ltime; time(<ime); - std::wstring gname = toWideString((int)ltime) + L"_" + toWideString(rand()); + std::wstring gname = std::to_wstring(ltime) + L"_" + std::to_wstring(rand()); palette->setGlobalName(gname); setStylesGlobalNames(palette); save(fp, palette); @@ -496,7 +496,7 @@ TFilePath StudioPalette::importPalette( TFilePath fp = makeUniqueName(dstFolder + (name + L".tpl")); time_t ltime; time(<ime); - std::wstring gname = toWideString((int)ltime) + L"_" + toWideString(rand()); + std::wstring gname = std::to_wstring(ltime) + L"_" + std::to_wstring(rand()); palette->setGlobalName(gname); setStylesGlobalNames(palette.getPointer()); TSystem::touchParentDir(fp); @@ -566,7 +566,7 @@ std::pair StudioPalette::getSourceStyle(TColorStyle *cs) return ret; std::wstring paletteId = gname.substr(1, k - 1); ret.first = getPalettePath(paletteId) - m_root; - ret.second = toInt(gname.substr(k + 1)); + ret.second = std::stoi(gname.substr(k + 1)); return ret; } @@ -602,7 +602,7 @@ bool StudioPalette::updateLinkedColors(TPalette *palette) } else spPalette = it->second.getPointer(); - int j = toInt(gname.substr(k + 1)); + int j = std::stoi(gname.substr(k + 1)); if (spPalette && 0 <= j && j < spPalette->getStyleCount()) { TColorStyle *spStyle = spPalette->getStyle(j); assert(spStyle); @@ -630,7 +630,7 @@ void StudioPalette::setStylesGlobalNames(TPalette *palette) TColorStyle *cs = palette->getStyle(i); // set global name only to the styles of which the global name is empty if (cs->getGlobalName() == L"") { - std::wstring gname = L"-" + palette->getGlobalName() + L"-" + toWideString(i); + std::wstring gname = L"-" + palette->getGlobalName() + L"-" + std::to_wstring(i); cs->setGlobalName(gname); } } @@ -642,7 +642,7 @@ void StudioPalette::save(const TFilePath &path, TPalette *palette) { TOStream os(path); std::map attr; - attr["name"] = toString(palette->getGlobalName()); + attr["name"] = ::to_string(palette->getGlobalName()); os.openChild("palette", attr); palette->saveData(os); os.closeChild(); @@ -663,7 +663,7 @@ TPalette *StudioPalette::load(const TFilePath &path) is.getTagParam("name", gname); TPalette *palette = new TPalette(); palette->loadData(is); - palette->setGlobalName(toWideString(gname)); + palette->setGlobalName(::to_wstring(gname)); is.matchEndTag(); palette->setPaletteName(path.getWideName()); return palette; diff --git a/toonz/sources/toonzlib/studiopalettecmd.cpp b/toonz/sources/toonzlib/studiopalettecmd.cpp index b8c861d..d554623 100644 --- a/toonz/sources/toonzlib/studiopalettecmd.cpp +++ b/toonz/sources/toonzlib/studiopalettecmd.cpp @@ -352,7 +352,7 @@ public: const TImageP &oldImage, const TPaletteP &oldPalette, const TPaletteP &newPalette, int tolerance) : TUndo(), m_currentLevelHandle(currentLevelHandle), m_paletteHandle(paletteHandle), m_fid(fid), m_oldPalette(oldPalette), m_newPalette(newPalette), m_tolerance(tolerance) { - m_oldImageId = "AdjustIntoCurrentPaletteUndo_oldImage_" + toString(m_idCount++); + m_oldImageId = "AdjustIntoCurrentPaletteUndo_oldImage_" + std::to_string(m_idCount++); TImageCache::instance()->add(m_oldImageId, (const TImageP)oldImage); diff --git a/toonz/sources/toonzlib/tcolumnfx.cpp b/toonz/sources/toonzlib/tcolumnfx.cpp index 1b097e5..b9cd847 100644 --- a/toonz/sources/toonzlib/tcolumnfx.cpp +++ b/toonz/sources/toonzlib/tcolumnfx.cpp @@ -482,7 +482,7 @@ TImageP applyCmappedFx(TToonzImageP &ti, const std::vector if (sandorData && sandorData->m_type == BlendTz) { BlendParam param; - param.intensity = toDouble(std::string(sandorData->m_argv[3])) * scale * dpi; + param.intensity = std::stod(std::string(sandorData->m_argv[3])) * scale * dpi; param.smoothness = sandorData->m_blendParams.m_smoothness; param.stopAtCountour = sandorData->m_blendParams.m_noBlending; @@ -574,8 +574,8 @@ TImageP applyCmappedFx(TToonzImageP &ti, const std::vector const char *argv[12]; memcpy(argv, sandorData->m_argv, 12 * sizeof(const char *)); - double thickness = toDouble(std::string(sandorData->m_argv[7])) * scale * dpi; - argv[7] = strsave(toString(thickness).c_str()); + double thickness = std::stod(std::string(sandorData->m_argv[7])) * scale * dpi; + argv[7] = strsave(std::to_string(thickness).c_str()); calligraph(oldRasterIn, oldRasterOut, sandorData->m_border, sandorData->m_argc, argv, sandorData->m_shrink, sandorData->m_type == OutBorder); @@ -586,16 +586,16 @@ TImageP applyCmappedFx(TToonzImageP &ti, const std::vector const char *argv[12]; memcpy(argv, sandorData->m_argv, 12 * sizeof(const char *)); - double distance = toDouble(std::string(sandorData->m_argv[6])) * scale * dpi; - argv[6] = strsave(toString(distance).c_str()); - distance = toDouble(std::string(sandorData->m_argv[7])) * scale * dpi; - argv[7] = strsave(toString(distance).c_str()); - double density = toDouble(std::string(sandorData->m_argv[8])) / sq(scale * dpi); - argv[8] = strsave(toString(density).c_str()); - double size = toDouble(std::string(sandorData->m_argv[1])) * scale * dpi; - argv[1] = strsave(toString(size).c_str()); - size = toDouble(std::string(sandorData->m_argv[2])) * scale * dpi; - argv[2] = strsave(toString(size).c_str()); + double distance = std::stod(std::string(sandorData->m_argv[6])) * scale * dpi; + argv[6] = strsave(std::to_string(distance).c_str()); + distance = std::stod(std::string(sandorData->m_argv[7])) * scale * dpi; + argv[7] = strsave(std::to_string(distance).c_str()); + double density = std::stod(std::string(sandorData->m_argv[8])) / sq(scale * dpi); + argv[8] = strsave(std::to_string(density).c_str()); + double size = std::stod(std::string(sandorData->m_argv[1])) * scale * dpi; + argv[1] = strsave(std::to_string(size).c_str()); + size = std::stod(std::string(sandorData->m_argv[2])) * scale * dpi; + argv[2] = strsave(std::to_string(size).c_str()); RASTER *imgContour = TRop::convertRaster50to46(sandorData->m_controller, 0); patternmap(oldRasterIn, oldRasterOut, sandorData->m_border, sandorData->m_argc, argv, sandorData->m_shrink, imgContour); @@ -1437,7 +1437,7 @@ std::wstring TLevelColumnFx::getColumnId() const { if (!m_levelColumn) return L"Col?"; - return L"Col" + toWideString(m_levelColumn->getIndex() + 1); + return L"Col" + std::to_wstring(m_levelColumn->getIndex() + 1); } //------------------------------------------------------------------- @@ -1447,7 +1447,7 @@ std::wstring TLevelColumnFx::getColumnName() const if (!m_levelColumn) return L""; int idx = getColumnIndex(); - return toWideString(m_levelColumn->getXsheet()->getStageObject(TStageObjectId::ColumnId(idx))->getName()); + return ::to_wstring(m_levelColumn->getXsheet()->getStageObject(TStageObjectId::ColumnId(idx))->getName()); } //------------------------------------------------------------------- @@ -1488,7 +1488,7 @@ std::string TLevelColumnFx::getAlias(double frame, const TRenderSettings &info) if (sl->getType() == PLI_XSHLEVEL || sl->getType() == TZP_XSHLEVEL) { TPalette *palette = cell.getPalette(); if (palette && palette->isAnimated()) - rdata += "animatedPlt" + toString(frame); + rdata += "animatedPlt" + std::to_string(frame); } if (Preferences::instance()->isIgnoreAlphaonColumn1Enabled()) { @@ -1499,7 +1499,7 @@ std::string TLevelColumnFx::getAlias(double frame, const TRenderSettings &info) rdata += "column_0"; } - return getFxType() + "[" + toString(fp.getWideString()) + "," + rdata + "]"; + return getFxType() + "[" + ::to_string(fp.getWideString()) + "," + rdata + "]"; } //------------------------------------------------------------------- @@ -1682,7 +1682,7 @@ std::wstring TPaletteColumnFx::getColumnName() const { if (!m_paletteColumn) return L"Col?"; - return L"Col" + toWideString(m_paletteColumn->getIndex() + 1); + return L"Col" + std::to_wstring(m_paletteColumn->getIndex() + 1); } //------------------------------------------------------------------- @@ -1691,7 +1691,7 @@ std::wstring TPaletteColumnFx::getColumnId() const { if (!m_paletteColumn) return L"Col?"; - return L"Col" + toWideString(m_paletteColumn->getIndex() + 1); + return L"Col" + std::to_wstring(m_paletteColumn->getIndex() + 1); } //------------------------------------------------------------------- @@ -1699,7 +1699,7 @@ std::wstring TPaletteColumnFx::getColumnId() const std::string TPaletteColumnFx::getAlias(double frame, const TRenderSettings &info) const { TFilePath palettePath = getPalettePath(frame); - return "TPaletteColumnFx[" + toString(palettePath.getWideString()) + "]"; + return "TPaletteColumnFx[" + ::to_string(palettePath.getWideString()) + "]"; } //------------------------------------------------------------------- diff --git a/toonz/sources/toonzlib/textureutils.cpp b/toonz/sources/toonzlib/textureutils.cpp index 9a84030..867a0b8 100644 --- a/toonz/sources/toonzlib/textureutils.cpp +++ b/toonz/sources/toonzlib/textureutils.cpp @@ -165,7 +165,7 @@ namespace std::string getImageId(const TXsheet *xsh, int frame) { - return "X" + toString(xsh->id()) + "_" + toString(frame); + return "X" + std::to_string(xsh->id()) + "_" + std::to_string(frame); } } // namespace diff --git a/toonz/sources/toonzlib/toonzimageutils.cpp b/toonz/sources/toonzlib/toonzimageutils.cpp index 544e532..76e32f5 100644 --- a/toonz/sources/toonzlib/toonzimageutils.cpp +++ b/toonz/sources/toonzlib/toonzimageutils.cpp @@ -417,7 +417,7 @@ TToonzImageP ToonzImageUtils::vectorToToonzImage( for (i = 0; i < (int)fxs->size(); i++) { SandorFxRenderData *sandorData = dynamic_cast((*fxs)[i].getPointer()); if (sandorData && sandorData->m_type == BlendTz) { - std::string indexes = toString(sandorData->m_blendParams.m_colorIndex); + std::string indexes = ::to_string(sandorData->m_blendParams.m_colorIndex); std::vector items; parseIndexes(indexes, items); PaletteFilterFxRenderData paletteFilterData; @@ -502,7 +502,7 @@ TPalette *ToonzImageUtils::loadTzPalette(const TFilePath &pltFile) TSolidColorStyle *style = new TSolidColorStyle(pixelRow[x]); if ((it = pltColorNames.find(x)) != pltColorNames.end()) { std::string styleName = it->second.second; - style->setName(toWideString(styleName)); + style->setName(::to_wstring(styleName)); } if (x < count) palette->setStyle(x, style); @@ -525,7 +525,7 @@ TPalette *ToonzImageUtils::loadTzPalette(const TFilePath &pltFile) for (x = 0; x < rasPlt->getLx(); ++x) { if ((it = pltColorNames.find(x)) != pltColorNames.end()) { std::wstring pageName; - pageName = toWideString(it->second.first); + pageName = ::to_wstring(it->second.first); if (x == 0) { page = palette->getPage(0); page->setName(pageName); diff --git a/toonz/sources/toonzlib/toonzscene.cpp b/toonz/sources/toonzlib/toonzscene.cpp index 917006f..cf86ca7 100644 --- a/toonz/sources/toonzlib/toonzscene.cpp +++ b/toonz/sources/toonzlib/toonzscene.cpp @@ -228,9 +228,9 @@ void saveBackup(const TFilePath &fp) { int id = oldBackups.rbegin()->first + 1; if(fp.getType() == "tnz") - bckFp = bckDir + TFilePath(sceneName + L"_" + toWideString(id) + L".tnz"); + bckFp = bckDir + TFilePath(sceneName + L"_" + ::to_wstring(id) + L".tnz"); else if(fp.getType() == "tab") - bckFp = bckDir + TFilePath(sceneName + L"_" + toWideString(id) + L".tab"); + bckFp = bckDir + TFilePath(sceneName + L"_" + ::to_wstring(id) + L".tab"); } TSystem::renameFile(bckFp, fp); @@ -511,8 +511,8 @@ void ToonzScene::loadTnzFile(const TFilePath &fp) VersionNumber versionNumber(0, 0); int k = v.find("."); if (k != (int)std::string::npos && 0 < k && k < (int)v.length()) { - versionNumber.first = toInt(v.substr(0, k)); - versionNumber.second = toInt(v.substr(k + 1)); + versionNumber.first = std::stoi(v.substr(0, k)); + versionNumber.second = std::stoi(v.substr(k + 1)); } if (versionNumber == VersionNumber(0, 0)) throw TException("Bad version number :" + v); @@ -607,7 +607,7 @@ void ToonzScene::setUntitled() if (TFileStatus(tempDir + name).doesExist()) { int count = 2; do { - name = baseName + toString(count++); + name = baseName + std::to_string(count++); } while (TFileStatus(tempDir + name).doesExist()); } TFilePath fp = tempDir + name + (name + ".tnz"); @@ -1048,7 +1048,7 @@ TFilePath ToonzScene::getImportedLevelPath(const TFilePath path) const &dots = path.getDots(); TFilePath importedLevelPath = - getDefaultLevelPath(ltype.m_ltype, levelName).getParentDir() + (levelName + toWideString(dots + ext)); + getDefaultLevelPath(ltype.m_ltype, levelName).getParentDir() + (levelName + ::to_wstring(dots + ext)); if (dots == "..") importedLevelPath = importedLevelPath.withFrame(TFrameId::EMPTY_FRAME); @@ -1271,7 +1271,7 @@ TFilePath ToonzScene::decodeFilePath(const TFilePath &path) const return dir + tail; } if (project) { - h = toString(head.substr(1)); + h = ::to_string(head.substr(1)); TFilePath f = project->getFolder(h); if (f != TFilePath()) s = f.getWideString(); @@ -1412,7 +1412,7 @@ TFilePath ToonzScene::codeSavePath(TFilePath path) const head == TFilePath() || head.getWideString()[0] != L'+') return originalPath; - std::string folderName = toString(head.getWideString().substr(1)); + std::string folderName = ::to_string(head.getWideString().substr(1)); if (!getProject()->getUseScenePath(folderName)) return originalPath; return head + savePathString + filename; diff --git a/toonz/sources/toonzlib/tproject.cpp b/toonz/sources/toonzlib/tproject.cpp index c2366f3..bd3baf4 100644 --- a/toonz/sources/toonzlib/tproject.cpp +++ b/toonz/sources/toonzlib/tproject.cpp @@ -505,7 +505,7 @@ wstring TProject::getFolderNameFromPath(const TFilePath &folderDir) if (index < 0) return L""; if (getFolder(index).isAbsolute()) - return toWideString("+" + getFolderName(index)); + return ::to_wstring("+" + getFolderName(index)); else return folderDir.getWideName(); } @@ -562,7 +562,7 @@ bool TProject::save(const TFilePath &projectPath) std::map attr; string folderName = getFolderName(i); attr["name"] = folderName; - attr["path"] = toString(folderRelativePath); // escape() + attr["path"] = ::to_string(folderRelativePath); // escape() if (getUseScenePath(folderName)) attr["useScenePath"] = "yes"; os.openCloseChild("folder", attr); @@ -947,7 +947,7 @@ void TProjectManager::getFolderNames(std::vector &names) void TProjectManager::setCurrentProjectPath(const TFilePath &fp) { assert(TProject::isAProjectPath(fp)); - currentProjectPath = toString(fp.getWideString()); + currentProjectPath = ::to_string(fp.getWideString()); currentProject = TProjectP(); notifyListeners(); } @@ -971,7 +971,7 @@ TFilePath TProjectManager::getCurrentProjectPath() if (!TFileStatus(fp).doesExist()) fp = projectNameToProjectPath(TProject::SandboxProjectName); fp = getLatestVersionProjectPath(fp); - string s = toString(fp); + string s = ::to_string(fp); if (s != (string)currentProjectPath) currentProjectPath = s; return fp; diff --git a/toonz/sources/toonzlib/trasterimageutils.cpp b/toonz/sources/toonzlib/trasterimageutils.cpp index 4d9b820..05d4e15 100644 --- a/toonz/sources/toonzlib/trasterimageutils.cpp +++ b/toonz/sources/toonzlib/trasterimageutils.cpp @@ -276,7 +276,7 @@ TRasterImageP TRasterImageUtils::vectorToFullColorImage( for (i = 0; i < (int)fxs->size(); i++) { SandorFxRenderData *sandorData = dynamic_cast((*fxs)[i].getPointer()); if (sandorData && sandorData->m_type == BlendTz) { - std::string indexes = toString(sandorData->m_blendParams.m_colorIndex); + std::string indexes = ::to_string(sandorData->m_blendParams.m_colorIndex); std::vector items; parseIndexes(indexes, items); PaletteFilterFxRenderData paletteFilterData; diff --git a/toonz/sources/toonzlib/tstageobject.cpp b/toonz/sources/toonzlib/tstageobject.cpp index 1c1fc84..6766b15 100644 --- a/toonz/sources/toonzlib/tstageobject.cpp +++ b/toonz/sources/toonzlib/tstageobject.cpp @@ -119,15 +119,15 @@ TStageObjectId toStageObjectId(string s) return TStageObjectId::TableId; else if (isInt(s)) { TStageObjectId id; - id.setCode(toInt(s)); + id.setCode(std::stoi(s)); return id; } else if (s.length() > 3) { if (s.substr(0, 3) == "Col") - return TStageObjectId::ColumnId(toInt(s.substr(3)) - 1); + return TStageObjectId::ColumnId(std::stoi(s.substr(3)) - 1); else if (s.substr(0, 3) == "Peg") - return TStageObjectId::PegbarId(toInt(s.substr(3)) - 1); + return TStageObjectId::PegbarId(std::stoi(s.substr(3)) - 1); else if (s.length() > 6 && s.substr(0, 6) == "Camera") - return TStageObjectId::CameraId(toInt(s.substr(6)) - 1); + return TStageObjectId::CameraId(std::stoi(s.substr(6)) - 1); } return TStageObjectId::NoneId; } @@ -208,16 +208,16 @@ string TStageObjectId::toString() const shortName = "None"; break; case CAMERA: - shortName = "Camera" + ::toString(index + 1); + shortName = "Camera" + std::to_string(index + 1); break; case TABLE: shortName = "Table"; break; case PEGBAR: - shortName = "Peg" + ::toString(index + 1); + shortName = "Peg" + std::to_string(index + 1); break; case COLUMN: - shortName = "Col" + ::toString(index + 1); + shortName = "Col" + std::to_string(index + 1); break; default: shortName = "BadPegbar"; @@ -553,8 +553,7 @@ string TStageObject::getName() const return m_name; if (!m_id.isColumn()) return m_id.toString(); - wstring s = L"Col" + toWideString(m_id.getIndex() + 1); - return toString(s); + return "Col" + std::to_string(m_id.getIndex() + 1); } //----------------------------------------------------------------------------- @@ -568,7 +567,7 @@ string TStageObject::getFullName() const name.find_first_not_of("0123456789", 3) == string::npos) return name; else - return name + " (" + toString(m_id.getIndex() + 1) + ")"; + return name + " (" + std::to_string(m_id.getIndex() + 1) + ")"; } else return name; } diff --git a/toonz/sources/toonzlib/tstageobjectcmd.cpp b/toonz/sources/toonzlib/tstageobjectcmd.cpp index ea94ec3..5babfe2 100644 --- a/toonz/sources/toonzlib/tstageobjectcmd.cpp +++ b/toonz/sources/toonzlib/tstageobjectcmd.cpp @@ -679,7 +679,7 @@ public: TStageObject *obj = pegTree->getStageObject(m_ids[i], false); if (obj) { obj->setGroupId(m_groupId, m_positions[i]); - obj->setGroupName(L"Group " + toWideString(m_groupId), m_positions[i]); + obj->setGroupName(L"Group " + std::to_wstring(m_groupId), m_positions[i]); } } m_xshHandle->notifyXsheetChanged(); @@ -1690,7 +1690,7 @@ void TStageObjectCmd::group(const QList ids, TXsheetHandle *xshH TStageObject *obj = pegTree->getStageObject(ids[i], false); if (obj) { int position = obj->setGroupId(groupId); - obj->setGroupName(L"Group " + toWideString(groupId)); + obj->setGroupName(L"Group " + std::to_wstring(groupId)); positions.append(position); } } diff --git a/toonz/sources/toonzlib/tstageobjectspline.cpp b/toonz/sources/toonzlib/tstageobjectspline.cpp index f60dcea..103a0dc 100644 --- a/toonz/sources/toonzlib/tstageobjectspline.cpp +++ b/toonz/sources/toonzlib/tstageobjectspline.cpp @@ -112,7 +112,7 @@ void PosPathKeyframesUpdater::update(double &s) // TStageObjectSpline TStageObjectSpline::TStageObjectSpline() - : TSmartObject(m_classCode), m_stroke(0), m_dagNodePos(TConst::nowhere), m_id(-1), m_idBase(toString(idBaseCode++)), m_name(""), m_isOpened(false) + : TSmartObject(m_classCode), m_stroke(0), m_dagNodePos(TConst::nowhere), m_id(-1), m_idBase(std::to_string(idBaseCode++)), m_name(""), m_isOpened(false) { double d = 30; std::vector points; @@ -256,7 +256,7 @@ int TStageObjectSpline::getId() const std::string TStageObjectSpline::getName() const { if (m_name == "") - return "Path" + toString(m_id + 1); + return "Path" + std::to_string(m_id + 1); return m_name; } diff --git a/toonz/sources/toonzlib/txshchildlevel.cpp b/toonz/sources/toonzlib/txshchildlevel.cpp index fb534b2..3d84a16 100644 --- a/toonz/sources/toonzlib/txshchildlevel.cpp +++ b/toonz/sources/toonzlib/txshchildlevel.cpp @@ -25,8 +25,6 @@ TXshChildLevel::TXshChildLevel(std::wstring name) { m_xsheet->addRef(); m_type = CHILD_XSHLEVEL; - //static int count = 0; - //m_name = L"sub" + toWideString(++count); } //----------------------------------------------------------------------------- diff --git a/toonz/sources/toonzlib/txsheet.cpp b/toonz/sources/toonzlib/txsheet.cpp index 9ba8311..6ee3ed4 100644 --- a/toonz/sources/toonzlib/txsheet.cpp +++ b/toonz/sources/toonzlib/txsheet.cpp @@ -58,14 +58,14 @@ string getColumnDefaultName(TXsheet *xsh, int col, QString oldName) bool isNumber = true; oldName.right(oldName.size() - 3).toInt(&isNumber); if (oldName.left(3) == "Col" && isNumber) - return toString(level->getName()); + return ::to_string(level->getName()); else return ""; } } } } - return "Col" + toString(col + 1); + return "Col" + std::to_string(col + 1); } //----------------------------------------------------------------------------- diff --git a/toonz/sources/toonzlib/txsheetexpr.cpp b/toonz/sources/toonzlib/txsheetexpr.cpp index 55eb9aa..6bf59f0 100644 --- a/toonz/sources/toonzlib/txsheetexpr.cpp +++ b/toonz/sources/toonzlib/txsheetexpr.cpp @@ -309,14 +309,14 @@ public: TFx *getFx(const Token &token) const { - return m_xsh->getFxDag()->getFxById(toWideString(toLower(token.getText()))); + return m_xsh->getFxDag()->getFxById(::to_wstring(toLower(token.getText()))); } TParam *getParam(const TFx *fx, const Token &token) const { int i; for (i = 0; i < fx->getParams()->getParamCount(); i++) { TParam *param = fx->getParams()->getParam(i); - std::string paramName = toString(TStringTable::translate(fx->getFxType() + "." + param->getName())); + std::string paramName = ::to_string(TStringTable::translate(fx->getFxType() + "." + param->getName())); int i = paramName.find(" "); while (i != std::string::npos) { paramName.erase(i, 1); diff --git a/toonz/sources/toonzlib/txshsimplelevel.cpp b/toonz/sources/toonzlib/txshsimplelevel.cpp index 3be22b3..55a7404 100644 --- a/toonz/sources/toonzlib/txshsimplelevel.cpp +++ b/toonz/sources/toonzlib/txshsimplelevel.cpp @@ -191,7 +191,7 @@ bool TXshSimpleLevel::m_fillFullColorRaster = false; //----------------------------------------------------------------------------- TXshSimpleLevel::TXshSimpleLevel(const std::wstring &name) - : TXshLevel(m_classCode, name), m_properties(new LevelProperties), m_palette(0), m_idBase(toString(idBaseCode++)), m_editableRangeUserInfo(L""), m_isSubsequence(false), m_16BitChannelLevel(false), m_isReadOnly(false), m_temporaryHookMerged(false) + : TXshLevel(m_classCode, name), m_properties(new LevelProperties), m_palette(0), m_idBase(std::to_string(idBaseCode++)), m_editableRangeUserInfo(L""), m_isSubsequence(false), m_16BitChannelLevel(false), m_isReadOnly(false), m_temporaryHookMerged(false) { } @@ -301,7 +301,7 @@ std::wstring TXshSimpleLevel::getEditableFileName() getIndexesRangefromFids(this, m_editableRange, from, to); if (from == -1 && to == -1) return L""; - fileName += L"_" + toWideString(from + 1) + L"-" + toWideString(to + 1); + fileName += L"_" + std::to_wstring(from + 1) + L"-" + std::to_wstring(to + 1); return fileName; } @@ -741,7 +741,7 @@ std::string TXshSimpleLevel::getIconId(const TFrameId &fid, int frameStatus) con std::string TXshSimpleLevel::getIconId(const TFrameId &fid, const TDimension &size) const { - return getImageId(fid) + ":" + toString(size.lx) + "x" + toString(size.ly); + return getImageId(fid) + ":" + std::to_string(size.lx) + "x" + std::to_string(size.ly); } //----------------------------------------------------------------------------- @@ -967,9 +967,9 @@ void TXshSimpleLevel::loadData(TIStream &is) int antialiasSoftness = 0; LevelProperties::DpiPolicy dpiPolicy = LevelProperties::DP_ImageDpi; if (is.getTagParam("dpix", v)) - xdpi = toDouble(v); + xdpi = std::stod(v); if (is.getTagParam("dpiy", v)) - ydpi = toDouble(v); + ydpi = std::stod(v); if (xdpi != 0 && ydpi != 0) dpiPolicy = LevelProperties::DP_CustomDpi; std::string dpiType = is.getTagAttribute("dpiType"); @@ -978,13 +978,13 @@ void TXshSimpleLevel::loadData(TIStream &is) if (is.getTagParam("type", v) && v == "s") type = TZI_XSHLEVEL; if (is.getTagParam("subsampling", v)) - subsampling = toInt(v); + subsampling = std::stoi(v); if (is.getTagParam("premultiply", v)) - doPremultiply = toInt(v); + doPremultiply = std::stoi(v); if (is.getTagParam("antialias", v)) - antialiasSoftness = toInt(v); + antialiasSoftness = std::stoi(v); if (is.getTagParam("whiteTransp", v)) - whiteTransp = toInt(v); + whiteTransp = std::stoi(v); m_properties->setDpiPolicy(dpiPolicy); m_properties->setDpi(TPointD(xdpi, ydpi)); @@ -1013,7 +1013,7 @@ void TXshSimpleLevel::loadData(TIStream &is) type = OVL_XSHLEVEL; m_properties->setDpi(TPointD(xdpi, ydpi)); setType(type); - setPath(TFilePath("+drawings/") + (getName() + L"." + toWideString("bmp")), true); + setPath(TFilePath("+drawings/") + (getName() + L"." + ::to_wstring("bmp")), true); } else if (token == L"__raster") // obsoleto (Tab2.2) { double xdpi = 1, ydpi = 1; @@ -1023,7 +1023,7 @@ void TXshSimpleLevel::loadData(TIStream &is) type = OVL_XSHLEVEL; m_properties->setDpi(TPointD(xdpi, ydpi)); setType(type); - setPath(TFilePath("+drawings/") + (getName() + L"." + toWideString(extension)), true); + setPath(TFilePath("+drawings/") + (getName() + L"." + ::to_wstring(extension)), true); } else { m_name = token; setName(m_name); @@ -1377,23 +1377,23 @@ void TXshSimpleLevel::saveData(TOStream &os) if (getProperties()->getDpiPolicy() == LevelProperties::DP_CustomDpi) { TPointD dpi = getProperties()->getDpi(); if (dpi.x != 0 && dpi.y != 0) { - attr["dpix"] = toString(dpi.x); - attr["dpiy"] = toString(dpi.y); + attr["dpix"] = std::to_string(dpi.x); + attr["dpiy"] = std::to_string(dpi.y); } } else { attr["dpiType"] = "image"; } if (getProperties()->getSubsampling() != 1) { - attr["subsampling"] = toString(getProperties()->getSubsampling()); + attr["subsampling"] = std::to_string(getProperties()->getSubsampling()); } if (getProperties()->antialiasSoftness() > 0) { - attr["antialias"] = toString(getProperties()->antialiasSoftness()); + attr["antialias"] = std::to_string(getProperties()->antialiasSoftness()); } if (getProperties()->doPremultiply()) { - attr["premultiply"] = toString(getProperties()->doPremultiply()); + attr["premultiply"] = std::to_string(getProperties()->doPremultiply()); } else if (getProperties()->whiteTransp()) { - attr["whiteTransp"] = toString(getProperties()->whiteTransp()); + attr["whiteTransp"] = std::to_string(getProperties()->whiteTransp()); } if (m_type == TZI_XSHLEVEL) @@ -1412,7 +1412,7 @@ void TXshSimpleLevel::save() { assert(getScene()); TFilePath path = getScene()->decodeFilePath(m_path); - TSystem::outputDebug("save() : " + toString(m_path) + " = " + toString(path) + "\n"); + TSystem::outputDebug("save() : " + ::to_string(m_path) + " = " + ::to_string(path) + "\n"); if (getProperties()->getDirtyFlag() == false && getPalette()->getDirtyFlag() == false && @@ -2028,20 +2028,20 @@ void TXshSimpleLevel::renumber(const std::vector &fids) { for (i = 0, jt = table.begin(); jt != table.end(); ++jt, ++i) - im->rebind(getImageId(jt->first), "^" + toString(i)); + im->rebind(getImageId(jt->first), "^" + std::to_string(i)); for (i = 0, jt = table.begin(); jt != table.end(); ++jt, ++i) - im->rebind("^" + toString(i), getImageId(jt->second)); + im->rebind("^" + std::to_string(i), getImageId(jt->second)); } if (getType() == PLI_XSHLEVEL) { for (i = 0, jt = table.begin(); jt != table.end(); ++jt, ++i) { const std::string &id = rasterized(getImageId(jt->first)); if (im->isBound(id)) - im->rebind(id, rasterized("^" + toString(i))); + im->rebind(id, rasterized("^" + std::to_string(i))); } for (i = 0, jt = table.begin(); jt != table.end(); ++jt, ++i) { - const std::string &id = rasterized("^" + toString(i)); + const std::string &id = rasterized("^" + std::to_string(i)); if (im->isBound(id)) im->rebind(id, rasterized(getImageId(jt->second))); } @@ -2051,10 +2051,10 @@ void TXshSimpleLevel::renumber(const std::vector &fids) for (i = 0, jt = table.begin(); jt != table.end(); ++jt, ++i) { const std::string &id = filled(getImageId(jt->first)); if (im->isBound(id)) - im->rebind(id, filled("^" + toString(i))); + im->rebind(id, filled("^" + std::to_string(i))); } for (i = 0, jt = table.begin(); jt != table.end(); ++jt, ++i) { - const std::string &id = filled("^" + toString(i)); + const std::string &id = filled("^" + std::to_string(i)); if (im->isBound(id)) im->rebind(id, filled(getImageId(jt->second))); } diff --git a/toonz/sources/toonzqt/addfxcontextmenu.cpp b/toonz/sources/toonzqt/addfxcontextmenu.cpp index ec7d038..3ac9c24 100644 --- a/toonz/sources/toonzqt/addfxcontextmenu.cpp +++ b/toonz/sources/toonzqt/addfxcontextmenu.cpp @@ -112,28 +112,6 @@ TFx *createMacroFxByPath(TFilePath path, TXsheet *xsheet) } } } - /* QStack > newPortNames; - - //Devo cambiare il nome alle porte: contengono l'id dei vecchi effetti - for(i=fx->getInputPortCount()-1; i>=0; i--) - { - string oldPortName = fx->getInputPortName(i); - string inFxOldId = oldPortName; - inFxOldId.erase(0,inFxOldId.find_last_of("_")+1); - assert(oldNewId.contains(toWideString(inFxOldId))); - string inFxNewId = toString(oldNewId[toWideString(inFxOldId)]); - string newPortName = oldPortName; - newPortName.erase(newPortName.find_last_of("_")+1,newPortName.size()-1); - newPortName.append(inFxNewId); - TFxPort* fxPort = fx->getInputPort(i); - newPortNames.append(QPair(newPortName,fxPort)); - fx->removeInputPort(oldPortName); - } - while(!newPortNames.isEmpty()) - { - QPair newPort = newPortNames.pop(); - fx->addInputPort(newPort.first,*newPort.second); - }*/ return fx; } catch (...) { diff --git a/toonz/sources/toonzqt/colorfield.cpp b/toonz/sources/toonzqt/colorfield.cpp index 4ebd8e4..f0fa64e 100644 --- a/toonz/sources/toonzqt/colorfield.cpp +++ b/toonz/sources/toonzqt/colorfield.cpp @@ -271,7 +271,7 @@ void ChannelField::onSliderChanged(int value) assert(0 <= value && value <= m_maxValue); if (m_channelEdit->getValue() == value) return; - m_channelEdit->setText(QString(toString(value).c_str())); + m_channelEdit->setText(QString(std::to_string(value).c_str())); emit valueChanged(value, true); } diff --git a/toonz/sources/toonzqt/functionsegmentviewer.cpp b/toonz/sources/toonzqt/functionsegmentviewer.cpp index c6908ac..6d8d731 100644 --- a/toonz/sources/toonzqt/functionsegmentviewer.cpp +++ b/toonz/sources/toonzqt/functionsegmentviewer.cpp @@ -540,7 +540,7 @@ void FunctionExpressionSegmentPage::refresh() m_expressionFld->setExpression(expression); m_expressionFld->blockSignals(oldBlockSignalsStatus); - std::wstring unitName = toWideString(kf0.m_unitName); + std::wstring unitName = ::to_wstring(kf0.m_unitName); if (unitName == L"" && curve->getMeasure()) unitName = curve->getMeasure()->getCurrentUnit()->getDefaultExtension(); @@ -737,7 +737,7 @@ public: if (measure) { const TUnit *unit = measure->getCurrentUnit(); if (unit) - unitName = toString(unit->getDefaultExtension()); + unitName = ::to_string(unit->getDefaultExtension()); } } } @@ -758,7 +758,7 @@ public: if (measure) { const TUnit *unit = measure->getCurrentUnit(); if (unit) - unitName = toString(unit->getDefaultExtension()); + unitName = ::to_string(unit->getDefaultExtension()); } m_measureFld->setText(QString::fromStdString(unitName)); diff --git a/toonz/sources/toonzqt/fxhistogramrender.cpp b/toonz/sources/toonzqt/fxhistogramrender.cpp index 1cba931..04bdb79 100644 --- a/toonz/sources/toonzqt/fxhistogramrender.cpp +++ b/toonz/sources/toonzqt/fxhistogramrender.cpp @@ -110,7 +110,7 @@ void FxHistogramRender::computeHistogram(TFxP fx, int frame) if (!rasterFx) return; std::string alias = rasterFx->getAlias(frame, rs); - if (!TImageCache::instance()->isCached(alias + ".noext" + toString(frame))) { + if (!TImageCache::instance()->isCached(alias + ".noext" + std::to_string(frame))) { TDimension size = m_scene->getCurrentCamera()->getRes(); TRectD area(TPointD(-0.5 * size.lx, -0.5 * size.ly), TDimensionD(size.lx, size.ly)); m_renderPort->setRenderArea(area); @@ -124,7 +124,7 @@ void FxHistogramRender::computeHistogram(TFxP fx, int frame) m_lastFrameInfo.m_fx = fx; m_lastFrameInfo.m_fxAlias = alias; } else { - std::string id = toString(fx->getIdentifier()) + ".noext" + toString(frame); + std::string id = std::to_string(fx->getIdentifier()) + ".noext" + std::to_string(frame); TRasterImageP img = TImageCache::instance()->get(id, false); m_histograms->setRaster(img->getRaster()); } @@ -157,7 +157,7 @@ void FxHistogramRender::updateRenderer(int frame) int i; for (i = 0; i < m_scene->getFrameCount(); i++) { - std::string id = toString(m_lastFrameInfo.m_fx->getIdentifier()) + ".noext" + toString(i); + std::string id = std::to_string(m_lastFrameInfo.m_fx->getIdentifier()) + ".noext" + std::to_string(i); TImageCache::instance()->remove(id); } m_lastFrameInfo.m_frame = frame; @@ -203,7 +203,7 @@ void FxHistogramRender::onRenderCompleted(const TRasterP &raster, UINT renderId) QMutexLocker sl(&m_mutex); TRasterImageP img(raster); - std::string id = toString(m_lastFrameInfo.m_fx->getIdentifier()) + ".noext" + toString(m_lastFrameInfo.m_frame); + std::string id = std::to_string(m_lastFrameInfo.m_fx->getIdentifier()) + ".noext" + std::to_string(m_lastFrameInfo.m_frame); TImageCache::instance()->add(id, img, true); m_histograms->setRaster(raster); diff --git a/toonz/sources/toonzqt/fxsettings.cpp b/toonz/sources/toonzqt/fxsettings.cpp index 856c817..67e6563 100644 --- a/toonz/sources/toonzqt/fxsettings.cpp +++ b/toonz/sources/toonzqt/fxsettings.cpp @@ -875,9 +875,7 @@ void ParamsPageSet::createControls(const TFxP &fx, int index) while (!is.matchEndTag()) createPage(is, fx, index); - } catch (TException &) { - // TMessage::error("Error loading %1:%2, %3", - // fp, toString(is.getLine()), e.getMessage()); + } catch (TException const&) { } } // else createEmptyPage(); diff --git a/toonz/sources/toonzqt/icongenerator.cpp b/toonz/sources/toonzqt/icongenerator.cpp index d574586..797c493 100644 --- a/toonz/sources/toonzqt/icongenerator.cpp +++ b/toonz/sources/toonzqt/icongenerator.cpp @@ -919,7 +919,7 @@ public: static std::string getId(TXshChildLevel *level, int row) { - return "sub:" + toString(level->getName()) + toString(row); + return "sub:" + ::to_string(level->getName()) + std::to_string(row); } TRaster32P generateRaster(const TDimension &iconSize) const; @@ -991,7 +991,7 @@ std::string FileIconRenderer::getId(const TFilePath &path, const TFrameId &fid) std::string fidNumber; if (fid != TFrameId::NO_FRAME) fidNumber = "frame:" + fid.expand(TFrameId::NO_PAD); - return "$:" + toString(path) + fidNumber; + return "$:" + ::to_string(path) + fidNumber; } //All the other types whose icon is the same for file type, get the same id per type. diff --git a/toonz/sources/toonzqt/imageutils.cpp b/toonz/sources/toonzqt/imageutils.cpp index 08ae11e..6422877 100644 --- a/toonz/sources/toonzqt/imageutils.cpp +++ b/toonz/sources/toonzqt/imageutils.cpp @@ -147,7 +147,7 @@ TFilePath duplicate(const TFilePath &levelPath) return TFilePath(); } - NameBuilder *nameBuilder = NameBuilder::getBuilder(toWideString(levelPath.getName())); + NameBuilder *nameBuilder = NameBuilder::getBuilder(::to_wstring(levelPath.getName())); std::wstring levelNameOut; do levelNameOut = nameBuilder->getNext(); @@ -610,10 +610,8 @@ void convert(const TFilePath &source, const TFilePath &dest, res.ly = info->m_ly; std::string codecName = prop->getProperty(0)->getValueAsString(); - if (!AviCodecRestrictions::canWriteMovie(toWideString(codecName), res)) { + if (!AviCodecRestrictions::canWriteMovie(::to_wstring(codecName), res)) { return; - //QString msg=QObject::tr("The image resolution does not fit the chosen output file format."); - //DVGui::MsgBox(DVGui::WARNING,msg); } } #endif diff --git a/toonz/sources/toonzqt/stageschematicnode.cpp b/toonz/sources/toonzqt/stageschematicnode.cpp index 105715d..38837d2 100644 --- a/toonz/sources/toonzqt/stageschematicnode.cpp +++ b/toonz/sources/toonzqt/stageschematicnode.cpp @@ -1218,7 +1218,7 @@ void StageSchematicNodeDock::onModifyHandle(int increase) int index; if (handle[0] == 'H' && handle.length()>1) - index = -(toInt(handle.substr(1))); + index = -(std::stoi(handle.substr(1))); else index = handle[0] - 'A'; index += -increase;//==1 ? -1 : 1; @@ -1227,7 +1227,7 @@ void StageSchematicNodeDock::onModifyHandle(int increase) index = tcrop(index, min, 25); if (index >= 0) handle = std::string(1, (char)('A' + index)); - else handle = "H" + toString(-index); + else handle = "H" + std::to_string(-index); if (m_isParentPort) TStageObjectCmd::setHandle(getNode()->getStageObject()->getId(), handle, stageScene->getXsheetHandle()); diff --git a/toonz/sources/toonzqt/studiopaletteviewer.cpp b/toonz/sources/toonzqt/studiopaletteviewer.cpp index fe134c0..3af8842 100644 --- a/toonz/sources/toonzqt/studiopaletteviewer.cpp +++ b/toonz/sources/toonzqt/studiopaletteviewer.cpp @@ -451,11 +451,11 @@ void StudioPaletteTreeViewer::onItemChanged(QTreeWidgetItem *item, int column) TFilePath oldPath = getCurrentFolderPath(); if (oldPath.isEmpty() || name.empty() || oldPath.getWideName() == name) return; - TFilePath newPath(oldPath.getParentDir() + TFilePath(name + toWideString(oldPath.getDottedType()))); + TFilePath newPath(oldPath.getParentDir() + TFilePath(name + ::to_wstring(oldPath.getDottedType()))); try { StudioPaletteCmd::movePalette(newPath, oldPath); } catch (TException &e) { - error(QString(toString(e.getMessage()).c_str())); + error(QString(::to_string(e.getMessage()).c_str())); item->setText(column, QString::fromStdWString(oldPath.getWideName())); } catch (...) { error("Can't rename file"); @@ -514,7 +514,7 @@ void StudioPaletteTreeViewer::addNewPalette() try { newPath = StudioPaletteCmd::createPalette(getCurrentFolderPath(), "", 0); } catch (TException &e) { - error("Can't create palette: " + QString(toString(e.getMessage()).c_str())); + error("Can't create palette: " + QString(::to_string(e.getMessage()).c_str())); } catch (...) { error("Can't create palette"); } @@ -534,7 +534,7 @@ void StudioPaletteTreeViewer::addNewFolder() try { newPath = StudioPaletteCmd::addFolder(getCurrentFolderPath()); } catch (TException &e) { - error("Can't create palette folder: " + QString(toString(e.getMessage()).c_str())); + error("Can't create palette folder: " + QString(::to_string(e.getMessage()).c_str())); } catch (...) { error("Can't create palette folder"); } @@ -571,7 +571,7 @@ void StudioPaletteTreeViewer::convertToStudioPalette() // apply global name time_t ltime; time(<ime); - wstring gname = toWideString((int)ltime) + L"_" + toWideString(rand()); + wstring gname = std::to_wstring(ltime) + L"_" + std::to_wstring(rand()); m_currentPalette->setGlobalName(gname); studioPalette->setStylesGlobalNames(m_currentPalette.getPointer()); studioPalette->save(path, m_currentPalette.getPointer()); @@ -605,7 +605,7 @@ void StudioPaletteTreeViewer::deleteItem(QTreeWidgetItem *item) try { StudioPaletteCmd::deleteFolder(path); } catch (TException &e) { - error("Can't delete folder: " + QString(toString(e.getMessage()).c_str())); + error("Can't delete folder: " + QString(::to_string(e.getMessage()).c_str())); } catch (...) { error("Can't delete folder"); } @@ -614,7 +614,7 @@ void StudioPaletteTreeViewer::deleteItem(QTreeWidgetItem *item) try { StudioPaletteCmd::deletePalette(path); } catch (TException &e) { - error("Can't delete palette: " + QString(toString(e.getMessage()).c_str())); + error("Can't delete palette: " + QString(::to_string(e.getMessage()).c_str())); } catch (...) { error("Can't delete palette"); } @@ -1079,9 +1079,9 @@ void StudioPaletteTreeViewer::dropEvent(QDropEvent *event) return; try { - StudioPaletteCmd::createPalette(newPath, toString(palette->getPaletteName()), palette); + StudioPaletteCmd::createPalette(newPath, ::to_string(palette->getPaletteName()), palette); } catch (TException &e) { - error("Can't create palette: " + QString(toString(e.getMessage()).c_str())); + error("Can't create palette: " + QString(::to_string(e.getMessage()).c_str())); } catch (...) { error("Can't create palette"); } @@ -1104,11 +1104,11 @@ void StudioPaletteTreeViewer::dropEvent(QDropEvent *event) continue; if (isInStudioPalette(path)) { - TFilePath newPalettePath = newPath + TFilePath(path.getWideName() + toWideString(path.getDottedType())); + TFilePath newPalettePath = newPath + TFilePath(path.getWideName() + ::to_wstring(path.getDottedType())); try { StudioPaletteCmd::movePalette(newPalettePath, path); } catch (TException &e) { - error("Can't rename palette: " + QString(toString(e.getMessage()).c_str())); + error("Can't rename palette: " + QString(::to_string(e.getMessage()).c_str())); } catch (...) { error("Can't rename palette"); } diff --git a/toonz/sources/toonzqt/styleeditor.cpp b/toonz/sources/toonzqt/styleeditor.cpp index 731fbae..2af3465 100644 --- a/toonz/sources/toonzqt/styleeditor.cpp +++ b/toonz/sources/toonzqt/styleeditor.cpp @@ -3158,7 +3158,7 @@ void StyleEditor::onStyleSwitched() setEditedStyleToStyle(palette->getStyle(styleIndex)); bool isStyleNull = setStyle(m_editedStyle.getPointer()); - bool isColorInField = palette->getPaletteName() == toWideString("EmptyColorFieldPalette"); + bool isColorInField = palette->getPaletteName() == L"EmptyColorFieldPalette"; bool isValidIndex = styleIndex > 0 || isColorInField; bool isCleanUpPalette = palette->isCleanupPalette(); @@ -3245,7 +3245,7 @@ void StyleEditor::copyEditedStyleToPalette(bool isDragging) if (!isDragging) { if (!(*m_oldStyle == *m_editedStyle)) { //do not register undo if the edited color is special one (e.g. changing the ColorField in the fx settings) - if (palette->getPaletteName() != toWideString("EmptyColorFieldPalette")) + if (palette->getPaletteName() != L"EmptyColorFieldPalette") TUndoManager::manager()->add(new UndoPaletteChange( m_paletteHandle, styleIndex, *m_oldStyle, *m_editedStyle)); } diff --git a/toonz/sources/toonzqt/styleselection.cpp b/toonz/sources/toonzqt/styleselection.cpp index 5e3f593..e05955d 100644 --- a/toonz/sources/toonzqt/styleselection.cpp +++ b/toonz/sources/toonzqt/styleselection.cpp @@ -122,7 +122,7 @@ bool pasteStylesDataWithoutUndo(TPalette *palette, TPaletteHandle *pltHandle, co } // 2. If pasting normal style to studio palette, add a new link and make it linkable else { - std::wstring gname = L"-" + palette->getGlobalName() + L"-" + toWideString(styleId); + std::wstring gname = L"-" + palette->getGlobalName() + L"-" + std::to_wstring(styleId); style->setGlobalName(gname); } } @@ -1874,7 +1874,7 @@ void TStyleSelection::getBackOriginalStyle() spPalette = palIt->second.getPointer(); //j is StudioPaletteID - int j = toInt(gname.substr(k + 1)); + int j = std::stoi(gname.substr(k + 1)); if (spPalette && 0 <= j && j < spPalette->getStyleCount()) { TColorStyle *spStyle = spPalette->getStyle(j);