コード例 #1
0
//
// 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
0
ファイル: FDialogTemplate.cpp プロジェクト: YggdrasiI/PBStats
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
0
ファイル: ASAPShellEx.cpp プロジェクト: Kinglions/modizer
	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
0
ファイル: prompt.cpp プロジェクト: Desch/MythCore
    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
0
ファイル: stringer.c プロジェクト: lorenzo-stoakes/weak
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
0
ファイル: Library.cpp プロジェクト: GCRC/build-couchdb
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
0
ファイル: renderer.cpp プロジェクト: 3s3s/tess-two
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
0
ファイル: Library.cpp プロジェクト: luke-chang/gecko-1
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;
}
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
0
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;
}
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
0
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
0
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
0
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
0
void CNativeW::AppendStringOld( const char* pData, int nDataLen )
{
	int nLen;
	wchar_t* szTmp=mbstowcs_new(pData,nDataLen,&nLen);
	AppendString(szTmp,nLen);
	delete[] szTmp;
}
コード例 #16
0
ファイル: XString.cpp プロジェクト: Eridia/OBS
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;
    }
}
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);
}
コード例 #18
0
ファイル: FDialogTemplate.cpp プロジェクト: YggdrasiI/PBStats
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++;
}
コード例 #19
0
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);
}
コード例 #20
0
ファイル: mateInTwo_test.c プロジェクト: lorenzo-stoakes/weak
// 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);
}
コード例 #21
0
ファイル: PIUtilitiesWin.cpp プロジェクト: jxfengzi/AirPhoto
void NumToString (const long x, Str255 s)
{
	char c[33] = "";

	s [ (s[0]=0)+1 ] = 0;
	_ltoa(x, c, 10);
	AppendString(s, (const unsigned char*)&c, 0, (short)strlen(c));
}
コード例 #22
0
ファイル: test.c プロジェクト: kgadek/kpfp
int main() {
	char a[LEN] = {'a', 'l', 'a', ' '},
		 b[LEN] = {'m', 'a', ' '},
		 c[LEN] = {'k', 'o', 't', 'a'},
		 d[LEN] = {'a', 'l', 'a', ' '},
		 e[LEN];
	printf("eCompareString: %s\n",eCompareString(a,d) == EQUAL ? "OK" : "FAIL");
	printf("eCompareString: %s\n",eCompareString(a,e) == EQUAL ? "FAIL" : "OK");
	AppendString(b,a);
	AppendString(c,a);
	printf(">[%s]< == >[ala ma kota[< ?\n", a);
	ReplaceCharactersInString(c, 'o', 'a');
	printf(">[%s%s%s]< == >[ala ma kata]< ?\n",d,b,c);
	CopyString(a,e);
	printf("CopyString: %s\n",eCompareString(a,e) == EQUAL ? "OK" : "FAIL");
	return 0;
}
コード例 #23
0
ファイル: PCL6Writer.cpp プロジェクト: looncraz/haiku
void
PCL6Writer::PJLHeader(ProtocolClass protocolClass, int dpi, const char* comment)
{
	BString string;
	AppendString("\033%-12345X@PJL JOB\n@PJL SET RESOLUTION=");
	string << dpi;
	AppendString(string.String());
	AppendString("\n@PJL ENTER LANGUAGE=PCLXL\n) HP-PCL XL;");

	const char* pc = "";
	switch (protocolClass) {
		case kProtocolClass1_1:
			pc = "1;1;";
			break;
		case kProtocolClass2_0:
			pc = "2;0;";
			break;
		case kProtocolClass2_1:
			pc = "2;1;";
			break;
		case kProtocolClass3_0:
			pc = "3;0;";
			break;
	}
	AppendString(pc);
	
	if (comment != NULL) {
		AppendString("Comment ");
		AppendString(comment);
	}
	
	AppendString("\n");
}
コード例 #24
0
ファイル: renderer.cpp プロジェクト: Annyjain29/tess-two
bool TessBoxTextRenderer::AddImageHandler(TessBaseAPI* api) {
  char* text = api->GetBoxText(imagenum());
  if (text == NULL) return false;

  AppendString(text);
  delete[] text;

  return true;
}
コード例 #25
0
ファイル: renderer.cpp プロジェクト: Annyjain29/tess-two
bool TessUnlvRenderer::AddImageHandler(TessBaseAPI* api) {
  char* unlv = api->GetUNLVText();
  if (unlv == NULL) return false;

  AppendString(unlv);
  delete[] unlv;

  return true;
}
コード例 #26
0
ファイル: renderer.cpp プロジェクト: Annyjain29/tess-two
bool TessHOcrRenderer::AddImageHandler(TessBaseAPI* api) {
  char* hocr = api->GetHOCRText(imagenum());
  if (hocr == NULL) return false;

  AppendString(hocr);
  delete[] hocr;

  return true;
}
コード例 #27
0
ファイル: prompt.cpp プロジェクト: Desch/MythCore
  void AddListBox(LPCSTR caption, DWORD style, DWORD exStyle, int x, int y, int w, int h, WORD id) {
      AddStandardComponent(0x0083, caption, style, exStyle, x, y, w, h, id);

      WORD creationDataLength = sizeof(WORD) + 5 * sizeof(WCHAR);
      AppendData(&creationDataLength, sizeof(WORD));

      AppendString("TEST");

    }
コード例 #28
0
bool TessTextRenderer::AddImageHandler(TessBaseAPI* api) {
  char* utf8 = api->GetUTF8Text();
  if (utf8 == NULL) {
    return false;
  }

  AppendString(utf8);
  delete[] utf8;

  bool pageBreak = false;
  api->GetBoolVariable("include_page_breaks", &pageBreak);
  const char* pageSeparator = api->GetStringVariable("page_separator");
  if (pageBreak) {
    AppendString(pageSeparator);
  }

  return true;
}
コード例 #29
0
ファイル: BaseResourceChooser.cpp プロジェクト: Gaerzi/SLADE
/* BaseResourceChooser::populateChoices
 * Clears and repopulates the choice list with base resource paths
 * from the ArchiveManager
 *******************************************************************/
void BaseResourceChooser::populateChoices()
{
    // Clear current items
    Clear();

    // Add <none> option
    AppendString("<none>");

    // Populate with base resource paths
    for (unsigned a = 0; a < theArchiveManager->numBaseResourcePaths(); a++)
    {
        wxFileName fn(theArchiveManager->getBaseResourcePath(a));
        AppendString(fn.GetFullName());
    }

    // Select current base resource
    SetSelection(base_resource + 1);
}
コード例 #30
0
ファイル: text_test.c プロジェクト: BKampers/JSON_C
void LongTextTest()
{
    StringBuffer buffer;
    TextStatus status;
    char* longString = malloc(65);
    memset(longString, '.', 64);
    longString[64] = '\0';
    InitializeStringBuffer(&buffer);
    status = AppendString(&buffer, longString);
    ASSERT_EQUAL_INT(TEXT_OK, status);
    ASSERT_EQUAL_INT(64, buffer.length);
    ASSERT_EQUAL_INT(64 * 2, buffer.capacity);
    status = AppendString(&buffer, longString);
    ASSERT_EQUAL_INT(TEXT_OK, status);
    EXPECT_EQUAL_INT(128, buffer.length);
    EXPECT_EQUAL_INT(64 * 3, buffer.capacity);
    free(buffer.buffer);
}