本文整理汇总了C++中String::AppendString方法的典型用法代码示例。如果您正苦于以下问题:C++ String::AppendString方法的具体用法?C++ String::AppendString怎么用?C++ String::AppendString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类String
的用法示例。
在下文中一共展示了String::AppendString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: New
BasicString *Stack::Description() const
{
if (mIsNull)
return String::New("null");
String *description = String::New("[");
SinglyLinkedNode *node = mFront;
bool first = true;
Object *item;
while (node)
{
if ((item = static_cast<Object*>(node->Value)))
{
BasicString *tmp = item->Description();
if (!first)
description->AppendChar(',');
if (first)
first = false;
description->AppendString(tmp);
UnReference(tmp);
}
node = node->Next;
}
description->AppendChar(']');
return description;
}
示例2: Append
void XStringLog::Append(CTSTR tstr, UINT len, bool linefeed)
{
if (stopped) return;
String str;
str.AppendString(tstr, len);
Append(str, linefeed);
}
示例3: SaveTo
void XConfig::SaveTo(CTSTR lpPath)
{
if (RootElement)
{
String tmpPath = lpPath;
tmpPath.AppendString(TEXT(".tmp"));
XFile file;
if (file.Open(tmpPath, XFILE_WRITE, XFILE_CREATEALWAYS))
{
if (WriteFileData(file, 0, RootElement))
{
file.Close();
OSRenameFile(tmpPath, lpPath);
}
else
{
Log(TEXT("XConfig::SaveTo: WriteFileData failed while writing %s."), lpPath);
}
}
}
}
示例4: Save
void XConfig::Save()
{
if(RootElement)
{
String tmpPath = strFileName;
tmpPath.AppendString(TEXT(".tmp"));
XFile file;
if (file.Open(strFileName, XFILE_WRITE, XFILE_CREATEALWAYS))
{
if (WriteFileData(file, 0, RootElement))
{
file.Close();
OSRenameFile(tmpPath, strFileName);
}
else
{
Log(TEXT("XConfig::Save: WriteFileData failed while writing %s."), strFileName.Array());
}
}
}
}
示例5: GetData
String String::ToLower() const
{
UInt32 c;
const char* psource = GetData()->Data;
const char* pend = psource + GetData()->GetSize();
String str;
SPInt bufferOffset = 0;
char buffer[512];
while(psource < pend)
{
do {
c = UTF8Util::DecodeNextChar_Advance0(&psource);
UTF8Util::EncodeChar(buffer, &bufferOffset, OVR_towlower(wchar_t(c)));
} while ((psource < pend) && (bufferOffset < SPInt(sizeof(buffer)-8)));
// Append string a piece at a time.
str.AppendString(buffer, bufferOffset);
bufferOffset = 0;
}
return str;
}
示例6: SaveAs
BOOL ConfigFile::SaveAs(CTSTR lpPath)
{
XFile newFile;
String tmpPath = lpPath;
tmpPath.AppendString(TEXT(".tmp"));
if (newFile.Open(tmpPath, XFILE_WRITE, XFILE_CREATEALWAYS))
{
if (newFile.Write("\xEF\xBB\xBF", 3) != 3)
return FALSE;
if (!newFile.WriteAsUTF8(lpFileData))
return FALSE;
newFile.Close();
if (!OSRenameFile(tmpPath, lpPath))
Log(TEXT("ConfigFile::SaveAs: Unable to move new config file %s to %s"), tmpPath.Array(), lpPath);
strFileName = lpPath;
return TRUE;
}
return FALSE;
}
示例7: HTTPGetString
String HTTPGetString (CTSTR url, CTSTR extraHeaders, int *responseCode, String verb)
{
HINTERNET hSession = NULL;
HINTERNET hConnect = NULL;
HINTERNET hRequest = NULL;
URL_COMPONENTS urlComponents;
BOOL secure = FALSE;
String result = "";
String body = TEXT("");
String nurl = url;
String hostName, path;
const TCHAR *acceptTypes[] = {
TEXT("*/*"),
NULL
};
if (verb == TEXT("POST")){
CTSTR s = srchr(url, TEXT('?'));
body = String(s + 1);
nurl = nurl.Left(s - url);
}
hostName.SetLength(256);
path.SetLength(1024);
zero(&urlComponents, sizeof(urlComponents));
urlComponents.dwStructSize = sizeof(urlComponents);
urlComponents.lpszHostName = hostName;
urlComponents.dwHostNameLength = hostName.Length();
urlComponents.lpszUrlPath = path;
urlComponents.dwUrlPathLength = path.Length();
WinHttpCrackUrl(nurl, 0, 0, &urlComponents);
if (urlComponents.nPort == 443)
secure = TRUE;
hSession = WinHttpOpen(TEXT("gecko test"), WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0);
if (!hSession)
goto failure;
hConnect = WinHttpConnect(hSession, hostName, secure ? INTERNET_DEFAULT_HTTPS_PORT : INTERNET_DEFAULT_HTTP_PORT, 0);
if (!hConnect)
goto failure;
hRequest = WinHttpOpenRequest(hConnect, verb, path, NULL, WINHTTP_NO_REFERER, acceptTypes, secure ? WINHTTP_FLAG_SECURE|WINHTTP_FLAG_REFRESH : WINHTTP_FLAG_REFRESH);
if (!hRequest)
goto failure;
BOOL bResults = WinHttpSendRequest(hRequest, extraHeaders, extraHeaders ? -1 : 0, body.Array(),
body.Length(), body.Length(), 0);
// End the request.
if (bResults)
bResults = WinHttpReceiveResponse(hRequest, NULL);
else
goto failure;
TCHAR statusCode[8];
DWORD statusCodeLen;
statusCodeLen = sizeof(statusCode);
if (!WinHttpQueryHeaders (hRequest, WINHTTP_QUERY_STATUS_CODE, WINHTTP_HEADER_NAME_BY_INDEX, &statusCode, &statusCodeLen, WINHTTP_NO_HEADER_INDEX))
goto failure;
*responseCode = wcstoul(statusCode, NULL, 10);
if (bResults && *responseCode == 200)
{
CHAR buffer[16384];
DWORD dwSize, dwOutSize;
do
{
// Check for available data.
dwSize = 0;
if (!WinHttpQueryDataAvailable(hRequest, &dwSize))
goto failure;
if (!WinHttpReadData(hRequest, (LPVOID)buffer, dwSize, &dwOutSize))
{
goto failure;
}
else
{
if (!dwOutSize)
break;
// Ensure the string is terminated.
buffer[dwOutSize] = 0;
String b = String((LPCSTR)buffer);
result.AppendString(b);
}
} while (dwSize > 0);
//.........这里部分代码省略.........