本文整理汇总了C++中AppendString函数的典型用法代码示例。如果您正苦于以下问题:C++ AppendString函数的具体用法?C++ AppendString怎么用?C++ AppendString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AppendString函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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( " )" );
}
开发者ID:johanvdw,项目名称:fdo-git-mirror,代码行数:33,代码来源:FdoRdbmsMySqlFilterProcessor.cpp
示例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++;
}
开发者ID:YggdrasiI,项目名称:PBStats,代码行数:25,代码来源:FDialogTemplate.cpp
示例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;
}
}
开发者ID:Kinglions,项目名称:modizer,代码行数:30,代码来源:ASAPShellEx.cpp
示例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);
}
}
开发者ID:Desch,项目名称:MythCore,代码行数:35,代码来源:prompt.cpp
示例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);
}
开发者ID:lorenzo-stoakes,项目名称:weak,代码行数:35,代码来源:stringer.c
示例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;
}
开发者ID:GCRC,项目名称:build-couchdb,代码行数:31,代码来源:Library.cpp
示例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;
}
开发者ID:3s3s,项目名称:tess-two,代码行数:25,代码来源:renderer.cpp
示例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;
}
开发者ID:luke-chang,项目名称:gecko-1,代码行数:31,代码来源:Library.cpp
示例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;
}
开发者ID:PolyMtl,项目名称:crash-inducing,代码行数:59,代码来源:0085dd307b8ba9833b16fa086ca7d67715277245.cpp
示例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;
}
开发者ID:kolomenkin,项目名称:TaskManagerEx,代码行数:58,代码来源:SystemInfoUI.cpp
示例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;
}
开发者ID:PolyMtl,项目名称:crash-inducing,代码行数:56,代码来源:0085dd307b8ba9833b16fa086ca7d67715277245.cpp
示例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;
}
开发者ID:ehsan,项目名称:mozilla-history,代码行数:52,代码来源:nsTextEquivUtils.cpp
示例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;
}
开发者ID:ehsan,项目名称:mozilla-history,代码行数:52,代码来源:nsTextEquivUtils.cpp
示例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;
}
开发者ID:dclarke,项目名称:services-central,代码行数:48,代码来源:nsTextEquivUtils.cpp
示例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;
}
开发者ID:daisukekoba,项目名称:sakura-editor-trunk2,代码行数:7,代码来源:CNativeW.cpp
示例16: assert
void String::InsertString(UINT dwPos, CTSTR str)
{
assert(str);
if(!str) return;
assert(dwPos <= curLength);
if(dwPos == curLength)
{
AppendString(str);
return;
}
UINT strLength = slen(str);
if(strLength)
{
lpString = (TSTR)ReAllocate(lpString, (curLength+strLength+1)*sizeof(TCHAR));
TSTR lpPos = lpString+dwPos;
mcpyrev(lpPos+strLength, lpPos, ((curLength+1)-dwPos)*sizeof(TCHAR));
mcpy(lpPos, str, strLength*sizeof(TCHAR));
curLength += strLength;
}
}
开发者ID:Eridia,项目名称:OBS,代码行数:26,代码来源:XString.cpp
示例17: AppendTextEquivFromTextContent
nsresult
nsTextEquivUtils::AppendFromDOMNode(nsIContent *aContent, nsAString *aString)
{
nsresult rv = AppendTextEquivFromTextContent(aContent, aString);
NS_ENSURE_SUCCESS(rv, rv);
if (rv != NS_OK_NO_NAME_CLAUSE_HANDLED)
return NS_OK;
if (aContent->IsXUL()) {
nsAutoString textEquivalent;
nsCOMPtr<nsIDOMXULLabeledControlElement> labeledEl =
do_QueryInterface(aContent);
if (labeledEl) {
labeledEl->GetLabel(textEquivalent);
} else {
if (aContent->NodeInfo()->Equals(nsAccessibilityAtoms::label,
kNameSpaceID_XUL))
aContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::value,
textEquivalent);
if (textEquivalent.IsEmpty())
aContent->GetAttr(kNameSpaceID_None,
nsAccessibilityAtoms::tooltiptext, textEquivalent);
}
AppendString(aString, textEquivalent);
}
return AppendFromDOMChildren(aContent, aString);
}
开发者ID:PolyMtl,项目名称:crash-inducing,代码行数:32,代码来源:0085dd307b8ba9833b16fa086ca7d67715277245.cpp
示例18: AlignData
void CDialogTemplate::AddStandardComponent(WORD type, LPCSTR caption, DWORD style,
DWORD exStyle, int x, int y, int w, int h, WORD id)
{
DLGITEMTEMPLATE item;
// DWORD algin the beginning of the component data
AlignData(sizeof(DWORD));
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));
WORD preType = 0xFFFF;
AppendData(&preType, sizeof(WORD));
AppendData(&type, sizeof(WORD));
AppendString(caption);
// Increment the component count
dialogTemplate->cdit++;
}
开发者ID:YggdrasiI,项目名称:PBStats,代码行数:28,代码来源:FDialogTemplate.cpp
示例19: GetDisplayNameEntry
void FName::ToString(FString& Out) const
{
// a version of ToString that saves at least one string copy
const FNameEntry* const NameEntry = GetDisplayNameEntry();
Out.Empty( NameEntry->GetNameLength() + 6);
AppendString(Out);
}
开发者ID:Art1stical,项目名称:AHRUnrealEngine,代码行数:7,代码来源:UnrealNames.cpp
示例20: TestMatesInTwo
// Test that our search finds example mates in one.
char*
TestMatesInTwo()
{
char *fen;
Game game;
int i, dummyVal;
Move actual, expected;
uint64_t dummy = 0;
StringBuilder builder = NewStringBuilder();
for(i = 0; i < COUNT; i++) {
fen = fens[i];
expected = ParseMove(mates[i]);
game = ParseFen(fen);
actual = Search(&game, &dummy, &dummyVal, 3);
if(actual != expected) {
AppendString(&builder, "Search failed mate-in-two for:-\n\n"
"%s\n"
"Expected move %s, engine selected %s.\n\n",
StringChessSet(&game.ChessSet), StringMove(expected), StringMove(actual));
}
}
return builder.Length == 0 ? NULL : BuildString(&builder, true);
}
开发者ID:lorenzo-stoakes,项目名称:weak,代码行数:29,代码来源:mateInTwo_test.c
注:本文中的AppendString函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论