本文整理汇总了C++中Add函数的典型用法代码示例。如果您正苦于以下问题:C++ Add函数的具体用法?C++ Add怎么用?C++ Add使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Add函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: Add
Group::Group(Group &group)
{
Add(group);
}
示例3: ExportB
void ExportB()
{
printf("ExportB: 3 + 9 = %d\n", Add(3, 9));
}
示例4: AddProv
void cProviders::AddProv(cProvider *p)
{
if(p) Add(p);
}
示例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);
//.........这里部分代码省略.........
示例6: Add
Vector3& Vector3::operator+=(const Vector3& other)
{
return Add(other);
}
示例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);
}
示例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();
}
示例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 );
}
示例10: AddFunction
// Add a function to the current scope
Symbol *
GlobalScope::
AddFunction(const char * const name)
{
return Add(name, &m_functions);
}
示例11: Add
//==========================================================================*
// Add a value P(x,y)
//--------------------------------------------------------------------------*
void TLinearRegression::Add(const TVec2d& Point)
{
Add(Point.x, Point.y);
}
示例12: AddSymbol
// Add a symbol to the current scope
Symbol *
GlobalScope::
AddSymbol(const char * const name)
{
return Add(name, &m_symbols);
}
示例13: Add
void cAssembleData::SetAssembled(const unsigned char *Data)
{
Add(new cAssSct(Data));
curr=First();
}
示例14: AddLabel
// Add a label to the current scope
Symbol *
GlobalScope::
AddLabel(const char * const name)
{
return Add(name, &m_labels);
}
示例15: Add
HWStubManager::HWStubManager()
{
Add("Default", QString::fromStdString(hwstub::uri::default_uri().full_uri()));
}