From 35831ff8dc30c9884a7c3340414f005a0d4ada10 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 12 May 2022 20:21:09 +0300 Subject: Completely reworked documentation --- docs/html/classList.html | 426 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 426 insertions(+) create mode 100644 docs/html/classList.html (limited to 'docs/html/classList.html') diff --git a/docs/html/classList.html b/docs/html/classList.html new file mode 100644 index 0000000..9193ce3 --- /dev/null +++ b/docs/html/classList.html @@ -0,0 +1,426 @@ + + + + + + + +FMI Ticket System: List< T > Class Template Reference + + + + + + + + + +
+
+ + + + + + +
+
FMI Ticket System +
+
| Kamen Mladenov | FMI Computer Science Year 1 Group 6 | Project 1 | Project Topic 4 |
+
+
+ + + + + + + + +
+
+ + +
+ +
+ +
+
+ +
List< T > Class Template Reference
+
+
+ +

Templated class that stores an array of elements in dynamic memory. + More...

+ +

#include <List.hpp>

+
+Inheritance diagram for List< T >:
+
+
+ + +OrderedList< T > + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

+ List (const T *elements, unsigned elementsCount)
 Copies all elements in given array.
 
void add (const T &element)
 Adds an element. More...
 
void insertAt (const T &element, unsigned index)
 Inserts element at given index. More...
 
bool removeAt (unsigned index)
 Removes element at index. More...
 
unsigned findIndex (const T &element) const
 Finds the index of element. More...
 
bool contain (const T &element) const
 
+T & operator[] (unsigned index)
 Returns reference to element at index.
 
+const T & operator[] (unsigned index) const
 Returns constant reference to element at index.
 
+List< T > & operator+= (const List< T > other)
 Appends elements from other list.
 
std::istream & read (std::istream &istr)
 Reads from stream. More...
 
std::ostream & write (std::ostream &ostr) const
 Writes to stream. More...
 
unsigned get_length () const
 Returns the length. More...
 
unsigned get_count () const
 Returns the count. More...
 
+List & operator= (const List &other)
 
+ List (const List &other)
 
+ List (List &&other)
 
+List & operator= (List &&other)
 
+ + + + + + + +

+Protected Member Functions

+void resize ()
 
+void free ()
 
+void copyFrom (const List &other)
 
+ + + + + + + +

+Protected Attributes

+T * elements
 
+unsigned length
 
+unsigned count
 
+

Detailed Description

+
template<typename T>
+class List< T >

Templated class that stores an array of elements in dynamic memory.

+
Warning
findIndex(), contain(), read(), write(), operator<<() and operator>>() require the type to have defined a couple of functions.
+
See also
findIndex()
+
+contain()
+
+read()
+
+write()
+
+operator<<()
+
+operator>>()
+

Member Function Documentation

+ +

◆ add()

+ +
+
+
+template<typename T >
+ + + + + + + + +
void List< T >::add (const T & element)
+
+ +

Adds an element.

+

Resizes internal array if there is no space for additional elements.

+ +
+
+ +

◆ contain()

+ +
+
+
+template<typename T >
+ + + + + + + + +
bool List< T >::contain (const T & element) const
+
+
Returns
Whether the element is contained in the current List
+
Warning
Function depends on findIndex(), which means the same "compare" function must be defined in the type
+
See also
findIndex()
+ +
+
+ +

◆ findIndex()

+ +
+
+
+template<typename T >
+ + + + + + + + +
unsigned List< T >::findIndex (const T & element) const
+
+ +

Finds the index of element.

+
Returns
Index of element. If element isn't found, returns the count of element.
+
Warning
The function depends on the type having a function "compare" defined, which takes two elements and returns a number <0 if elem1 < elem2, >0 if elem1 > elem2, 0 if elem1 == elem2
+
Note
Searching is done linearly
+ +
+
+ +

◆ get_count()

+ +
+
+
+template<typename T >
+ + + + +
unsigned List< T >::get_count
+
+ +

Returns the count.

+

Count is the amount of elements that are stored.

+ +
+
+ +

◆ get_length()

+ +
+
+
+template<typename T >
+ + + + +
unsigned List< T >::get_length
+
+ +

Returns the length.

+

Length is the size of the underlying array (allocated memory).

+ +
+
+ +

◆ insertAt()

+ +
+
+
+template<typename T >
+ + + + + + + + + + + + + + + + + + +
void List< T >::insertAt (const T & element,
unsigned index 
)
+
+ +

Inserts element at given index.

+

If index is after the last element, the element is just added. Otherwise all elements after the index are shifted right and element is put in place.

+

Resizes internal array if there is no space for additional elements.

+ +
+
+ +

◆ read()

+ +
+
+
+template<typename T >
+ + + + + + + + +
std::istream & List< T >::read (std::istream & istr)
+
+ +

Reads from stream.

+
Parameters
+ + +
istrAn input stream
+
+
+

Directly reads bytes from stream (calls read() function). Any stored values are deleted and replaced with those from the stream.

+
Warning
The function depends on the type having a function "read" defined, which takes an std::istream& and writes it's data to it. Return type doesn't matter.
+
Remarks
Doesn't alter the stream in any other way.
+
Note
Best used with binary ifstream
+ +
+
+ +

◆ removeAt()

+ +
+
+
+template<typename T >
+ + + + + + + + +
bool List< T >::removeAt (unsigned index)
+
+ +

Removes element at index.

+
Returns
Wether element could be removed
+

If index is after that of the last element, nothing is done and false is returned. Otherwise elements after index are shifted right and count is reduced.

+ +
+
+ +

◆ write()

+ +
+
+
+template<typename T >
+ + + + + + + + +
std::ostream & List< T >::write (std::ostream & ostr) const
+
+ +

Writes to stream.

+
Parameters
+ + +
ostrAn output stream
+
+
+

Directly writes bytes to stream (calls write() function).

+
Warning
The function depends on the type having a function "write" defined, which takes an std::ostream& and writes it's data to it. Return type doesn't matter.
+
Remarks
Doesn't alter the stream in any other way.
+
Note
Best used with binary ofstream
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + -- cgit v1.3.1-23-gd82d