本文整理匯總了C++中AppendString函數的典型用法代碼示例。如果您正苦於以下問題:C++ AppendString函數的具體用法?C++ AppendString怎麽用?C++ AppendString使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了AppendString函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: ProcessFunctionName
//
// The TRIM function requires special processing.
void FdoRdbmsMySqlFilterProcessor::ProcessTrimFunction( FdoFunction& expr)
{
// Append the function name and the opening bracket.
ProcessFunctionName(expr);
AppendString( "( " );
// Process the arguments. This is were the special processing is required.
// If the call includes an operator (BOTH, LEADING, TRAILING), it is required
// to add a FROM clause after the operation keyword.
FdoPtr<FdoExpressionCollection> exprCol = expr.GetArguments();
for ( int i=0; i<exprCol->GetCount(); i++ )
{
FdoPtr<FdoExpression>exp = exprCol->GetItem( i );
if ( (i == 0) && (IsDataValue( exp )) )
{
FdoDataValue *dataValue = (static_cast<FdoDataValue *>(exp.p) );
if ( dataValue->GetDataType() == FdoDataType_String )
{
FdoStringValue *stringValue = static_cast<FdoStringValue *>(dataValue);
AppendString( stringValue->GetString() );
AppendString( " FROM " );
}
else
throw FdoFilterException::Create(NlsMsgGet(FDORDBMS_29, "Unsupported FDO type in expression"));
}
else
HandleExpr( exp );
}
AppendString( " )" );
}
示例2: AppendData
void CDialogTemplate::AddComponent(LPCSTR type, LPCSTR caption, DWORD style, DWORD exStyle,
int x, int y, int w, int h, WORD id)
{
DLGITEMTEMPLATE item;
item.style = style;
item.x = x;
item.y = y;
item.cx = w;
item.cy = h;
item.id = id;
item.dwExtendedStyle = exStyle;
AppendData(&item, sizeof(DLGITEMTEMPLATE));
AppendString(type);
AppendString(caption);
WORD creationDataLength = 0;
AppendData(&creationDataLength, sizeof(WORD));
// Increment the component count
dialogTemplate->cdit++;
}
示例3: SetString
static HRESULT SetString(char *dest, REFPROPVARIANT propvar)
{
int offset = 0;
switch (propvar.vt) {
case VT_EMPTY:
dest[0] = '\0';
return S_OK;
case VT_UI4:
return sprintf(dest, "%lu", propvar.ulVal) == 4 ? S_OK : E_FAIL;
case VT_LPWSTR:
return AppendString(dest, &offset, propvar.pwszVal);
case VT_VECTOR | VT_LPWSTR:
ULONG i;
dest[0] = '\0';
for (i = 0; i < propvar.calpwstr.cElems; i++) {
HRESULT hr;
if (i > 0) {
hr = AppendString(dest, &offset, L" & ");
if (FAILED(hr))
return hr;
}
hr = AppendString(dest, &offset, propvar.calpwstr.pElems[i]);
if (FAILED(hr))
return hr;
}
return S_OK;
default:
return E_NOTIMPL;
}
}
示例4: DialogTemplate
DialogTemplate(LPCSTR caption, DWORD style,
int x, int y, int w, int h,
LPCSTR font = NULL, WORD fontSize = 8) {
usedBufferLength = sizeof(DLGTEMPLATE);
totalBufferLength = usedBufferLength;
dialogTemplate = (DLGTEMPLATE*)malloc(totalBufferLength);
dialogTemplate->style = style;
if(font != NULL) {
dialogTemplate->style |= DS_SETFONT;
}
dialogTemplate->x = (short)x;
dialogTemplate->y = (short)y;
dialogTemplate->cx = (short)w;
dialogTemplate->cy = (short)h;
dialogTemplate->cdit = 0;
dialogTemplate->dwExtendedStyle = 0;
// The dialog box doesn't have a menu or a special class
AppendData("\0", 2);
AppendData("\0", 2);
// Add the dialog's caption to the template
AppendString(caption);
if(font != NULL) {
AppendData(&fontSize, sizeof(WORD));
AppendString(font);
}
}
示例5: StringMoveHistory
char*
StringMoveHistory(MemorySlice *history, bool abbrev)
{
Move move;
Memory *curr;
Side side = White;
StringBuilder builder = NewStringBuilder();
int fullMoveCount = 1;
for(curr = history->Vals; curr != history->Curr; curr++) {
move = curr->Move;
if(abbrev) {
AppendString(&builder, "%s ", StringMove(move));
} else {
switch(side) {
case White:
AppendString(&builder, "%d. %s",
fullMoveCount, StringMove(move));
break;
case Black:
AppendString(&builder, " %s\n",
StringMove(move));
fullMoveCount++;
break;
}
}
side = OPPOSITE(side);
}
return builder.Length == 0 ? NULL : BuildString(&builder, true);
}
示例6: JS_ReportError
JSBool
Library::Name(JSContext* cx, uintN argc, jsval *vp)
{
if (argc != 1) {
JS_ReportError(cx, "libraryName takes one argument");
return JS_FALSE;
}
jsval arg = JS_ARGV(cx, vp)[0];
JSString* str = NULL;
if (JSVAL_IS_STRING(arg)) {
str = JSVAL_TO_STRING(arg);
}
else {
JS_ReportError(cx, "name argument must be a string");
return JS_FALSE;
}
AutoString resultString;
AppendString(resultString, DLL_PREFIX);
AppendString(resultString, str);
AppendString(resultString, DLL_SUFFIX);
JSString *result = JS_NewUCStringCopyN(cx, resultString.begin(),
resultString.length());
if (!result)
return JS_FALSE;
JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(result));
return JS_TRUE;
}
示例7: AppendString
bool TessHOcrRenderer::BeginDocumentHandler() {
AppendString(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n"
" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"
"<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" "
"lang=\"en\">\n <head>\n <title>\n");
AppendString(title());
AppendString(
"</title>\n"
"<meta http-equiv=\"Content-Type\" content=\"text/html;"
"charset=utf-8\" />\n"
" <meta name='ocr-system' content='tesseract " TESSERACT_VERSION_STR
"' />\n"
" <meta name='ocr-capabilities' content='ocr_page ocr_carea ocr_par"
" ocr_line ocrx_word");
if (font_info_)
AppendString(
" ocrp_lang ocrp_dir ocrp_font ocrp_fsize ocrp_wconf");
AppendString(
"'/>\n"
"</head>\n<body>\n");
return true;
}
示例8: CallArgsFromVp
bool
Library::Name(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
if (args.length() != 1) {
JS_ReportErrorASCII(cx, "libraryName takes one argument");
return false;
}
Value arg = args[0];
JSString* str = nullptr;
if (arg.isString()) {
str = arg.toString();
} else {
JS_ReportErrorASCII(cx, "name argument must be a string");
return false;
}
AutoString resultString;
AppendString(resultString, DLL_PREFIX);
AppendString(resultString, str);
AppendString(resultString, DLL_SUFFIX);
JSString* result = JS_NewUCStringCopyN(cx, resultString.begin(),
resultString.length());
if (!result)
return false;
args.rval().setString(result);
return true;
}
示例9: accessNode
nsresult
nsTextEquivUtils::AppendFromAccessible(nsIAccessible *aAccessible,
nsAString *aString)
{
nsCOMPtr<nsIAccessNode> accessNode(do_QueryInterface(aAccessible));
nsCOMPtr<nsIDOMNode> DOMNode;
accessNode->GetDOMNode(getter_AddRefs(DOMNode));
nsCOMPtr<nsIContent> content(do_QueryInterface(DOMNode));
NS_ASSERTION(content, "There is no content!");
if (content) {
nsresult rv = AppendTextEquivFromTextContent(content, aString);
if (rv != NS_OK_NO_NAME_CLAUSE_HANDLED)
return rv;
}
nsAutoString text;
nsresult rv = aAccessible->GetName(text);
NS_ENSURE_SUCCESS(rv, rv);
PRBool isEmptyTextEquiv = PR_TRUE;
// If the name is from tooltip then append it to result string in the end
// (see h. step of name computation guide).
if (rv != NS_OK_NAME_FROM_TOOLTIP)
isEmptyTextEquiv = !AppendString(aString, text);
// Implementation of f. step.
rv = AppendFromValue(aAccessible, aString);
NS_ENSURE_SUCCESS(rv, rv);
if (rv != NS_OK_NO_NAME_CLAUSE_HANDLED)
isEmptyTextEquiv = PR_FALSE;
// Implementation of g) step of text equivalent computation guide. Go down
// into subtree if accessible allows "text equivalent from subtree rule" or
// it's not root and not control.
if (isEmptyTextEquiv) {
PRUint32 role = nsAccUtils::Role(aAccessible);
PRUint32 nameRule = gRoleToNameRulesMap[role];
if (nameRule & eFromSubtreeIfRec) {
rv = AppendFromAccessibleChildren(aAccessible, aString);
NS_ENSURE_SUCCESS(rv, rv);
if (rv != NS_OK_NO_NAME_CLAUSE_HANDLED)
isEmptyTextEquiv = PR_FALSE;
}
}
// Implementation of h. step
if (isEmptyTextEquiv && !text.IsEmpty()) {
AppendString(aString, text);
return NS_OK;
}
return rv;
}
示例10: _T
int SystemMemoryMapInformation::MEMORY_INFORMATION::Insert( CSystemInfoListCtrl& list,
size_t iItem, size_t iItemCount, BOOL bExpandRegions) const
{
iItem; // use var
iItemCount; // use var
CString strBaseAddress, strSize, strType, strBlockCount, strProtect, strDescription;
strBaseAddress.Format(FMT_REAL_DYN_PTR,
(bRegion ? vmq.pvRgnBaseAddress : vmq.pvBlkBaseAddress ) );
strSize.Format( _T("%Id"),
(bRegion ? vmq.RgnSize : vmq.BlkSize ) );
strType = GetMemStorageText( (bRegion ? vmq.dwRgnStorage : vmq.dwBlkStorage ) );
if( vmq.dwBlkStorage != MEM_FREE )
{
strProtect = GetProtectText(
(bRegion ? vmq.dwRgnProtection : vmq.dwBlkProtection ), FALSE );
}
if( bRegion )
{
if( vmq.dwBlkStorage != MEM_FREE )
{
strBlockCount.Format( _T("%d"), vmq.dwRgnBlocks );
}
if( vmq.fRgnIsAStack )
{
AppendString( strDescription, LocLoadString(IDS_MEMORY_THREAD_STACK) );
}
AppendString( strDescription, Module );
AppendString( strDescription, MappedFile );
}
int iListItemCount = list.GetItemCount();
int nPos = list.InsertItem( iListItemCount, _T("") );
if( bExpandRegions && !bRegion )
{
LVITEM item;
ZeroMemory( &item, sizeof(item) );
item.iItem = nPos;
item.iSubItem = 0; // whole item
item.mask = LVIF_INDENT;
item.iIndent = 20 / LIST_IMAGE_WIDTH;
list.SetItem( &item );
}
list.SetItemText( nPos, 0, strBaseAddress );
list.SetItemText( nPos, 1, strSize );
list.SetItemText( nPos, 2, strType );
list.SetItemText( nPos, 3, strBlockCount );
list.SetItemText( nPos, 4, strProtect );
list.SetItemText( nPos, 5, strDescription );
return nPos;
}
示例11: NS_ENSURE_SUCCESS
nsresult
nsTextEquivUtils::AppendFromValue(nsIAccessible *aAccessible,
nsAString *aString)
{
PRUint32 role = nsAccUtils::Role(aAccessible);
PRUint32 nameRule = gRoleToNameRulesMap[role];
if (nameRule != eFromValue)
return NS_OK_NO_NAME_CLAUSE_HANDLED;
// Implementation of step f. of text equivalent computation. If the given
// accessible is not root accessible (the accessible the text equivalent is
// computed for in the end) then append accessible value. Otherwise append
// value if and only if the given accessible is in the middle of its parent.
nsAutoString text;
if (aAccessible != gInitiatorAcc) {
nsresult rv = aAccessible->GetValue(text);
NS_ENSURE_SUCCESS(rv, rv);
return AppendString(aString, text) ?
NS_OK : NS_OK_NO_NAME_CLAUSE_HANDLED;
}
nsRefPtr<nsAccessible> acc = do_QueryObject(aAccessible);
nsCOMPtr<nsIDOMNode> node;
acc->GetDOMNode(getter_AddRefs(node));
NS_ENSURE_STATE(node);
nsCOMPtr<nsIContent> content(do_QueryInterface(node));
NS_ENSURE_STATE(content);
nsCOMPtr<nsIContent> parent = content->GetParent();
PRInt32 indexOf = parent->IndexOf(content);
for (PRInt32 i = indexOf - 1; i >= 0; i--) {
// check for preceding text...
if (!parent->GetChildAt(i)->TextIsOnlyWhitespace()) {
PRUint32 childCount = parent->GetChildCount();
for (PRUint32 j = indexOf + 1; j < childCount; j++) {
// .. and subsequent text
if (!parent->GetChildAt(j)->TextIsOnlyWhitespace()) {
nsresult rv = aAccessible->GetValue(text);
NS_ENSURE_SUCCESS(rv, rv);
return AppendString(aString, text) ?
NS_OK : NS_OK_NO_NAME_CLAUSE_HANDLED;
break;
}
}
break;
}
}
return NS_OK_NO_NAME_CLAUSE_HANDLED;
}
示例12: AppendTextEquivFromTextContent
nsresult
nsTextEquivUtils::AppendFromAccessible(nsAccessible *aAccessible,
nsAString *aString)
{
//XXX: is it necessary to care the accessible is not a document?
if (aAccessible->IsContent()) {
nsresult rv = AppendTextEquivFromTextContent(aAccessible->GetContent(),
aString);
if (rv != NS_OK_NO_NAME_CLAUSE_HANDLED)
return rv;
}
nsAutoString text;
nsresult rv = aAccessible->GetName(text);
NS_ENSURE_SUCCESS(rv, rv);
bool isEmptyTextEquiv = true;
// If the name is from tooltip then append it to result string in the end
// (see h. step of name computation guide).
if (rv != NS_OK_NAME_FROM_TOOLTIP)
isEmptyTextEquiv = !AppendString(aString, text);
// Implementation of f. step.
rv = AppendFromValue(aAccessible, aString);
NS_ENSURE_SUCCESS(rv, rv);
if (rv != NS_OK_NO_NAME_CLAUSE_HANDLED)
isEmptyTextEquiv = PR_FALSE;
// Implementation of g) step of text equivalent computation guide. Go down
// into subtree if accessible allows "text equivalent from subtree rule" or
// it's not root and not control.
if (isEmptyTextEquiv) {
PRUint32 nameRule = gRoleToNameRulesMap[aAccessible->Role()];
if (nameRule & eFromSubtreeIfRec) {
rv = AppendFromAccessibleChildren(aAccessible, aString);
NS_ENSURE_SUCCESS(rv, rv);
if (rv != NS_OK_NO_NAME_CLAUSE_HANDLED)
isEmptyTextEquiv = PR_FALSE;
}
}
// Implementation of h. step
if (isEmptyTextEquiv && !text.IsEmpty()) {
AppendString(aString, text);
return NS_OK;
}
return rv;
}
示例13: NS_ENSURE_SUCCESS
nsresult
nsTextEquivUtils::AppendFromValue(nsAccessible *aAccessible,
nsAString *aString)
{
PRUint32 nameRule = gRoleToNameRulesMap[aAccessible->Role()];
if (nameRule != eFromValue)
return NS_OK_NO_NAME_CLAUSE_HANDLED;
// Implementation of step f. of text equivalent computation. If the given
// accessible is not root accessible (the accessible the text equivalent is
// computed for in the end) then append accessible value. Otherwise append
// value if and only if the given accessible is in the middle of its parent.
nsAutoString text;
if (aAccessible != gInitiatorAcc) {
nsresult rv = aAccessible->GetValue(text);
NS_ENSURE_SUCCESS(rv, rv);
return AppendString(aString, text) ?
NS_OK : NS_OK_NO_NAME_CLAUSE_HANDLED;
}
//XXX: is it necessary to care the accessible is not a document?
if (aAccessible->IsDocumentNode())
return NS_ERROR_UNEXPECTED;
nsIContent *content = aAccessible->GetContent();
nsCOMPtr<nsIContent> parent = content->GetParent();
PRInt32 indexOf = parent->IndexOf(content);
for (PRInt32 i = indexOf - 1; i >= 0; i--) {
// check for preceding text...
if (!parent->GetChildAt(i)->TextIsOnlyWhitespace()) {
PRUint32 childCount = parent->GetChildCount();
for (PRUint32 j = indexOf + 1; j < childCount; j++) {
// .. and subsequent text
if (!parent->GetChildAt(j)->TextIsOnlyWhitespace()) {
nsresult rv = aAccessible->GetValue(text);
NS_ENSURE_SUCCESS(rv, rv);
return AppendString(aString, text) ?
NS_OK : NS_OK_NO_NAME_CLAUSE_HANDLED;
break;
}
}
break;
}
}
return NS_OK_NO_NAME_CLAUSE_HANDLED;
}
示例14: AppendString
nsresult
nsTextEquivUtils::AppendFromValue(nsAccessible *aAccessible,
nsAString *aString)
{
PRUint32 nameRule = gRoleToNameRulesMap[aAccessible->Role()];
if (nameRule != eFromValue)
return NS_OK_NO_NAME_CLAUSE_HANDLED;
// Implementation of step f. of text equivalent computation. If the given
// accessible is not root accessible (the accessible the text equivalent is
// computed for in the end) then append accessible value. Otherwise append
// value if and only if the given accessible is in the middle of its parent.
nsAutoString text;
if (aAccessible != gInitiatorAcc) {
aAccessible->Value(text);
return AppendString(aString, text) ?
NS_OK : NS_OK_NO_NAME_CLAUSE_HANDLED;
}
//XXX: is it necessary to care the accessible is not a document?
if (aAccessible->IsDocumentNode())
return NS_ERROR_UNEXPECTED;
nsIContent *content = aAccessible->GetContent();
for (nsIContent* childContent = content->GetPreviousSibling(); childContent;
childContent = childContent->GetPreviousSibling()) {
// check for preceding text...
if (!childContent->TextIsOnlyWhitespace()) {
for (nsIContent* siblingContent = content->GetNextSibling(); siblingContent;
siblingContent = siblingContent->GetNextSibling()) {
// .. and subsequent text
if (!siblingContent->TextIsOnlyWhitespace()) {
aAccessible->Value(text);
return AppendString(aString, text) ?
NS_OK : NS_OK_NO_NAME_CLAUSE_HANDLED;
break;
}
}
break;
}
}
return NS_OK_NO_NAME_CLAUSE_HANDLED;
}
示例15: AppendString
void CNativeW::AppendStringOld( const char* pData, int nDataLen )
{
int nLen;
wchar_t* szTmp=mbstowcs_new(pData,nDataLen,&nLen);
AppendString(szTmp,nLen);
delete[] szTmp;
}