NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
c_line.hpp
1#pragma once
2#include <types.h>
3
4/// @brief A doubly-linked list node. See cLineMg_c.
5/// @ingroup clib
6class cLineNd_c {
7public:
8 /// @brief Constructs a new list node.
9 cLineNd_c() : mpPrev(nullptr), mpNext(nullptr) {}
10
11 cLineNd_c *getPrev() const { return mpPrev; }
12 cLineNd_c *getNext() const { return mpNext; }
13
14protected:
15 cLineNd_c *mpPrev; ///< The previous node.
16 cLineNd_c *mpNext; ///< The next node.
17
18 friend class cLineMg_c;
19};
20
21/// @brief A doubly-linked list container. See cLineNd_c.
22/// @ingroup clib
23class cLineMg_c {
24public:
25 /// @brief Constructs a new list container.
26 cLineMg_c() : mpFirst(nullptr), mpLast(nullptr) {}
27
28 /**
29 * @brief Inserts a node after the given previous node.
30 *
31 * @param node The node to insert.
32 * @param prevNode The node to insert it after, or @p nullptr to insert it at the beginning.
33 * @return If the operation was successful.
34 */
35 bool insertLineNode(cLineNd_c *node, cLineNd_c *prevNode);
36
37 /**
38 * @brief Removes a node from the list.
39 *
40 * @param node The node to remove.
41 * @return If the operation was successful.
42 */
43 bool removeLineNode(cLineNd_c *node);
44
45 /**
46 * @brief Adds a node to the end of the list.
47 *
48 * @param node The node to append.
49 * @return If the operation was successful.
50 */
51 bool addLastLineNode(cLineNd_c *node);
52
53 /**
54 * @brief Adds a node to the beginning of the list.
55 *
56 * @param node The node to prepend.
57 * @return If the operation was successful.
58 */
59 bool addTopLineNode(cLineNd_c *node);
60
61 cLineNd_c *getFirst() const { return mpFirst; }
62 cLineNd_c *getLast() const { return mpLast; }
63
64protected:
65 cLineNd_c *mpFirst; ///< The first node in the list.
66 cLineNd_c *mpLast; ///< The last node in the list.
67};
cLineMg_c()
Constructs a new list container.
Definition c_line.hpp:26
bool insertLineNode(cLineNd_c *node, cLineNd_c *prevNode)
Inserts a node after the given previous node.
Definition c_line.cpp:4
bool removeLineNode(cLineNd_c *node)
Removes a node from the list.
Definition c_line.cpp:30
bool addLastLineNode(cLineNd_c *node)
Adds a node to the end of the list.
Definition c_line.cpp:60
bool addTopLineNode(cLineNd_c *node)
Adds a node to the beginning of the list.
Definition c_line.cpp:80
cLineNd_c * mpLast
The last node in the list.
Definition c_line.hpp:66
cLineNd_c * mpFirst
The first node in the list.
Definition c_line.hpp:65
A doubly-linked list node. See cLineMg_c.
Definition c_line.hpp:6
cLineNd_c * mpPrev
The previous node.
Definition c_line.hpp:15
cLineNd_c * mpNext
The next node.
Definition c_line.hpp:16
cLineNd_c()
Constructs a new list node.
Definition c_line.hpp:9