summaryrefslogtreecommitdiff
path: root/iup/src/iup_array.h
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2009-11-04 11:56:41 -0800
committerPixel <pixel@nobis-crew.org>2009-11-04 11:59:33 -0800
commitd577d991b97ae2b5ee1af23641bcffc3f83af5b2 (patch)
tree590639d50205d1bcfaff2a7d2dc6ebf3f373c7ed /iup/src/iup_array.h
Initial import. Contains the im, cd and iup librairies, and a "working" Makefile for them under linux.
Diffstat (limited to 'iup/src/iup_array.h')
-rwxr-xr-xiup/src/iup_array.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/iup/src/iup_array.h b/iup/src/iup_array.h
new file mode 100755
index 0000000..b44e862
--- /dev/null
+++ b/iup/src/iup_array.h
@@ -0,0 +1,63 @@
+/** \file
+ * \brief Simple expandable array
+ *
+ * See Copyright Notice in "iup.h"
+ */
+
+#ifndef __IUP_ARRAY_H
+#define __IUP_ARRAY_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/** \defgroup iarray Simple Array
+ * \par
+ * Expandable array using a simple pointer.
+ * \par
+ * See \ref iup_array.h
+ * \ingroup util */
+
+typedef struct _Iarray Iarray;
+
+/** Creates an array with an initial room for elements, and the element size.
+ * The array count starts at 0. And the maximum number of elements starts at the given count.
+ * The maximum number of elements is increased by the start count, every time it needs more memory.
+ * Must call \ref iupArrayInc to proper allocates memory.
+ * \ingroup iarray */
+Iarray* iupArrayCreate(int start_count, int elem_size);
+
+/** Destroys the array.
+ * \ingroup iarray */
+void iupArrayDestroy(Iarray* iarray);
+
+/** Returns the pointer that contains the array.
+ * \ingroup iarray */
+void* iupArrayGetData(Iarray* iarray);
+
+/** Increments the number of elements in the array.
+ * The array count starts at 0.
+ * If the maximum number of elements is reached, the memory allocated is increased by the initial start count.
+ * Returns the pointer that contains the array.
+ * \ingroup iarray */
+void* iupArrayInc(Iarray* iarray);
+
+/** Increments the number of elements in the array by a given count.
+ * The array count starts at 0.
+ * If the maximum number of elements is reached, the memory allocated is increased by the given count.
+ * Returns the pointer that contains the array.
+ * \ingroup iarray */
+void* iupArrayAdd(Iarray* iarray, int new_count);
+
+/** Returns the actual number of elements in the array.
+ * \ingroup iarray */
+int iupArrayCount(Iarray* iarray);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif