本文整理汇总了C++中tstring类的典型用法代码示例。如果您正苦于以下问题:C++ tstring类的具体用法?C++ tstring怎么用?C++ tstring使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了tstring类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GetFileName
tstring GetFileName(tstring s)
{
tstring::size_type n = s.find(_T('.'));
if(n == tstring::npos)return s;
return s.substr(0,n);
};
开发者ID:GMIS,项目名称:GMIS,代码行数:6,代码来源:Space.cpp
示例2: GetInfoString
//
// Query any given "\StringFileInfo\lang-charset\<str>" version info string.
// lang indicates the language translation, may be 0 to signify file default.
// String version. Throws exception on failure. [VH 2005-04-03]
//
tstring TModuleVersionInfo::GetInfoString(const tstring& str, uint lang)
{LPCTSTR v = _T(""); E = GetInfoString(str.c_str (), v, lang); return v;}
开发者ID:Meridian59,项目名称:Meridian59,代码行数:7,代码来源:modversi.cpp
示例3: UnserializeParameter
static void UnserializeParameter(const tstring& sHandle, const tstring& sValue, CBaseEntity* pEntity)
{
CSaveData oSaveDataValues;
CSaveData* pSaveData = CBaseEntity::FindSaveDataValuesByHandle(pEntity->GetClassName(), sHandle.c_str(), &oSaveDataValues);
TAssert(pSaveData && pSaveData->m_pszHandle);
if (!pSaveData || !pSaveData->m_pszHandle)
{
TError("Unknown handle '" + sHandle + "'\n");
return;
}
if (!pSaveData->m_pfnUnserializeString)
return;
pSaveData->m_pfnUnserializeString(sValue, pSaveData, pEntity);
}
开发者ID:BSVino,项目名称:LunarWorkshop,代码行数:16,代码来源:gameserver.cpp
示例4: GetFileDirectorySizes
/////////////////////////////////////////////////////////////////////
//
// Function:
//
// Description:
//
/////////////////////////////////////////////////////////////////////
BOOL CAMigrateBOINCData::GetFileDirectorySizes( tstring strDirectory, ULONGLONG& ullFileSize, ULONGLONG& ullDirectorySize )
{
WIN32_FIND_DATA ffData;
HANDLE hFind;
tstring csPathMask;
tstring csFullPath;
tstring csNewFullPath;
if ( _T("\\") != strDirectory.substr(strDirectory.length() - 1, 1) )
{
strDirectory += _T("\\");
}
csPathMask = strDirectory + _T("*.*");
hFind = FindFirstFile(csPathMask.c_str(), &ffData);
if (hFind == INVALID_HANDLE_VALUE){
LogMessage(
INSTALLMESSAGE_INFO,
NULL,
NULL,
NULL,
NULL,
_T("CAMigrateBOINCData::GetFileDirectorySizes -- Invalid handle")
);
return FALSE;
}
// Calculating Sizes
while (hFind && FindNextFile(hFind, &ffData))
{
if( !(ffData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) )
{
csFullPath = strDirectory;
csFullPath += ffData.cFileName;
// Add current file size to the overall directory size
ullDirectorySize += ((ffData.nFileSizeHigh * MAXDWORD) + ffData.nFileSizeLow);
// If this file size is bigger than the one we know about, store it
// for later use.
if (ullFileSize < ((ffData.nFileSizeHigh * MAXDWORD) + ffData.nFileSizeLow)) {
ullFileSize = ((ffData.nFileSizeHigh * MAXDWORD) + ffData.nFileSizeLow);
}
}
else // it is a directory
{
csNewFullPath = strDirectory;
csNewFullPath += ffData.cFileName;
csNewFullPath += _T("\\");
if( (_tcscmp(ffData.cFileName, _T(".")) != 0) &&
(_tcscmp(ffData.cFileName, _T("..")) != 0) )
{
GetFileDirectorySizes(csNewFullPath, ullFileSize, ullDirectorySize);
}
}
}
FindClose(hFind);
return TRUE;
}
开发者ID:BME-IK,项目名称:gridbee-nacl-framework,代码行数:69,代码来源:CAMigrateBOINCData.cpp
示例5: _T
/////////////////////////////////////////////////////////////////////
//
// Function:
//
// Description:
//
/////////////////////////////////////////////////////////////////////
BOOL CAMigrateBOINCData::MoveFiles( tstring strSourceDirectory, tstring strDestinationDirectory, ULONGLONG& ullBytesTransfered )
{
BOOL bRet = TRUE;
WIN32_FIND_DATA ffData;
HANDLE hFind;
tstring csPathMask;
tstring csFullPath;
tstring csNewFullPath;
tstring strMessage;
strMessage = _T("CAMigrateBOINCData::MoveFiles -- Directory: '");
strMessage += strSourceDirectory;
strMessage += _T("'");
LogMessage(
INSTALLMESSAGE_INFO,
NULL,
NULL,
NULL,
NULL,
strMessage.c_str()
);
// Create the destination cirectory if needed.
//
CreateDirectory(strDestinationDirectory.c_str(), NULL);
if ( _T("\\") != strSourceDirectory.substr(strSourceDirectory.length() - 1, 1) )
{
strSourceDirectory += _T("\\");
}
if ( _T("\\") != strDestinationDirectory.substr(strDestinationDirectory.length() - 1, 1) )
{
strDestinationDirectory += _T("\\");
}
csPathMask = strSourceDirectory + _T("*.*");
hFind = FindFirstFile(csPathMask.c_str(), &ffData);
if (hFind == INVALID_HANDLE_VALUE){
LogMessage(
INSTALLMESSAGE_INFO,
NULL,
NULL,
NULL,
NULL,
_T("CAMigrateBOINCData::MoveFiles -- Invalid handle")
);
return FALSE;
}
// Copying all the files
while (hFind && FindNextFile(hFind, &ffData))
{
csFullPath = strSourceDirectory + ffData.cFileName;
csNewFullPath = strDestinationDirectory + ffData.cFileName;
RemoveReadOnly(csFullPath);
RemoveReadOnly(csNewFullPath);
if( !(ffData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) )
{
strMessage = _T("CAMigrateBOINCData::MoveFiles -- Copy File: '");
strMessage += csFullPath.c_str();
strMessage += _T("' to '");
strMessage += csNewFullPath.c_str();
strMessage += _T("'");
LogMessage(
INSTALLMESSAGE_INFO,
NULL,
NULL,
NULL,
NULL,
strMessage.c_str()
);
if( !CopyFile(csFullPath.c_str(), csNewFullPath.c_str(), FALSE) )
{
LogMessage(
INSTALLMESSAGE_INFO,
NULL,
NULL,
NULL,
GetLastError(),
_T("CAMigrateBOINCData::MoveFiles -- Failed to copy original file")
);
bRet = FALSE;
}
else
{
ullBytesTransfered += ((ffData.nFileSizeHigh * MAXDWORD) + ffData.nFileSizeLow);
//.........这里部分代码省略.........
开发者ID:BME-IK,项目名称:gridbee-nacl-framework,代码行数:101,代码来源:CAMigrateBOINCData.cpp
示例6: setItemText
void ErrorDialog::setItemText(int id, tstring text)
{
SetWindowText(GetDlgItem(handle, id), text.c_str());
}
开发者ID:SCORE42,项目名称:inno-download-plugin,代码行数:4,代码来源:errordialog.cpp
示例7: SetQueryString
bool VaultSearchQuery::SetQueryString( const tstring& queryString, tstring& errors )
{
// Set the QueryString
m_QueryString = queryString;
m_SQLQueryString.clear();
if ( !ParseQueryString( m_QueryString, errors, this ) )
{
Log::Warning( TXT( "Errors occurred while parsing the query string: %s\n %s\n" ), m_QueryString.c_str(), errors.c_str() );
return false;
}
return true;
}
开发者ID:euler0,项目名称:Helium,代码行数:14,代码来源:VaultSearchQuery.cpp
示例8: Init
//
/// String-aware overload
//
TProfile::TProfile(const tstring& section, const tstring& filename)
{
Init(
section.empty() ? 0 : section.c_str(),
filename.empty() ? 0 : filename.c_str());
}
开发者ID:AlleyCat1976,项目名称:Meridian59_103,代码行数:9,代码来源:profile.cpp
示例9: CreateWaitableTimer
//
// String-aware overload
//
TWaitableTimer::TWaitableTimer(bool manualReset, const tstring& name, LPSECURITY_ATTRIBUTES sa)
{
Handle = CreateWaitableTimer(sa, manualReset, name.c_str());
if (!Handle) throw TXOwl(_T("CreateWaitableTimer failed."));
}
开发者ID:AlleyCat1976,项目名称:Meridian59_103,代码行数:8,代码来源:thread.cpp
示例10: _T
/////////////////////////////////////////////////////////////////////
//
// Function:
//
// Description:
//
/////////////////////////////////////////////////////////////////////
tstring CACreateProjectInitFile::ParseParameter(tstring& strSetupExeName, tstring& strParameter)
{
tstring strParameterName;
tstring strEncodedValue;
tstring strParameterValue;
tstring strError;
size_t iParameterStart = 0;
size_t iParameterEnd = 0;
strParameterName = strParameter + _T("_");
strError = _T("Searching for parameter '");
strError += strParameterName;
strError += _T("'");
LogMessage(
INSTALLMESSAGE_INFO,
NULL,
NULL,
NULL,
NULL,
strError.c_str()
);
iParameterStart = strSetupExeName.rfind(strParameterName);
if (iParameterStart != tstring::npos) {
iParameterStart += strParameterName.size();
iParameterEnd = strSetupExeName.find(_T("_"), iParameterStart);
if (iParameterEnd == tstring::npos) {
iParameterEnd = strSetupExeName.find(_T("."), iParameterStart);
if (iParameterEnd == tstring::npos) {
return tstring(_T(""));
}
}
strEncodedValue = strSetupExeName.substr(iParameterStart, iParameterEnd - iParameterStart);
strError = _T("Found encoded value '");
strError += strEncodedValue;
strError += _T("'");
LogMessage(
INSTALLMESSAGE_INFO,
NULL,
NULL,
NULL,
NULL,
strError.c_str()
);
// WCG didn't want to have to encode their setup cookie value. So all parameters but the setup cookie
// are base64 encoded.
//
if (strParameterName == _T("asc_")) {
strParameterValue = strEncodedValue;
} else {
CW2A pszASCIIEncodedValue( strEncodedValue.c_str() );
CA2W pszUnicodeDecodedValue( r_base64_decode(pszASCIIEncodedValue, strlen(pszASCIIEncodedValue)).c_str() );
strError = _T("Decoded value '");
strError += pszUnicodeDecodedValue;
strError += _T("'");
LogMessage(
INSTALLMESSAGE_INFO,
NULL,
NULL,
NULL,
NULL,
strError.c_str()
);
strParameterValue = pszUnicodeDecodedValue;
}
}
strError = _T("Returning value '");
strError += strParameterValue;
strError += _T("'");
LogMessage(
INSTALLMESSAGE_INFO,
NULL,
NULL,
NULL,
NULL,
strError.c_str()
);
return strParameterValue;
//.........这里部分代码省略.........
开发者ID:DanAurea,项目名称:boinc,代码行数:101,代码来源:CACreateProjectInitFile.cpp
示例11: TriToken
tstring TriToken(tstring& Token){
tstring::size_type begin = Token.find_first_not_of(_T(' '));
if(begin == string::npos)return Token;
tstring::size_type end = Token.find_last_not_of(_T(' '));
return Token.substr(begin,end-begin+1);
}
开发者ID:GMIS,项目名称:GMIS,代码行数:6,代码来源:SpaceMsgList.cpp
示例12: set_srcdir
void set_srcdir(tstring const& x)
{
srcdir.assign(x.data(), x.size());
}
开发者ID:zbigg,项目名称:tinfra,代码行数:4,代码来源:test.cpp
示例13: set_test_resources_dir
void set_test_resources_dir(tstring const& x)
{
top_srcdir.assign(x.data(), x.size());
}
开发者ID:zbigg,项目名称:tinfra,代码行数:4,代码来源:test.cpp
示例14: switch
void Logger::Log(LogLevel level, const tstring& pMessage, const tstring& tag)
{
#if LOGGER_MIN_LEVEL > 0
tstring levelName;
switch(level)
{
case LogLevel::Info :
levelName = _T("INFO");
break;
case LogLevel::Warning:
levelName = _T("WARNING");
break;
case LogLevel::Error:
levelName = _T("ERROR");
break;
case LogLevel::Debug:
levelName = _T("DEBUG");
break;
}
#ifdef DESKTOP
tstringstream messageBuffer;
messageBuffer << _T("[") << tag << _T("] ") << _T("[") << levelName << _T("] ") << pMessage << std::endl;
tstring combinedMessage = messageBuffer.str();
if(m_UseConsole)
{
switch(level)
{
case LogLevel::Info :
#if LOGGER_MIN_LEVEL < 2
SetConsoleTextAttribute(m_ConsoleHandle, FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
#endif
break;
case LogLevel::Warning :
#if LOGGER_MIN_LEVEL < 3
SetConsoleTextAttribute(m_ConsoleHandle, FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN);
#endif
break;
case LogLevel::Error :
#if LOGGER_MIN_LEVEL < 4
SetConsoleTextAttribute(m_ConsoleHandle, FOREGROUND_INTENSITY | FOREGROUND_RED);
#endif
break;
case LogLevel::Debug :
#if LOGGER_MIN_LEVEL < 5
#ifdef DEBUG
SetConsoleTextAttribute(m_ConsoleHandle, FOREGROUND_INTENSITY | FOREGROUND_GREEN);
#endif
#endif
break;
}
tprintf(combinedMessage.c_str());
}
else
{
OutputDebugString(combinedMessage.c_str());
}
#ifndef NO_LOG_FILE
LogMessage(combinedMessage);
#endif
#else
switch(level)
{
case LogLevel::Info:
#if LOGGER_MIN_LEVEL < 2
__android_log_print(ANDROID_LOG_INFO, tag.c_str(), "%s", pMessage.c_str());
#endif
break;
case LogLevel::Warning:
#if LOGGER_MIN_LEVEL < 3
__android_log_print(ANDROID_LOG_WARN, tag.c_str(), "%s", pMessage.c_str());
#endif
break;
case LogLevel::Error:
#if LOGGER_MIN_LEVEL < 4
__android_log_print(ANDROID_LOG_ERROR, tag.c_str(), "%s", pMessage.c_str());
#endif
break;
case LogLevel::Debug:
#if LOGGER_MIN_LEVEL < 5
#ifdef DEBUG
__android_log_print(ANDROID_LOG_DEBUG, tag.c_str(), pMessage.c_str());
#endif
#endif
break;
}
#ifndef NO_LOG_FILE
tstringstream messageBuffer;
messageBuffer << _T("[") << tag << _T("] ") << _T("[") << levelName << _T("] ") << pMessage << std::endl;
LogMessage(messageBuffer.str());
#endif
#endif
#endif
}
开发者ID:AzureCrab,项目名称:StarEngine,代码行数:96,代码来源:Logger.cpp
示例15: OpenWaitableTimer
//
// String-aware overload
//
TWaitableTimer::TWaitableTimer(const tstring& name, bool inherit, uint32 access)
{
Handle = OpenWaitableTimer(access, inherit, name.c_str());
if (!Handle) throw TXOwl(_T("OpenWaitableTimer failed."));
}
开发者ID:AlleyCat1976,项目名称:Meridian59_103,代码行数:8,代码来源:thread.cpp
示例16: Color
void CGeneralWindow::Paint(float x, float y, float w, float h)
{
if (m_flFadeToBlack)
{
float flAlpha = (float)RemapVal(GameServer()->GetGameTime(), m_flFadeToBlack, m_flFadeToBlack+1.5f, 0.0, 1.0);
glgui::CRootPanel::PaintRect(0, 0, glgui::CRootPanel::Get()->GetWidth(), glgui::CRootPanel::Get()->GetHeight(), Color(0, 0, 0, (int)(255*flAlpha)));
return;
}
Rect recAntivirus = m_hAntivirus.GetArea("Antivirus");
glgui::CBaseControl::PaintSheet(m_hAntivirus.GetSheet("Antivirus"), x, y, w, h, recAntivirus.x, recAntivirus.y, recAntivirus.w, recAntivirus.h, m_hAntivirus.GetSheetWidth("Antivirus"), m_hAntivirus.GetSheetHeight("Antivirus"));
BaseClass::Paint(x, y, w, h);
if (!m_sEmotion.length())
return;
CGameRenderingContext c(GameServer()->GetRenderer(), true);
c.SetBlend(BLEND_ALPHA);
c.SetColor(Color(255, 255, 255, 255));
Rect recEmotion = m_hGeneral.GetArea(m_sEmotion);
glgui::CBaseControl::PaintSheet(m_hGeneral.GetSheet(m_sEmotion), x, y, 256, 256, recEmotion.x, recEmotion.y, recEmotion.w, recEmotion.h, m_hGeneral.GetSheetWidth(m_sEmotion), m_hGeneral.GetSheetHeight(m_sEmotion));
if ((m_bHelperSpeaking || m_bProgressBar) && Oscillate((float)GameServer()->GetGameTime(), 0.2f) > 0.5)
{
Rect recMouth = m_hGeneralMouth.GetArea(m_sEmotion);
glgui::CBaseControl::PaintSheet(m_hGeneralMouth.GetSheet(m_sEmotion), x, y, 256, 256, recMouth.x, recMouth.y, recMouth.w, recMouth.h, m_hGeneralMouth.GetSheetWidth(m_sEmotion), m_hGeneralMouth.GetSheetHeight(m_sEmotion));
}
if (m_bProgressBar)
{
double flTime = 3;
glgui::CBaseControl::PaintRect(x + m_pText->GetLeft(), y + 160, m_pText->GetWidth(), 10, Color(255, 255, 255, 255));
glgui::CBaseControl::PaintRect(x + m_pText->GetLeft() + 2, y + 160 + 2, ((m_pText->GetWidth() - 4) * (float)RemapValClamped(GameServer()->GetGameTime(), m_flStartTime, m_flStartTime+flTime, 0.0, 1.0)), 10 - 4, Color(42, 65, 122, 255));
static tstring sEstimate;
static double flLastEstimateUpdate = 0;
if (!sEstimate.length() || GameServer()->GetGameTime() - flLastEstimateUpdate > 1)
{
int iRandomTime = RandomInt(0, 5);
tstring sRandomTime;
if (iRandomTime == 0)
sRandomTime = "centuries";
else if (iRandomTime == 1)
sRandomTime = "minutes";
else if (iRandomTime == 2)
sRandomTime = "hours";
else if (iRandomTime == 3)
sRandomTime = "days";
else
sRandomTime = "seconds";
sEstimate = tsprintf(tstring("Estimated time remaining: %d %s"), RandomInt(2, 100), sRandomTime.c_str());
flLastEstimateUpdate = GameServer()->GetGameTime();
}
float flWidth = glgui::RootPanel()->GetTextWidth(sEstimate, sEstimate.length(), "sans-serif", 12);
glgui::CLabel::PaintText(sEstimate, sEstimate.length(), "sans-serif", 12, x + m_pText->GetLeft() + m_pText->GetWidth()/2 - flWidth/2, (float)y + 190, Color(0, 0, 0, 255));
}
}
开发者ID:BSVino,项目名称:Digitanks,代码行数:63,代码来源:general_window.cpp
示例17: SetWindowText
inline void SetWindowText (HWND hwnd, const tstring& ts) { SetWindowText(hwnd, ts.c_str()); }
开发者ID:frastlin,项目名称:6pad2,代码行数:1,代码来源:win32api++.hpp
示例18:
int Win32DebugAppender::append(const tstring &logMsg)
{
OutputDebugString(logMsg.c_str());
return 0;
}
开发者ID:yellowbigbird,项目名称:bird-self-lib,代码行数:5,代码来源:Logger.cpp
示例19: SetDlgItemText
inline void SetDlgItemText (HWND hwnd, int i, const tstring& ts) { SetDlgItemText(hwnd, i, ts.c_str()); }
开发者ID:frastlin,项目名称:6pad2,代码行数:1,代码来源:win32api++.hpp
示例20: path
path(const tstring &p) { StringCbCopy(this->buf, sizeof(this->buf), p.c_str()); }
开发者ID:DroidInteractiveSoftware,项目名称:peerblock,代码行数:1,代码来源:pathx.hpp
注:本文中的tstring类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论