本文整理汇总了C++中_tstring类的典型用法代码示例。如果您正苦于以下问题:C++ _tstring类的具体用法?C++ _tstring怎么用?C++ _tstring使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了_tstring类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: SAFE_DELETE
xnBgObj::xProp* XPropBgObj::LoadEach( XEXmlNode& nodeEach, xtBgObj type, LPCTSTR szTag )
{
auto pProp = new xnBgObj::xProp();
pProp->m_idObj = (ID)nodeEach.GetInt( "id" );
if( XBREAK(pProp->m_idObj == 0) ) {
SAFE_DELETE( pProp );
return nullptr;
}
#ifdef _xIN_TOOL
s_idGlobal = std::max( pProp->m_idObj, s_idGlobal );
#endif // _xIN_TOOL
pProp->m_vwPos = nodeEach.GetVec2();
if( pProp->m_vwPos.IsInvalid() ) {
PROP_LOG("warning: invalid pos");
}
pProp->m_Type = type;
pProp->m_typeSub = 0;
// if( type == xBOT_SOUND ) {
// pProp->m_strSnd = nodeEach.GetTString( "file" );
// } else {
pProp->m_idAct = nodeEach.GetInt( "id_act" );
if( XBREAK( pProp->m_idAct == 0 ) ) {
PROP_LOG( "error: id_act is 0" );
}
// }
pProp->m_strSnd = nodeEach.GetTString("sound");
const _tstring strExt = XE::GetFileExt( pProp->m_strSnd );
if( !strExt.empty() ) {
pProp->m_strSnd = XE::GetFileTitle( pProp->m_strSnd );
}
return pProp;
}
开发者ID:xahgo,项目名称:tama,代码行数:32,代码来源:XPropBgObj.cpp
示例2: while
bool XPropBgObj::LoadObj( XEXmlNode& nodeObj, XGAME::xtBgObj type, LPCTSTR szTag )
{
// LPCTSTR szTag = XFORMAT("type=%d", type );
XEXmlNode nodeEach = nodeObj.GetFirst();
bool bOk = true;
while( !nodeEach.IsEmpty() ) {
const std::string strcName = nodeEach.GetcstrName();
if( strcName == "each" ) {
const _tstring strTag = C2SZ(strcName);
auto pProp = LoadEach( nodeEach, type, strTag.c_str() );
if( pProp ) {
pProp->m_strSpr = nodeObj.GetTString( "spr" );
// if( type != xBOT_SOUND ) {
if( XBREAK(pProp->m_strSpr.empty()) ) {
PROP_LOG("error: spr is empty");
}
// }
AddBgObj( pProp );
}
} else {
PROP_LOG( "%s: 알수없는 노드", C2SZ(strcName.c_str()) )
}
//
nodeEach = nodeEach.GetNext();
}
return bOk;
}
开发者ID:xahgo,项目名称:tama,代码行数:27,代码来源:XPropBgObj.cpp
示例3: SplitString
void SplitString(const _tstring & src, const TCHAR delim, std::vector<_tstring> & strArr)
{
strArr.clear();
int i = 0, j;
int k = static_cast<int>(src.length());
const TCHAR * pSrc = src.c_str();
while (i < k)
{
while (*pSrc == delim && i < k)
{
pSrc++;
i++;
}
j = i;
while (*pSrc != delim && i < k)
{
pSrc++;
i++;
}
if (j < i)
{
strArr.push_back(src.substr(j, i - j));
}
}
}
开发者ID:sharkka,项目名称:xzcapture,代码行数:30,代码来源:TString.cpp
示例4: Find
XWndImage* XWndSpot::UpdateHardMark( const char* cIdentifier, bool bShow )
{
// 애초에 출력할필요 없는 스팟은 컨트롤을 만들지 않는다.
if( !bShow ) {
auto pExist = Find( cIdentifier );
if( pExist )
pExist->SetbShow( bShow );
return SafeCast2<XWndImage*>( pExist );
}
// 스팟 난이도 아이콘
int power = m_pBaseSpot->GetPower();
if( power == 0 ) {
m_pBaseSpot->UpdatePower();
power = m_pBaseSpot->GetPower();
}
if( XASSERT(power) ) {
int lvHard = XGAME::GetHardLevel( power, ACCOUNT->GetPowerExcludeEmpty() );
auto pImg = XWndImage::sUpdateCtrl( this, XE::VEC2(0), nullptr, true, cIdentifier );
if( pImg ) {
pImg->SetPriority( -100 );
pImg->SetbShow( true );
const auto bb = GetBoundBoxByVisibleLocal();
const auto vSize = pImg->GetSizeLocal();
pImg->SetX( -( vSize.w * 0.5f ) );
pImg->SetY( bb.vLT.y - (vSize.h * 0.8f) );
const _tstring strImg = XE::Format( _T( "world_hard%d.png" ), lvHard + 2 );
const _tstring strPath = XE::MakePath( DIR_UI, strImg );
pImg->SetSurfaceRes( strPath.c_str(), XE::xPF_ARGB1555, true );
}
return pImg;
}
return nullptr;
}
开发者ID:xahgo,项目名称:tama,代码行数:33,代码来源:XWndSpots.cpp
示例5: _T
bool XPropBgObj::OnDidFinishLoad()
{
LPCTSTR szTag = _T("root");
XEXmlNode nodeRoot = FindNode( "root" );
if( nodeRoot.IsEmpty() ) {
XALERT("%s: not found root node", GetstrFilename().c_str() );
return false;
}
XEXmlNode nodeChild = nodeRoot.GetFirst();
if( nodeChild.IsEmpty() ) {
return false;
}
while( !nodeChild.IsEmpty() ) {
const std::string strNodeName = nodeChild.GetcstrName();
const _tstring strtNodeName = C2SZ( strNodeName );
auto type = (XGAME::xtBgObj)CONSTANT->GetValue( strtNodeName );
if( type > XGAME::xBOT_NONE && type < XGAME::xBOT_MAX ) {
LoadObj( nodeChild, type, strtNodeName.c_str() );
} else {
PROP_LOG( "%s: 알수없는 노드", nodeChild.GetstrName().c_str() );
}
//
nodeChild = nodeChild.GetNext();
}
XTRACE( "propBgObj loaded....num=%d", m_listBgObjs.size() );
if( m_bError ) {
XALERT("%s: 로딩중 에러 발견.", GetstrFilename().c_str() );
}
return true;
}
开发者ID:xahgo,项目名称:tama,代码行数:30,代码来源:XPropBgObj.cpp
示例6: StringT2W
std::wstring StringT2W(const _tstring & tstr)
{
std::wstring wstrRes;
#ifdef UNICODE
wstrRes = tstr;
#else
size_t sz;
mbstowcs_s(&sz, NULL, 0, tstr.c_str(), 0);
wchar_t * pwstr = new wchar_t[sz+1];
mbstowcs_s(&sz, pwstr, sz+1, tstr.c_str(), sz);
wstrRes = pwstr;
delete [] pwstr;
#endif
return wstrRes;
}
开发者ID:sharkka,项目名称:xzcapture,代码行数:26,代码来源:TString.cpp
示例7: chr
/*
In python:
>>> '海阔天空'.encode('utf-16')
b'\xff\xfewm\x14\x96)Yzz'
>>> '海阔天空'.encode('utf-16-le')
b'wm\x14\x96)Yzz'
>>> '海阔天空'.encode('utf-16-be')
b'mw\x96\x14Y)zz'
>>> chr(0x7a)
'z'
>>> chr(0x59)
'Y'
Output of this program: (Unicode mode)
GB2312: 海阔天空
77 6d 14 96 29 59 7a 7a
UTF-8 without BOM: 娴烽様澶╃┖
34 5a fd 70 d8 69 b6 6f 43 25 16 25
UTF-8 with BOM: 海阔天空
77 6d 14 96 29 59 7a 7a
UTF-16 BE: 海阔天空
77 6d 14 96 29 59 7a 7a
UTF-16 LE: 海阔天空
77 6d 14 96 29 59 7a 7a
So, windows uses UTF-16-LE to represent a string in UNICODE mode.
In non-unicode mode, cp936 is used.
*/
void dump(const _tstring &str)
{
std::size_t wpos = str.rfind(_T(' '));
if (_tstring::npos == wpos)
{
return;
}
const byte *beg = reinterpret_cast<const byte *>(str.c_str() + wpos + 1);
const byte *end = reinterpret_cast<const byte *>(str.c_str() + str.size());
#if 0
_tcout << std::hex;
std::ostream_iterator<byte, _TCHAR> oit(_tcout, _T(" ")); // Caution
std::copy(beg, end, oit);
_tcout << std::dec << std::endl;
#else
_tcout << std::setfill(_T('0')) << std::hex;
for (const byte *p = beg; p != end; ++p)
{
if (*p <= 0x7f && std::isprint(static_cast<char>(*p)))
{
_tcout << static_cast<char>(*p);
}
else
{
// In non-unicode mode, if we want to print the value of '*p'
// in hexadecimal format, we have to cast it into an integer.
_tcout << _T("\\x") << std::setw(2) << static_cast<int>(*p);
}
}
_tcout << std::setfill(_T(' ')) << std::dec << std::endl;
#endif
}
开发者ID:myd7349,项目名称:Ongoing-Study,代码行数:62,代码来源:main.cpp
示例8: glShaderSource
BOOL XShader::CompileShaderFromString( GLuint *shader
, GLenum type
, const GLchar *cShader
, const char *cszTag )
{
GLint status;
*shader = glCreateShader( type );
glShaderSource( *shader, 1, &cShader, nullptr );
glCompileShader( *shader );
GLint logLength;
glGetShaderiv( *shader, GL_INFO_LOG_LENGTH, &logLength );
if( logLength > 0 ) {
GLchar *log = (GLchar *)malloc( logLength );
glGetShaderInfoLog( *shader, logLength, &logLength, log );
if( logLength > 0 ) {
const _tstring strTag = C2SZ(cszTag);
const _tstring strLog = C2SZ(log);
XTRACE( "Shader compile log:\n %s\n [%s]\n", strTag.c_str(), strLog.c_str() );
}
free( log );
}
glGetShaderiv( *shader, GL_COMPILE_STATUS, &status );
if( status == 0 ) {
glDeleteShader( *shader );
return NO;
}
return YES;
}
开发者ID:xahgo,项目名称:tama,代码行数:29,代码来源:XGraphicsOpenGL.cpp
示例9: while
void CXmlParser::GetTagAttributes(CXmlNode& Node, const _tstring& sTag)
{
// У узла нет атрибутов
if (sTag.find('=') == _tstring::npos)
return;
TCHAR * itStart = const_cast< TCHAR * > (&sTag[0]);
const TCHAR * itEnd = &sTag[sTag.size()];
while (itStart < itEnd)
{
// Ищем начало имени
const TCHAR * itNameStart = std::find(static_cast< const TCHAR * > (itStart), itEnd, ' ') + 1;
// Ищем разделитель "="
const TCHAR * itSplitter = std::find(static_cast< const TCHAR * > (itStart), itEnd, '=');
// Ищем окончание значения
const TCHAR * itValueEnd = std::find(itSplitter + 2, itEnd, '\"');
Node.Data[_tstring(itNameStart, itSplitter)] = _tstring(itSplitter + 2, itValueEnd);
itStart = const_cast< TCHAR * > (itValueEnd + 1);
}
}
开发者ID:Bia10,项目名称:clrn,代码行数:25,代码来源:XmlParser.cpp
示例10: StringT2A
std::string StringT2A(const _tstring & tstr)
{
std::string strRes;
#ifdef UNICODE
size_t sz;
wcstombs_s(&sz, NULL, 0, tstr.c_str(), 0);
char * pstr = new char[sz + 1];
wcstombs_s(&sz, pstr, sz + 1, tstr.c_str(), sz);
strRes = pstr;
delete[] pstr;
#else
strRes = tstr;
#endif
return strRes;
}
开发者ID:sharkka,项目名称:xzcapture,代码行数:25,代码来源:TString.cpp
示例11: ReplaceAll
void ReplaceAll(_tstring &base,const _tstring &needle, const _tstring &s){
unsigned long lastpos = 0, thispos;
while ((thispos = base.find(needle, lastpos)) != _tstring::npos){
base.replace(thispos, needle.length(), s);
lastpos = thispos+s.length() ;
}
}
开发者ID:leeathefei,项目名称:ResManager,代码行数:7,代码来源:XmlConfig.cpp
示例12: _tstring
//---------------------------------------------------------------------
// PathRenameExtensionのラッパー
//---------------------------------------------------------------------
_tstring kjm::util::path_rename_extension(const _tstring& pszPath, const _tstring& pszExt) {
TCHAR buffer[MAX_PATH];
if (PathRenameExtension(lstrcpy(buffer, pszPath.c_str()), pszExt.c_str()) == FALSE) {
return _tstring(); // 関数失敗の時は、空文字列を返す
}
return buffer;
}
开发者ID:willmomo,项目名称:ry2kojima,代码行数:11,代码来源:kjmlib.cpp
示例13: VALID_SOCK
void XFSMMakeNewAccount::OnStart()
{
VALID_SOCK( pSockLogin, pSockGame );
//
const _tstring strtNick = m_pOwner->GetstrtNickGenerate();
XBREAK( strtNick.empty() );
XBREAK( !m_pOwner->GetstrName().empty() );
m_pOwner->SetstrName( strtNick );
pSockLogin->SendReqCreateAccount( strtNick );
}
开发者ID:xahgo,项目名称:tama,代码行数:11,代码来源:XFSMConnector.cpp
示例14: GetEnvironmentVariable
//---------------------------------------------------------------------
// GetEnvironmentVariable関数のラッパー
//---------------------------------------------------------------------
_tstring kjm::util::get_environment_variable(const _tstring& lpName) {
// 必要な文字数を求める
DWORD dwRet = GetEnvironmentVariable(lpName.c_str(), NULL, 0);
if (dwRet == 0) {
return _tstring(); // 環境変数なしの時は、空文字列を返す
}
std::vector<TCHAR> buffer(dwRet); // 必要なバッファを確保
GetEnvironmentVariable(lpName.c_str(), &buffer[0], buffer.size());
return &buffer[0];
}
开发者ID:willmomo,项目名称:ry2kojima,代码行数:15,代码来源:kjmlib.cpp
示例15: int
void XSceneTrader::UpdateSlidingResource(const char *key, XGAME::xtResource resource)
{
if (m_slider[resource]) {
const int maxRes = ACCOUNT->GetResource(resource);
const int numCurr = int(maxRes * m_slider[resource]->GetCurr());
const _tstring str1 = XE::NtS(numCurr);
const _tstring str2 = XE::NtS(maxRes);
xSET_TEXT(this, key, XFORMAT("%s / %s", str1.c_str(), str2.c_str()));
m_resourceGold[resource] = int(numCurr * XGC->m_resourceRate[resource]);
UpdateTotalGold();
}
}
开发者ID:xahgo,项目名称:tama,代码行数:12,代码来源:XSceneTrader.cpp
示例16: IsUserCredentialsValid
const bool CUserInfo::IsUserCredentialsValid(const _tstring & sLogin, const _tstring & sPassword, _tstring& sPasswordHash) const
{
if (sLogin.empty() || sPassword.empty())
return false;
// Get user password hash
std::vector< unsigned char > vecCredentials;
vecCredentials.reserve(sLogin.size() + sPassword.size());
std::copy(sLogin.begin(), sLogin.end(), std::back_inserter(vecCredentials));
std::copy(sPassword.begin(), sPassword.end(), std::back_inserter(vecCredentials));
sPasswordHash = cmn::CCrypto::CalcMD5(&vecCredentials.front(), vecCredentials.size());
boost::mutex::scoped_lock Lock(m_mxData);
for (const auto& User : m_vecUsers)
{
if (!boost::algorithm::iequals(User.sLogin, sLogin))
continue;
if (!boost::algorithm::iequals(User.sPasswordHash, sPasswordHash))
continue;
return true;
}
return false;
}
开发者ID:Bia10,项目名称:clrn,代码行数:28,代码来源:UserInfo.cpp
示例17: buffer
//---------------------------------------------------------------------
// GetPrivateProfileString関数のラッパー
//---------------------------------------------------------------------
_tstring kjm::util::get_private_profile_string(const _tstring& lpSectionName, const _tstring& lpKeyName, const _tstring& lpDefault, const _tstring& lpFileName) {
std::vector<TCHAR> buffer(512);
while (1) {
int nRet = GetPrivateProfileString(lpSectionName.c_str(), lpKeyName.c_str(), lpDefault.c_str(), &buffer[0], buffer.size(), lpFileName.c_str());
if (buffer.size() - 1 > nRet) {
// バッファのサイズ - 1が、戻り値よりも大きいときは、
// すべての文字を読み込んだことが確実なので、ループを抜ける。
break;
}
buffer.resize(buffer.size() * 2);
}
return &buffer[0];
}
开发者ID:willmomo,项目名称:ry2kojima,代码行数:17,代码来源:kjmlib.cpp
示例18: StripTrailing
_tstring StripTrailing(const _tstring &source, const char toStrip)
{
size_t i = source.length();
const TCHAR *pSrc = source.c_str() + i;
--pSrc;
while (i && *pSrc == toStrip)
{
--pSrc;
--i;
}
return source.substr(0, i);
}
开发者ID:sharkka,项目名称:xzcapture,代码行数:15,代码来源:TString.cpp
示例19: sUpdateHelloMsg
/**
@brief 인삿말 UI를 업데이트 한다.
*/
void XWndSpot::sUpdateHelloMsg( XSpot *pSpot, const _tstring& strHello )
{
const ID idSpot = pSpot->GetidSpot();
auto pRoot = SCENE_WORLD->GetpLayerByProfilePictures(); // 프로필사진 전용레이어에 설치.
// 인삿말이 등록되어 있다면 출력.
if( !strHello.empty() ) {
if( pRoot ) {
auto pWndProfile = SafeCast2<XWndProfileForSpot*>( pRoot->Findf( "wnd.profile.%d", idSpot ) );
if( pWndProfile && !pWndProfile->IsShowProfile() )
pWndProfile = nullptr;
const auto vSpot = pSpot->GetpBaseProp()->vWorld;
// 프로필액자가 있으면 그위에 띄우고 없으면 스팟 바로위에 띄운다.
auto pWndHello = SafeCast2<XWndHello*>( pRoot->Findf( "wnd.hello.%d", idSpot ) );
if( pWndHello == nullptr ) {
pWndHello = new XWndHello( idSpot, vSpot );
pWndHello->SetstrIdentifierf( "wnd.hello.%d", idSpot );
pRoot->Add( pWndHello );
SCENE_WORLD->SetbUpdate( true );
}
pWndHello->SetText( strHello );
pWndHello->UpdatePos();
}
}
else {
// 인삿말이 없으면 윈도우 삭제.
pRoot->DestroyWndByIdentifierf( "wnd.hello.%d", idSpot );
}
}
开发者ID:xahgo,项目名称:tama,代码行数:31,代码来源:XWndSpots.cpp
示例20: StringToHex
void StringToHex(const _tstring &ts, unsigned char *pBuffer, size_t nBytes)
{
const std::string s = StringT2A(const_cast<TCHAR *>(ts.c_str()));
for (size_t i = 0; i < nBytes; i++)
{
const size_t stringOffset = i * 2;
unsigned char val = 0;
const unsigned char b = s[stringOffset];
if (isdigit(b))
{
val = (unsigned char)((b - '0') * 16);
}
else
{
val = (unsigned char)(((toupper(b) - 'A') + 10) * 16);
}
const unsigned char b1 = s[stringOffset + 1];
if (isdigit(b1))
{
val += b1 - '0';
}
else
{
val += (unsigned char)((toupper(b1) - 'A') + 10);
}
pBuffer[i] = val;
}
}
开发者ID:sharkka,项目名称:xzcapture,代码行数:35,代码来源:TString.cpp
注:本文中的_tstring类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论