Data Structures | |
| struct | Cmaid_Container |
| The Container Class structure This is the base structure of every container. Do not manipulate the attributes directly. More... | |
Modules | |
| The Container Interface | |
Defines | |
| #define | CMAID_CONTAINER(c) ((Cmaid_Container *)(c)) |
| Typecast a pointer to a Cmaid_Container pointer. | |
Typedefs | |
| typedef struct Cmaid_Container | Cmaid_Container |
| Type definition of the Container Class. | |
Functions | |
| CMAID_INLINE int | cmaid_container_count (const Cmaid_Container *c) |
| Retrieve the memeber count of the container. | |
| CMAID_INLINE int | cmaid_container_empty_is (const Cmaid_Container *c) |
| CMAID_INLINE void | cmaid_container_clear (Cmaid_Container *c) |
| Remove and free every item from the container. | |
| CMAID_INLINE void | cmaid_container_iter_attach (Cmaid_Container *c, Cmaid_Iter *it) |
| Attach an iterator to the container. | |
| CMAID_INLINE void | cmaid_container_iter_detach (Cmaid_Container *c, Cmaid_Iter *it) |
| Detach an iterator of the container. | |
| CMAID_INLINE void | cmaid_container_destroy (Cmaid_Container *c) |
| Destroy the container and its nodes. | |
The container class builds the base of all containers, therefor it needs to be general a does not provides any function that are related to the underlying container layout, e.g. if the container is ordered or not, if objects may appear twice etc.
| CMAID_INLINE void cmaid_container_clear | ( | Cmaid_Container * | c | ) |
Remove and free every item from the container.
| c | the container to clear |
| CMAID_INLINE int cmaid_container_count | ( | const Cmaid_Container * | c | ) |
Retrieve the memeber count of the container.
| c | the container to retrieve the child count |
| CMAID_INLINE void cmaid_container_destroy | ( | Cmaid_Container * | c | ) |
Destroy the container and its nodes.
| c | the container to destroy |
| CMAID_INLINE int cmaid_container_empty_is | ( | const Cmaid_Container * | c | ) |
| c | the container to retrieve fill state |
TRUE if the container is empty else FALSE | CMAID_INLINE void cmaid_container_iter_attach | ( | Cmaid_Container * | c, | |
| Cmaid_Iter * | it | |||
| ) |
Attach an iterator to the container.
| c | the container to attach the iterator | |
| it | the iterator to attach Attach an iterator to the given container. The iterator will point to the virtual -1 item, i.e. before the very first item of the container. The iterator needs to point valud memory. Don't forget to detach the iterator after you used it. A normal usage case looks like this: |
Cmaid_Iter it; const char *item; cmaid_container_iter_attach(c, &it); while ((item = cmaid_iter_next(&it))) printf("%s\n", item); cmaid_container_iter_detach(c, &it);
| CMAID_INLINE void cmaid_container_iter_detach | ( | Cmaid_Container * | c, | |
| Cmaid_Iter * | it | |||
| ) |
Detach an iterator of the container.
| c | the container to detach the iterator | |
| it | the iterator to detach This will remove the iterator from the internal iterator list. It is important that you call the function after the iterator goes to be invalid, i.e. after it is freed or is going to be out of scope. |
1.5.8