Browse Source

Update documentation for some containers

Daniele Bartolini 12 năm trước cách đây
mục cha
commit
8cac7e0771

+ 26 - 22
engine/core/containers/Array.h

@@ -32,51 +32,55 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 namespace crown
 {
+
+/// Functions to manipulate Array.
+///
+/// @ingroup Containers
 namespace array
 {
-	/// Returns whether the list is empty
+	/// Returns whether the array @a a is empty.
 	template <typename T> bool empty(const Array<T>& a);
 
-	/// Returns the number of items in the list
+	/// Returns the number of items in the array @a a.
 	template <typename T> uint32_t size(const Array<T>& a);
 
-	/// Returns the maximum number of items the array can hold
+	/// Returns the maximum number of items the array @a can hold.
 	template <typename T> uint32_t capacity(const Array<T>& a);
 
-	/// Resizes the list to the given @a size.
+	/// Resizes the array @a a to the given @a size.
 	/// @note
-	/// Old items will be copied to the newly created list.
+	/// Old items will be copied to the newly created array.
 	/// If the new capacity is smaller than the previous one, the
-	/// list will be truncated.
+	/// array will be truncated.
 	template <typename T> void resize(Array<T>& a, uint32_t size);
 
-	/// Reserves space in the list for at least @a capacity items.
+	/// Reserves space in the array @a a for at least @a capacity items.
 	template <typename T> void reserve(uint32_t capacity);
 
-	/// Sets the list capacity
+	/// Sets the capacity of array @a a.
 	template <typename T> void set_capacity(Array<T>& a, uint32_t capacity);
 
-	/// Grows the list to contain at least @a min_capacity items
+	/// Grows the array @a a to contain at least @a min_capacity items.
 	template <typename T> void grow(Array<T>& a, uint32_t min_capacity);
 
-	/// Condenses the array so that the capacity matches the actual number
-	/// of items in the list.
+	/// Condenses the array @a a so that its capacity matches the actual number
+	/// of items in the array.
 	template <typename T> void condense(Array<T>& a);
 
-	/// Appends an item to the list and returns its index.
+	/// Appends an item to the array @a a and returns its index.
 	template <typename T> uint32_t push_back(Array<T>& a, const T& item);
 
-	/// Removes the last item from the list.
+	/// Removes the last item from the array @a a.
 	template <typename T> void pop_back(Array<T>& a);
 
-	/// Appends @a count @a items to the list and returns the number
-	/// of items in the list after the append operation.
+	/// Appends @a count @a items to the array @a a and returns the number
+	/// of items in the array after the append operation.
 	template <typename T> uint32_t push(Array<T>& a, const T* items, uint32_t count);
 
-	/// Clears the content of the list.
+	/// Clears the content of the array @a.
 	/// @note
 	/// Does not free memory nor call destructors, it only zeroes
-	/// the number of items in the list for efficiency.
+	/// the number of items in the array.
 	template <typename T> void clear(Array<T>& a);
 
 	template <typename T> T* begin(Array<T>& a);
@@ -194,7 +198,7 @@ namespace array
 	template <typename T>
 	inline void pop_back(Array<T>& a)
 	{
-		CE_ASSERT(a.m_size > 0, "The list is empty");
+		CE_ASSERT(a.m_size > 0, "The array is empty");
 
 		a.m_size--;
 	}
@@ -246,7 +250,7 @@ namespace array
 	template <typename T>
 	inline T& front(Array<T>& a)
 	{
-		CE_ASSERT(a.m_size > 0, "The list is empty");
+		CE_ASSERT(a.m_size > 0, "The array is empty");
 
 		return a.m_array[0];
 	}
@@ -254,7 +258,7 @@ namespace array
 	template <typename T>
 	inline const T& front(const Array<T>& a)
 	{
-		CE_ASSERT(a.m_size > 0, "The list is empty");
+		CE_ASSERT(a.m_size > 0, "The array is empty");
 
 		return a.m_array[0];
 	}
@@ -262,7 +266,7 @@ namespace array
 	template <typename T>
 	inline T& back(Array<T>& a)
 	{
-		CE_ASSERT(a.m_size > 0, "The list is empty");
+		CE_ASSERT(a.m_size > 0, "The array is empty");
 
 		return a.m_array[a.m_size - 1];
 	}
@@ -270,7 +274,7 @@ namespace array
 	template <typename T>
 	inline const T& back(const Array<T>& a)
 	{
-		CE_ASSERT(a.m_size > 0, "The list is empty");
+		CE_ASSERT(a.m_size > 0, "The array is empty");
 
 		return a.m_array[a.m_size - 1];
 	}

+ 10 - 0
engine/core/containers/ContainerTypes.h

@@ -32,9 +32,13 @@ OTHER DEALINGS IN THE SOFTWARE.
 namespace crown
 {
 
+/// @defgroup Containers Containers
+
 /// Dynamic array of POD items.
 /// @note
 /// Does not call constructors/destructors so it is not very suitable for non-POD items.
+///
+/// @ingroup Containers
 template <typename T>
 struct Array
 {
@@ -60,6 +64,8 @@ struct Array
 /// Circular buffer double-ended queue of POD items.
 /// @note
 /// Does not call constructors/destructors so it is not very suitable for non-POD items.
+///
+/// @ingroup Containers
 template <typename T>
 struct Queue
 {
@@ -77,6 +83,8 @@ struct Queue
 };
 
 /// Priority queue of POD items.
+///
+/// @ingroup Containers
 template <typename T>
 struct PriorityQueue
 {
@@ -87,6 +95,8 @@ struct PriorityQueue
 
 /// Hash from an uint64_t to POD items. If you want to use a generic key
 /// item, use a hash function to map that item to an uint64_t.
+///
+/// @ingroup Containers
 template<typename T>
 struct Hash
 {

+ 3 - 0
engine/core/containers/EventStream.h

@@ -32,6 +32,9 @@ OTHER DEALINGS IN THE SOFTWARE.
 namespace crown
 {
 
+/// Array of generic event structs.
+/// 
+/// @ingroup Containers
 typedef Array<char> EventStream;
 
 /// Functions for operating on a Array<char> as a stream of events of the form:

+ 2 - 0
engine/core/containers/IdArray.h

@@ -35,6 +35,8 @@ namespace crown
 {
 
 /// Packed array of objects with lookup table.
+///
+/// @ingroup Containers
 template <uint32_t MAX_NUM_ID, typename T>
 class IdArray
 {

+ 2 - 0
engine/core/containers/IdTable.h

@@ -34,6 +34,8 @@ namespace crown
 {
 
 /// Table of Ids.
+///
+/// @ingroup Containers
 template <uint32_t MAX_NUM_ID>
 class IdTable
 {

+ 4 - 0
engine/core/containers/PriorityQueue.h

@@ -31,6 +31,10 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 namespace crown
 {
+
+/// Functions to manipulate PriorityQueue.
+///
+/// @ingroup Containers
 namespace priority_queue
 {
 	/// Returns the first item in the queue.

+ 4 - 0
engine/core/containers/Queue.h

@@ -33,6 +33,10 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 namespace crown
 {
+
+/// Functions to manipulate Queue.
+///
+/// @ingroup Containers
 namespace queue
 {
 	/// Returns whether the queue is empty.