• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Append函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Append函数的典型用法代码示例。如果您正苦于以下问题:C++ Append函数的具体用法?C++ Append怎么用?C++ Append使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Append函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: Append

void SQArray::Extend(const SQArray *a){
	SQInteger xlen;
	if((xlen=a->Size()))
		for(SQInteger i=0;i<xlen;i++)
			Append(a->_values[i]);
}
开发者ID:Heartbroken,项目名称:bikini,代码行数:6,代码来源:sqobject.cpp


示例2: LOG

std::unique_ptr<Ephemeris<Frame>> Ephemeris<Frame>::ReadFromPreBourbakiMessages(
    google::protobuf::RepeatedPtrField<
        serialization::Plugin::CelestialAndProperties> const& messages,
    Length const& fitting_tolerance,
    typename Ephemeris<Frame>::FixedStepParameters const& fixed_parameters) {
  LOG(INFO) << "Reading "<< messages.SpaceUsedExcludingSelf()
            << " bytes in pre-Bourbaki compatibility mode ";
  std::vector<not_null<std::unique_ptr<MassiveBody const>>> bodies;
  std::vector<DegreesOfFreedom<Frame>> initial_state;
  std::vector<std::unique_ptr<DiscreteTrajectory<Frame>>> histories;
  std::set<Instant> initial_time;
  std::set<Instant> final_time;
  for (auto const& message : messages) {
    serialization::Celestial const& celestial = message.celestial();
    bodies.emplace_back(MassiveBody::ReadFromMessage(celestial.body()));
    histories.emplace_back(DiscreteTrajectory<Frame>::ReadFromMessage(
        celestial.history_and_prolongation().history(), /*forks=*/{}));
    auto const prolongation =
        DiscreteTrajectory<Frame>::ReadPointerFromMessage(
            celestial.history_and_prolongation().prolongation(),
            histories.back().get());
    typename DiscreteTrajectory<Frame>::Iterator const history_begin =
        histories.back()->Begin();
    initial_state.push_back(history_begin.degrees_of_freedom());
    initial_time.insert(history_begin.time());
    final_time.insert(prolongation->last().time());
  }
  CHECK_EQ(1, initial_time.size());
  CHECK_EQ(1, final_time.size());
  LOG(INFO) << "Initial time is " << *initial_time.cbegin()
            << ", final time is " << *final_time.cbegin();

  // Construct a new ephemeris using the bodies and initial states and time
  // extracted from the serialized celestials.
  auto ephemeris = std::make_unique<Ephemeris<Frame>>(std::move(bodies),
                                                      initial_state,
                                                      *initial_time.cbegin(),
                                                      fitting_tolerance,
                                                      fixed_parameters);

  // Extend the continuous trajectories using the data from the discrete
  // trajectories.
  std::set<Instant> last_state_time;
  for (int i = 0; i < histories.size(); ++i) {
    not_null<MassiveBody const*> const body = ephemeris->unowned_bodies_[i];
    auto const& history = histories[i];
    int const j = ephemeris->serialization_index_for_body(body);
    auto continuous_trajectory = ephemeris->trajectories_[j];

    typename DiscreteTrajectory<Frame>::Iterator it = history->Begin();
    Instant last_time = it.time();
    DegreesOfFreedom<Frame> last_degrees_of_freedom = it.degrees_of_freedom();
    for (; it != history->End(); ++it) {
      Time const duration_since_last_time = it.time() - last_time;
      if (duration_since_last_time == fixed_parameters.step_) {
        // A time in the discrete trajectory that is aligned on the continuous
        // trajectory.
        last_time = it.time();
        last_degrees_of_freedom = it.degrees_of_freedom();
        continuous_trajectory->Append(last_time, last_degrees_of_freedom);
      } else if (duration_since_last_time > fixed_parameters.step_) {
        // A time in the discrete trajectory that is not aligned on the
        // continuous trajectory.  Stop here, we'll use prolong to recompute the
        // rest.
        break;
      }
    }

    // Fill the |last_state_| for this body.  It will be the starting state for
    // Prolong.
    last_state_time.insert(last_time);
    ephemeris->last_state_.positions[j] = last_degrees_of_freedom.position();
    ephemeris->last_state_.velocities[j] = last_degrees_of_freedom.velocity();
  }
  CHECK_EQ(1, last_state_time.size());
  ephemeris->last_state_.time = *last_state_time.cbegin();
  LOG(INFO) << "Last time in discrete trajectories is "
            << *last_state_time.cbegin();

  // Prolong the ephemeris to the final time.  This might create discrepancies
  // from the discrete trajectories.
  ephemeris->Prolong(*final_time.cbegin());

  return ephemeris;
}
开发者ID:pdn4kd,项目名称:Principia,代码行数:85,代码来源:ephemeris_body.hpp


示例3: GetAfterPath

CBool CScene::Load( CChar * fileName, CBool reportWarningsAndErrors, CBool readFromBuffer )
{
	if ( fileName == NULL )
		return CFalse; 
	CChar * nameOnly = GetAfterPath( fileName );
	SetName( nameOnly );

	// Instantiate the reference implementation
	m_collada = new DAE;
	PrintInfo( "\n" );
	PrintInfo( _T("\n========Importing new external scene========"), COLOR_BLUE ); 
	numErrors = numWarnings = 0;
	domCOLLADA *dom;
	if( readFromBuffer )
	{
		/////////////////////////////////////////////////////////////////
		//zip path
		CChar zipPath[MAX_NAME_SIZE];
		Cpy( zipPath, fileName );
		GetWithoutDot( zipPath );
		Append(zipPath, ".zip" );

		//file name inside zip file
		CChar fileNameInZip[MAX_NAME_SIZE];
		Cpy( fileNameInZip, GetAfterPath( fileName ) );
		//Uncompress zip file
		std::string buffer = ReadZipFile( zipPath, fileNameInZip );
		//res = m_collada->load( "", buffer.c_str() );
		dom = m_collada->openFromMemory( "", buffer.c_str() );
		///////////////////////////////////////////////////////////////
	}
	else
	{
		// load with full path 
		//res = m_collada->load( fileName );
		dom = m_collada->open(fileName);
	}

	//if (res != DAE_OK)
	//{
	//	PrintInfo(_T("\nCScene::Load > Error loading the COLLADA file:") + CString(fileName), COLOR_RED );
	//	delete m_collada;
	//	m_collada = NULL;

		//if( reportWarningsAndErrors )
		//{
		//	char tempReport[MAX_NAME_SIZE];;
		//	sprintf( tempReport, "%s - fatal error (s)", nameOnly );
		//	PrintInfo2( tempReport, COLOR_RED ); 
		//}

	//	return CFalse;
	//}
	PrintInfo( _T("\nCOLLADA_DOM Runtime database initialized from" ) );
	PrintInfo( _T("'") +  CString( fileName ), COLOR_RED_GREEN );
	//PrintInfo( _T("nameOnly: '") + (CString)nameOnly + _T( "'\n" ) );

	//domCOLLADA *dom = m_collada->getDom(nameOnly);
	//if ( !dom )
	//	dom = m_collada->getDom( fileName); 
	if ( !dom )
	{
		PrintInfo( _T("\nCScene::Load > COLLADA File loaded to the dom, but query for the dom assets failed "), COLOR_RED );
		PrintInfo( _T("\nCScene::Load > COLLADA Load Aborted! "), COLOR_RED );
		delete m_collada;	
		m_collada = NULL;
		if( reportWarningsAndErrors )
		{
			char tempReport[MAX_NAME_SIZE];;
			sprintf( tempReport, "\n%s - Fatal error (s)", nameOnly );
			PrintInfo( tempReport, COLOR_RED ); 
		}
		return CFalse; 
	}

	CInt ret = 0;
	//PrintInfo("Begin Conditioning\n");
	//ret = kmzcleanup(m_collada, true);
	//if (ret)
	//	PrintInfo("kmzcleanup complete\n");
	ret = Triangulate(m_collada);
	if (ret)
		PrintInfo("\nTriangulate complete");
	//ret = deindexer(m_collada);
	//if (ret)
	//	PrintInfo("deindexer complete\n");

	//PrintInfo("Finish Conditioning\n");

	// Need to now get the asset tag which will determine what vector x y or z is up.  Typically y or z. 
	if ( dom->getAsset()->getUp_axis() )
	{
		domAsset::domUp_axis *up = dom->getAsset()->getUp_axis();
		switch( up->getValue() )
		{
			case UPAXISTYPE_X_UP:
				PrintInfo(_T("\nWarning!X is Up Data and Hiearchies must be converted!") ); 
				PrintInfo(_T("\nConversion to X axis Up isn't currently supported!") ); 
				PrintInfo(_T("\nCOLLADA defaulting to Y Up") ); 
				numWarnings +=1;
//.........这里部分代码省略.........
开发者ID:DCubix,项目名称:1.4.0,代码行数:101,代码来源:Scene.cpp


示例4: Append

	//--------------------------------------------------------------------------------
	CUTF16String& CUTF16String::Append( const CUTF16String& Str )
	{
		return Append( Str.m_String, Str.m_String.Len() );
	}
开发者ID:mfaithfull,项目名称:QOR,代码行数:5,代码来源:UTF16String.cpp


示例5: main

int main(int argc, char* argv[])
{
        
    NodePtr head = NULL;
    NodePtr second = NULL;
    NodePtr third = NULL;

    head = malloc(sizeof(Node));
    second = malloc(sizeof(Node));
    third = malloc(sizeof(Node));

    assert(head != NULL);
    assert(second != NULL);
    assert(third != NULL);
    head = buildList(head, second, third);

    NodePtr newNode;
   
    newNode = malloc(sizeof(Node));
    newNode->data = 1;
    newNode->next = head;    

    head = newNode; // now head points to list {1,2,3}
    printList(head);

    Push(&head, 13);
    Push(&head, 2);
    Push(&head, 1);
    Push(&head, 23);
    Push(&head, 35);

    printf("Before reverse:\n");
    printList(head);
    Reverse(&head);
    printf("After reverse:\n");
    printList(head);

    int count = countIntInList(head, 1);
    printf("count of %d in list is : %d\n", 1, count);
    
    printf("Third item in list is : %d\n", getNth(head, 3) );

#if 0
    printf("Test code for append()\n");

    NodePtr a;
    a = malloc(sizeof(a));
    assert( a!= NULL);
    Push(&a, 100);
    Push(&a, 200);
    printf("Built list a :\n");
    printList(a);

    NodePtr b;
    b = malloc(sizeof(a));
    assert( b!= NULL);
    Push(&b, 300);
    Push(&b, 400);
    printf("Built list b :\n");
    printList(b);

    //Delete(&a);

    Append(&a, &b);
    printf("After appending a to b :\n");
    printList(a);

    free(head);
#endif    
#if 0
    free(second);
    free(third);
    free(newNode);
    free(a);
    free(b);
#endif
  
    return 0; 
}
开发者ID:bds105,项目名称:myrepo,代码行数:79,代码来源:llist.c


示例6: yylex


//.........这里部分代码省略.........
	if (strcmp(yytext, "public") == 0)
	  return (PUBLIC);
	if (strcmp(yytext, "protected") == 0)
	  return (PROTECTED);
	if (strcmp(yytext, "friend") == 0)
	  return (FRIEND);
	if (strcmp(yytext, "virtual") == 0)
	  return (VIRTUAL);
	if (strcmp(yytext, "operator") == 0) {
	  int nexttok;
	  String *s = NewString("operator ");

	  /* If we have an operator, we have to collect the operator symbol and attach it to
             the operator identifier.   To do this, we need to scan ahead by several tokens.
             Cases include:

             (1) If the next token is an operator as determined by Scanner_isoperator(),
                 it means that the operator applies to one of the standard C++ mathematical,
                 assignment, or logical operator symbols (e.g., '+','<=','==','&', etc.)
                 In this case, we merely append the symbol text to the operator string above.

             (2) If the next token is (, we look for ).  This is operator ().
             (3) If the next token is [, we look for ].  This is operator [].
	     (4) If the next token is an identifier.  The operator is possibly a conversion operator.
                      (a) Must check for special case new[] and delete[]

             Error handling is somewhat tricky here.  We'll try to back out gracefully if we can.
 
	  */

	  nexttok = Scanner_token(scan);
	  if (Scanner_isoperator(nexttok)) {
	    /* One of the standard C/C++ symbolic operators */
	    Append(s,Scanner_text(scan));
	    yylval.str = s;
	    return OPERATOR;
	  } else if (nexttok == SWIG_TOKEN_LPAREN) {
	    /* Function call operator.  The next token MUST be a RPAREN */
	    nexttok = Scanner_token(scan);
	    if (nexttok != SWIG_TOKEN_RPAREN) {
	      Swig_error(Scanner_file(scan),Scanner_line(scan),"Syntax error. Bad operator name.\n");
	    } else {
	      Append(s,"()");
	      yylval.str = s;
	      return OPERATOR;
	    }
	  } else if (nexttok == SWIG_TOKEN_LBRACKET) {
	    /* Array access operator.  The next token MUST be a RBRACKET */
	    nexttok = Scanner_token(scan);
	    if (nexttok != SWIG_TOKEN_RBRACKET) {
	      Swig_error(Scanner_file(scan),Scanner_line(scan),"Syntax error. Bad operator name.\n");	      
	    } else {
	      Append(s,"[]");
	      yylval.str = s;
	      return OPERATOR;
	    }
	  } else if (nexttok == SWIG_TOKEN_ID) {
	    /* We have an identifier.  This could be any number of things. It could be a named version of
               an operator (e.g., 'and_eq') or it could be a conversion operator.   To deal with this, we're
               going to read tokens until we encounter a ( or ;.  Some care is needed for formatting. */
	    int needspace = 1;
	    int termtoken = 0;
	    const char *termvalue = 0;

	    Append(s,Scanner_text(scan));
	    while (1) {
开发者ID:veeramarni,项目名称:xuggle-swig,代码行数:67,代码来源:cscanner.c


示例7: _CoreRecover

ssize_t MemKeyCache::StartRecover()
{
	//非新建的共享内存,不用恢复
	if (m_iInitType!=emInit)
	{
		return 0;
	}

	m_pMemCacheHead->m_iDataOK = 0;

	//关闭binlog
	ssize_t iOldBinLogOpen = m_iBinLogOpen;
	m_iBinLogOpen = 0;

	if (access(m_szDumpFile, F_OK) == 0)
	{
		//恢复core
		ssize_t iRet = _CoreRecover(m_iDumpType);
		if (iRet > 0)
		{
			if (m_iDumpType == DUMP_TYPE_MIRROR)
			{
				printf("Recover from dumpfile(%s) %lld bytes.\n",m_szDumpFile,(long long)iRet);
			}
			else
			{
				printf("Recover from dumpfile(%s) %lld records.\n",m_szDumpFile,(long long)iRet);
			}
		}
		else
		{
			printf("not recover from dumpfile\n");
		}
	}
	else
	{
		printf("no dumpfile to recover.\n");
	}

	char cOp = 0;
	ssize_t iCount = 0;
	ssize_t iLogLen = 0;

	char* pTmpBuffer = new char[BUFFSIZE];
	u_int64_t tLogTime;
	//恢复日志流水,均为脏数据
	m_stBinLog.ReadRecordStart();
	while(0<(iLogLen = m_stBinLog.ReadRecordFromBinLog(pTmpBuffer,BUFFSIZE,tLogTime)))
	{
		memcpy(&cOp,pTmpBuffer,sizeof(cOp));

		char *pBuffer = pTmpBuffer+sizeof(cOp);
		ssize_t iBufferLen = iLogLen - sizeof(cOp);

		if (cOp == op_set)
		{
			DecodeBufferFormat(pBuffer,iBufferLen);
			Set(pNodeKey,*piNodeKeyLen,pNodeData,iNodeDataLen,*piDataFlag,pNodeReserve,*piNodeReserveLen);
		}
		else if  (cOp == op_mark)
		{
			DecodeBufferKeyFormat(pBuffer,iBufferLen);
			MarkFlag(pNodeKey,*piNodeKeyLen,*piDataFlag);
		}
		else if  (cOp == op_del)
		{
			DecodeBufferKeyFormat(pBuffer,iBufferLen);
			Del(pNodeKey,*piNodeKeyLen);
		}
		else if  (cOp == op_append)
		{
			DecodeBufferFormat(pBuffer,iBufferLen);
			Append(pNodeKey,*piNodeKeyLen,pNodeData,iNodeDataLen,*piDataFlag);
		}
		else
		{
			printf("bad binlog op %lld.\n",(long long)cOp);
		}

		iCount++;
	}

	printf("recover from binlog %lld records.\n",(long long)iCount);
	delete []pTmpBuffer;

	//恢复binlog开关
	m_iBinLogOpen = iOldBinLogOpen;

	m_pMemCacheHead->m_iDataOK = 1;
	return 0;
}
开发者ID:yafngzh,项目名称:easyMq,代码行数:91,代码来源:MemKeyCache.cpp


示例8: Append

//+-------------------------------------------------------------------------------------------------------------------------------
FvDynamicTuple::FvDynamicTuple(const FvBaseTuple& kOther)
{
	Append(kOther);
}
开发者ID:Kiddinglife,项目名称:geco-game-engine,代码行数:5,代码来源:FvTuple.cpp


示例9: GuiWindow


//.........这里部分代码省略.........
		if(gameList[gameIdx] == header)
		{
			gameSelected = gameIdx;
			break;
		}
	}

	//! Set dvd header if the header does not match any of the list games
	if(gameIdx == gameList.size())
		dvdheader = header;

	GuiBannerGrid *bannerBrowser = dynamic_cast<GuiBannerGrid *>(browserMenu->GetGameBrowser());
	if(bannerBrowser)
		bannerBrowser->GetIconCoordinates(gameSelected, &AnimPosX, &AnimPosY);

	gameBanner = new Banner;

	imgLeft = Resources::GetImageData("startgame_arrow_left.png");
	imgRight = Resources::GetImageData("startgame_arrow_right.png");

	trigA = new GuiTrigger;
	trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
	trigB = new GuiTrigger;
	trigB->SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
	trigL = new GuiTrigger;
	trigL->SetButtonOnlyTrigger(-1, WPAD_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_LEFT, PAD_BUTTON_LEFT);
	trigR = new GuiTrigger;
	trigR->SetButtonOnlyTrigger(-1, WPAD_BUTTON_RIGHT | WPAD_CLASSIC_BUTTON_RIGHT, PAD_BUTTON_RIGHT);
	trigPlus = new GuiTrigger;
	trigPlus->SetButtonOnlyTrigger(-1, WPAD_BUTTON_PLUS | WPAD_CLASSIC_BUTTON_PLUS, PAD_TRIGGER_R);
	trigMinus = new GuiTrigger;
	trigMinus->SetButtonOnlyTrigger(-1, WPAD_BUTTON_MINUS | WPAD_CLASSIC_BUTTON_MINUS, PAD_TRIGGER_L);

	playcntTxt = new GuiText((char*) NULL, 18, thColor("r=0 g=0 b=0 a=255 - banner window playcount text color"));
	playcntTxt->SetAlignment(ALIGN_CENTER, ALIGN_MIDDLE);
	playcntTxt->SetPosition(thInt("0 - banner window play count pos x"),
							thInt("215 - banner window play count pos y") - Settings.AdjustOverscanY / 2);

	settingsBtn = new GuiButton(215, 75);
	settingsBtn->SetAlignment(ALIGN_CENTER, ALIGN_MIDDLE);
	settingsBtn->SetSoundOver(btnSoundOver);
	settingsBtn->SetSoundClick(btnSoundAccept);
	settingsBtn->SetPosition(-120, 175);
	settingsBtn->SetTrigger(trigA);

	startBtn = new GuiButton(215, 75);
	startBtn->SetAlignment(ALIGN_CENTER, ALIGN_MIDDLE);
	startBtn->SetSoundOver(btnSoundOver);
	startBtn->SetSoundClick(btnSoundClick3);
	startBtn->SetPosition(110, 175);
	startBtn->SetTrigger(trigA);

	backBtn = new GuiButton(215, 75);
	backBtn->SetAlignment(ALIGN_CENTER, ALIGN_MIDDLE);
	backBtn->SetSoundOver(btnSoundOver);
	backBtn->SetSoundClick(btnSoundBack);
	backBtn->SetPosition(-screenwidth, -screenheight); // set out of screen
	backBtn->SetTrigger(0, trigA);
	backBtn->SetTrigger(1, trigB);

	btnLeftImg = new GuiImage(imgLeft);
	if (Settings.wsprompt) btnLeftImg->SetWidescreen(Settings.widescreen);
	btnLeft = new GuiButton(btnLeftImg, btnLeftImg, ALIGN_LEFT, ALIGN_MIDDLE, 20, -50, trigA, btnSoundOver, btnSoundClick2, 1);
	btnLeft->SetTrigger(trigL);
	btnLeft->SetTrigger(trigMinus);

	btnRightImg = new GuiImage(imgRight);
	if (Settings.wsprompt) btnRightImg->SetWidescreen(Settings.widescreen);
	btnRight = new GuiButton(btnRightImg, btnRightImg, ALIGN_RIGHT, ALIGN_MIDDLE, -20, -50, trigA, btnSoundOver, btnSoundClick2, 1);
	btnRight->SetTrigger(trigR);
	btnRight->SetTrigger(trigPlus);

	if (Settings.ShowPlayCount)
		Append(playcntTxt);
	Append(backBtn);

	if (!dvdheader) //stuff we don't show if it is a DVD mounted
	{
		Append(btnLeft);
		Append(btnRight);
	}

	bannerFrame.SetButtonBText(tr("Start"));

	//check if unlocked
	if (Settings.godmode || !(Settings.ParentalBlocks & BLOCK_GAME_SETTINGS))
	{
		bannerFrame.SetButtonAText(tr("Settings"));
		Append(settingsBtn);
	}
	else
	{
		bannerFrame.SetButtonAText(tr("Back"));
		backBtn->SetPosition(-120, 175);
	}

	Append(startBtn); //! Appending the disc on top of all

	ChangeGame(false);
}
开发者ID:SuperrSonic,项目名称:ULGX-ICON-VIEW,代码行数:101,代码来源:BannerWindow.cpp


示例10: C4PacketBase

C4PacketList::C4PacketList(const C4PacketList &List2)
		: C4PacketBase(List2),
		pFirst(NULL), pLast(NULL)
{
	Append(List2);
}
开发者ID:Rocket-Fish,项目名称:openclonk,代码行数:6,代码来源:C4Packet2.cpp


示例11: Clear

void FvDynamicTuple::operator=(const FvBaseTuple& kOther)
{
	Clear();
	Append(kOther);
}
开发者ID:Kiddinglife,项目名称:geco-game-engine,代码行数:5,代码来源:FvTuple.cpp


示例12: Append

	const CDuiString& CDuiString::operator+=(const TCHAR ch)
	{      
		TCHAR str[] = { ch, '\0' };
		Append(str);
		return *this;
	}
开发者ID:wang1986one,项目名称:duipcmgr,代码行数:6,代码来源:Utils.cpp


示例13: head_

List<T>::List (const List<T>& x) : head_(nullptr), tail_(nullptr)
// copy constructor
{
  Init();
  Append(x);
}
开发者ID:cob174,项目名称:school-projects,代码行数:6,代码来源:list.cpp


示例14: Swig_symbol_clookup


//.........这里部分代码省略.........
	int *priorities_row;
	max_possible_partials = Len(partials);
	priorities_matrix = (int *)malloc(sizeof(int) * max_possible_partials * parms_len); /* slightly wasteful allocation for max possible matches */
	priorities_row = priorities_matrix;
	for (pi = First(partials); pi.item; pi = Next(pi)) {
	  Parm *p = parms;
	  int all_parameters_match = 1;
	  int i = 1;
	  Parm *partialparms = Getattr(pi.item, "partialparms");
	  Parm *pp = partialparms;
	  String *templcsymname = Getattr(pi.item, "templcsymname");
	  if (template_debug) {
	    Printf(stdout, "    checking match: '%s' (partial specialization)\n", templcsymname);
	  }
	  if (ParmList_len(partialparms) == parms_len) {
	    while (p && pp) {
	      SwigType *t;
	      sprintf(tmp, "$%d", i);
	      t = Getattr(p, "type");
	      if (!t)
		t = Getattr(p, "value");
	      if (t) {
		EMatch match = does_parm_match(t, Getattr(pp, "type"), tmp, tscope, priorities_row + i - 1);
		if (match < (int)PartiallySpecializedMatch) {
		  all_parameters_match = 0;
		  break;
		}
	      }
	      i++;
	      p = nextSibling(p);
	      pp = nextSibling(pp);
	    }
	    if (all_parameters_match) {
	      Append(possiblepartials, pi.item);
	      priorities_row += parms_len;
	    }
	  }
	}
      }
    }

    posslen = Len(possiblepartials);
    if (template_debug) {
      int i;
      if (posslen == 0)
	Printf(stdout, "    matched partials: NONE\n");
      else if (posslen == 1)
	Printf(stdout, "    chosen partial: '%s'\n", Getattr(Getitem(possiblepartials, 0), "templcsymname"));
      else {
	Printf(stdout, "    possibly matched partials:\n");
	for (i = 0; i < posslen; i++) {
	  Printf(stdout, "      '%s'\n", Getattr(Getitem(possiblepartials, i), "templcsymname"));
	}
      }
    }

    if (posslen > 1) {
      /* Now go through all the possibly matched partial specialization templates and look for a non-ambiguous match.
       * Exact matches rank the highest and deduced parameters are ranked by how specialized they are, eg looking for
       * a match to const int *, the following rank (highest to lowest):
       *   const int * (exact match)
       *   const T *
       *   T *
       *   T
       *
       *   An ambiguous example when attempting to match as either specialization could match: %template() X<int *, double *>;
开发者ID:kkaempf,项目名称:swig,代码行数:67,代码来源:templ.c


示例15: swill_deny

void swill_deny(const char *ip) {
   if (!SwillInit) return;
   if (!ip_deny) ip_deny = NewList();
   Append(ip_deny,ip);
}
开发者ID:s1d,项目名称:sniffjoke,代码行数:5,代码来源:security.c


示例16: cparse_template_expand

static void cparse_template_expand(Node *templnode, Node *n, String *tname, String *rname, String *templateargs, List *patchlist, List *typelist, List *cpatchlist) {
  static int expanded = 0;
  String *nodeType;
  if (!n)
    return;
  nodeType = nodeType(n);
  if (Getattr(n, "error"))
    return;

  if (Equal(nodeType, "template")) {
    /* Change the node type back to normal */
    if (!expanded) {
      expanded = 1;
      set_nodeType(n, Getattr(n, "templatetype"));
      cparse_template_expand(templnode, n, tname, rname, templateargs, patchlist, typelist, cpatchlist);
      expanded = 0;
      return;
    } else {
      /* Called when template appears inside another template */
      /* Member templates */

      set_nodeType(n, Getattr(n, "templatetype"));
      cparse_template_expand(templnode, n, tname, rname, templateargs, patchlist, typelist, cpatchlist);
      set_nodeType(n, "template");
      return;
    }
  } else if (Equal(nodeType, "cdecl")) {
    /* A simple C declaration */
    SwigType *t, *v, *d;
    String *code;
    t = Getattr(n, "type");
    v = Getattr(n, "value");
    d = Getattr(n, "decl");

    code = Getattr(n, "code");

    Append(typelist, t);
    Append(typelist, d);
    Append(patchlist, v);
    Append(cpatchlist, code);

    if (Getattr(n, "conversion_operator")) {
      Append(cpatchlist, Getattr(n, "name"));
      if (Getattr(n, "sym:name")) {
	Append(cpatchlist, Getattr(n, "sym:name"));
      }
    }
    if (checkAttribute(n, "storage", "friend")) {
      String *symname = Getattr(n, "sym:name");
      if (symname) {
	String *stripped_name = SwigType_templateprefix(symname);
	Setattr(n, "sym:name", stripped_name);
	Delete(stripped_name);
      }
      Append(typelist, Getattr(n, "name"));
    }

    add_parms(Getattr(n, "parms"), cpatchlist, typelist);
    add_parms(Getattr(n, "throws"), cpatchlist, typelist);

  } else if (Equal(nodeType, "class")) {
    /* Patch base classes */
    {
      int b = 0;
      for (b = 0; b < 3; ++b) {
	List *bases = Getattr(n, baselists[b]);
	if (bases) {
	  int i;
	  int ilen = Len(bases);
	  for (i = 0; i < ilen; i++) {
	    String *name = Copy(Getitem(bases, i));
	    Setitem(bases, i, name);
	    Append(typelist, name);
	  }
	}
      }
    }
    /* Patch children */
    {
      Node *cn = firstChild(n);
      while (cn) {
	cparse_template_expand(templnode, cn, tname, rname, templateargs, patchlist, typelist, cpatchlist);
	cn = nextSibling(cn);
      }
    }
  } else if (Equal(nodeType, "constructor")) {
    String *name = Getattr(n, "name");
    if (!(Getattr(n, "templatetype"))) {
      String *symname;
      String *stripped_name = SwigType_templateprefix(name);
      if (Strstr(tname, stripped_name)) {
	Replaceid(name, stripped_name, tname);
      }
      Delete(stripped_name);
      symname = Getattr(n, "sym:name");
      if (symname) {
	stripped_name = SwigType_templateprefix(symname);
	if (Strstr(tname, stripped_name)) {
	  Replaceid(symname, stripped_name, tname);
	}
//.........这里部分代码省略.........
开发者ID:kkaempf,项目名称:swig,代码行数:101,代码来源:templ.c


示例17: Append

BString&
BString::AppendChars(const char* string, int32 charCount)
{
	return Append(string, UTF8CountBytes(string, charCount));
}
开发者ID:veer77,项目名称:Haiku-services-branch,代码行数:5,代码来源:String.cpp


示例18: milsTomm


//.........这里部分代码省略.........
            else
            {
                wsText->m_FullText = BuildFullText( wsText->m_TextBase );
                multilines = wsText->ReplaceAntiSlashSequence();
            }

            if( wsText->m_FullText.IsEmpty() )
                break;

            if( pensize == 0 )
                pensize = m_penSize;

            wsText->SetConstrainedTextSize();
            wxSize textsize;

            textsize.x = KiROUND( wsText->m_ConstrainedTextSize.x
                                  * WORKSHEET_DATAITEM::m_WSunits2Iu );
            textsize.y = KiROUND( wsText->m_ConstrainedTextSize.y
                                  * WORKSHEET_DATAITEM::m_WSunits2Iu );

            if( wsText->IsBold())
                pensize = GetPenSizeForBold( std::min( textsize.x, textsize.y ) );

            for( int jj = 0; jj < wsText->m_RepeatCount; jj++)
            {
                if( jj && ! wsText->IsInsidePage( jj ) )
                    continue;

                gtext = new WS_DRAW_ITEM_TEXT( wsText, wsText->m_FullText,
                                               wsText->GetStartPosUi( jj ),
                                               textsize, pensize, color,
                                               wsText->IsItalic(),
                                               wsText->IsBold() );
                Append( gtext );
                gtext->SetMultilineAllowed( multilines );
                wsText->TransfertSetupToGraphicText( gtext );

                // Increment label for the next text
                // (has no meaning for multiline texts)
                if( wsText->m_RepeatCount > 1 && !multilines )
                    wsText->IncrementLabel( (jj+1)*wsText->m_IncrementLabel);
            }
        }
            break;

        case WORKSHEET_DATAITEM::WS_SEGMENT:
            if( pensize == 0 )
                pensize = m_penSize;

            for( int jj = 0; jj < wsItem->m_RepeatCount; jj++ )
            {
                if( jj && ! wsItem->IsInsidePage( jj ) )
                    continue;
                Append( new WS_DRAW_ITEM_LINE( wsItem, wsItem->GetStartPosUi( jj ),
                                               wsItem->GetEndPosUi( jj ),
                                               pensize, color ) );
            }
            break;

        case WORKSHEET_DATAITEM::WS_RECT:
            if( pensize == 0 )
                pensize = m_penSize;

            for( int jj = 0; jj < wsItem->m_RepeatCount; jj++ )
            {
                if( jj && ! wsItem->IsInsidePage( jj ) )
开发者ID:Lotharyx,项目名称:kicad-source-mirror,代码行数:67,代码来源:title_block_shapes.cpp


示例19: SetWindowStyle


//.........这里部分代码省略.........
        sizeText.x = DEFAULT_ITEM_WIDTH + MARGIN_BETWEEN + sizeBtn.x;
    }

    sizeText.x -= sizeBtn.x + MARGIN_BETWEEN;
    if ( sizeText.x <= 0 )
    {
        wxLogDebug(wxT("not enough space for wxSpinCtrl!"));
    }

    wxPoint posBtn(pos);
    posBtn.x += sizeText.x + MARGIN_BETWEEN;

    // we must create the list control before the spin button for the purpose
    // of the dialog navigation: if there is a static text just before the spin
    // control, activating it by Alt-letter should give focus to the text
    // control, not the spin and the dialog navigation code will give focus to
    // the next control (at Windows level), not the one after it

    // create the text window

    m_hwndBuddy = (WXHWND)::CreateWindowEx
                    (
                     exStyle,                // sunken border
                     wxT("LISTBOX"),         // window class
                     NULL,                   // no window title
                     msStyle,                // style (will be shown later)
                     pos.x, pos.y,           // position
                     0, 0,                   // size (will be set later)
                     GetHwndOf(parent),      // parent
                     (HMENU)-1,              // control id
                     wxGetInstance(),        // app instance
                     NULL                    // unused client data
                    );

    if ( !m_hwndBuddy )
    {
        wxLogLastError(wxT("CreateWindow(buddy text window)"));

        return false;
    }

    // initialize wxControl
    if ( !CreateControl(parent, id, posBtn, sizeBtn, style, validator, name) )
        return false;

    // now create the real HWND
    WXDWORD spiner_style = WS_VISIBLE |
                           UDS_ALIGNRIGHT |
                           UDS_ARROWKEYS |
                           UDS_SETBUDDYINT |
                           UDS_EXPANDABLE;

    if ( !IsVertical(style) )
        spiner_style |= UDS_HORZ;

    if ( style & wxSP_WRAP )
        spiner_style |= UDS_WRAP;

    if ( !MSWCreateControl(UPDOWN_CLASS, spiner_style, posBtn, sizeBtn, wxEmptyString, 0) )
        return false;

    // subclass the text ctrl to be able to intercept some events
    wxSetWindowUserData(GetBuddyHwnd(), this);
    m_wndProcBuddy = (WXFARPROC)wxSetWindowProc(GetBuddyHwnd(),
                                                wxBuddyChoiceWndProc);

    // set up fonts and colours  (This is nomally done in MSWCreateControl)
    InheritAttributes();
    if (!m_hasFont)
        SetFont(GetDefaultAttributes().font);

    // set the size of the text window - can do it only now, because we
    // couldn't call DoGetBestSize() before as font wasn't set
    if ( sizeText.y <= 0 )
    {
        int cx, cy;
        wxGetCharSize(GetHWND(), &cx, &cy, GetFont());

        sizeText.y = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy);
    }

    SetInitialSize(size);

    (void)::ShowWindow(GetBuddyHwnd(), SW_SHOW);

    // associate the list window with the spin button
    (void)::SendMessage(GetHwnd(), UDM_SETBUDDY, (WPARAM)GetBuddyHwnd(), 0);

    // do it after finishing with m_hwndBuddy creation to avoid generating
    // initial wxEVT_COMMAND_TEXT_UPDATED message
    ms_allChoiceSpins.Add(this);

    // initialize the controls contents
    for ( int i = 0; i < n; i++ )
    {
        Append(choices[i]);
    }

    return true;
}
开发者ID:beanhome,项目名称:dev,代码行数:101,代码来源:choicece.cpp


示例20: size_t

// ProcessOne() takes a track, transforms it to bunch of buffer-blocks,
// and calls libsamplerate code on these blocks.
bool EffectChangeSpeed::ProcessOne(WaveTrack * track,
                           sampleCount start, sampleCount end)
{
   if (track == NULL)
      return false;

   // initialization, per examples of Mixer::Mixer and
   // EffectSoundTouch::ProcessOne

   auto outputTrack = mFactory->NewWaveTrack(track->GetSampleFormat(),
                                                    track->GetRate());

   //Get the length of the selection (as double). len is
   //used simple to calculate a progress meter, so it is easier
   //to make it a double now than it is to do it later
   auto len = (end - start).as_double();

   // Initiate processing buffers, most likely shorter than
   // the length of the selection being processed.
   auto inBufferSize = track->GetMaxBlockSize();

   Floats inBuffer{ inBufferSize };

   // mFactor is at most 100-fold so this shouldn't overflow size_t
   auto outBufferSize = size_t( mFactor * inBufferSize + 10 );
   Floats outBuffer{ outBufferSize };

   // Set up the resampling stuff for this track.
   Resample resample(true, mFactor, mFactor); // constant rate resampling

   //Go through the track one buffer at a time. samplePos counts which
   //sample the current buffer starts at.
   bool bResult = true;
   auto samplePos = start;
   while (samplePos < end) {
      //Get a blockSize of samples (smaller than the size of the buffer)
      auto blockSize = limitSampleBufferSize(
         track->GetBestBlockSize(samplePos),
         end - samplePos
      );

      //Get the samples from the track and put them in the buffer
      track->Get((samplePtr) inBuffer.get(), floatSample, samplePos, blockSize);

      const auto results = resample.Process(mFactor,
                                    inBuffer.get(),
                                    blockSize,
                                    ((samplePos + blockSize) >= end),
                                    outBuffer.get(),
                                    outBufferSize);
      const auto outgen = results.second;

      if (outgen > 0)
         outputTrack->Append((samplePtr)outBuffer.get(), floatSample,
                             outgen);

      // Increment samplePos
      samplePos += results.first;

      // Update the Progress meter
      if (TrackProgress(mCurTrackNum, (samplePos - start).as_double() / len)) {
         bResult = false;
         break;
      }
   }

   // Flush the output WaveTrack (since it's buffered, too)
   outputTrack->Flush();

   // Take the output track and insert it in place of the original
   // sample data
   double newLength = outputTrack->GetEndTime();
   if (bResult)
   {
      LinearTimeWarper warper { mCurT0, mCurT0, mCurT1, mCurT0 + newLength };
      track->ClearAndPaste(
         mCurT0, mCurT1, outputTrack.get(), true, false, &warper);
   }

   if (newLength > mMaxNewLength)
      mMaxNewLength = newLength;

   return bResult;
}
开发者ID:MindFy,项目名称:audacity,代码行数:86,代码来源:ChangeSpeed.cpp



注:本文中的Append函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ AppendData函数代码示例发布时间:2022-05-30
下一篇:
C++ AppWarning函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap