Esempio n. 1
0
/**
 * Adds a new element to the list, the new element will be the first element.
 *
 * @param list The list for which to add an element in its start
 * @param element The element to insert. A copy of the element will be
 * inserted as supplied by the copying function which is stored in the list
 * @return
 * LIST_NULL_ARGUMENT if a NULL was sent as list
 * LIST_OUT_OF_MEMORY if an allocation failed (Meaning the function for copying
 * an element failed)
 * LIST_SUCCESS the element has been inserted successfully
 */
ListResult listInsertFirst( List list, ListElement element ) {
	if ((list == NULL) || (element == NULL)) return LIST_NULL_ARGUMENT;
	ListItem new_list_item = CreateListItem(list->copyElementFunc, element);
	if (new_list_item == NULL) return LIST_OUT_OF_MEMORY;
	new_list_item->Next = list->First;
	list->First = new_list_item;
	return LIST_SUCCESS;
}
Esempio n. 2
0
void C4FileSelDlg::UpdateFileList() {
  BeginFileListUpdate();
  // reload files
  C4GUI::Element *pEl;
  while (pEl = pFileListBox->GetFirst()) delete pEl;
  // file items
  StdStrBuf sSearch;
  const char *szFileMask = GetFileMask();
  for (DirectoryIterator iter(sPath.getData()); *iter; ++iter)
    if (!szFileMask || WildcardListMatch(szFileMask, *iter))
      pFileListBox->AddElement(CreateListItem(*iter));
  // none-item?
  if (HasNoneItem()) {
    pFileListBox->AddElement(CreateListItem(NULL));
  }
  // list now done
  EndFileListUpdate();
  // path into title
  const char *szPath = sPath.getData();
  SetTitle(*szPath ? FormatString("%s [%s]", sTitle.getData(), szPath).getData()
                   : sTitle.getData());
  // initial no-selection
  UpdateSelection();
}
Esempio n. 3
0
/**
* Adds a new element to the list, the new element will be place right after
* the current element (As pointed by the inner iterator be of the list)
*
* @param list The list for which to add an element after its current element
* @param element The element to insert. A copy of the element will be
* inserted as supplied by the copying function which is stored in the list
* @return
* LIST_NULL_ARGUMENT if a NULL was sent as list
* LIST_INVALID_CURRENT if the list's iterator is in an invalid state (Does
* not point to a legal element in the list)
* LIST_OUT_OF_MEMORY if an allocation failed (Meaning the function for copying
* an element failed)
* LIST_SUCCESS the element has been inserted successfully
*/
ListResult listInsertAfterCurrent(List list, ListElement element) {
	if (list == NULL || element == NULL){
		return LIST_NULL_ARGUMENT;
	}
	if (list->Current == NULL){
			return LIST_INVALID_CURRENT;
	}
	ListItem newListItem = CreateListItem(list->copyElementFunc, element);
	if (newListItem == NULL){
		return LIST_OUT_OF_MEMORY;
	}
	newListItem->Next = list->Current->Next;
	list->Current->Next = newListItem;
	return LIST_SUCCESS;
}
Esempio n. 4
0
/**
 * Adds a new element to the list, the new element will be the last element
 *
 * @param list The list for which to add an element in its end
 * @param element The element to insert. A copy of the element will be
 * inserted as supplied by the copying function which is stored in the list
 * @return
 * LIST_NULL_ARGUMENT if a NULL was sent as list
 * LIST_OUT_OF_MEMORY if an allocation failed (Meaning the function for copying
 * an element failed)
 * LIST_SUCCESS the element has been inserted successfully
 */
ListResult listInsertLast( List list, ListElement element ) {
	if ((list == NULL) || (element == NULL)) return LIST_NULL_ARGUMENT;
	ListItem new_list_item = CreateListItem(list->copyElementFunc, element);
	if (new_list_item == NULL) return LIST_OUT_OF_MEMORY;
	if (list->First == NULL) {
		list->First = new_list_item;
	} else {
		ListItem last_item = list->First;
		while ( last_item->Next != NULL ) {

			last_item = last_item->Next;
		}
		last_item->Next = new_list_item;
	}
	return LIST_SUCCESS;
}
Esempio n. 5
0
/**
 * Adds a new element to the list, the new element will be place right before
 * the current element (As pointed by the inner iterator of the list)
 *
 * @param list The list for which to add an element before its current element
 * @param element The element to insert. A copy of the element will be
 * inserted as supplied by the copying function which is stored in the list
 * @return
 * LIST_NULL_ARGUMENT if a NULL was sent as list
 * LIST_INVALID_CURRENT if the list's iterator is in an invalid state (Does
 * not point to a legal element in the list)
 * LIST_OUT_OF_MEMORY if an allocation failed (Meaning the function for copying
 * an element failed)
 * LIST_SUCCESS the element has been inserted successfully
 */
ListResult listInsertBeforeCurrent( List list, ListElement element ) {
	if ((list == NULL) || (element == NULL)) return LIST_NULL_ARGUMENT;
	if (list->Current == NULL) return LIST_INVALID_CURRENT;
	ListItem new_list_item = CreateListItem(list->copyElementFunc, element);
	if (new_list_item == NULL) return LIST_OUT_OF_MEMORY;
	if (list->First == list->Current) {
		new_list_item->Next = list->First;
		list->First = new_list_item;
	} else {
		ListItem item_before_current = list->First;
		while (item_before_current->Next != list->Current) {
			item_before_current = item_before_current->Next;
		}
		new_list_item->Next = item_before_current->Next;
		item_before_current->Next = new_list_item;
	}
	return LIST_SUCCESS;
}
Esempio n. 6
0
/**
* Adds a new element to the list, the new element will be the last element
*
* @param list The list for which to add an element in its end
* @param element The element to insert. A copy of the element will be
* inserted as supplied by the copying function which is stored in the list
* @return
* LIST_NULL_ARGUMENT if a NULL was sent as list
* LIST_OUT_OF_MEMORY if an allocation failed (Meaning the function for copying
* an element failed)
* LIST_SUCCESS the element has been inserted successfully
*/
ListResult listInsertLast(List list, ListElement element) {
	if (list == NULL || element == NULL){
		return LIST_NULL_ARGUMENT;
	}
	ListItem newListItem = CreateListItem(list->copyElementFunc, element);
	if (newListItem == NULL){
		return LIST_OUT_OF_MEMORY;
	}
	if (list->First == NULL) {
		list->First = newListItem;
	} else {
		ListItem toAddTo = list->First;
		while (toAddTo->Next != NULL) {
			toAddTo = toAddTo->Next;
		}
		toAddTo->Next = newListItem;
	}
	return LIST_SUCCESS;
}
Esempio n. 7
0
LRESULT CDlgIgnoredVuls::OnDoneScan( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled )
{
	SetItemVisible(201, FALSE);
	SetItemVisible(300, TRUE);
	
	int count = 0;
	const CSimpleArray<LPTUpdateItem>& arr = theEngine->m_pVulScanIgnored->GetResults();
	ResetListCtrl(m_wndListCtrlVul);
	for(int i=0; i<arr.GetSize(); ++i)
	{
		LPTUpdateItem pItem = arr[i];
		if(pItem->isIgnored)
		{
			++count;
			AppendItemIgnoredList( m_wndListCtrlVul, CreateListItem(pItem) );
		}
	}
	
	_UpdateTitle();

	return 0;
}
Esempio n. 8
0
/**
* Adds a new element to the list, the new element will be place right before
* the current element (As pointed by the inner iterator of the list)
*
* @param list The list for which to add an element before its current element
* @param element The element to insert. A copy of the element will be
* inserted as supplied by the copying function which is stored in the list
* @return
* LIST_NULL_ARGUMENT if a NULL was sent as list
* LIST_INVALID_CURRENT if the list's iterator is in an invalid state (Does
* not point to a legal element in the list)
* LIST_OUT_OF_MEMORY if an allocation failed (Meaning the function for copying
* an element failed)
* LIST_SUCCESS the element has been inserted successfully
*/
ListResult listInsertBeforeCurrent(List list, ListElement element) {
	if (list == NULL || element == NULL){
		return LIST_NULL_ARGUMENT;
	}
	if (list->Current == NULL){
			return LIST_INVALID_CURRENT;
	}
	ListItem newListItem = CreateListItem(list->copyElementFunc, element);
	if (newListItem == NULL){
		return LIST_OUT_OF_MEMORY;
	}
	if (list->First == list->Current) {
		newListItem->Next = list->First;
		list->First = newListItem;
	} else {
		ListItem toAddTo = list->First;
		while (toAddTo->Next != list->Current) {
			toAddTo = toAddTo->Next;
		}
		newListItem->Next = toAddTo->Next;
		toAddTo->Next = newListItem;
	}
	return LIST_SUCCESS;
}