---
name: "lqr_carver_list_foreach"
section: "3"
platform: "linux"
package: "liblqr-1-0-dev"
version: "0.4.1-2"
release: "Debian 7 (Wheezy)"
platforms: ["linux"]
url: "https://new.carta.tech/lqr_carver_list_foreach"
---

# lqr\_carver\_list\_foreach(3)

perform operations on all LqrCarver objects in an LqrCarverList object

## NAME

lqr\_carver\_list\_foreach - perform operations on all LqrCarver objects in an LqrCarverList object

## SYNOPSIS

```
#include <lqr.h>
```

**LqrRetVal lqr\_carver\_list\_foreach(LqrCarverList\*** *list***, LqrCarverFunc** *func***, LqrDataTok** *data***);**

**LqrRetVal lqr\_carver\_list\_foreach\_recursive(LqrCarverList\*** *list***, LqrCarverFunc** *func***, LqrDataTok** *data***);**

## DESCRIPTION

The function **lqr\_carver\_list\_foreach** can be used to apply the function *func* to all the LqrCarver objects listed in *list*. The parameter *data* is used to pass arguments to the function.

The *list* value should be obtained through the function [**lqr\_carver\_list\_start**(3)](/lqr_carver_list_start/3.md). The order in the list will then follow the one in which carver objects were attached.

The function *func* is of type LqrCarverFunc, whose prototype is defined by:

```
typedef LqrRetVal (*LqrCarverFunc) (LqrCarver *carver, LqrDataTok data);
```

The *data* argument is of type LqrDataTok, which is defined as a union with the following fields:

• **LqrCarver\*** *carver*

• **gint** *integer*

• **gpointer** *data*

The function **lqr\_carver\_list\_foreach\_recursive** is equivelant to **lqr\_carver\_list\_foreach**, but it works recursively if the LqrCarver objects in *list* have themselves other attached LqrCarver objects attached. In this case, the function *func* will be applied to each element of the list and to each element of the attached list recursively, before moving on to the next element.

## SEE ALSO

[**LqrRetVal**(3)](/LqrRetVal/3.md), [**lqr\_carver\_attach**(3)](/lqr_carver_attach/3.md), [**lqr\_carver\_list\_start**(3)](/lqr_carver_list_start/3.md), [**lqr\_carver\_list\_current**(3)](/lqr_carver_list_current/3.md), [**lqr\_carver\_list\_next**(3)](/lqr_carver_list_next/3.md)

## COPYRIGHT

Copyright © 2007-2009 Carlo Baldassi\
