本文整理匯總了C++中AddTail函數的典型用法代碼示例。如果您正苦於以下問題:C++ AddTail函數的具體用法?C++ AddTail怎麽用?C++ AddTail使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了AddTail函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: sort_list
void sort_list(Att_List *input_list)
{
struct Node *node,*tmpnode,*next_node;
struct List *list,sorted;
list=&input_list->list;
if (list && !IsListEmpty(list))
{
NewList(&sorted);
while ((node=(struct Node*)(list->lh_Head)) && list->lh_Head->ln_Succ!=NULL) /* list not empty!*/
{
tmpnode=node;
while ((next_node=node->ln_Succ))
{
if (stricmp(tmpnode->ln_Name,node->ln_Name)>0)
tmpnode=node;
node=next_node;
}
Remove(tmpnode);
AddTail(&sorted,tmpnode);
}
while ((node=sorted.lh_Head) && sorted.lh_Head->ln_Succ!=NULL) /* list not empty!*/
{
Remove(node);
AddTail(list,node);
}
}
}
示例2: AddTail
void CPTRList::InsertAfter( int n,void *pData)
{
if ( n<0 )
{
AddTail(pData);
return ;
}
if ( n==GetCount()-1)
{
AddTail(pData);
return;
}
GetAt(n);
nCurrent = -1;
PTR_BLK *pNew = new PTR_BLK;
pNew->pData = pData;
pNew->pPrev = pCur;
pNew->pNext = pCur->pNext;
pCur->pNext->pPrev = pNew;
pCur->pNext = pNew;
nMax++;
}
示例3: al
DWORD LStrList::LoadFromFile(LTxtFile* tf, BOOL bIncludeNull)
{
LAutoLock al(m_lock);
// 如果列表為空,則按照來源文件編碼
if (LPtrList::IsEmpty())
{
m_dwFlags = 0;
if (tf->IsUnicode())
{
m_dwFlags = SLFLAG_UNICODE;
m_pfnCopy = LStrList_CopyW;
m_pfnDestroy = LStrList_DestroyW;
}
else
{
m_pfnCopy = LStrList_CopyA;
m_pfnDestroy = LStrList_DestroyA;
}
}
DWORD ret = 0;
if (IsUnicode())
{
LStringW str;
while (!tf->Eof())
{
tf->ReadLn(&str);
if ((L'\0' != str[0]) || bIncludeNull)
{
AddTail(str);
++ret;
}
}
}
else
{
LStringA str;
while (!tf->Eof())
{
tf->ReadLn(&str);
if (('\0' != str[0]) || bIncludeNull)
{
AddTail(str);
++ret;
}
}
}
return ret;
}
示例4: ASSERT_VALID
void CStringList::Serialize(CArchive& ar)
{
ASSERT_VALID(this);
CObject::Serialize(ar);
if (ar.IsStoring())
{
ar << (WORD) m_nCount;
for (CNode* pNode = m_pNodeHead; pNode != NULL; pNode = pNode->pNext)
{
ASSERT(AfxIsValidAddress(pNode, sizeof(CNode)));
ar << pNode->data;
}
}
else
{
WORD nNewCount;
ar >> nNewCount;
CString newData;
while (nNewCount--)
{
ar >> newData;
AddTail(newData);
}
}
}
示例5: URLHistoryFound
static bool URLHistoryFound(const char *url, const struct url_data *data)
{
struct Node *node;
/* skip this URL if it is already in the list */
if(URLHistory_FindPage(url)) return true;
node = AllocVec( sizeof( struct Node ), MEMF_SHARED|MEMF_CLEAR );
if ( node )
{
STRPTR urladd = (STRPTR) AllocVec( strlen ( url ) + 1, MEMF_SHARED|MEMF_CLEAR );
if ( urladd )
{
strcpy(urladd, url);
node->ln_Name = urladd;
AddTail( &PageList, node );
}
else
{
FreeVec(node);
}
}
return true;
}
示例6: _MEMTRACK
///
/// _MEMTRACK
// add a new node to the memory tracking lists
void _MEMTRACK(const char *file, const int line, const char *func, void *ptr, size_t size)
{
if(isFlagSet(debug_classes, DBC_MTRACK))
{
if(ptr != NULL && size != 0)
{
struct DbgMallocNode *dmn;
if((dmn = AllocVec(sizeof(*dmn), MEMF_ANY)) != NULL)
{
dmn->memory = ptr;
dmn->size = size;
dmn->file = file;
dmn->line = line;
dmn->func = func;
ObtainSemaphore(&DbgMallocListSema);
AddTail((struct List *)&DbgMallocList[ptr2hash(ptr)], (struct Node *)&dmn->node);
DbgMallocCount++;
ReleaseSemaphore(&DbgMallocListSema);
}
}
else
_DPRINTF(DBC_WARNING, DBF_ALWAYS, file, line, "potential invalid %s call with return (0x%08lx, 0x%08lx)", func, ptr, size);
}
}
示例7: switch
CRecord CRecord::operator =(ARFieldValueList &fieldList)
{
ARFieldValueStruct *pFieldValuePair = fieldList.fieldValueList; // working pointer
CFieldValuePair FieldValuePair; // working field value pair
CString workingString; // working string to convert value
// Loop once for each field/value pair in the list
for(UINT i=0; i<fieldList.numItems; i++, pFieldValuePair++)
{
// decode the field/value pair
FieldValuePair.uiFieldId = pFieldValuePair->fieldId; // save field id
FieldValuePair.uiType = pFieldValuePair->value.dataType; // save data type
switch(pFieldValuePair->value.dataType) // convert the value based on data type
{
case AR_DATA_TYPE_NULL:
workingString.Empty();
break;
case AR_DATA_TYPE_INTEGER:
case AR_DATA_TYPE_TIME:
case AR_DATA_TYPE_DATE:
case AR_DATA_TYPE_TIME_OF_DAY:
case AR_DATA_TYPE_KEYWORD:
case AR_DATA_TYPE_BITMASK:
workingString.Format("%d", pFieldValuePair->value.u.intVal);
break;
case AR_DATA_TYPE_REAL:
workingString.Format("%e", pFieldValuePair->value.u.realVal);
break;
case AR_DATA_TYPE_CHAR:
case AR_DATA_TYPE_DIARY:
case AR_DATA_TYPE_DECIMAL:
workingString = pFieldValuePair->value.u.charVal;
break;
case AR_DATA_TYPE_ENUM:
workingString.Format("%u", pFieldValuePair->value.u.enumVal);
break;
case AR_DATA_TYPE_ATTACH:
workingString = FieldValuePair.StoreAttachment(pFieldValuePair->value.u.attachVal);
break;
case AR_DATA_TYPE_CURRENCY:
workingString = FieldValuePair.StoreCurrency(pFieldValuePair->fieldId,
pFieldValuePair->value.u.currencyVal);
break;
default:
workingString.Empty();
ThrowARSException(UNKNOWN_DATA_TYPE, "CRecord::operator=()");
break;
} // end switch
// decode attachement fields
// decode currency fields
FieldValuePair.Value = workingString; // save the decoded value
AddTail(FieldValuePair); // Add the field/value pair
} // end for
// return the populated record
return *this;
}
示例8: ASSERT_VALID
void CObList::Serialize(CArchive& ar)
{
ASSERT_VALID(this);
CObject::Serialize(ar);
if (ar.IsStoring())
{
ar.WriteCount(m_nCount);
for (CNode* pNode = m_pNodeHead; pNode != NULL; pNode = pNode->pNext)
{
ASSERT(AfxIsValidAddress(pNode, sizeof(CNode)));
ar << pNode->data;
}
}
else
{
DWORD_PTR nNewCount = ar.ReadCount();
CObject* newData;
while (nNewCount--)
{
ar >> newData;
AddTail(newData);
}
}
}
示例9: addfile
/**
*
* Add a filename to a list.
*
**/
void addfile(char *name)
{
FileNode *filenode = (FileNode *)malloc(sizeof(FileNode) + strlen(name));
strcpy(filenode->name, name);
AddTail(&filelist, &filenode->node);
}
示例10: L_AddSorted
void LIBFUNC L_AddSorted(
REG(a0, struct List *list),
REG(a1, struct Node *node))
{
struct Node *posnode,*lastnode=0;
BOOL added=0;
// Go through existing nodes
for (posnode=list->lh_Head;
posnode->ln_Succ;
lastnode=posnode,posnode=posnode->ln_Succ)
{
// Compare new node name against existing name
if ((stricmp(node->ln_Name,posnode->ln_Name))<=0)
{
// Insert into list
Insert(list,node,lastnode);
added=1;
break;
}
}
// If not added, add to end of list
if (!added) AddTail(list,node);
}
示例11: CheckFractalBitmap
BOOL GlobalFractalList::AddFractal(FillGeometryAttribute* NewFractal)
{
CachedFractal* ExistingFrac = CheckFractalBitmap(NewFractal);
if (ExistingFrac != NULL)
{
ExistingFrac->IncUsageCount();
return FALSE;
}
CachedFractal* Fractal = new CachedFractal();
if (Fractal == NULL)
return FALSE;
TRACEUSER( "Mike", _T("Adding Cached Fractal @ %x\n"),Fractal);
Fractal->SetCachedFractal(NewFractal);
Fractal->IncUsageCount();
AddTail((ListItem*)Fractal);
if (this != GetApplication()->GetGlobalFractalList())
Fractal->MakeFakeFractal();
TRACEUSER( "Mike", _T("Cached Fractal Count = %d\n"),GetFractalCacheCount());
TRACEUSER( "Mike", _T("Cached Fractal Size = %d\n"),GetFractalCacheSize());
return(TRUE);
}
示例12: RemoveAll
CFormList & CFormList::operator =(CFormList &newList)
{
RemoveAll();
AddTail(&newList);
return *this;
}
示例13: FreeARNameList
/////////////////////////////////////////////////////////////////////
// Fills the list with all the form names on the server
void CFormList::GetForms(CARSConnection &arsConnection, unsigned int uiType)
{
ARStatusList statusList;
ARNameList nameList; // list of form names
ARNameType *pNameType; // pointer to a single form name
unsigned int i = 0;
// get the list of form names
if(ARGetListSchema(&arsConnection.LoginInfo,
0, // change since
uiType, // form type to get
NULL, // name of uplink/downlink form
NULL, // id list of fields to qualify forms retrieved
&nameList, // return value, the list of form names
&statusList) > AR_RETURN_OK)
{
FreeARNameList(&nameList, FALSE);
ThrowARSException(statusList, "CFormList::GetForms()");
}
FreeARStatusList(&statusList, FALSE);
CString strFormName;
for(i=0, pNameType = nameList.nameList;
i < nameList.numItems;
i++, pNameType++)
{
strFormName = (char*)pNameType;
AddTail(strFormName);
}
// Free heap memory
FreeARNameList(&nameList, FALSE);
}
示例14: add_popup_ext
// Add PopUp extensions
void add_popup_ext(char *menu,Att_List *type_list,char *command,ULONG flags)
{
Att_Node *node;
// Go through menu list
for (node=(Att_Node *)type_list->list.lh_Head;
node->node.ln_Succ;
node=(Att_Node *)node->node.ln_Succ)
{
Cfg_Filetype *ftype=0;
ULONG type=0;
short a;
// No name?
if (!node->node.ln_Name) continue;
// Special type?
for (a=0;icon_types[a];a++)
{
// Compare string
if (stricmp(node->node.ln_Name,icon_types[a])==0)
{
// All?
if (a==0) type=POPUP_ALL;
else type=a;
break;
}
}
// Search filetypes?
if (!type)
{
// Try to find filetype
if (!(ftype=filetype_find(node->node.ln_Name,1)))
ftype=filetype_find(node->node.ln_Name,0);
}
// Got something to match on?
if (type || ftype)
{
PopUpExt *ext;
// Allocate PopUpExtension
if ((ext=AllocMemH(global_memory_pool,sizeof(PopUpExt))))
{
// Fill it out
ext->pe_Type=type;
if (ftype) stccpy(ext->pe_FileType,ftype->type.name,sizeof(ext->pe_FileType));
stccpy(ext->pe_Command,command,40);
stccpy(ext->pe_Menu,menu,40);
ext->pe_Flags=flags;
// Lock list and add new entry
lock_listlock(&GUI->popupext_list,TRUE);
AddTail(&GUI->popupext_list.list,(struct Node *)ext);
unlock_listlock(&GUI->popupext_list);
}
}
}
}
示例15: gptimer1_handler
void gptimer1_handler(int id) {
uint32_t irq = reg32r(GPTIMER1_BASE, GPT_TISR);
{
static int blink = 0;
if (blink & (1<<2)) {
LEDS_OFF(LED0);
LEDS_ON(LED1);
} else {
LEDS_ON(LED0);
LEDS_OFF(LED1);
}
blink++;
}
// check for overflow int
if (irq & OVF_IT_FLAG) {
Remove(&thistask->Node);
AddTail(&tasks, &thistask->Node);
thistask = (struct task *)tasks.Head;
irq_new_task(tcb_to_sp(&thistask->tcb));
}
// clear ints
reg32w(GPTIMER1_BASE, GPT_TISR, ~0);
}