Beispiel #1
0
void deleteAllElements(){
	GSErrCode err;
	GS::Array<API_Guid> elemList;

	err = ACAPI_Element_GetElemList(API_ZombieElemID, &elemList);
	if (hasError(err)){
		quit();
		return;
	}
	if (elemList.GetSize() > 0){
		int size = elemList.GetSize(); 
		API_Elem_Head* headList = new API_Elem_Head[size];
		API_Elem_Head* toDelete;
		for (int i = 0; i < size; i++){
			API_Element el;
			el.header.guid = elemList.Get(i);
			headList[i] = el.header;
			/*
			err = ACAPI_Element_Get(&el);
			toDelete = &el.header;
			ACAPI_Element_Delete(&toDelete, 1);
			if (hasError(err)){
				quit();
				return;
			}
			*/
		}
		ACAPI_Element_Delete(&headList, size);
		if (hasError(err)){
			quit();
			return;
		}
	}
	
}
void Do_ElemSet_Delete (void)
{
	// get the guid of a Wall
	GS::Array<API_Guid>  wallList;
	if (ACAPI_Element_GetElemList (API_WallID, &wallList) != NoError)
		return;

	if (wallList.IsEmpty ())
		return;

	GS::Array<API_Guid> setGuids;
	GSErrCode	err = ACAPI_ElementSet_Identify (wallList[0], &setGuids);
	USize		nSet = (err == NoError) ? setGuids.GetSize () : 0;

	for (USize i = 0; i < nSet; i++) {
		err = ACAPI_ElementSet_Delete (setGuids[i]);
		if (err != NoError) {
			DBPrintf ("Delete Element Set error: %d\n", err);
		} else {
			DBPrintf ("Deleted Element Set %lu (%s)\n", i, APIGuidToString (setGuids[i]).ToCStr ().Get ());
		}
	}
}		/* ElemSet_Delete */