本文整理汇总了C++中SimpleList::Append方法的典型用法代码示例。如果您正苦于以下问题:C++ SimpleList::Append方法的具体用法?C++ SimpleList::Append怎么用?C++ SimpleList::Append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleList
的用法示例。
在下文中一共展示了SimpleList::Append方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
enqueue_result (int req_id, const char ** results, const int argc)
{
std::string *buffer = new std::string();
sprintf( *buffer, "%d", req_id );
for ( int i = 0; i < argc; i++ ) {
*buffer += ' ';
if ( results[i] == NULL ) {
*buffer += "NULL";
} else {
for ( int j = 0; results[i][j] != '\0'; j++ ) {
switch ( results[i][j] ) {
case ' ':
case '\\':
case '\r':
case '\n':
*buffer += '\\';
default:
*buffer += results[i][j];
}
}
}
}
*buffer += '\n';
results_queue.Append( buffer );
}
示例2:
void
requestScheddUpdateNotification( int timer_id )
{
if ( scheddUpdateNotifications.IsMember( timer_id ) == false ) {
// A new request; add it to the list
scheddUpdateNotifications.Append( timer_id );
RequestContactSchedd();
}
}
示例3:
void GenericQuery::
copyFloatCategory (SimpleList<float> &to, SimpleList<float> &from)
{
float item;
clearFloatCategory (to);
while (from.Next (item))
to.Append (item);
}
示例4: while
int
LoadCredentialList () {
CredentialWrapper * pCred;
// Clear the old list
if (!credentials.IsEmpty()) {
credentials.Rewind();
while (credentials.Next(pCred)) {
credentials.DeleteCurrent();
delete pCred;
}
}
credentials.Rewind();
classad::ClassAdXMLParser parser;
char buff[50000];
priv_state priv = set_root_priv();
FILE * fp = safe_fopen_wrapper(cred_index_file, "r");
if (!fp) {
dprintf (D_FULLDEBUG, "Credential database %s does not exist!\n", cred_index_file);
set_priv (priv);
return TRUE;
}
while (fgets(buff, 50000, fp)) {
if ((buff[0] == '\n') || (buff[0] == '\r')) {
continue;
}
classad::ClassAd * classad = parser.ParseClassAd (buff);
int type=0;
if ((!classad) || (!classad->EvaluateAttrInt ("Type", type))) {
dprintf (D_ALWAYS, "Invalid classad %s\n", buff);
set_priv (priv);
fclose (fp);
return FALSE;
}
if (type == X509_CREDENTIAL_TYPE) {
pCred = new X509CredentialWrapper (*classad);
credentials.Append (pCred);
}
else {
dprintf (D_ALWAYS, "Invalid type %d\n",type);
}
}
fclose (fp);
set_priv (priv);
return TRUE;
}
示例5: AmazonGahpCommand
void
registerAmazonGahpCommand(const char* command, ioCheckfn iofunc, workerfn workerfunc)
{
if( !command ) {
return;
}
AmazonGahpCommand* newcommand = new AmazonGahpCommand(command, iofunc, workerfunc);
ASSERT(newcommand);
amazon_gahp_commands.Append(newcommand);
}
示例6: strlen
bool
MyString::replaceString(
const char *pszToReplace,
const char *pszReplaceWith,
int iStartFromPos)
{
SimpleList<int> listMatchesFound;
int iToReplaceLen = strlen(pszToReplace);
if (!iToReplaceLen) {
return false;
}
int iWithLen = strlen(pszReplaceWith);
while (iStartFromPos <= Len){
iStartFromPos = find(pszToReplace, iStartFromPos);
if (iStartFromPos == -1)
break;
listMatchesFound.Append(iStartFromPos);
iStartFromPos += iToReplaceLen;
}
if (!listMatchesFound.Number())
return false;
int iLenDifPerMatch = iWithLen - iToReplaceLen;
int iNewLen = Len + iLenDifPerMatch * listMatchesFound.Number();
char *pNewData = new char[iNewLen+1];
int iItemStartInData;
int iPosInNewData = 0;
int iPreviousEnd = 0;
listMatchesFound.Rewind();
while(listMatchesFound.Next(iItemStartInData)) {
memcpy(pNewData + iPosInNewData,
Data + iPreviousEnd,
iItemStartInData - iPreviousEnd);
iPosInNewData += (iItemStartInData - iPreviousEnd);
memcpy(pNewData + iPosInNewData, pszReplaceWith, iWithLen);
iPosInNewData += iWithLen;
iPreviousEnd = iItemStartInData + iToReplaceLen;
}
memcpy(pNewData + iPosInNewData,
Data + iPreviousEnd,
Len - iPreviousEnd + 1);
delete [] Data;
Data = pNewData;
capacity = iNewLen;
Len = iNewLen;
return true;
}
示例7: dprintf
//.........这里部分代码省略.........
cred_wrapper = new X509CredentialWrapper (classad);
dprintf (D_ALWAYS, "Name=%s Size=%d\n",
cred_wrapper->cred->GetName(),
cred_wrapper->cred->GetDataSize());
} else {
dprintf (D_ALWAYS, "Unsupported credential type %d\n", type);
goto EXIT;
}
cred_wrapper->cred->SetOrigOwner (socket->getOwner()); // original remote uname
cred_wrapper->cred->SetOwner (user); // mapped uname
// Receive credential data
data_size = cred_wrapper->cred->GetDataSize();
if (data_size > MAX_CRED_DATA_SIZE) {
dprintf (D_ALWAYS, "ERROR: Credential data size %d > maximum allowed (%d)\n", data_size, MAX_CRED_DATA_SIZE);
goto EXIT;
}
data = malloc (data_size);
if (data == NULL) {
EXCEPT("Out of memory. Aborting.");
}
if (!socket->code_bytes(data,data_size)) {
dprintf (D_ALWAYS, "Error receiving credential data\n");
goto EXIT;
}
cred_wrapper->cred->SetData (data, data_size);
// Check whether credential under this name already exists
found_cred=false;
credentials.Rewind();
while (credentials.Next(temp_cred)) {
if ((strcmp(cred_wrapper->cred->GetName(),
temp_cred->cred->GetName()) == 0) &&
(strcmp(cred_wrapper->cred->GetOwner(),
temp_cred->cred->GetOwner()) == 0)) {
found_cred=true;
break; // found it
}
}
if (found_cred) {
dprintf (D_ALWAYS, "Credential %s for owner %s already exists!\n",
cred_wrapper->cred->GetName(),
cred_wrapper->cred->GetOwner());
socket->encode();
int rcred=CREDD_ERROR_CREDENTIAL_ALREADY_EXISTS;
socket->code(rcred);
goto EXIT;
}
// Write data to a file
temp_file_name = dircat (cred_store_dir, "credXXXXXX");
condor_mkstemp (temp_file_name);
cred_wrapper->SetStorageName (temp_file_name);
init_user_id_from_FQN (user);
if (!StoreData(temp_file_name,data,data_size)) {
socket->encode();
int rcred = CREDD_UNABLE_TO_STORE;
socket->code(rcred);
goto EXIT;
}
((X509CredentialWrapper*)cred_wrapper)->cred->SetRealExpirationTime (
x509_proxy_expiration_time(temp_file_name));
// Write metadata to a file
credentials.Append (cred_wrapper);
SaveCredentialList();
// Write response to the client
socket->encode();
rc = CREDD_SUCCESS;
socket->code(rc);
dprintf( D_ALWAYS, "Credential name %s owner %s successfully stored\n",
cred_wrapper->cred->GetName(), cred_wrapper->cred->GetOwner() );
if (type == X509_CREDENTIAL_TYPE) {
((X509Credential*)cred_wrapper->cred)->display( D_FULLDEBUG );
}
rtnVal = TRUE;
EXIT:
if ( data != NULL ) {
free (data);
}
if ( temp_file_name != NULL ) {
delete [] temp_file_name;
}
if ( cred_wrapper != NULL) {
delete cred_wrapper;
}
return rtnVal;
}