本文整理汇总了C++中tstring::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ tstring::empty方法的具体用法?C++ tstring::empty怎么用?C++ tstring::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tstring
的用法示例。
在下文中一共展示了tstring::empty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: save
void CConfig::save(const tstring& sFile)
{
if(!sFile.empty())
{
m_sPath = sFile;
}
CXMLElement* pXML = new CXMLElement(NULL,_T("config"));
list<CParamItem*>::iterator iter = m_items.begin();
while (iter != m_items.end())
{
(*iter)->save(pXML);
iter++;
}
pXML->toFile(m_sPath,true);
delete pXML;
}
示例2: setRemoteAddr
bool CgcUdpClient::setRemoteAddr(const tstring & sRemoteAddr)
{
if (sRemoteAddr.empty()) return false;
if (sRemoteAddr==m_ipRemote.address())
return true;
std::vector<std::string> pList;
if (CgcBaseClient::ParseString(sRemoteAddr.c_str(),":",pList)==2)
{
std::string sIp;
for (int i=0;i<20;i++)
{
sIp = CgcBaseClient::GetHostIp(pList[0].c_str(),"");
if (!sIp.empty())
break;
#ifdef WIN32
Sleep(100);
#else
usleep(100000);
#endif
}
if (sIp.empty())
{
// *
return false;
sIp = pList[0];
}
unsigned short nPort = atoi(pList[1].c_str());
if (m_ipRemote.getport()!=nPort || m_ipRemote.getip()!=sIp)
{
m_ipRemote.address(sIp,nPort);
boost::system::error_code ec;
m_endpointRemote.address(boost::asio::ip::address_v4::from_string(sIp.c_str(),ec));
m_endpointRemote.port(nPort);
}
if (m_udpClient.get()!=NULL && m_udpClient->socket()!=NULL)
{
boost::system::error_code ec;
m_udpClient->socket()->connect(m_endpointRemote,ec);
}
return true;
}
return false;
}
示例3: BuildIO
inline bool CMapMatchImpl::BuildIO(const tstring &strCon)
{
assert(m_explainer);
if(strCon.empty())
{
#if __UE_WINDOWS__
m_io = new CWinComIO(strCon, *m_explainer);
#else
#pragma message(__FILE__">> Need COMM functions invloved by current platform!")
#endif
}
else
{
m_io = new CFileIO(strCon, *m_explainer);
}
return m_io != 0;
}
示例4: _isFileExistInternal
bool FileUtils::_isFileExistInternal(const tstring& strFilePath) const
{
if (strFilePath.empty()) return false;
tstring strPath = strFilePath;
#ifdef SHEET_X_UNICODE
DWORD attr = GetFileAttributesW(strPath.c_str());
#else
static WCHAR utf16Buf[512] = {0};
MultiByteToWideChar(CP_ACP, 0, strPath.c_str(), -1, utf16Buf, sizeof(utf16Buf)/sizeof(utf16Buf[0]));
DWORD attr = GetFileAttributesW(utf16Buf);
#endif
if(attr == INVALID_FILE_ATTRIBUTES || (attr & FILE_ATTRIBUTE_DIRECTORY))
return false; // not a file
return true;
}
示例5: onEndTestSet
void onEndTestSet()
{
ASSERT(s_currentTestCase.empty());
ASSERT(s_currentTestCaseAsserts.empty());
if (!s_quiet && !s_verbose)
{
tcout << std::endl;
}
if (!s_failures.empty())
{
const tstring failureCount = (s_quiet) ? Core::fmt(TXT(" %s: %u failure(s)"), s_currentTestSet.c_str(), s_failures.size())
: Core::fmt(TXT(" %u failure(s)"), s_failures.size());
tcout << std::endl;
tcout << failureCount << std::endl;
for (size_t i = 0; i != s_failures.size(); ++i)
{
debugWrite(TXT(" > %s\n"), s_failures[i].c_str());
tcout << TXT(" > ") << s_failures[i] << std::endl;
for (size_t j = 0; j != s_failuresAsserts[i].size(); ++j)
{
debugWrite(TXT(" %s\n"), s_failuresAsserts[i][j].c_str());
tcout << TXT(" ") << s_failuresAsserts[i][j] << std::endl;
}
}
}
if (!s_quiet)
{
tcout << std::endl;
}
s_currentTestSet.clear();
s_failures.clear();
s_failuresAsserts.clear();
s_executed.clear();
s_setup = nullptr;
s_teardown = nullptr;
}
示例6: HandleCustomPic
BOOL CMainWindow::HandleCustomPic(CRichEditUI * pRichEdit, LPCTSTR& p, tstring& strText)
{
tstring strFileName = GetBetweenString(p+2, _T("[\""), _T("\"]"));
if (!strFileName.empty())
{
if (!strText.empty())
{
_RichEdit_ReplaceSel(pRichEdit, strText.c_str());
strText = _T("");
}
_RichEdit_InsertFace(pRichEdit, strFileName.c_str(), -1, -1);
p = _tcsstr(p+2, _T("\"]"));
p++;
return TRUE;
}
return FALSE;
}
示例7: HasGotSubEntries
bool FolderTree::HasGotSubEntries(const tstring &sDirectory)
{
if(sDirectory.empty())
return false;
if(DriveHasRemovableMedia(sDirectory))
{
return true; //we do not bother searching for files on drives
//which have removable media as this would cause
//the drive to spin up, which for the case of a
//floppy is annoying
}
else
{
//First check to see if there is any sub directories
tstring sFile;
if (sDirectory[sDirectory.size()-1] == _T('\\'))
sFile = sDirectory + _T("*.*");
else
sFile = sDirectory + _T("\\*.*");
WIN32_FIND_DATA fData;
HANDLE hFind;
hFind = FindFirstFile(sFile.c_str(), &fData);
if(hFind != INVALID_HANDLE_VALUE)
{
do
{
tstring cFileName = fData.cFileName;
if((fData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) &&
(cFileName != _T(".")) && (cFileName != _T("..")))
{
FindClose(hFind);
return true;
}
} while (FindNextFile(hFind, &fData));
}
FindClose(hFind);
}
return false;
}
示例8: load
void CConfig::load(const tstring& sFile)
{
if(!sFile.empty())
{
m_sPath = sFile;
}
CXMLElement* pXML = CXMLElement::fromFile(m_sPath);
if(pXML == NULL)
return;
list<CParamItem*>::iterator iter = m_items.begin();
while (iter != m_items.end())
{
(*iter)->load(pXML);
iter++;
}
delete pXML;
}
示例9: getItem
bool AsGroupsDlg::getItem(tstring& name, bool checkSel) {
{
CEdit wnd;
wnd.Attach(GetDlgItem(IDC_NAME));
name = WinUtil::getEditText(wnd);
wnd.Detach();
if (name.empty()) {
MessageBox(_T("You must enter a group name!"), CTSTRING(MANAGE_GROUPS), MB_ICONERROR);
return false;
}
else {
int32_t pos = findGroup(name.c_str());
if (pos != -1 && (checkSel == false || pos != ctrlGroups.GetSelectedIndex())) {
MessageBox(_T("Item already exists!"), CTSTRING(MANAGE_GROUPS), MB_ICONERROR);
return false;
}
}
}
return true;
}
示例10: output
/********************************************************************
* [函数名]: output
* [描述]: 打印信息
* [修改记录]:
* 2015-05-20,littledj: create
********************************************************************/
void GLogger::output(const tstring& msg, PRINT_COLOR color)
{
if (msg.empty())
output_screen(TEXT("<empty message>"), color);
// 判断是否输出到屏幕
if (m_wpTarget == PRINT_TARGET::SCREEN)
output_screen(msg, color);
// 判断是否输出到日志文件
else if (m_wpTarget == PRINT_TARGET::FILE)
output_file(msg);
// 都输出
else if (m_wpTarget == PRINT_TARGET::BOTH)
{
output_screen(msg, color);
output_file(msg);
}
}
示例11:
int CDBTableCollection::IndexOf(const tstring& tbl)
{
int iRet = -1;
if(tbl.empty())
{
_ASSERT(false);
return iRet;
}
for (DBTableCollection::const_iterator iter = Tables.begin(); iter != Tables.end(); ++iter)
{
++iRet;
if((*iter)->GetName() == tbl)
{
return iRet;
}
}
return -1;
}
示例12: FindValueInExpandedString
// Find a string value within an expanded string, returns the offset if found, else string::npos
// We need to match the entire string, so that we can match '3' in the following
// 1,2,33,3 and not match the 33
tstring::size_type FindValueInExpandedString(const tstring& szData, const tstring& szSearch, tstring::size_type iValueIndex)
{
if (szData.empty())
return tstring::npos;
bool bCompleted = false;
size_t iValueOffset = 0;
tstring szTmpVal;
if (iValueIndex > 0)
iValueOffset = iValueIndex;
else
iValueIndex = tstring::npos;
while (!bCompleted)
{
if (iValueOffset >= szData.length())
{
bCompleted = true;
continue;
}
tstring::size_type iTmpIndex = szData.find(_T(";"), iValueOffset);
if (iTmpIndex != tstring::npos)
szTmpVal = szData.substr(iValueOffset, iTmpIndex - iValueOffset); // Grab up to the next seperator
else
szTmpVal = szData.substr(iValueOffset, szData.length()); // Grab up to the end of the line
if (szTmpVal == szSearch) // Found it so stop searching
{
iValueIndex = iValueOffset;
bCompleted = true;
continue;
}
iValueOffset += szTmpVal.length() + 1; // Move to the next entry
}
return iValueIndex;
}
示例13: HandleSysFaceIndex
BOOL CMainWindow::HandleSysFaceIndex(CRichEditUI * pRichEdit, LPCTSTR& p, tstring& strText)
{
int nFaceIndex = GetBetweenInt(p+2, _T("[\""), _T("\"]"), -1);
CFaceInfo * lpFaceInfo = m_FaceList.GetFaceInfoByIndex(nFaceIndex);
if (lpFaceInfo != NULL)
{
if (!strText.empty())
{
_RichEdit_ReplaceSel(pRichEdit, strText.c_str());
strText = _T("");
}
_RichEdit_InsertFace(pRichEdit, lpFaceInfo->m_strFileName.c_str(),
lpFaceInfo->m_nId, lpFaceInfo->m_nIndex);
p = _tcsstr(p+2, _T("\"]"));
p++;
return TRUE;
}
return FALSE;
}
示例14: Read
///////////////////////////////////////////////////////////////////////////////
// Reads a value from the registry. You can specify a relative path and the
// actual key to read. The value parameter will be populated with valid data
// if this function returns true.
//
// The relativePath parameter should be separated by forward-slashes, but not
// start with one. Example: Foo/Bar
//
bool SimpleConfig::Read( const tstring& relativePath, const tstring& key, tstring& value )
{
bool wasRead = false;
wxString oldPath = m_Config->GetPath();
if ( !relativePath.empty() )
{
m_Config->SetPath( relativePath.c_str() );
}
wxString wxVal;
if ( m_Config->Read( key.c_str(), &wxVal ) )
{
value = wxVal.c_str();
wasRead = true;
}
m_Config->SetPath( oldPath );
return wasRead;
}
示例15: onStartTestSet
void onStartTestSet(const tchar* name)
{
ASSERT(tstrlen(name) != 0);
ASSERT(s_currentTestCase.empty());
ASSERT(s_currentTestCaseAsserts.empty());
if (!s_quiet)
{
tcout << name << std::endl;
if (!s_verbose)
tcout << TXT(" ");
}
s_currentTestSet = name;
s_failures.clear();
s_failuresAsserts.clear();
s_executed.clear();
s_setup = nullptr;
s_teardown = nullptr;
}