CStdString CIMDocInfo::AsDocIDPath() { LOG_WS_FUNCTION_SCOPE(); CStdString sRes(_T("")); sRes.Format(_T("%s/%d/%d"), m_sDatabaseName.c_str(), m_lDocNum, m_lVerNum); return sRes; }
CStdString CIMDocInfo::TempFileName() { LOG_WS_FUNCTION_SCOPE(); CStdString sRes(_T("")); CStdString sTempPath = CGeneral::GetTemporaryPath(); sRes.Format(_T("%s%s_%s_%d_%d.%s"), sTempPath.c_str(), m_sServerName.c_str(), m_sDatabaseName.c_str(), m_lDocNum, m_lVerNum, m_sExtension.c_str()); return sRes; }
std::string WsModulesLoader::checkPath(const std::string& path) { std::string sRes(path); for (int iModule = 0; iModule < modules().size(); ++iModule) { WsModule* curModule = modules()[iModule]->module; sRes = curModule->checkPath(path); if ( sRes != path ) break; } return sRes; }
////////////////////////////////////////////////////////////////////// // Converts an integer into a part of the key, as of now it is a //simple conversion from integer to string ////////////////////////////////////////////////////////////////////// string MemoizationLevel::intToKey(int i) { char *c; unsigned int ui=i; c=(char *)&ui; string sRes(c); return sRes; }
static std::string codepage_issue_fixToOEM(const std::wstring& sVal) { #if defined(_WIN32) || defined (_WIN64) const wchar_t* buffer = sVal.c_str(); int nBufferSize = WideCharToMultiByte( CP_OEMCP, 0, buffer, -1, NULL, 0, NULL, NULL ); char* pBuffer = new char[nBufferSize]; WideCharToMultiByte( CP_OEMCP, 0, buffer, -1, pBuffer, nBufferSize, NULL, NULL ); std::string sRes(pBuffer, nBufferSize); RELEASEARRAYOBJECTS(pBuffer); return sRes; #else return unicode_to_ascii(sVal.c_str()); #endif }
QString GuiManager::isPrimality(unsigned long long data) { // qDebug()<<data<<LLONG_MAX; if (data >= LLONG_MAX || data == 0) return QString("Out of Range"); bool res = false; QString sRes("FALSE"); if (data < ULONG_MAX) res = prime_fermat(data); else res = prime_regular(data); if (res) sRes = "TRUE"; return sRes; }
/*This static functions are copies from ZLib miniunz.c with some changes.*/ static std::wstring codepage_issue_fixFromOEM( const char* sVal) { #if defined(_WIN32) || defined (_WIN64) int nBufferSize = MultiByteToWideChar( CP_OEMCP, 0, sVal, -1, NULL, 0 ); wchar_t* pBuffer = new wchar_t[nBufferSize]; MultiByteToWideChar( CP_OEMCP, 0, sVal, -1, pBuffer, nBufferSize ); //If this parameter is -1, the function processes the entire input string, including the terminating null character. //Therefore, the resulting Unicode string has a terminating null character, and the length returned by the function includes this character. std::wstring sRes(pBuffer, nBufferSize - 1); RELEASEARRAYOBJECTS(pBuffer); return sRes; #else return ascii_to_unicode(sVal); #endif }
std::string WsModulesLoader::removePrefix(const std::string& path) { // TODO : en attendant de mettre ces éléménts en Modules std::string sRes(path); std::string searchPath = WsLayoutProperties::instance()->get("global", "search_path", "/Search"); // LOG(DEBUG)<<"WsModulesLoader::removePrefix() path = " << path; if ( path.compare(0, searchPath.size(), searchPath ) == 0 ) return ""; // Search if ( path.compare(0, 5, "/Logo" ) == 0 ) return sRes.assign(path, 5, path.size() - 5); if ( path.compare(0, 8, "/SiteMap" ) == 0 ) return sRes.assign(path, 8, path.size() - 8); if ( path.compare(0, 5, "/Edit" ) == 0 ) return sRes.assign(path, 5, path.size() - 5); if ( path.compare(0, 11, "/FileUpload" ) == 0 ) return sRes.assign(path, 11, path.size() - 11); if ( path.compare(0, 10, "/FolderNew" ) == 0 ) return sRes.assign(path, 10, path.size() - 10); if ( path.compare(0, 13, "/FolderDelete" ) == 0 ) return sRes.assign(path, 13, path.size() - 13); if ( path.compare(0, 11, "/FolderEdit" ) == 0 ) return sRes.assign(path, 11, path.size() - 11); for (int iModule = 0; iModule < modules().size(); ++iModule) { WsModule* curModule = modules()[iModule]->module; if ( curModule->prefix().size() < 1 ) continue; if ( path.compare(0, curModule->prefix().size(), curModule->prefix() ) == 0) return curModule->pathWithoutPrefix(path); } return path; }
std::string CircularBuffer::readAllAsString() { std::string sRes(""); sRes.append(m_circular_buffer_.begin(),m_circular_buffer_.end()); return sRes; }
CStrAny Parse::TrimWhitespace(const CStrAny &s) { CStrAny sRes(s, ST_PART); Parse::ReadWhitespace(sRes); return Parse::ReadUntilWhitespace(sRes); }