summaryrefslogtreecommitdiff
path: root/src/Fl_Int_Vector.cxx
diff options
context:
space:
mode:
authorGreg Ercolano <erco@seriss.com>2022-11-06 20:21:46 -0800
committerGreg Ercolano <erco@seriss.com>2022-11-06 20:21:46 -0800
commit8b72f0c6681d0d13506ff56985052b9a81760cdc (patch)
tree03ac30daa0ea0fbf484e869ee70843b1afbf4579 /src/Fl_Int_Vector.cxx
parent38d40365f8d69cc6e60842a71011a184a8fca37e (diff)
Add doxygen docs for Fl_Int_Vector.
While adding the docs, noticed some things that need modification for proper public use. These are highlighted as \todo items and \warning items, which will be fixed in a separate commit forthcoming. -erco
Diffstat (limited to 'src/Fl_Int_Vector.cxx')
-rw-r--r--src/Fl_Int_Vector.cxx16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/Fl_Int_Vector.cxx b/src/Fl_Int_Vector.cxx
index 361dd2634..08e45c4cc 100644
--- a/src/Fl_Int_Vector.cxx
+++ b/src/Fl_Int_Vector.cxx
@@ -18,16 +18,32 @@
#include <FL/Fl_Int_Vector.H>
#include <stdlib.h>
+/**
+ Make a copy of another array.
+ Private: For use internally by the class's copy ctors only.
+*/
void Fl_Int_Vector::copy(int *newarr, unsigned int newsize) {
size(newsize);
memcpy(arr_, newarr, newsize * sizeof(int));
}
+/** Destructor - frees the internal array and destroys the class. */
Fl_Int_Vector::~Fl_Int_Vector() {
if (arr_)
free(arr_);
}
+/**
+ Set the size of the array to \p count.
+
+ A size of zero empties the array completely and frees all memory.
+
+ \warning
+ - Only advised use currently is to shrink the array size, i.e. (count < size()).
+ - Currently enlarging the array leaves the new values uninitialized.
+ - When assignment via indexes is supported, i.e. v[x] = 123, array enlargement should zero new values
+ \todo Check if count > size, and if so init new values to 0.
+*/
void Fl_Int_Vector::size(unsigned int count) {
if (count <= 0) {
if (arr_)