static tstring formatIntegerValue(uint64 value) { typedef tstring::reverse_iterator rev_iter; typedef tstring::const_reverse_iterator c_rev_iter; const tstring rawResult = Core::format<uint64>(value); const size_t numDigits = (rawResult[0] != TXT('-')) ? rawResult.length() : (rawResult.length()-1); const tstring separator = getGroupSeparator(); const size_t numSeps = (numDigits-1) / 3; const size_t total = rawResult.length() + (numSeps * separator.length()); tstring result = tstring(total, TXT(' ')); c_rev_iter it = rawResult.rbegin(); c_rev_iter end = rawResult.rend(); size_t digits = 0; size_t seps = 0; rev_iter output = result.rbegin(); while (it != end) { *output++ = *it++; if ( ((++digits % 3) == 0) && (seps++ != numSeps) ) output = std::copy(separator.rbegin(), separator.rend(), output); } return result; }
// construct \ref data content void ShellCache::CPathFilter::AddEntry(const tstring& s, bool include) { static wchar_t pathbuf[MAX_PATH * 4] = { 0 }; if (s.empty()) return; TCHAR lastChar = *s.rbegin(); SEntry entry; entry.hasSubFolderEntries = false; entry.recursive = lastChar != L'?'; entry.included = include ? tristate_true : tristate_false; entry.subPathIncluded = include == entry.recursive ? tristate_true : tristate_false; entry.path = s; if ((lastChar == L'?') || (lastChar == L'*')) entry.path.erase(s.length() - 1); if (!entry.path.empty() && (*entry.path.rbegin() == L'\\')) entry.path.erase(entry.path.length() - 1); auto ret = ExpandEnvironmentStrings(entry.path.c_str(), pathbuf, _countof(pathbuf)); if ((ret > 0) && (ret < _countof(pathbuf))) entry.path = pathbuf; data.push_back(entry); }
void Path::GuaranteeSeparator( tstring& path ) { if ( !path.empty() && *path.rbegin() != s_InternalPathSeparator ) { path += s_InternalPathSeparator; } }
void ShellCache::CPathFilter::AddEntry (const tstring& s, bool include) { if (s.empty()) return; TCHAR lastChar = *s.rbegin(); SEntry entry; entry.hasSubFolderEntries = false; entry.recursive = lastChar != '?'; entry.included = include ? svn_tristate_true : svn_tristate_false; entry.subPathIncluded = include == entry.recursive ? svn_tristate_true : svn_tristate_false; entry.path = s; if ((lastChar == '?') || (lastChar == '*')) entry.path.erase (s.length()-1); if (!entry.path.empty() && (*entry.path.rbegin() == '\\')) entry.path.erase (entry.path.length()-1); data.push_back (entry); }
/** @brief パスのファイル名への追加 @param tstrPath パス文字列 @param tszFName 追加するファイル名 @retval tstrPath ファイル名を追加したパス */ static void AddFilename( tstring& tstrPath, const _TCHAR* tszFName ) { if( *tstrPath.rbegin() != '\\' )tstrPath += "\\"; tstrPath += tszFName; }