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

C++ Add函数代码示例

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

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



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

示例1: Current

void cMenuSetupUserdefTimes::Set()
{
  int current = Current();
  Clear();
  helpTexts.clear();

  cString szUseUserTime = cString::sprintf("%s %d", tr("Use user-defined time"), 1);
  Add(new cMenuEditBoolItem(szUseUserTime, &data->ShowModes[showUserMode1].useIt,       trVDR("no"),      trVDR("yes")));
  AddHelp(tr("Help$Besides 'Now' and 'Next' you can specify up to 4 other times in the EPG which can be used by repeatedly pressing the green key, e.g. 'prime time', 'late night',..."));
  if (data->ShowModes[showUserMode1].GetUsage())
  {
      Add(new cMenuEditStrItem(IndentMenuItem(tr("Description")), data->ShowModes[showUserMode1].description, sizeof(data->ShowModes[showUserMode1].description), trVDR(FileNameChars)));
      AddHelp(tr("Help$This is the description for your user-defined time as it will appear as label on the green button."));
      Add(new cMenuEditTimeItem(IndentMenuItem(tr("Time")), &data->ShowModes[showUserMode1].itime));
      AddHelp(tr("Help$Specify the user-defined time here in 'HH:MM'."));
  }

  szUseUserTime = cString::sprintf("%s %d", tr("Use user-defined time"), 2);
  Add(new cMenuEditBoolItem( szUseUserTime, &data->ShowModes[showUserMode2].useIt,       trVDR("no"),      trVDR("yes")));
  AddHelp(tr("Help$Besides 'Now' and 'Next' you can specify up to 4 other times in the EPG which can be used by repeatedly pressing the green key, e.g. 'prime time', 'late night',..."));
  if (data->ShowModes[showUserMode2].GetUsage())
  {
      Add(new cMenuEditStrItem(IndentMenuItem(tr("Description")), data->ShowModes[showUserMode2].description, sizeof(data->ShowModes[showUserMode2].description), trVDR(FileNameChars)));
      AddHelp(tr("Help$This is the description for your user-defined time as it will appear as label on the green button."));
      Add(new cMenuEditTimeItem(IndentMenuItem(tr("Time")), &data->ShowModes[showUserMode2].itime));
      AddHelp(tr("Help$Specify the user-defined time here in 'HH:MM'."));
  }

  szUseUserTime = cString::sprintf("%s %d", tr("Use user-defined time"), 3);
  Add(new cMenuEditBoolItem(szUseUserTime, &data->ShowModes[showUserMode3].useIt,       trVDR("no"),      trVDR("yes")));
  AddHelp(tr("Help$Besides 'Now' and 'Next' you can specify up to 4 other times in the EPG which can be used by repeatedly pressing the green key, e.g. 'prime time', 'late night',..."));
  if (data->ShowModes[showUserMode3].GetUsage())
  {
      Add(new cMenuEditStrItem(IndentMenuItem(tr("Description")), data->ShowModes[showUserMode3].description, sizeof(data->ShowModes[showUserMode3].description), trVDR(FileNameChars)));
      AddHelp(tr("Help$This is the description for your user-defined time as it will appear as label on the green button."));
      Add(new cMenuEditTimeItem(IndentMenuItem(tr("Time")), &data->ShowModes[showUserMode3].itime));
      AddHelp(tr("Help$Specify the user-defined time here in 'HH:MM'."));
  }

  szUseUserTime = cString::sprintf("%s %d", tr("Use user-defined time"), 4);
  Add(new cMenuEditBoolItem(szUseUserTime, &data->ShowModes[showUserMode4].useIt,       trVDR("no"),      trVDR("yes")));
  AddHelp(tr("Help$Besides 'Now' and 'Next' you can specify up to 4 other times in the EPG which can be used by repeatedly pressing the green key, e.g. 'prime time', 'late night',..."));
  if (data->ShowModes[showUserMode4].GetUsage())
  {
      Add(new cMenuEditStrItem(IndentMenuItem(tr("Description")), data->ShowModes[showUserMode4].description, sizeof(data->ShowModes[showUserMode4].description), trVDR(FileNameChars)));
      AddHelp(tr("Help$This is the description for your user-defined time as it will appear as label on the green button."));
      Add(new cMenuEditTimeItem(IndentMenuItem(tr("Time")), &data->ShowModes[showUserMode4].itime));
      AddHelp(tr("Help$Specify the user-defined time here in 'HH:MM'."));
  }

  SetCurrent(Get(current));
  Display();
  SetHelp(NULL, NULL, tr("Button$Help"), NULL);
}
开发者ID:jowi24,项目名称:vdr-epgsearch,代码行数:54,代码来源:epgsearchsetup.c


示例2: Add

Group::Group(Group &group)
{
    Add(group);
}
开发者ID:NVIDIA,项目名称:ptp-nsight,代码行数:4,代码来源:group.cpp


示例3: ExportB

void ExportB()
{
	printf("ExportB: 3 + 9 = %d\n", Add(3, 9));
}
开发者ID:0xb1dd1e,项目名称:jamplus,代码行数:4,代码来源:slib-b.c


示例4: AddProv

void cProviders::AddProv(cProvider *p)
{
  if(p) Add(p);
}
开发者ID:attuska,项目名称:Sasc-ng,代码行数:4,代码来源:parse.c


示例5: main

int main(int argc, char *argv[]) {
	FILE * inputFile;
	if (argc < 2 || argc>3) 
		DieWithUserMessage("Parameter(s)","<Server Name> [LClient.txt]");
	if(argc==3)
	{
		inputFile = fopen (argv[2] , "r");
		if (inputFile == NULL)
			DieWithSystemMessage("File Open Error!");
	}
	if(argc==2)
	{
		inputFile =stdin;
	}
	char *servName = argv[1];
	char *servIP=getIPbyHostName(servName, addr);//Get Server IP by Server Name

	FILE *fp;
	if((fp=fopen("LClient.log","w"))==NULL)
		DieWithSystemMessage("File Open Error!");

	//===========Deal with Login Command============
	char _CMDString[MAXLEN_CMD];
	char *CMDString=_CMDString;

	beforeLogin:fputs("Please use login command to connect to the server first as [login <name>]:\n", stdout);

	if(fgets(CMDString,MAXLEN_CMD,inputFile)== NULL)
		DieWithSystemMessage("Input Error!");
	//printf("string length:\t%d\n",strlen(CMDString));
	while((Login(CMDString))!=1)
	{
		fputs("\nLogin again:\n", stdout);
		if(fgets(CMDString,MAXLEN_CMD,inputFile)== NULL)
			DieWithSystemMessage("Input Error!");
	}

	//===========End of dealing with Login Command, and Get the name=========


	//===========initiate the socket =====================	
	in_port_t servPort =atoi("5000");// Set server port (numeric) 5000	
	int sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);// Create a reliable, stream socket using TCP
	if (sock < 0)
		DieWithSystemMessage("socket() failed");	
	struct sockaddr_in servAddr;// Construct the server address structure
	memset(&servAddr, 0, sizeof(servAddr)); // Zero out structure
	servAddr.sin_family = AF_INET;			   // IPv4 address family
	// Convert address
	int rtnVal = inet_pton(AF_INET, servIP, &servAddr.sin_addr.s_addr);
	if (rtnVal == 0)
		DieWithUserMessage("inet_pton() failed", "invalid address string");
	else if (rtnVal < 0)
		DieWithSystemMessage("inet_pton() failed");
	servAddr.sin_port = htons(servPort);		// Server port
	//===========END initiate the socket =====================




	//===========Establish the connection to the echo server=============
	if (connect(sock, (struct sockaddr *) &servAddr, sizeof(servAddr)) < 0)
		DieWithSystemMessage("connect() failed");
	IsLogined=1;  //Connection Established, and this means someone logined successfully
	char buffer[BUFSIZE];

	int IsListCmd=0;

	//char IsListDone[5]="Done";
	char QUIT[2]="*";
	char _EOF[2]="$";
	int IsReLogin=0;
	for(;;)
	{		
		//puts(CMDString);
		ssize_t numBytes = send(sock, CMDString, strlen(CMDString), 0);
		if (numBytes < 0)
			DieWithSystemMessage("send() failed");
		else if (numBytes != strlen(CMDString))
				DieWithUserMessage("send()", "sent unexpected number of bytes");

		if(IsListCmd==0)
		{
			bufferClean(buffer);
			numBytes = recv(sock, buffer, BUFSIZE - 1, 0);
			if (numBytes < 0)
				DieWithSystemMessage("recv() failed");
			buffer[numBytes] = '\0';// Terminate the string!	
			if(strncmp(buffer,QUIT,1)==0)
			{
				fputs(buffer, fp);
				fputs("\r\n",fp);
				labelQUIT:close(sock);
				goto beforeLogin;
			}

			if(strncmp(buffer,_EOF,1)==0)
			{
				fputs(buffer, fp);
				fputs("\r\n",fp);
//.........这里部分代码省略.........
开发者ID:zhouhao,项目名称:TCP-Command-Server-And-Client,代码行数:101,代码来源:TCPClient.c


示例6: Add

		Vector3& Vector3::operator+=(const Vector3& other)
		{
			return Add(other);
		}
开发者ID:newwtron54,项目名称:Aphelion,代码行数:4,代码来源:Vector3.cpp


示例7: s

void MC::MCRUN()
{
	Cells s(c,r);

	stringstream st;

	double addordel; // the prob to decide either add or del;
	// double probd;//,proba; // the acceptance prob of addition; proba = min(1.0,aaccp);
	double prob; // the prob to decide either accept add/del;
	double aaccp,daccp; 
	double Q; // the fraction of hor and ver particle;
	double tho; // the density 
	double AD;// addition and deletion fraction
	double size;
		
	srand(time(NULL));
	long int i = 0;
	// Histogram his(0, r*c/length, 1); // the histogram of nv

	//================================Start my MC simulation=================================
	while (i<step)
	{
		i++;
		// generate a random probability to decide either add or del;
		addordel = rand()%2;
		size = av+ah-dv-dh;

		// *****************define the probabilities ***********************************// I HAVE TO CHANGE IT FOR LATTICE GAS CASE!!!
		prob = ((double) rand() / (RAND_MAX)); 
		tho = double(length*size)/double(r*c);

		aaccp = z*double(r*c)/(double(nh+nv+1.0)*double(length));
		daccp = (double(nh+nv)*double(length))/(z*double(r*c));

		// proba = min(1.0,aaccp);
		// probd = min(1.0,daccp);

        // ===========================Addition ===================================
		if(addordel == 0) 
		{
			//Do Addition;
			Add(s,prob,aaccp);
		}

		// ============================Deletion=============================
		else
		{
			if (size != 0) // make sure there are rods to be del;
			{
				//Do deletion;
				Del(s,prob,daccp,size);
			}			
		}

		// ======================= Record the datas =============================================		
        Q = (nv - nh)/(nh + nv);
		AD = (av+ah-dv-dh)/(av+ah+dv+dh);

		if (i%(step/10000) == 0)
		{
			// his.record(nv);
			st << i << "         " << Q <<"        "<< nv << "          "<< nh << "         "<< tho << "         "<< AD<< "         "<< endl;
			cout <<"Process: "<< ((10000*i)/step)/100.00 <<"%"<<"    "<<"SIZE: "<<av+ah-dv-dh<<"    "<<"# of Ver Rod: "<<nv<<"    "<<"# of Hor Rod: "<< nh <<"   "<<"Qis "<<Q <<"   "<<"tho is: "<<tho << endl;
		}
	}
	// Record the data into a txt file
	ofstream myfile3 ("dataplot.dat");
	string data = st.str();
	myfile3 << data;
	myfile3.close();
	// his.plot(0);
}
开发者ID:Aieener,项目名称:HRE,代码行数:72,代码来源:MC.cpp


示例8: Delete

/**
 * \brief Add a new mark of the given type. Before the new mark is added, any
 *        existing redundant mark of that type is removed. This simplifies
 *        the cleanup code.
 */
void DeleteMap::AddMark(uint64_t frame, MarkTypes type)
{
    EDIT_CHECK;
    if ((MARK_CUT_START != type) && (MARK_CUT_END != type) &&
        (MARK_PLACEHOLDER != type))
        return;

    frm_dir_map_t::Iterator find_temporary = m_deleteMap.find(frame);
    if (find_temporary != m_deleteMap.end())
    {
        if (MARK_PLACEHOLDER == find_temporary.value())
        {
            // Delete the temporary mark before putting a real mark at its
            // location
            Delete(frame, "");
        }
        else // Don't add a mark on top of a mark
            return;
    }

    int       lasttype  = MARK_UNSET;
    long long lastframe = -1;
    long long remove    = -1;
    QMutableMapIterator<uint64_t, MarkTypes> it(m_deleteMap);

    if (type == MARK_CUT_END)
    {
        // remove curent end marker if it exists
        while (it.hasNext())
        {
            it.next();
            if (it.key() > frame)
            {
                if ((lasttype == MARK_CUT_END) && (lastframe > -1))
                    remove = lastframe;
                break;
            }
            lasttype  = it.value();
            lastframe = it.key();
        }
        if ((remove < 0) && (lasttype == MARK_CUT_END) &&
            (lastframe > -1) && (lastframe < (int64_t)frame))
            remove = lastframe;
    }
    else if (type == MARK_CUT_START)
    {
        // remove curent start marker if it exists
        it.toBack();
        while (it.hasPrevious())
        {
            it.previous();
            if (it.key() <= frame)
            {
                if (lasttype == MARK_CUT_START && (lastframe > -1))
                    remove = lastframe;
                break;
            }
            lasttype  = it.value();
            lastframe = it.key();
        }
        if ((remove < 0) && (lasttype == MARK_CUT_START) &&
            (lastframe > -1) && (lastframe > (int64_t)frame))
            remove = lastframe;
    }

    if (remove > -1)
        Delete((uint64_t)remove);
    Add(frame, type);
    CleanMap();
}
开发者ID:tomhughes,项目名称:mythtv,代码行数:75,代码来源:deletemap.cpp


示例9: Delete

/**
 * Change value by key.
 * @param osName  Key name.
 * @param bValue   Boolean value.
 *
 * @since GDAL 2.3
 */
void CPLJSONObject::Set(const std::string &osName, bool bValue)
{
    Delete( osName );
    Add( osName, bValue );
}
开发者ID:koordinates,项目名称:gdal,代码行数:12,代码来源:cpl_json.cpp


示例10: AddFunction

// Add a function to the current scope
Symbol *
	GlobalScope::
	AddFunction(const char * const name)
{
	return Add(name, &m_functions);
}
开发者ID:Y-Less,项目名称:yavascript,代码行数:7,代码来源:GlobalScope.cpp


示例11: Add

//==========================================================================*
// Add a value P(x,y)
//--------------------------------------------------------------------------*
void TLinearRegression::Add(const TVec2d& Point)
{
  Add(Point.x, Point.y);
}
开发者ID:702nADOS,项目名称:speed-dreams,代码行数:7,代码来源:unitlinreg.cpp


示例12: AddSymbol

// Add a symbol to the current scope
Symbol *
	GlobalScope::
	AddSymbol(const char * const name)
{
	return Add(name, &m_symbols);
}
开发者ID:Y-Less,项目名称:yavascript,代码行数:7,代码来源:GlobalScope.cpp


示例13: Add

void cAssembleData::SetAssembled(const unsigned char *Data)
{
  Add(new cAssSct(Data));
  curr=First();
}
开发者ID:attuska,项目名称:Sasc-ng,代码行数:5,代码来源:parse.c


示例14: AddLabel

// Add a label to the current scope
Symbol *
	GlobalScope::
	AddLabel(const char * const name)
{
	return Add(name, &m_labels);
}
开发者ID:Y-Less,项目名称:yavascript,代码行数:7,代码来源:GlobalScope.cpp


示例15: Add

HWStubManager::HWStubManager()
{
    Add("Default", QString::fromStdString(hwstub::uri::default_uri().full_uri()));
}
开发者ID:Rockbox,项目名称:rockbox,代码行数:4,代码来源:backend.cpp


示例16: CImpactActionsSet

CModuleActionsSet::CModuleActionsSet(string language) : CImpactActionsSet(language) {
	Add(new CRenameAction());
	Add(new CDeleteEntityAction());
	if(m_szLanguage=="JAVA")		
		Add(new CMoveToPackageAction());
}
开发者ID:kit-transue,项目名称:software-emancipation-discover,代码行数:6,代码来源:ModuleActions.cpp


示例17: Clear

void C4ObjectList::Copy(const C4ObjectList &rList)
{
	Clear(); Default();
	C4ObjectLink *cLnk;
	for (cLnk=rList.First; cLnk; cLnk=cLnk->Next) Add(cLnk->Obj, C4ObjectList::stNone);
}
开发者ID:772,项目名称:openclonk,代码行数:6,代码来源:C4ObjectList.cpp


示例18: while

//-----------------------------------------------------------------------------
// Invokes methods on all installed game systems
//-----------------------------------------------------------------------------
bool IGameSystem::InitAllSystems()
{
	int i;

	{
		// first add any auto systems to the end
		CAutoGameSystem *pSystem = s_pSystemList;
		while ( pSystem )
		{
			if ( s_GameSystems.Find( pSystem ) == s_GameSystems.InvalidIndex() )
			{
				Add( pSystem );
			}
			else
			{
				DevWarning( 1, "AutoGameSystem already added to game system list!!!\n" );
			}
			pSystem = pSystem->m_pNext;
		}
		s_pSystemList = NULL;
	}

	{
		CAutoGameSystemPerFrame *pSystem = s_pPerFrameSystemList;
		while ( pSystem )
		{
			if ( s_GameSystems.Find( pSystem ) == s_GameSystems.InvalidIndex() )
			{
				Add( pSystem );
			}
			else
			{
				DevWarning( 1, "AutoGameSystem already added to game system list!!!\n" );
			}

			pSystem = pSystem->m_pNext;
		}
		s_pSystemList = NULL;
	}
	// Now remember that we are initted so new CAutoGameSystems will add themselves automatically.
	s_bSystemsInitted = true;

	for ( i = 0; i < s_GameSystems.Count(); ++i )
	{
		MDLCACHE_CRITICAL_SECTION();

		IGameSystem *sys = s_GameSystems[i];

#if defined( _X360 )
		char sz[128];
		Q_snprintf( sz, sizeof( sz ), "%s->Init():Start", sys->Name() );
		XBX_rTimeStampLog( Plat_FloatTime(), sz );
#endif
		bool valid = sys->Init();

#if defined( _X360 )
		Q_snprintf( sz, sizeof( sz ), "%s->Init():Finish", sys->Name() );
		XBX_rTimeStampLog( Plat_FloatTime(), sz );
#endif
		if ( !valid )
			return false;
	}

	return true;
}
开发者ID:dreckard,项目名称:dhl2,代码行数:68,代码来源:igamesystem.cpp


示例19: creationTime

// add files to list
gbool GFileSorter::AddFiles(const char *directory,time_t &maxFileTime,BOOL &stop)
{

    CFileFind finder;

    CString dir = directory;

    // add separator
    int l = dir.GetLength();
    if (l == 0) return FALSE;
    if ( !((dir[l-1] == '\\') || (dir[l-1] == '/'))) dir += '\\';

    dir += "*.*";

    CString path;

    CTime creationTime((time_t)0);
    CTime accessTime((time_t)0);
    CTime writeTime((time_t)0);

    // setup the find structure
    BOOL bWorking = finder.FindFile(dir);


    while (bWorking)  { // for all entrys
        if (stop) break;

        bWorking = finder.FindNextFile();

        path = finder.GetFilePath();

        creationTime = (time_t)0;
        accessTime = (time_t)0;
        writeTime = (time_t)0;

        BOOL ret=finder.GetCreationTime(creationTime);
        finder.GetLastAccessTime(accessTime);
        finder.GetLastWriteTime(writeTime);

        time_t t = creationTime.GetTime();

        if (writeTime.GetTime()>0) t = max(t,writeTime.GetTime()); // HG wg Kristof

        if (accessTime.GetTime()>0) t = max(t,accessTime.GetTime());

        if (finder.IsDots( )) {	// ignore . ..

        } else 	if (finder.IsDirectory( )) { // recursively step down

            t=0; // we want to delete empty directories new 20.10.98
            AddFiles(path,t,stop);

            DWORD length = 0;

            // to do get date of latest
            TRACE("D %s c %ld a %ld w %ld size %ld \n",(const char *) path, creationTime.GetTime(),accessTime.GetTime(),writeTime.GetTime(),length);

            // time is the max of the child time +1
            GFSortEntry *e = new GFSortEntry(path,t+1,length,gtrue);

            if (!e) break;
            if (!Add(e)) break;

            if (t>maxFileTime) maxFileTime = t;


        }
        else {

            DWORD length = finder.GetLength(); // get length 64
            fileSum += length;

            TRACE("F %s c %ld a %ld w %ld size %ld \n",(const char *) path, creationTime.GetTime(),accessTime.GetTime(),writeTime.GetTime(),length);
            GFSortEntry *e = new GFSortEntry(path,t,length);

            if (t>maxFileTime) maxFileTime = t;

            if (!e) break;
            if (!Add(e)) break;
        }


    }
    finder.Close();

    //TRACE("%ld bytes \n",(long)fileSum);

    return TRUE;
}
开发者ID:deepmatrix,项目名称:blaxxun-cc3d,代码行数:90,代码来源:gurlcache.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ AddAction函数代码示例发布时间:2022-05-30
下一篇:
C++ Actor_Set_Goal_Number函数代码示例发布时间: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