本文整理汇总了C++中CStdString::append方法的典型用法代码示例。如果您正苦于以下问题:C++ CStdString::append方法的具体用法?C++ CStdString::append怎么用?C++ CStdString::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStdString
的用法示例。
在下文中一共展示了CStdString::append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetKeyName
CStdString CKeyboardStat::GetKeyName(int KeyID)
{ int keyid;
CStdString keyname;
keyname.clear();
// Get modifiers
if (KeyID & CKey::MODIFIER_CTRL)
keyname.append("ctrl-");
if (KeyID & CKey::MODIFIER_SHIFT)
keyname.append("shift-");
if (KeyID & CKey::MODIFIER_ALT)
keyname.append("alt-");
if (KeyID & CKey::MODIFIER_SUPER)
keyname.append("win-");
// Now get the key name
keyid = KeyID & 0x0FFF;
if (keyid > NUM_KEYNAMES)
keyname.AppendFormat("%i", keyid);
else if (!keynames[keyid])
keyname.AppendFormat("%i", keyid);
else
keyname.append(keynames[keyid]);
keyname.AppendFormat(" (%02x)", KeyID);
return keyname;
}
示例2: GetConnectionInfo
std::string CCECClient::GetConnectionInfo(void)
{
CStdString strLog;
strLog.Format("libCEC version = %s, client version = %s, firmware version = %d", ToString((cec_server_version)m_configuration.serverVersion), ToString((cec_client_version)m_configuration.clientVersion), m_configuration.iFirmwareVersion);
if (m_configuration.iFirmwareBuildDate != CEC_FW_BUILD_UNKNOWN)
{
time_t buildTime = (time_t)m_configuration.iFirmwareBuildDate;
strLog.AppendFormat(", firmware build date: %s", asctime(gmtime(&buildTime)));
strLog = strLog.Left((int)strLog.length() - 1); // strip \n added by asctime
strLog.append(" +0000");
}
// log the addresses that are being used
if (!m_configuration.logicalAddresses.IsEmpty())
{
strLog.append(", logical address(es) = ");
CECDEVICEVEC devices;
m_processor->GetDevices()->GetByLogicalAddresses(devices, m_configuration.logicalAddresses);
for (CECDEVICEVEC::iterator it = devices.begin(); it != devices.end(); it++)
strLog.AppendFormat("%s (%X) ", (*it)->GetLogicalAddressName(), (*it)->GetLogicalAddress());
}
if (!CLibCEC::IsValidPhysicalAddress(m_configuration.iPhysicalAddress))
strLog.AppendFormat(", base device: %s (%X), HDMI port number: %d", ToString(m_configuration.baseDevice), m_configuration.baseDevice, m_configuration.iHDMIPort);
else
strLog.AppendFormat(", physical address: %04x", m_configuration.iPhysicalAddress);
strLog.AppendFormat(", %s", LIB_CEC->GetLibInfo());
std::string strReturn(strLog.c_str());
return strReturn;
}
示例3: Delete
bool CEpgDatabase::Delete(const CEpg &table, const CDateTime &start /* = NULL */, const CDateTime &end /* = NULL */)
{
/* invalid channel */
if (table.EpgID() <= 0)
{
CLog::Log(LOGERROR, "EpgDB - %s - invalid channel id: %d",
__FUNCTION__, table.EpgID());
return false;
}
CLog::Log(LOGDEBUG, "EpgDB - %s - clearing the EPG '%d'",
__FUNCTION__, table.EpgID());
CStdString strWhereClause;
strWhereClause = FormatSQL("idEpg = %u", table.EpgID());
if (start != NULL)
{
time_t iStartTime;
start.GetAsTime(iStartTime);
strWhereClause.append(FormatSQL(" AND iStartTime < %u", iStartTime).c_str());
}
if (end != NULL)
{
time_t iEndTime;
end.GetAsTime(iEndTime);
strWhereClause.append(FormatSQL(" AND iEndTime > %u", iEndTime).c_str());
}
return DeleteValues("epgtags", strWhereClause);
}
示例4: GetKeyName
CStdString CKeyboardStat::GetKeyName(int KeyID)
{ int keyid;
CStdString keyname;
XBMCKEYTABLE keytable;
keyname.clear();
// Get modifiers
if (KeyID & CKey::MODIFIER_CTRL)
keyname.append("ctrl-");
if (KeyID & CKey::MODIFIER_SHIFT)
keyname.append("shift-");
if (KeyID & CKey::MODIFIER_ALT)
keyname.append("alt-");
if (KeyID & CKey::MODIFIER_SUPER)
keyname.append("win-");
// Now get the key name
keyid = KeyID & 0xFF;
if (KeyTableLookupVKeyName(keyid, &keytable))
keyname.append(keytable.keyname);
else
keyname.AppendFormat("%i", keyid);
keyname.AppendFormat(" (%02x)", KeyID);
return keyname;
}
示例5: GetUAWindowsVersion
CStdString CSysInfo::GetUAWindowsVersion()
{
OSVERSIONINFOEX osvi = {};
osvi.dwOSVersionInfoSize = sizeof(osvi);
CStdString strVersion = "Windows NT";
if (GetVersionEx((OSVERSIONINFO *)&osvi))
{
strVersion.AppendFormat(" %d.%d", osvi.dwMajorVersion, osvi.dwMinorVersion);
}
SYSTEM_INFO si = {};
GetSystemInfo(&si);
BOOL bIsWow = FALSE;
if (IsWow64Process(GetCurrentProcess(), &bIsWow))
{
if (bIsWow)
{
strVersion.append(";WOW64");
GetNativeSystemInfo(&si); // different function to read the info under Wow
}
}
if (si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64)
strVersion.append(";Win64;x64");
else if (si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_IA64)
strVersion.append(";Win64;IA64");
return strVersion;
}
示例6: FormatWindowsError
void FormatWindowsError(int iErrorCode, CStdString &strMessage)
{
if (iErrorCode != ERROR_SUCCESS)
{
char strAddMessage[1024];
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, iErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), strAddMessage, 1024, NULL);
strMessage.append(": ");
strMessage.append(strAddMessage);
}
}
示例7: ResolveSymlink
bool CAFPDirectory::ResolveSymlink( const CStdString &dirName, const CStdString &fileName,
struct stat *stat, CURL &resolvedUrl)
{
CSingleLock lock(gAfpConnection);
int ret = 0;
bool retVal = true;
char resolvedLink[MAX_PATH];
CStdString fullpath = dirName;
URIUtils::AddSlashAtEnd(fullpath);
fullpath += fileName;
CPasswordManager::GetInstance().AuthenticateURL(resolvedUrl);
resolvedUrl.SetProtocol("afp");
resolvedUrl.SetHostName(gAfpConnection.GetConnectedIp());
ret = gAfpConnection.GetImpl()->afp_wrap_readlink(gAfpConnection.GetVolume(), fullpath.c_str(), resolvedLink, MAX_PATH);
if(ret == 0)
{
fullpath = dirName;
URIUtils::AddSlashAtEnd(fullpath);
fullpath.append(resolvedLink);
if(resolvedLink[0] == '/')
{
//use the special stat function for using an extra context
//because we are inside of a dir traversation
//and just can't change the global nfs context here
//without destroying something...
fullpath = resolvedLink;
fullpath = fullpath.Right(fullpath.length()-1);
resolvedUrl.SetFileName(fullpath);
ret = gAfpConnection.stat(resolvedUrl, stat);
if(ret < 0)
{
URIUtils::AddSlashAtEnd(fullpath);
resolvedUrl.SetFileName(fullpath);
ret = gAfpConnection.stat(resolvedUrl, stat);
}
}
else
{
ret = gAfpConnection.GetImpl()->afp_wrap_getattr(gAfpConnection.GetVolume(), fullpath.c_str(), stat);
resolvedUrl.SetFileName(gAfpConnection.GetUrl()->volumename + fullpath);
}
if (ret != 0)
{
CLog::Log(LOGERROR, "AFP: Failed to stat(%s) on link resolve %s\n", fullpath.c_str(), strerror(errno));
retVal = false;;
}
}
else
{
CLog::Log(LOGERROR, "Failed to readlink(%s) %s\n", fullpath.c_str(), strerror(errno));
retVal = false;
}
return retVal;
}
示例8: ReadFileContents
bool ReadFileContents(CStdString const &strFileName, CStdString &strContent)
{
void* fileHandle = XBMC->OpenFile(strFileName.c_str(), 0);
if (fileHandle)
{
char buffer[1024];
while (XBMC->ReadFileString(fileHandle, buffer, 1024))
strContent.append(buffer);
XBMC->CloseFile(fileHandle);
return true;
}
return false;
}
示例9: Delete
bool CEpgDatabase::Delete(const CEpg &table, const time_t start /* = 0 */, const time_t end /* = 0 */)
{
/* invalid channel */
if (table.EpgID() <= 0)
{
CLog::Log(LOGERROR, "EpgDB - %s - invalid channel id: %d",
__FUNCTION__, table.EpgID());
return false;
}
CStdString strWhereClause;
strWhereClause = FormatSQL("idEpg = %u", table.EpgID());
if (start != 0)
strWhereClause.append(FormatSQL(" AND iStartTime >= %u", start).c_str());
if (end != 0)
strWhereClause.append(FormatSQL(" AND iEndTime <= %u", end).c_str());
CSingleLock lock(m_critSection);
return DeleteValues("epgtags", strWhereClause);
}
示例10: ReadFile
bool CFileCurl::ReadFile(const CStdString &fileName, CStdString &out)
{
XFILE::CFile file;
if (file.Open(fileName))
{
char buffer[16384];
unsigned int size_read;
while( (size_read = file.Read(buffer, sizeof(buffer)) ) > 0 )
out.append(buffer, size_read);
file.Close();
return true;
}
return false;
}
示例11: EraseEpgForChannel
bool CPVRDatabase::EraseEpgForChannel(const CPVRChannel &channel, const CDateTime &start /* = NULL */, const CDateTime &end /* = NULL */)
{
/* invalid channel */
if (channel.ChannelID() <= 0)
{
CLog::Log(LOGERROR, "PVRDB - %s - invalid channel id: %li",
__FUNCTION__, channel.ChannelID());
return false;
}
CLog::Log(LOGDEBUG, "PVRDB - %s - clearing the EPG for channel '%s'",
__FUNCTION__, channel.ChannelName().c_str());
CStdString strWhereClause;
strWhereClause = FormatSQL("ChannelId = %u", channel.ChannelID());
if (start != NULL)
strWhereClause.append(FormatSQL(" AND StartTime < %u", start.GetAsDBDateTime().c_str()).c_str());
if (end != NULL)
strWhereClause.append(FormatSQL(" AND EndTime > %u", end.GetAsDBDateTime().c_str()).c_str());
return DeleteValues("EpgData", strWhereClause);
}
示例12: ReadResponses
//Receive until error or \n
bool Socket::ReadResponses(int &code, vector<CStdString> &lines)
{
int result;
char buffer[4096]; // this buff size has to be known in server
code = 0;
bool readComplete = false;
CStdString bigString = "";
do
{
result = recv(_sd, buffer, sizeof(buffer) - 1, 0);
if (result < 0) // if result is negative, the socket is bad
{
#ifdef TARGET_WINDOWS
int errorCode = WSAGetLastError();
XBMC->Log(LOG_DEBUG, "ReadResponse ERROR - recv failed, Err: %d", errorCode);
#else
XBMC->Log(LOG_DEBUG, "ReadResponse ERROR - recv failed");
#endif
code = 1;
_sd = INVALID_SOCKET;
return false;
}
if (result > 0) // if we got data from the server in this last pass
{
buffer[result] = 0; // insert end of string marker
bigString.append(buffer); // accumulate all the reads
}
} while (result > 0); // keep reading until result returns '0', meaning server is done sending reponses
if (EndsWith(bigString, "<EOF>"))
{
readComplete = true; // all server data has benn read
lines = split(bigString, "<EOL>", true); // split each reponse by <EOL> delimiters
lines.erase(lines.end() - 1); // erase <EOF> at end
}
else
{
XBMC->Log(LOG_DEBUG, "ReadResponse ERROR - <EOF> in read reponses not found");
_sd = INVALID_SOCKET;
}
return readComplete;
}
示例13: while
// curl calls this routine to debug
extern "C" int debug_callback(CURL_HANDLE *handle, curl_infotype info, char *output, size_t size, void *data)
{
if (info == CURLINFO_DATA_IN || info == CURLINFO_DATA_OUT)
return 0;
CStdString strLine;
strLine.append(output, size);
std::vector<CStdString> vecLines;
CUtil::Tokenize(strLine, vecLines, "\r\n");
std::vector<CStdString>::const_iterator it = vecLines.begin();
while (it != vecLines.end()) {
CLog::Log(LOGDEBUG, "Curl::Debug %s", (*it).c_str());
it++;
}
return 0;
}
示例14:
void CWIN32Util::ExtendDllPath()
{
CStdString strEnv;
CStdStringArray vecEnv;
strEnv = CEnvironment::getenv("PATH");
if (strEnv.IsEmpty())
CLog::Log(LOGWARNING, "Can get system env PATH or PATH is empty");
StringUtils::SplitString(DLL_ENV_PATH, ";", vecEnv);
for (int i=0; i<(int)vecEnv.size(); ++i)
strEnv.append(";" + CSpecialProtocol::TranslatePath(vecEnv[i]));
if (CEnvironment::setenv("PATH", strEnv) == 0)
CLog::Log(LOGDEBUG,"Setting system env PATH to %S",strEnv.c_str());
else
CLog::Log(LOGDEBUG,"Can't set system env PATH to %S",strEnv.c_str());
}
示例15: ReadData
bool CFileCurl::ReadData(CStdString& strHTML)
{
int size_read = 0;
int data_size = 0;
strHTML = "";
char buffer[16384];
while( (size_read = Read(buffer, sizeof(buffer)) ) > 0 )
{
strHTML.append(buffer, size_read);
data_size += size_read;
}
if (m_state->m_fileSize > 0 && m_state->m_fileSize != data_size)
{
CLog::Log(LOGDEBUG,"%s - not all data retrieved! (%d from %"PRId64"). aborting.", __FUNCTION__, data_size, m_state->m_fileSize);
return false;
}
if (m_state->m_cancelled)
return false;
return true;
}